@malloydata/render 0.0.289 → 0.0.290
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/malloy-stories-indexer.ts +21 -16
- package/API_MIGRATION.md +189 -0
- package/dist/api/malloy-renderer.d.ts +9 -0
- package/dist/api/malloy-viz.d.ts +19 -0
- package/dist/api/types.d.ts +12 -0
- package/dist/component/dashboard/dashboard.d.ts +1 -1
- package/dist/component/malloy-modal/malloy-modal.d.ts +0 -7
- package/dist/component/render-result-metadata.d.ts +4 -4
- package/dist/component/render.d.ts +5 -23
- package/dist/component/util.d.ts +13 -1
- package/dist/data_tree/cells/atomic.d.ts +75 -0
- package/dist/data_tree/cells/base.d.ts +41 -0
- package/dist/data_tree/cells/index.d.ts +14 -0
- package/dist/data_tree/cells/nest.d.ts +44 -0
- package/dist/data_tree/drilling.d.ts +11 -0
- package/dist/data_tree/fields/atomic.d.ts +67 -0
- package/dist/data_tree/fields/base.d.ts +65 -0
- package/dist/data_tree/fields/index.d.ts +17 -0
- package/dist/data_tree/fields/nest.d.ts +43 -0
- package/dist/data_tree/index.d.ts +11 -0
- package/dist/data_tree/plugins.d.ts +14 -0
- package/dist/data_tree/types.d.ts +68 -0
- package/dist/data_tree/utils.d.ts +19 -0
- package/dist/html/html_view.d.ts +1 -2
- package/dist/html/renderer_types.d.ts +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/module/index.mjs +56960 -51018
- package/dist/module/index.umd.js +973 -402
- package/dist/render-field-metadata.d.ts +33 -0
- package/dist/stories/themes.stories.d.ts +0 -1
- package/dist/stories/vega-config-override.stories.d.ts +0 -1
- package/package.json +6 -18
- package/vite.config.base.ts +6 -0
- package/dist/bundle/main.d.ts +0 -6
- package/dist/bundle/renderer.d.ts +0 -1
- package/dist/component/copy-to-html.d.ts +0 -3
- package/dist/component/malloy-modal/malloy-modal-wc.d.ts +0 -5
- package/dist/component/register-webcomponent.d.ts +0 -15
- package/dist/component/render-webcomponent.d.ts +0 -1
- package/dist/data_tree.d.ts +0 -405
- package/dist/register/register.mjs +0 -162146
- package/dist/register/register.umd.js +0 -1921
- package/dist/register/style.css +0 -1
- package/dist/webcomponent/malloy-render.mjs +0 -162144
- package/dist/webcomponent/malloy-render.umd.js +0 -1921
- package/dist/webcomponent/style.css +0 -1
- package/vite.config.webcomponent-register.ts +0 -12
- package/vite.config.webcomponent.ts +0 -12
|
@@ -140,9 +140,8 @@ export function viteMalloyStoriesPlugin(): PluginOption {
|
|
|
140
140
|
: `
|
|
141
141
|
import script from '${id}?raw';
|
|
142
142
|
import {createLoader} from './util';
|
|
143
|
-
import {copyMalloyRenderHTML} from '../component/copy-to-html';
|
|
144
143
|
import './themes.css';
|
|
145
|
-
import '../
|
|
144
|
+
import {MalloyRenderer} from '../api/malloy-renderer';
|
|
146
145
|
|
|
147
146
|
const meta = {
|
|
148
147
|
title: "Malloy Next/${modelStoriesMeta.componentName}",
|
|
@@ -150,24 +149,30 @@ export function viteMalloyStoriesPlugin(): PluginOption {
|
|
|
150
149
|
const parent = document.createElement('div');
|
|
151
150
|
parent.style.height = 'calc(100vh - 40px)';
|
|
152
151
|
parent.style.position = 'relative';
|
|
153
|
-
const el = document.createElement('malloy-render');
|
|
154
|
-
if (classes) el.classList.add(classes);
|
|
155
|
-
el.malloyResult = context.loaded['result'];
|
|
156
|
-
el.tableConfig = {
|
|
157
|
-
enableDrill: true
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
el.onInitialState = (state) => {
|
|
162
|
-
console.log("Malloy render initial state", state);
|
|
163
|
-
};
|
|
164
152
|
|
|
165
153
|
const button = document.createElement('button');
|
|
166
154
|
button.innerHTML = "Copy HTML";
|
|
167
|
-
button.addEventListener("click", () =>
|
|
155
|
+
button.addEventListener("click", () => viz.copyToHTML());
|
|
156
|
+
parent.appendChild(button);
|
|
157
|
+
|
|
158
|
+
const targetElement = document.createElement('div');
|
|
159
|
+
if(classes) targetElement.classList.add(classes);
|
|
160
|
+
targetElement.style.height = '100%';
|
|
161
|
+
targetElement.style.width = '100%';
|
|
162
|
+
parent.appendChild(targetElement);
|
|
163
|
+
|
|
164
|
+
const renderer = new MalloyRenderer();
|
|
165
|
+
const viz = renderer.createViz({
|
|
166
|
+
// modelDef: context.loaded['result'].modelDef
|
|
167
|
+
}, {
|
|
168
|
+
onError: (error) => {
|
|
169
|
+
console.log("Malloy render error", error);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
viz.setResult(context.loaded['result']);
|
|
173
|
+
console.log('initial state', viz.getMetadata());
|
|
174
|
+
viz.render(targetElement);
|
|
168
175
|
|
|
169
|
-
parent.appendChild(button);
|
|
170
|
-
parent.appendChild(el);
|
|
171
176
|
return parent;
|
|
172
177
|
},
|
|
173
178
|
loaders: [createLoader(script)],
|
package/API_MIGRATION.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Malloy Render API Migration Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document describes the migration from the web component-based API to the new JavaScript API for `@malloydata/render`.
|
|
6
|
+
|
|
7
|
+
## New JavaScript API
|
|
8
|
+
|
|
9
|
+
### Basic Usage
|
|
10
|
+
|
|
11
|
+
```javascript
|
|
12
|
+
import {MalloyRenderer} from '@malloydata/render';
|
|
13
|
+
|
|
14
|
+
// Set up a global renderer with options
|
|
15
|
+
const renderer = new MalloyRenderer({
|
|
16
|
+
onClick: payload => console.log('Click:', payload),
|
|
17
|
+
onDrill: drillData => console.log('Drill:', drillData),
|
|
18
|
+
tableConfig: {
|
|
19
|
+
rowLimit: 1000,
|
|
20
|
+
shouldFillWidth: true,
|
|
21
|
+
enableDrill: true,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Create a viz instance
|
|
26
|
+
const viz = renderer.createViz();
|
|
27
|
+
|
|
28
|
+
// Pass in data
|
|
29
|
+
viz.setResult(malloyResult);
|
|
30
|
+
|
|
31
|
+
// Get metadata about the query renderers
|
|
32
|
+
viz.getMetadata();
|
|
33
|
+
|
|
34
|
+
// Render to a DOM element
|
|
35
|
+
const targetElement = document.getElementById('malloy_chart');
|
|
36
|
+
viz.render(targetElement);
|
|
37
|
+
|
|
38
|
+
// Update results and re-render into the same DOM node
|
|
39
|
+
viz.setResult(nextMalloyResult);
|
|
40
|
+
viz.render();
|
|
41
|
+
|
|
42
|
+
// Remove from DOM element, dispose of component
|
|
43
|
+
viz.remove();
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### API Reference
|
|
47
|
+
|
|
48
|
+
#### `MalloyRenderer`
|
|
49
|
+
|
|
50
|
+
The main renderer class that manages global configuration.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
class MalloyRenderer {
|
|
54
|
+
constructor(options?: MalloyRendererOptions);
|
|
55
|
+
createViz(additionalOptions?: Partial<MalloyRendererOptions>): MalloyViz;
|
|
56
|
+
updateOptions(newOptions: Partial<MalloyRendererOptions>): void;
|
|
57
|
+
getOptions(): MalloyRendererOptions;
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
#### `MalloyViz`
|
|
62
|
+
|
|
63
|
+
Represents an individual visualization instance.
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
class MalloyViz {
|
|
67
|
+
constructor(options: MalloyRendererOptions);
|
|
68
|
+
setResult(malloyResult: Malloy.Result): void;
|
|
69
|
+
render(targetElement?: HTMLElement): void;
|
|
70
|
+
remove(): void;
|
|
71
|
+
updateOptions(newOptions: Partial<MalloyRendererOptions>): void;
|
|
72
|
+
getMetadata(): RenderFieldMetadata | null;
|
|
73
|
+
getHTML(): Promise<string>;
|
|
74
|
+
copyToHTML(): Promise<void>;
|
|
75
|
+
static addStylesheet(styles: string): void;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Types
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
interface MalloyRendererOptions {
|
|
83
|
+
onClick?: (payload: MalloyClickEventPayload) => void;
|
|
84
|
+
onDrill?: (drillData: DrillData) => void;
|
|
85
|
+
onError?: (error: Error) => void;
|
|
86
|
+
vegaConfigOverride?: VegaConfigHandler;
|
|
87
|
+
tableConfig?: Partial<TableConfig>;
|
|
88
|
+
dashboardConfig?: Partial<DashboardConfig>;
|
|
89
|
+
modalElement?: HTMLElement;
|
|
90
|
+
scrollEl?: HTMLElement;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Migration from Web Component API
|
|
95
|
+
|
|
96
|
+
### Before (Web Component)
|
|
97
|
+
|
|
98
|
+
```html
|
|
99
|
+
<malloy-render></malloy-render>
|
|
100
|
+
|
|
101
|
+
<script>
|
|
102
|
+
const element = document.querySelector('malloy-render');
|
|
103
|
+
element.malloyResult = result;
|
|
104
|
+
element.onClick = payload => console.log(payload);
|
|
105
|
+
</script>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### After (JavaScript API)
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
import {MalloyRenderer} from '@malloydata/render';
|
|
112
|
+
|
|
113
|
+
const renderer = new MalloyRenderer(globalRenderOptions);
|
|
114
|
+
|
|
115
|
+
const viz = renderer.createViz(vizRenderOptions);
|
|
116
|
+
viz.setResult(result);
|
|
117
|
+
viz.render(document.querySelector('#my-container'));
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## CSS Changes
|
|
121
|
+
|
|
122
|
+
### Before (Shadow DOM)
|
|
123
|
+
|
|
124
|
+
CSS was injected into shadow root using special methods:
|
|
125
|
+
|
|
126
|
+
```javascript
|
|
127
|
+
// Old approach - no longer needed
|
|
128
|
+
config.addCSSToShadowRoot(css);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### After (Native DOM)
|
|
132
|
+
|
|
133
|
+
Components now import CSS naturally:
|
|
134
|
+
|
|
135
|
+
```javascript
|
|
136
|
+
// New approach
|
|
137
|
+
import './component.css';
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
CSS selectors that used `:host` are now scoped to the container ".malloy-render":
|
|
141
|
+
|
|
142
|
+
```css
|
|
143
|
+
/* Before */
|
|
144
|
+
:host {
|
|
145
|
+
font-family: var(--malloy-render--font-family);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/* After - automatically scoped */
|
|
149
|
+
.malloy-render {
|
|
150
|
+
font-family: var(--malloy-render--font-family);
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The renderer will continue to expose CSS variables for customizing the theme, but optionally you can add your own CSS to target internals. The latter is not recommended as internals will change over time.
|
|
155
|
+
|
|
156
|
+
## Breaking Changes
|
|
157
|
+
|
|
158
|
+
1. **Web Component Removed**: The `<malloy-render>` web component is no longer available
|
|
159
|
+
2. **CSS Handling**: No ShadowRoot boundaries around CSS
|
|
160
|
+
3. **Import Changes**: New imports for the JavaScript API
|
|
161
|
+
4. **DOM Structure**: Renders directly into provided element instead of shadow root
|
|
162
|
+
5. **HTML Export**: New methods `getHTML()` and `copyToHTML()` for exporting visualizations
|
|
163
|
+
|
|
164
|
+
## Backward Compatibility
|
|
165
|
+
|
|
166
|
+
The old exports are still available for existing code:
|
|
167
|
+
|
|
168
|
+
```javascript
|
|
169
|
+
// Legacy exports still work
|
|
170
|
+
import {HTMLView, JSONView, getDataTree} from '@malloydata/render';
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Implementation Details
|
|
174
|
+
|
|
175
|
+
### Under the Hood
|
|
176
|
+
|
|
177
|
+
- Uses SolidJS components for rendering
|
|
178
|
+
- Uses `solid-js/web` `render()` function to mount to DOM
|
|
179
|
+
- CSS is injected into document head with `data-malloy-viz` attribute
|
|
180
|
+
- No web component infrastructure required
|
|
181
|
+
- Supports HTML export functionality for copying visualizations
|
|
182
|
+
|
|
183
|
+
## Migration Steps
|
|
184
|
+
|
|
185
|
+
1. **Replace web component usage** with JavaScript API
|
|
186
|
+
2. **Update imports** to use new API classes
|
|
187
|
+
3. **Update CSS handling** if you were using custom styles
|
|
188
|
+
4. **Test thoroughly** - behavior should be identical but integration is different
|
|
189
|
+
5. **Update HTML export** if you were using the old export methods
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MalloyRendererOptions } from './types';
|
|
2
|
+
import { MalloyViz } from './malloy-viz';
|
|
3
|
+
export declare class MalloyRenderer {
|
|
4
|
+
private globalOptions;
|
|
5
|
+
constructor(options?: MalloyRendererOptions);
|
|
6
|
+
createViz(additionalOptions?: Partial<MalloyRendererOptions>): MalloyViz;
|
|
7
|
+
updateOptions(newOptions: Partial<MalloyRendererOptions>): void;
|
|
8
|
+
getOptions(): MalloyRendererOptions;
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { MalloyRendererOptions } from '@/api/types';
|
|
2
|
+
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
3
|
+
import { RenderFieldMetadata } from '@/render-field-metadata';
|
|
4
|
+
export declare class MalloyViz {
|
|
5
|
+
private options;
|
|
6
|
+
private disposeFn;
|
|
7
|
+
private targetElement;
|
|
8
|
+
private result;
|
|
9
|
+
private metadata;
|
|
10
|
+
constructor(options: MalloyRendererOptions);
|
|
11
|
+
static addStylesheet(styles: string): void;
|
|
12
|
+
getHTML(): Promise<string>;
|
|
13
|
+
copyToHTML(): Promise<void>;
|
|
14
|
+
setResult(malloyResult: Malloy.Result): void;
|
|
15
|
+
render(targetElement?: HTMLElement): void;
|
|
16
|
+
remove(): void;
|
|
17
|
+
updateOptions(newOptions: Partial<MalloyRendererOptions>): void;
|
|
18
|
+
getMetadata(): RenderFieldMetadata | null;
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DashboardConfig, DrillData, MalloyClickEventPayload, TableConfig, VegaConfigHandler } from '../component/types';
|
|
2
|
+
export type { RenderFieldMetadata } from '@/render-field-metadata';
|
|
3
|
+
export interface MalloyRendererOptions {
|
|
4
|
+
onClick?: (payload: MalloyClickEventPayload) => void;
|
|
5
|
+
onDrill?: (drillData: DrillData) => void;
|
|
6
|
+
vegaConfigOverride?: VegaConfigHandler;
|
|
7
|
+
tableConfig?: Partial<TableConfig>;
|
|
8
|
+
dashboardConfig?: Partial<DashboardConfig>;
|
|
9
|
+
modalElement?: HTMLElement;
|
|
10
|
+
scrollEl?: HTMLElement;
|
|
11
|
+
onError?: (error: Error) => void;
|
|
12
|
+
}
|
|
@@ -4,10 +4,3 @@ export declare function MalloyModal(props: {
|
|
|
4
4
|
children?: JSXElement;
|
|
5
5
|
ref?: HTMLDivElement | ((el: HTMLDivElement) => void);
|
|
6
6
|
}): JSX.Element;
|
|
7
|
-
declare module 'solid-js' {
|
|
8
|
-
namespace JSX {
|
|
9
|
-
interface IntrinsicElements {
|
|
10
|
-
'malloy-modal': any;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Tag } from '@malloydata/malloy-tag';
|
|
2
2
|
import type { VegaChartProps, VegaConfigHandler } from './types';
|
|
3
|
-
import type { ResultStore } from '
|
|
3
|
+
import type { ResultStore } from '@/component/result-store/result-store';
|
|
4
4
|
import type { Runtime } from 'vega';
|
|
5
|
-
import {
|
|
5
|
+
import type { RootField } from '@/data_tree';
|
|
6
6
|
export type GetResultMetadataOptions = {
|
|
7
7
|
getVegaConfigOverride?: VegaConfigHandler;
|
|
8
8
|
parentSize: {
|
|
@@ -18,7 +18,7 @@ export interface FieldVegaInfo {
|
|
|
18
18
|
export interface RenderMetadata {
|
|
19
19
|
store: ResultStore;
|
|
20
20
|
vega: Record<string, FieldVegaInfo>;
|
|
21
|
-
|
|
21
|
+
rootField: RootField;
|
|
22
22
|
parentSize: {
|
|
23
23
|
width: number;
|
|
24
24
|
height: number;
|
|
@@ -26,5 +26,5 @@ export interface RenderMetadata {
|
|
|
26
26
|
renderAs: string;
|
|
27
27
|
sizingStrategy: 'fill' | 'fixed';
|
|
28
28
|
}
|
|
29
|
-
export declare function getResultMetadata(
|
|
29
|
+
export declare function getResultMetadata(rootField: RootField, options?: GetResultMetadataOptions): RenderMetadata;
|
|
30
30
|
export declare function shouldRenderChartAs(tag: Tag): string | undefined;
|
|
@@ -1,49 +1,31 @@
|
|
|
1
1
|
import type { Accessor } from 'solid-js';
|
|
2
|
-
import './render.css';
|
|
3
|
-
import type { ComponentOptions, ICustomElement } from 'component-register';
|
|
4
2
|
import type { DashboardConfig, DrillData, MalloyClickEventPayload, TableConfig, VegaConfigHandler } from './types';
|
|
5
3
|
export type { DrillData } from './types';
|
|
6
4
|
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
7
|
-
import type { ModelDef, QueryResult } from '@malloydata/malloy';
|
|
8
|
-
import { Result } from '@malloydata/malloy';
|
|
9
5
|
export type MalloyRenderProps = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
queryResult?: QueryResult;
|
|
13
|
-
modelDef?: ModelDef;
|
|
6
|
+
result?: Malloy.Result;
|
|
7
|
+
element: HTMLElement;
|
|
14
8
|
scrollEl?: HTMLElement;
|
|
15
9
|
modalElement?: HTMLElement;
|
|
16
10
|
onClick?: (payload: MalloyClickEventPayload) => void;
|
|
17
11
|
onDrill?: (drillData: DrillData) => void;
|
|
12
|
+
onError?: (error: Error) => void;
|
|
18
13
|
vegaConfigOverride?: VegaConfigHandler;
|
|
19
14
|
tableConfig?: Partial<TableConfig>;
|
|
20
15
|
dashboardConfig?: Partial<DashboardConfig>;
|
|
21
16
|
};
|
|
22
|
-
type MalloyRenderApiState = {
|
|
23
|
-
sizingStrategy: 'fill' | 'fixed';
|
|
24
|
-
renderAs: string;
|
|
25
|
-
};
|
|
26
|
-
export type MalloyRenderApi = {
|
|
27
|
-
onInitialState?: (state: MalloyRenderApiState) => void;
|
|
28
|
-
__experimental: MalloyRenderApiState;
|
|
29
|
-
};
|
|
30
|
-
export type MalloyCustomElement = HTMLElement & ICustomElement & MalloyRenderProps & MalloyRenderApi;
|
|
31
17
|
export declare const useConfig: () => {
|
|
32
18
|
tableConfig: Accessor<TableConfig>;
|
|
33
19
|
dashboardConfig: Accessor<DashboardConfig>;
|
|
34
|
-
element: MalloyCustomElement;
|
|
35
|
-
stylesheet: CSSStyleSheet;
|
|
36
|
-
addCSSToShadowRoot: (css: string) => void;
|
|
37
|
-
addCSSToDocument: (id: string, css: string) => void;
|
|
38
20
|
onClick?: (payload: MalloyClickEventPayload) => void;
|
|
39
21
|
onDrill?: (drillData: DrillData) => void;
|
|
40
22
|
vegaConfigOverride?: VegaConfigHandler;
|
|
41
23
|
modalElement?: HTMLElement;
|
|
42
24
|
};
|
|
43
|
-
export declare function MalloyRender(props: MalloyRenderProps
|
|
25
|
+
export declare function MalloyRender(props: MalloyRenderProps): import("solid-js").JSX.Element;
|
|
44
26
|
export declare function MalloyRenderInner(props: {
|
|
45
27
|
result: Malloy.Result;
|
|
46
|
-
element:
|
|
28
|
+
element: HTMLElement;
|
|
47
29
|
scrollEl?: HTMLElement;
|
|
48
30
|
vegaConfigOverride?: VegaConfigHandler;
|
|
49
31
|
}): import("solid-js").JSX.Element;
|
package/dist/component/util.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
|
+
import { type Accessor, type Setter } from 'solid-js';
|
|
1
2
|
export declare function getTextWidthCanvas(text: string, font: string, canvasToUse?: HTMLCanvasElement): number;
|
|
2
3
|
export declare function getTextWidthDOM(text: string, styles: Record<string, string>): number;
|
|
3
4
|
export declare function clamp(s: number, e: number, v: number): number;
|
|
4
5
|
export declare function getRangeSize(range: [number, number]): number;
|
|
5
|
-
export declare function createRAFSignal<T>(initialValue: T): readonly [
|
|
6
|
+
export declare function createRAFSignal<T>(initialValue: T): readonly [Accessor<T>, (this: unknown, value: Exclude<T, Function> | ((prev: T) => T)) => void];
|
|
7
|
+
export type ResizeDirectiveValue = [
|
|
8
|
+
Accessor<{
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}>,
|
|
12
|
+
Setter<{
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
}>
|
|
16
|
+
];
|
|
17
|
+
export declare function resize(el: HTMLElement, value: Accessor<ResizeDirectiveValue>): void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
|
+
import type { BooleanField, DateField, Field, JSONField, NumberField, SQLNativeField, StringField, TimestampField } from '../fields';
|
|
3
|
+
import { CellBase } from './base';
|
|
4
|
+
import type { Cell, NestCell } from '.';
|
|
5
|
+
export declare class NullCell extends CellBase {
|
|
6
|
+
readonly cell: Malloy.CellWithNullCell;
|
|
7
|
+
readonly field: Field;
|
|
8
|
+
readonly parent: NestCell | undefined;
|
|
9
|
+
constructor(cell: Malloy.CellWithNullCell, field: Field, parent: NestCell | undefined);
|
|
10
|
+
get value(): null;
|
|
11
|
+
get literalValue(): Malloy.LiteralValue | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare class NumberCell extends CellBase {
|
|
14
|
+
readonly cell: Malloy.CellWithNumberCell;
|
|
15
|
+
readonly field: NumberField;
|
|
16
|
+
readonly parent: NestCell | undefined;
|
|
17
|
+
constructor(cell: Malloy.CellWithNumberCell, field: NumberField, parent: NestCell | undefined);
|
|
18
|
+
get value(): number;
|
|
19
|
+
compareTo(other: Cell): 1 | 0 | -1;
|
|
20
|
+
get literalValue(): Malloy.LiteralValue | undefined;
|
|
21
|
+
}
|
|
22
|
+
export declare class DateCell extends CellBase {
|
|
23
|
+
readonly cell: Malloy.CellWithDateCell;
|
|
24
|
+
readonly field: DateField;
|
|
25
|
+
readonly parent: NestCell | undefined;
|
|
26
|
+
constructor(cell: Malloy.CellWithDateCell, field: DateField, parent: NestCell | undefined);
|
|
27
|
+
get value(): Date;
|
|
28
|
+
get timeframe(): Malloy.DateTimeframe | undefined;
|
|
29
|
+
compareTo(other: Cell): 1 | 0 | -1;
|
|
30
|
+
get literalValue(): Malloy.LiteralValue | undefined;
|
|
31
|
+
}
|
|
32
|
+
export declare class TimestampCell extends CellBase {
|
|
33
|
+
readonly cell: Malloy.CellWithTimestampCell;
|
|
34
|
+
readonly field: TimestampField;
|
|
35
|
+
readonly parent: NestCell | undefined;
|
|
36
|
+
constructor(cell: Malloy.CellWithTimestampCell, field: TimestampField, parent: NestCell | undefined);
|
|
37
|
+
get value(): Date;
|
|
38
|
+
get timeframe(): Malloy.TimestampTimeframe | undefined;
|
|
39
|
+
compareTo(other: Cell): 1 | 0 | -1;
|
|
40
|
+
get literalValue(): Malloy.LiteralValue | undefined;
|
|
41
|
+
}
|
|
42
|
+
export declare class JSONCell extends CellBase {
|
|
43
|
+
readonly cell: Malloy.CellWithJSONCell;
|
|
44
|
+
readonly field: JSONField;
|
|
45
|
+
readonly parent: NestCell | undefined;
|
|
46
|
+
constructor(cell: Malloy.CellWithJSONCell, field: JSONField, parent: NestCell | undefined);
|
|
47
|
+
get value(): any;
|
|
48
|
+
compareTo(other: Cell): 1 | 0 | -1;
|
|
49
|
+
}
|
|
50
|
+
export declare class SQLNativeCell extends CellBase {
|
|
51
|
+
readonly cell: Malloy.CellWithSQLNativeCell;
|
|
52
|
+
readonly field: SQLNativeField;
|
|
53
|
+
readonly parent: NestCell | undefined;
|
|
54
|
+
constructor(cell: Malloy.CellWithSQLNativeCell, field: SQLNativeField, parent: NestCell | undefined);
|
|
55
|
+
get value(): any;
|
|
56
|
+
compareTo(other: Cell): 1 | 0 | -1;
|
|
57
|
+
}
|
|
58
|
+
export declare class StringCell extends CellBase {
|
|
59
|
+
readonly cell: Malloy.CellWithStringCell;
|
|
60
|
+
readonly field: StringField;
|
|
61
|
+
readonly parent: NestCell | undefined;
|
|
62
|
+
constructor(cell: Malloy.CellWithStringCell, field: StringField, parent: NestCell | undefined);
|
|
63
|
+
get value(): string;
|
|
64
|
+
compareTo(other: Cell): number;
|
|
65
|
+
get literalValue(): Malloy.LiteralValue | undefined;
|
|
66
|
+
}
|
|
67
|
+
export declare class BooleanCell extends CellBase {
|
|
68
|
+
readonly cell: Malloy.CellWithBooleanCell;
|
|
69
|
+
readonly field: BooleanField;
|
|
70
|
+
readonly parent: NestCell | undefined;
|
|
71
|
+
constructor(cell: Malloy.CellWithBooleanCell, field: BooleanField, parent: NestCell | undefined);
|
|
72
|
+
get value(): boolean;
|
|
73
|
+
compareTo(other: Cell): 1 | 0 | -1;
|
|
74
|
+
get literalValue(): Malloy.LiteralValue | undefined;
|
|
75
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
|
+
import type { Cell, NestCell, RecordCell } from '.';
|
|
3
|
+
import type { Field } from '../fields';
|
|
4
|
+
import { ArrayCell, BooleanCell, DateCell, JSONCell, NullCell, NumberCell, RepeatedRecordCell, StringCell, TimestampCell, type TimeCell, type RecordOrRepeatedRecordCell, type CellValue } from '.';
|
|
5
|
+
import type { DrillEntry } from '../types';
|
|
6
|
+
export declare abstract class CellBase {
|
|
7
|
+
readonly cell: Malloy.Cell;
|
|
8
|
+
readonly field: Field;
|
|
9
|
+
readonly parent: NestCell | undefined;
|
|
10
|
+
constructor(cell: Malloy.Cell, field: Field, parent: NestCell | undefined);
|
|
11
|
+
get literalValue(): Malloy.LiteralValue | undefined;
|
|
12
|
+
abstract get value(): CellValue;
|
|
13
|
+
isNull(): this is NullCell;
|
|
14
|
+
isArray(): this is ArrayCell;
|
|
15
|
+
isRecord(): this is RecordCell;
|
|
16
|
+
isRepeatedRecord(): this is RepeatedRecordCell;
|
|
17
|
+
isRecordOrRepeatedRecord(): this is RecordOrRepeatedRecordCell;
|
|
18
|
+
isNest(): this is NestCell;
|
|
19
|
+
isNumber(): this is NumberCell;
|
|
20
|
+
isDate(): this is DateCell;
|
|
21
|
+
isTime(): this is TimeCell;
|
|
22
|
+
isJSON(): this is JSONCell;
|
|
23
|
+
isString(): this is StringCell;
|
|
24
|
+
isTimestamp(): this is TimestampCell;
|
|
25
|
+
isBoolean(): this is BooleanCell;
|
|
26
|
+
asCell(): Cell;
|
|
27
|
+
root(): Cell;
|
|
28
|
+
private getPathInfo;
|
|
29
|
+
getParentRecord(levelsUp: number): RecordCell;
|
|
30
|
+
getRelativeCell(relativeDataPath: string): Cell | undefined;
|
|
31
|
+
cellAt(path: string[] | string): Cell;
|
|
32
|
+
cellAtPath(path: string[]): Cell;
|
|
33
|
+
compareTo(_other: Cell): number;
|
|
34
|
+
canDrill(): boolean;
|
|
35
|
+
getStableDrillQuery(): Malloy.Query | undefined;
|
|
36
|
+
getStableDrillClauses(): Malloy.DrillOperation[] | undefined;
|
|
37
|
+
getDrillExpressions(): string[];
|
|
38
|
+
getDrillEntries(): DrillEntry[];
|
|
39
|
+
getStableDrillQueryMalloy(): string | undefined;
|
|
40
|
+
getDrillQueryMalloy(): string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
|
+
import { type Field } from '../fields';
|
|
3
|
+
import { ArrayCell, RecordCell, RepeatedRecordCell } from './nest';
|
|
4
|
+
import { BooleanCell, DateCell, JSONCell, NullCell, NumberCell, SQLNativeCell, StringCell, TimestampCell } from './atomic';
|
|
5
|
+
export { ArrayCell, RecordCell, RepeatedRecordCell, RootCell } from './nest';
|
|
6
|
+
export { BooleanCell, DateCell, JSONCell, NullCell, NumberCell, SQLNativeCell, StringCell, TimestampCell, } from './atomic';
|
|
7
|
+
export type NestCell = ArrayCell | RecordCell;
|
|
8
|
+
export type RecordOrRepeatedRecordCell = RepeatedRecordCell | RecordCell;
|
|
9
|
+
export type TimeCell = DateCell | TimestampCell;
|
|
10
|
+
export type Cell = ArrayCell | RecordCell | NullCell | NumberCell | DateCell | JSONCell | StringCell | TimestampCell | BooleanCell | SQLNativeCell;
|
|
11
|
+
export type CellValue = string | number | boolean | Date | Cell[] | Record<string, Cell> | null;
|
|
12
|
+
export declare const Cell: {
|
|
13
|
+
from(cell: Malloy.Cell, field: Field, parent: NestCell): Cell;
|
|
14
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
|
+
import type { ArrayField, RecordField, RepeatedRecordField, RootField } from '../fields';
|
|
3
|
+
import type { RenderPlugin } from '../plugins';
|
|
4
|
+
import type { FieldRegistry } from '../types';
|
|
5
|
+
import { Cell, type CellValue } from '.';
|
|
6
|
+
import { CellBase } from './base';
|
|
7
|
+
import type { NestCell } from '.';
|
|
8
|
+
export declare class ArrayCell extends CellBase {
|
|
9
|
+
readonly cell: Malloy.CellWithArrayCell;
|
|
10
|
+
readonly field: ArrayField;
|
|
11
|
+
readonly parent: NestCell | undefined;
|
|
12
|
+
readonly values: Cell[];
|
|
13
|
+
constructor(cell: Malloy.CellWithArrayCell, field: ArrayField, parent: NestCell | undefined);
|
|
14
|
+
get value(): Cell[];
|
|
15
|
+
}
|
|
16
|
+
export declare class RepeatedRecordCell extends ArrayCell {
|
|
17
|
+
readonly cell: Malloy.CellWithArrayCell;
|
|
18
|
+
readonly field: RepeatedRecordField;
|
|
19
|
+
readonly parent: NestCell | undefined;
|
|
20
|
+
readonly rows: RecordCell[];
|
|
21
|
+
readonly fieldValueSets: Map<string, Set<CellValue>>;
|
|
22
|
+
private plugins;
|
|
23
|
+
private registry?;
|
|
24
|
+
constructor(cell: Malloy.CellWithArrayCell, field: RepeatedRecordField, parent: NestCell | undefined, plugins?: RenderPlugin[], registry?: FieldRegistry);
|
|
25
|
+
get value(): RecordCell[];
|
|
26
|
+
}
|
|
27
|
+
export declare class RootCell extends RepeatedRecordCell {
|
|
28
|
+
readonly cell: Malloy.CellWithArrayCell;
|
|
29
|
+
readonly field: RootField;
|
|
30
|
+
constructor(cell: Malloy.CellWithArrayCell, field: RootField, plugins?: RenderPlugin[], registry?: FieldRegistry);
|
|
31
|
+
}
|
|
32
|
+
export declare class RecordCell extends CellBase {
|
|
33
|
+
readonly cell: Malloy.CellWithRecordCell;
|
|
34
|
+
readonly field: RecordField;
|
|
35
|
+
readonly parent: NestCell | undefined;
|
|
36
|
+
readonly cells: Record<string, Cell>;
|
|
37
|
+
constructor(cell: Malloy.CellWithRecordCell, field: RecordField, parent: NestCell | undefined);
|
|
38
|
+
get rows(): RecordCell[];
|
|
39
|
+
get value(): Record<string, Cell>;
|
|
40
|
+
column(name: string): Cell;
|
|
41
|
+
get columns(): Cell[];
|
|
42
|
+
allCellValues(): Record<string, CellValue>;
|
|
43
|
+
cellAtPath(path: string[]): Cell;
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as Malloy from '@malloydata/malloy-interfaces';
|
|
2
|
+
import type { Cell } from './cells';
|
|
3
|
+
import type { DrillEntry, DrillValue } from './types';
|
|
4
|
+
export declare function canDrill(cell: Cell): boolean;
|
|
5
|
+
export declare function getStableDrillQuery(cell: Cell): Malloy.Query | undefined;
|
|
6
|
+
export declare function getStableDrillClauses(cell: Cell): Malloy.DrillOperation[] | undefined;
|
|
7
|
+
export declare function getDrillValues(cell: Cell): DrillValue[];
|
|
8
|
+
export declare function getDrillExpressions(cell: Cell): string[];
|
|
9
|
+
export declare function getDrillEntries(cell: Cell): DrillEntry[];
|
|
10
|
+
export declare function getStableDrillQueryMalloy(cell: Cell): string | undefined;
|
|
11
|
+
export declare function getDrillQueryMalloy(cell: Cell): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { NestField } from '.';
|
|
2
|
+
import type { BooleanFieldInfo, DateFieldInfo, FieldRegistry, JSONFieldInfo, NumberFieldInfo, SQLNativeFieldInfo, StringFieldInfo, TimestampFieldInfo } from '../types';
|
|
3
|
+
import { FieldBase } from './base';
|
|
4
|
+
export declare class NumberField extends FieldBase {
|
|
5
|
+
readonly field: NumberFieldInfo;
|
|
6
|
+
min: number | undefined;
|
|
7
|
+
max: number | undefined;
|
|
8
|
+
private _maxString;
|
|
9
|
+
constructor(field: NumberFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
10
|
+
registerValue(value: number): void;
|
|
11
|
+
fieldAtPath(path: string[]): import(".").Field;
|
|
12
|
+
get minNumber(): number | undefined;
|
|
13
|
+
get maxNumber(): number | undefined;
|
|
14
|
+
get maxString(): string | undefined;
|
|
15
|
+
}
|
|
16
|
+
export declare class DateField extends FieldBase {
|
|
17
|
+
readonly field: DateFieldInfo;
|
|
18
|
+
min: Date | undefined;
|
|
19
|
+
max: Date | undefined;
|
|
20
|
+
private _maxString;
|
|
21
|
+
constructor(field: DateFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
22
|
+
get timeframe(): import("@malloydata/malloy-interfaces").DateTimeframe | undefined;
|
|
23
|
+
registerValue(value: Date): void;
|
|
24
|
+
get minValue(): Date | undefined;
|
|
25
|
+
get maxValue(): Date | undefined;
|
|
26
|
+
get maxString(): string | undefined;
|
|
27
|
+
get minNumber(): number | undefined;
|
|
28
|
+
get maxNumber(): number | undefined;
|
|
29
|
+
}
|
|
30
|
+
export declare class TimestampField extends FieldBase {
|
|
31
|
+
readonly field: TimestampFieldInfo;
|
|
32
|
+
min: Date | undefined;
|
|
33
|
+
max: Date | undefined;
|
|
34
|
+
private _maxString;
|
|
35
|
+
constructor(field: TimestampFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
36
|
+
get timeframe(): import("@malloydata/malloy-interfaces").TimestampTimeframe | undefined;
|
|
37
|
+
registerValue(value: Date): void;
|
|
38
|
+
get minValue(): Date | undefined;
|
|
39
|
+
get maxValue(): Date | undefined;
|
|
40
|
+
get maxString(): string | undefined;
|
|
41
|
+
}
|
|
42
|
+
export declare class StringField extends FieldBase {
|
|
43
|
+
readonly field: StringFieldInfo;
|
|
44
|
+
min: string | undefined;
|
|
45
|
+
max: string | undefined;
|
|
46
|
+
private _maxString;
|
|
47
|
+
constructor(field: StringFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
48
|
+
registerValue(value: string): void;
|
|
49
|
+
get minValue(): string | undefined;
|
|
50
|
+
get maxValue(): string | undefined;
|
|
51
|
+
get maxString(): string | undefined;
|
|
52
|
+
}
|
|
53
|
+
export declare class SQLNativeField extends FieldBase {
|
|
54
|
+
readonly field: SQLNativeFieldInfo;
|
|
55
|
+
constructor(field: SQLNativeFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
56
|
+
}
|
|
57
|
+
export declare class JSONField extends FieldBase {
|
|
58
|
+
readonly field: JSONFieldInfo;
|
|
59
|
+
constructor(field: JSONFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
60
|
+
}
|
|
61
|
+
export declare class BooleanField extends FieldBase {
|
|
62
|
+
readonly field: BooleanFieldInfo;
|
|
63
|
+
private _maxString;
|
|
64
|
+
constructor(field: BooleanFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
|
|
65
|
+
get maxString(): string | undefined;
|
|
66
|
+
registerValue(value: boolean): void;
|
|
67
|
+
}
|