version bump

This commit is contained in:
Henning Dieterichs
2024-01-04 19:18:26 +01:00
parent 21fa200446
commit 9e6dc9a5ad
13 changed files with 66 additions and 58 deletions

View File

@@ -1,4 +1,5 @@
{
"tasksStatusbar.taskLabelFilter": "dev",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"typescript.tsdk": "node_modules\\typescript\\lib"
}

View File

@@ -5,7 +5,7 @@
"scripts": {
"dev": "webpack-dev-server --hot",
"build": "yarn build-webpack && yarn build-docs",
"build-webpack": "node --max_old_space_size=4096 ../node_modules/webpack/bin/webpack.js --mode production",
"build-webpack": "node --max_old_space_size=4096 --openssl-legacy-provider ../node_modules/webpack/bin/webpack.js --mode production",
"build-docs": "ts-node ./scripts/build-docs",
"pub": "gh-pages -d dist -u 'github-actions-bot <support+actions@github.com>'"
},

View File

@@ -174,7 +174,7 @@ class VisualizationConfigView extends React.Component<{
if (visualizations.bestVisualization) {
const tsTypeGenerator = new TypeScriptTypeGenerator();
const typeSrc = tsTypeGenerator.getType(
visualizations.bestVisualization.sourceVisualizer.serializer.asSerializer()
visualizations.bestVisualizationVisualizer!.serializer.asSerializer()
);
const decl = tsTypeGenerator.getDefinitionSource();
return {

View File

@@ -4,7 +4,7 @@
"license": "MIT",
"scripts": {
"dev": "webpack-dev-server --hot --port 8090",
"build": "node --max_old_space_size=4096 ../node_modules/webpack/bin/webpack.js --mode production"
"build": "node --max_old_space_size=4096 --openssl-legacy-provider ../node_modules/webpack/bin/webpack.js --mode production"
},
"dependencies": {
"@hediet/visualization-core": "^0.1.0",

View File

@@ -1,7 +1,7 @@
{
"name": "@hediet/visualization-bundle",
"description": "Bundles several visualizers",
"version": "0.2.4",
"version": "0.2.5",
"license": "MIT",
"scripts": {
"dev": "tsc --watch",
@@ -50,9 +50,6 @@
"@types/plotly.js": "^1.50.16",
"@types/react": "^16.9.22",
"@types/react-dom": "^16.9.5",
"@types/react-measure": "^2.0.6",
"@types/react-plotly.js": "^2.2.4",
"@types/react-svg-pan-zoom": "^3.3.0",
"@types/webpack": "^4.41.6",
"ts-loader": "^6.2.1",
"ts-node": "^8.6.2",

18
visualization-bundle/src/types.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
declare module "react-measure" {
const content: any;
export default content;
export type ContentRect = any;
}
declare module "react-plotly.js" {
const content: any;
export default content;
}
declare module "react-svg-pan-zoom" {
export class Tool { }
export type ReactSVGPanZoom = any;
export const ReactSVGPanZoom = undefined as any;
export class Value { }
}

View File

@@ -37,7 +37,13 @@ export class AstTree extends React.Component<{
}
return (
<Measure client>
{({ measureRef, contentRect }) => {
{({
measureRef,
contentRect,
}: {
measureRef: any;
contentRect: any;
}) => {
return (
<div
ref={measureRef}

View File

@@ -74,7 +74,13 @@ export class SvgViewer extends React.Component<{
}
}}
>
{({ measureRef, contentRect }) => (
{({
measureRef,
contentRect,
}: {
measureRef: any;
contentRect: any;
}) => (
<div
ref={measureRef}
className="svgViewer"
@@ -85,7 +91,7 @@ export class SvgViewer extends React.Component<{
height={heightOrDefault(contentRect)}
tool={tool}
value={val as any}
onChangeValue={v => (this.value = v)}
onChangeValue={(v: any) => (this.value = v)}
onChangeTool={this.setTool}
ref={this.svgPanZoomRef}
toolbarProps={{

View File

@@ -4,7 +4,10 @@ import { Properties } from "csstype";
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
export function omit<T, K extends keyof T>(obj: T, keys: K[]): Omit<T, K> {
export function omit<T extends {}, K extends keyof T>(
obj: T,
keys: K[]
): Omit<T, K> {
const newObj: Omit<T, K> = {} as any;
for (const [key, val] of Object.entries(obj)) {
if (!keys.includes(key as K)) {

View File

@@ -1,7 +1,7 @@
{
"name": "@hediet/visualization-core",
"description": "Provides infrastructure to find registered visualizations for given json data",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"homepage": "https://github.com/hediet/visualization",
"repository": {

View File

@@ -64,7 +64,7 @@ export function createReactVisualization(
args: ReactVisualizationArgs,
renderReactNode: (args: ReactVisualizationRenderArgs) => React.ReactChild
) {
return new ReactVisualization(sourceVisualizer, args, (options) => {
return new ReactVisualization(sourceVisualizer, args, options => {
const deferred = new Deferred();
return {
node: (
@@ -86,7 +86,7 @@ class ComponentWithOnMount extends React.Component<{
this.props.onDidMount();
}
render() {
render(): React.ReactNode {
return this.props.child;
}
}
@@ -94,7 +94,9 @@ class ComponentWithOnMount extends React.Component<{
export function createLazyReactVisualization(
sourceVisualizer: Visualizer,
args: ReactVisualizationArgs,
renderReactNode: (args: ReactVisualizationRenderArgs) => {
renderReactNode: (
args: ReactVisualizationRenderArgs
) => {
node: React.ReactChild;
ready: Promise<void>;
}

View File

@@ -1,6 +1,6 @@
import { Visualizer, Visualization, VisualizationId } from "./Visualizer";
import { VisualizationData } from "./VisualizationData";
import { JSONValue, sUnionMany } from "@hediet/semantic-json";
import { JSONValue, Serializer, sUnionMany } from "@hediet/semantic-json";
import { ObservableMap } from "mobx";
export class VisualizationFactory {
@@ -10,13 +10,17 @@ export class VisualizationFactory {
Visualizer
>();
public getSerializer() {
public getSerializer(): Serializer<[Visualization<any>, Visualizer][]> {
return this._getSerializer(this.visualizers);
}
private _getSerializer(map: ObservableMap<string, Visualizer>) {
private _getSerializer(map: ObservableMap<string, Visualizer>): Serializer<[Visualization<any>, Visualizer][]> {
return sUnionMany(
[...map.values()].map((v) => v.serializer.asSerializer()),
[...map.values()].map((v) => v.serializer.asSerializer().refine<[Visualization, Visualizer]>({
canSerialize: (v): v is [Visualization, Visualizer] => false,
fromIntermediate: value => [value, v],
toIntermediate: () => { throw new Error("not supported"); }
})),
{ processingStrategy: "all" }
);
}
@@ -53,15 +57,15 @@ export class VisualizationFactory {
const hiddenResult = u2.deserialize(data as unknown as JSONValue);
allVisualizations.push(...(hiddenResult.value || []));
allVisualizations.sort((a, b) => b.priority - a.priority);
allVisualizations.sort(([a], [b]) => b.priority - a.priority);
let bestVisualization: Visualization | undefined = allVisualizations[0];
if (bestVisualization && bestVisualization.priority < 0) {
let bestVisualization: [Visualization, Visualizer] | undefined = allVisualizations[0];
if (bestVisualization && bestVisualization[0].priority < 0) {
bestVisualization = undefined;
}
if (preferredVisualization) {
const preferred = allVisualizations.find(
(vis) => vis.id === preferredVisualization
([vis]) => vis.id === preferredVisualization
);
if (preferred) {
bestVisualization = preferred;
@@ -69,8 +73,9 @@ export class VisualizationFactory {
}
return {
bestVisualization,
allVisualizations,
bestVisualization: bestVisualization ? bestVisualization[0] : undefined,
bestVisualizationVisualizer: bestVisualization ? bestVisualization[1] : undefined,
allVisualizations: allVisualizations.map(v => v[0]),
visualizationDataErrors: [],
};
}
@@ -78,6 +83,7 @@ export class VisualizationFactory {
export interface Visualizations {
bestVisualization: Visualization | undefined;
bestVisualizationVisualizer: Visualizer | undefined;
allVisualizations: Visualization[];
visualizationDataErrors: VisualizationDataError[];
}

View File

@@ -604,7 +604,7 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-15.12.1.tgz#9b60797dee1895383a725f828a869c86c6caa5c2"
integrity sha512-zyxJM8I1c9q5sRMtVF+zdd13Jt6RU4r4qfhTd7lQubyThvLfx6yYekWSQjGCGV2Tkecgxnlpl/DNlb6Hg+dmEw==
"@types/plotly.js@*", "@types/plotly.js@^1.50.16":
"@types/plotly.js@^1.50.16":
version "1.54.10"
resolved "https://registry.yarnpkg.com/@types/plotly.js/-/plotly.js-1.54.10.tgz#608ecf2b348006cff9e449c6e5e32625a675909e"
integrity sha512-38CuUoM5M1jQl5setuGl4yj59+7Cn6WYIQyeGLptJpAJre9/wZLl0EzdnImVB3l+qUBYxkbCH9FIDV/JoPzTXQ==
@@ -623,37 +623,6 @@
dependencies:
"@types/react" "^16"
"@types/react-measure@^2.0.6":
version "2.0.6"
resolved "https://registry.yarnpkg.com/@types/react-measure/-/react-measure-2.0.6.tgz#d66efad1960ea8b38eef9d8cc3cc857e7767b09e"
integrity sha512-FxAwgDVKvxm4SPXu24x9cwzsty8x33UueazHcpxM1UWZlGJI57yIHM2djE3xUJhYVxuzNzi4E8UL3kmCkdh+4A==
dependencies:
"@types/react" "*"
"@types/react-plotly.js@^2.2.4":
version "2.2.4"
resolved "https://registry.yarnpkg.com/@types/react-plotly.js/-/react-plotly.js-2.2.4.tgz#360fcfcace64d0ef173cf0c7d67fc2441b39f659"
integrity sha512-dsvngno7Ar13XoF2eJXM609Msoc5DPboNp8x4NE4L+rsBEEsu16/0b0Fze8REx3fA4HEUk4rcn3uJsx48m2sew==
dependencies:
"@types/plotly.js" "*"
"@types/react" "*"
"@types/react-svg-pan-zoom@^3.3.0":
version "3.3.1"
resolved "https://registry.yarnpkg.com/@types/react-svg-pan-zoom/-/react-svg-pan-zoom-3.3.1.tgz#ae210ffd20422515eaf5d54bfa8fe374be585b1e"
integrity sha512-N10C2gGqs6apsnTmmddCbAlNwb5VuX1DvosPV7NOmPPrSaKjMIRdgJ4luj9qipGHzafUU/T2JtM87RgvO/V+XA==
dependencies:
"@types/react" "*"
"@types/react@*":
version "17.0.9"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.9.tgz#1147fb520024a62c9b3841f5cb4db89b73ddb87f"
integrity sha512-2Cw7FvevpJxQrCb+k5t6GH1KIvmadj5uBbjPaLlJB/nZWUj56e1ZqcD6zsoMFB47MsJUTFl9RJ132A7hb3QFJA==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"
"@types/react@^16", "@types/react@^16.9.17", "@types/react@^16.9.22":
version "16.14.8"
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.8.tgz#4aee3ab004cb98451917c9b7ada3c7d7e52db3fe"