@uwdata/mosaic-spec 0.12.2 → 0.13.0
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/dist/mosaic-schema.json +15 -0
- package/dist/types/ast/PlotAttributeNode.d.ts +1 -1
- package/dist/types/ast/TransformNode.d.ts +1 -1
- package/dist/types/ast-to-dom.d.ts +16 -14
- package/dist/types/spec/Transform.d.ts +6 -0
- package/package.json +12 -12
- package/src/ast-to-dom.js +9 -4
- package/src/config/transforms.js +1 -0
- package/src/spec/Transform.ts +8 -0
- package/vitest.config.ts +3 -0
- package/dist/mosaic-spec.js +0 -38356
- package/dist/mosaic-spec.min.js +0 -80
package/dist/mosaic-schema.json
CHANGED
|
@@ -14888,6 +14888,9 @@
|
|
|
14888
14888
|
"bottom": {
|
|
14889
14889
|
"type": "string"
|
|
14890
14890
|
},
|
|
14891
|
+
"boxDecorationBreak": {
|
|
14892
|
+
"type": "string"
|
|
14893
|
+
},
|
|
14891
14894
|
"boxShadow": {
|
|
14892
14895
|
"type": "string"
|
|
14893
14896
|
},
|
|
@@ -15725,6 +15728,15 @@
|
|
|
15725
15728
|
"textAnchor": {
|
|
15726
15729
|
"type": "string"
|
|
15727
15730
|
},
|
|
15731
|
+
"textBox": {
|
|
15732
|
+
"type": "string"
|
|
15733
|
+
},
|
|
15734
|
+
"textBoxEdge": {
|
|
15735
|
+
"type": "string"
|
|
15736
|
+
},
|
|
15737
|
+
"textBoxTrim": {
|
|
15738
|
+
"type": "string"
|
|
15739
|
+
},
|
|
15728
15740
|
"textCombineUpright": {
|
|
15729
15741
|
"type": "string"
|
|
15730
15742
|
},
|
|
@@ -15842,6 +15854,9 @@
|
|
|
15842
15854
|
"verticalAlign": {
|
|
15843
15855
|
"type": "string"
|
|
15844
15856
|
},
|
|
15857
|
+
"viewTransitionClass": {
|
|
15858
|
+
"type": "string"
|
|
15859
|
+
},
|
|
15845
15860
|
"viewTransitionName": {
|
|
15846
15861
|
"type": "string"
|
|
15847
15862
|
},
|
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generate a running web application (DOM content) for a Mosaic spec AST.
|
|
3
3
|
* @param {SpecNode} ast Mosaic AST root node.
|
|
4
|
-
* @param {
|
|
5
|
-
* @param {string} [options.baseURL] The base URL for loading data files.
|
|
6
|
-
* @param {any[]} [options.plotDefaults] Array of default plot attributes.
|
|
7
|
-
* @param {Map<string, Param>} [options.params] A map of predefined Params/Selections.
|
|
4
|
+
* @param {ConstructorParameters<typeof InstantiateContext>[0]} [options] Instantiation options.
|
|
8
5
|
* @returns {Promise<{
|
|
9
6
|
* element: HTMLElement | SVGSVGElement;
|
|
10
7
|
* params: Map<string, Param | Selection>;
|
|
11
8
|
* }>} A Promise to an object with the resulting
|
|
12
9
|
* DOM element, and a map of named parameters (Param and Selection instances).
|
|
13
10
|
*/
|
|
14
|
-
export function astToDOM(ast: SpecNode, options?: {
|
|
15
|
-
baseURL?: string;
|
|
16
|
-
plotDefaults?: any[];
|
|
17
|
-
params?: Map<string, Param>;
|
|
18
|
-
}): Promise<{
|
|
11
|
+
export function astToDOM(ast: SpecNode, options?: ConstructorParameters<typeof InstantiateContext>[0]): Promise<{
|
|
19
12
|
element: HTMLElement | SVGSVGElement;
|
|
20
13
|
params: Map<string, Param | Selection>;
|
|
21
14
|
}>;
|
|
22
15
|
export class InstantiateContext {
|
|
16
|
+
/**
|
|
17
|
+
* Create a new InstantiateContext instance.
|
|
18
|
+
* @param {object} options Optional instantiation options.
|
|
19
|
+
* @param {string} [options.baseURL] The base URL for loading data files.
|
|
20
|
+
* @param {any[]} [options.plotDefaults] Array of default plot attributes.
|
|
21
|
+
* @param {Map<string, Param>} [options.params] A map of predefined Params/Selections.
|
|
22
|
+
* @param {ReturnType<typeof createAPIContext>} [options.api] The context to be used for vgplot API methods.
|
|
23
|
+
*/
|
|
23
24
|
constructor({ api, plotDefaults, params, baseURL }?: {
|
|
24
|
-
|
|
25
|
+
baseURL?: string;
|
|
25
26
|
plotDefaults?: any[];
|
|
26
|
-
params?: Map<
|
|
27
|
-
|
|
27
|
+
params?: Map<string, Param>;
|
|
28
|
+
api?: ReturnType<typeof createAPIContext>;
|
|
28
29
|
});
|
|
29
30
|
api: any;
|
|
30
31
|
plotDefaults: any[];
|
|
31
|
-
activeParams: Map<
|
|
32
|
-
baseURL:
|
|
32
|
+
activeParams: Map<string, Param>;
|
|
33
|
+
baseURL: string;
|
|
33
34
|
coordinator: any;
|
|
34
35
|
error(message: any, data: any): void;
|
|
35
36
|
}
|
|
36
37
|
import { SpecNode } from './ast/SpecNode.js';
|
|
37
38
|
import { Param } from '@uwdata/mosaic-core';
|
|
38
39
|
import { Selection } from '@uwdata/mosaic-core';
|
|
40
|
+
import { createAPIContext } from '@uwdata/vgplot';
|
|
@@ -177,6 +177,12 @@ export interface First extends AggregateOptions, WindowOptions {
|
|
|
177
177
|
*/
|
|
178
178
|
first: Arg1;
|
|
179
179
|
}
|
|
180
|
+
export interface Geomean extends AggregateOptions, WindowOptions {
|
|
181
|
+
/**
|
|
182
|
+
* Compute the geometric mean value of the given column.
|
|
183
|
+
*/
|
|
184
|
+
geomean: Arg1;
|
|
185
|
+
}
|
|
180
186
|
export interface Last extends AggregateOptions, WindowOptions {
|
|
181
187
|
/**
|
|
182
188
|
* Return the last column value found in an aggregation group.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uwdata/mosaic-spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Declarative specification of Mosaic-powered applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mosaic",
|
|
@@ -12,31 +12,31 @@
|
|
|
12
12
|
"license": "BSD-3-Clause",
|
|
13
13
|
"author": "Jeffrey Heer (https://idl.uw.edu)",
|
|
14
14
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"types": "dist/types/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
17
|
+
"default": "./src/index.js"
|
|
18
|
+
},
|
|
20
19
|
"repository": {
|
|
21
20
|
"type": "git",
|
|
22
21
|
"url": "https://github.com/uwdata/mosaic.git"
|
|
23
22
|
},
|
|
24
23
|
"scripts": {
|
|
25
24
|
"prebuild": "rimraf dist && mkdir dist",
|
|
26
|
-
"build": "npm run types
|
|
25
|
+
"build": "npm run types",
|
|
27
26
|
"lint": "eslint src test",
|
|
28
27
|
"types": "tsc && npm run schema",
|
|
29
28
|
"schema": "ts-json-schema-generator -f tsconfig.json -p src/spec/Spec.ts -t Spec --no-type-check --no-ref-encode --functions hide > dist/mosaic-schema.json",
|
|
30
29
|
"pretest": "npm run prebuild && npm run types",
|
|
31
|
-
"test": "vitest run &&
|
|
30
|
+
"test": "vitest run && npm run tsc",
|
|
31
|
+
"tsc": "tsc -p jsconfig.json",
|
|
32
32
|
"version": "cd ../.. && npm run docs:schema",
|
|
33
33
|
"prepublishOnly": "npm run test && npm run lint && npm run build"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@uwdata/mosaic-core": "^0.
|
|
37
|
-
"@uwdata/mosaic-sql": "^0.
|
|
38
|
-
"@uwdata/vgplot": "^0.
|
|
36
|
+
"@uwdata/mosaic-core": "^0.13.0",
|
|
37
|
+
"@uwdata/mosaic-sql": "^0.13.0",
|
|
38
|
+
"@uwdata/vgplot": "^0.13.0",
|
|
39
39
|
"ts-json-schema-generator": "^2.3.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "b5a0e03e200c0f04c46562a288f084ffc9f6ad55"
|
|
42
42
|
}
|
package/src/ast-to-dom.js
CHANGED
|
@@ -7,10 +7,7 @@ import { error } from './util.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* Generate a running web application (DOM content) for a Mosaic spec AST.
|
|
9
9
|
* @param {SpecNode} ast Mosaic AST root node.
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {string} [options.baseURL] The base URL for loading data files.
|
|
12
|
-
* @param {any[]} [options.plotDefaults] Array of default plot attributes.
|
|
13
|
-
* @param {Map<string, Param>} [options.params] A map of predefined Params/Selections.
|
|
10
|
+
* @param {ConstructorParameters<typeof InstantiateContext>[0]} [options] Instantiation options.
|
|
14
11
|
* @returns {Promise<{
|
|
15
12
|
* element: HTMLElement | SVGSVGElement;
|
|
16
13
|
* params: Map<string, Param | Selection>;
|
|
@@ -54,6 +51,14 @@ export async function astToDOM(ast, options) {
|
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
export class InstantiateContext {
|
|
54
|
+
/**
|
|
55
|
+
* Create a new InstantiateContext instance.
|
|
56
|
+
* @param {object} options Optional instantiation options.
|
|
57
|
+
* @param {string} [options.baseURL] The base URL for loading data files.
|
|
58
|
+
* @param {any[]} [options.plotDefaults] Array of default plot attributes.
|
|
59
|
+
* @param {Map<string, Param>} [options.params] A map of predefined Params/Selections.
|
|
60
|
+
* @param {ReturnType<typeof createAPIContext>} [options.api] The context to be used for vgplot API methods.
|
|
61
|
+
*/
|
|
57
62
|
constructor({
|
|
58
63
|
api = createAPIContext(),
|
|
59
64
|
plotDefaults = [],
|
package/src/config/transforms.js
CHANGED
package/src/spec/Transform.ts
CHANGED
|
@@ -229,6 +229,14 @@ export interface First extends AggregateOptions, WindowOptions {
|
|
|
229
229
|
first: Arg1;
|
|
230
230
|
}
|
|
231
231
|
|
|
232
|
+
/* A geometric mean aggregate transform. */
|
|
233
|
+
export interface Geomean extends AggregateOptions, WindowOptions {
|
|
234
|
+
/**
|
|
235
|
+
* Compute the geometric mean value of the given column.
|
|
236
|
+
*/
|
|
237
|
+
geomean: Arg1;
|
|
238
|
+
}
|
|
239
|
+
|
|
232
240
|
/* A last aggregate transform. */
|
|
233
241
|
export interface Last extends AggregateOptions, WindowOptions {
|
|
234
242
|
/**
|
package/vitest.config.ts
ADDED