Skip to content

Commit

Permalink
Merge branch 'dev-trash' into 'master'
Browse files Browse the repository at this point in the history
Dev trash

See merge request ebi-biows/jdispatcher-viewers!1
  • Loading branch information
biomadeira committed Oct 30, 2024
2 parents 94d1331 + 56deacc commit d7fc617
Show file tree
Hide file tree
Showing 24 changed files with 7,215 additions and 6,690 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# https://editorconfig.org

root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"semi": true,
"bracketSpacing": true,
"arrowParens": "avoid",
"trailingComma": "es5",
"bracketSameLine": true,
"printWidth": 120
}
12 changes: 6 additions & 6 deletions json.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// This will allow you to load `.json` files from disk
declare module "*.json" {
const value: any;
export default value;
declare module '*.json' {
const value: any;
export default value;
}

// This will allow you to load JSON from remote URL responses
declare module "json!*" {
const value: any;
export default value;
declare module 'json!*' {
const value: any;
export default value;
}
4,956 changes: 3,121 additions & 1,835 deletions package-lock.json

Large diffs are not rendered by default.

68 changes: 35 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
"dev": "npx webpack serve --config webpack.config.js",
"dev2": "npx webpack --watch --config webpack.config.js",
"build": "npx webpack --config webpack.config.prod.js",
"tsc": "tsc -w -p ./tsconfig.json",
"dev:cli": "tsc -w -p ./tsconfig.cli.json",
"build:cli": "tsc -p ./tsconfig.cli.json",
"tsc:cli": "tsc -w -p ./tsconfig.cli.json",
"release": "standard-version"
"tsc": "npx tsc -w -p ./tsconfig.json",
"dev:cli": "npx tsc -w -p ./tsconfig.cli.json",
"build:cli": "npx tsc -p ./tsconfig.cli.json",
"tsc:cli": "npx tsc -w -p ./tsconfig.cli.json",
"release": "npx standard-version",
"format": "npx prettier '**/*.ts' --check",
"format:write": "npx prettier '**/*.ts' --write"
},
"browser": {
"child_process": false
Expand All @@ -42,43 +44,43 @@
},
"license": "Apache-2.0",
"dependencies": {
"@types/browser-or-node": "^1.3.0",
"@types/fabric": "4.5.11",
"@types/figlet": "^1.5.5",
"@types/node": "^18.13.0",
"@types/node-fetch": "^2.6.2",
"@webcomponents/webcomponentsjs": "^2.7.0",
"assert": "^2.0.0",
"browser-or-node": "^2.1.1",
"@types/browser-or-node": "^1.3.2",
"@types/figlet": "^1.7.0",
"@types/node": "^22.8.1",
"@types/node-fetch": "^2.6.11",
"@webcomponents/webcomponentsjs": "^2.8.0",
"assert": "^2.1.0",
"browser-or-node": "^3.0.0",
"buffer": "^6.0.3",
"canvas": "^2.11.0",
"chalk": "^5.2.0",
"commander": "^9.5.0",
"canvas": "^2.11.2",
"chalk": "^5.3.0",
"commander": "^12.1.0",
"commonjs": "0.0.1",
"fabric": "5.2.1",
"figlet": "^1.5.2",
"lit": "^2.6.1",
"lit-element": "^3.2.2",
"lit-html": "^2.6.1",
"fabric": "6.4.3",
"figlet": "^1.8.0",
"lit": "^3.2.1",
"lit-element": "^4.1.1",
"lit-html": "^3.2.1",
"mini-svg-data-uri": "^1.4.4",
"node-fetch": "^3.3.0",
"stream": "^0.0.2",
"node-fetch": "^3.3.2",
"stream": "^0.0.3",
"xml-js": "^1.6.11"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.52.0",
"@typescript-eslint/parser": "^5.52.0",
"@types/jsdom": "^21.1.7",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"eslint": "^8.34.0",
"html-webpack-plugin": "^5.5.0",
"copy-webpack-plugin": "^12.0.2",
"eslint": "^9.13.0",
"html-webpack-plugin": "^5.6.3",
"node-loader": "^2.0.0",
"standard-version": "^9.5.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"webpack": "^5.75.0",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.1",
"ts-loader": "^9.5.1",
"typescript": "^5.6.3",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0",
"webpack-node-externals": "^3.0.0"
}
}
80 changes: 40 additions & 40 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
import svgToMiniDataURI from "mini-svg-data-uri";
import {isBrowser, isNode} from "browser-or-node";
import {VisualOutput} from "./visual-output-app";
import {FunctionalPredictions} from "./functional-predictions-app";
import svgToMiniDataURI from 'mini-svg-data-uri';
import { isBrowser, isNode } from 'browser-or-node';
import { VisualOutput } from './visual-output-app';
import { FunctionalPredictions } from './functional-predictions-app';
import {
validateJobId,
fetchData,
dataAsType,
getJdispatcherJsonURL,
validateSubmittedJobIdInput,
validateSubmittedDbfetchInput,
getIPRMCDataModelFlatFromXML,
} from "./other-utilities";
import {ColorSchemeEnum} from "./custom-types";
validateJobId,
fetchData,
dataAsType,
getJdispatcherJsonURL,
validateSubmittedJobIdInput,
validateSubmittedDbfetchInput,
getIPRMCDataModelFlatFromXML,
} from './other-utilities';
import { ColorSchemeEnum } from './custom-types';

// plugin support & module support
// if (typeof window === "undefined") {
if (isBrowser) {
(window as any).VisualOutput = VisualOutput;
(window as any).FunctionalPredictions = FunctionalPredictions;
(window as any).validateJobId = validateJobId;
(window as any).svgToMiniDataURI = svgToMiniDataURI;
(window as any).fetchData = fetchData;
(window as any).dataAsType = dataAsType;
(window as any).getJdispatcherJsonURL = getJdispatcherJsonURL;
(window as any).validateSubmittedJobIdInput = validateSubmittedJobIdInput;
(window as any).validateSubmittedDbfetchInput = validateSubmittedDbfetchInput;
(window as any).getIPRMCDataModelFlatFromXML = getIPRMCDataModelFlatFromXML;
(window as any).ColorSchemeEnum = ColorSchemeEnum;
(window as any).VisualOutput = VisualOutput;
(window as any).FunctionalPredictions = FunctionalPredictions;
(window as any).validateJobId = validateJobId;
(window as any).svgToMiniDataURI = svgToMiniDataURI;
(window as any).fetchData = fetchData;
(window as any).dataAsType = dataAsType;
(window as any).getJdispatcherJsonURL = getJdispatcherJsonURL;
(window as any).validateSubmittedJobIdInput = validateSubmittedJobIdInput;
(window as any).validateSubmittedDbfetchInput = validateSubmittedDbfetchInput;
(window as any).getIPRMCDataModelFlatFromXML = getIPRMCDataModelFlatFromXML;
(window as any).ColorSchemeEnum = ColorSchemeEnum;
}
if (isNode) {
module.exports = {
VisualOutput: VisualOutput,
FunctionalPredictions: FunctionalPredictions,
validateJobId: validateJobId,
svgToMiniDataURI: svgToMiniDataURI,
fetchData: fetchData,
dataAsType: dataAsType,
getJdispatcherJsonURL: getJdispatcherJsonURL,
validateSubmittedJobIdInput: validateSubmittedJobIdInput,
validateSubmittedDbfetchInput: validateSubmittedDbfetchInput,
getIPRMCDataModelFlatFromXML: getIPRMCDataModelFlatFromXML,
ColorSchemeEnum: ColorSchemeEnum,
};
module.exports = {
VisualOutput: VisualOutput,
FunctionalPredictions: FunctionalPredictions,
validateJobId: validateJobId,
svgToMiniDataURI: svgToMiniDataURI,
fetchData: fetchData,
dataAsType: dataAsType,
getJdispatcherJsonURL: getJdispatcherJsonURL,
validateSubmittedJobIdInput: validateSubmittedJobIdInput,
validateSubmittedDbfetchInput: validateSubmittedDbfetchInput,
getIPRMCDataModelFlatFromXML: getIPRMCDataModelFlatFromXML,
ColorSchemeEnum: ColorSchemeEnum,
};
}

// web-component support
import "./visual-output-webcomponent.ts";
import "./functional-predictions-webcomponent.ts";
import './visual-output-webcomponent.ts';
import './functional-predictions-webcomponent.ts';

// demo index page with JobId input form (implemented in TypeScript)
import "./index.ts";
import './index.ts';
120 changes: 59 additions & 61 deletions src/color-schemes.ts
Original file line number Diff line number Diff line change
@@ -1,71 +1,69 @@
import {fabric} from "fabric";
import {ColorType} from "./custom-types";
import { Gradient, FabricObject } from 'fabric';
import { ColorType } from './custom-types';

export const defaultGradient: ColorType = {
0.0: [255, 64, 64],
0.25: [255, 255, 64],
0.5: [64, 255, 64],
0.75: [64, 255, 255],
1.0: [64, 64, 255],
keys: [0.0, 0.25, 0.5, 0.75, 1.0],
0.0: [255, 64, 64],
0.25: [255, 255, 64],
0.5: [64, 255, 64],
0.75: [64, 255, 255],
1.0: [64, 64, 255],
keys: [0.0, 0.25, 0.5, 0.75, 1.0],
};

export function colorDefaultGradient(
canvasObj: fabric.Object,
start: number,
end: number
) {
canvasObj.set("fill", new fabric.Gradient({
type: "linear",
coords: {
x1: start,
y1: 0,
x2: end,
y2: 0
},
colorStops: [
{offset: 0.0, color: `rgb(${defaultGradient[0.0].join(",")})`},
{offset: 0.25, color: `rgb(${defaultGradient[0.25].join(",")})`},
{offset: 0.5, color: `rgb(${defaultGradient[0.5].join(",")})`},
{offset: 0.75, color: `rgb(${defaultGradient[0.75].join(",")})`},
{offset: 1.0, color: `rgb(${defaultGradient[1.0].join(",")})`}
]
}));
export function colorDefaultGradient(canvasObj: FabricObject, start: number, end: number) {
canvasObj.set(
'fill',
new Gradient({
type: 'linear',
coords: {
x1: start,
y1: 0,
x2: end,
y2: 0,
},
colorStops: [
{ offset: 0.0, color: `rgb(${defaultGradient[0.0].join(',')})` },
{ offset: 0.25, color: `rgb(${defaultGradient[0.25].join(',')})` },
{ offset: 0.5, color: `rgb(${defaultGradient[0.5].join(',')})` },
{ offset: 0.75, color: `rgb(${defaultGradient[0.75].join(',')})` },
{ offset: 1.0, color: `rgb(${defaultGradient[1.0].join(',')})` },
],
})
);
}

export const ncbiBlastGradient: ColorType = {
0: [0, 0, 0],
40: [0, 32, 233],
50: [117, 234, 76],
80: [219, 61, 233],
200: [219, 51, 36],
keys: [0, 40, 50, 80, 200],
0: [0, 0, 0],
40: [0, 32, 233],
50: [117, 234, 76],
80: [219, 61, 233],
200: [219, 51, 36],
keys: [0, 40, 50, 80, 200],
};

export function colorNcbiBlastGradient(
canvasObj: fabric.Object,
start: number,
end: number
) {
canvasObj.set("fill", new fabric.Gradient({
type: "linear",
coords: {
x1: start,
y1: 0,
x2: end,
y2: 0
},
colorStops: [
{offset: 0.0, color: `rgb(${ncbiBlastGradient[0].join(",")})`},
{offset: 0.199999, color: `rgb(${ncbiBlastGradient[0].join(",")})`},
{offset: 0.2, color: `rgb(${ncbiBlastGradient[40].join(",")})`},
{offset: 0.399999, color: `rgb(${ncbiBlastGradient[40].join(",")})`},
{offset: 0.4, color: `rgb(${ncbiBlastGradient[50].join(",")})`},
{offset: 0.599999, color: `rgb(${ncbiBlastGradient[50].join(",")})`},
{offset: 0.6, color: `rgb(${ncbiBlastGradient[80].join(",")})`},
{offset: 0.799999, color: `rgb(${ncbiBlastGradient[80].join(",")})`},
{offset: 0.8, color: `rgb(${ncbiBlastGradient[200].join(",")})`},
{offset: 1.0, color: `rgb(${ncbiBlastGradient[200].join(",")})`},
]
}));
export function colorNcbiBlastGradient(canvasObj: FabricObject, start: number, end: number) {
canvasObj.set(
'fill',
new Gradient({
type: 'linear',
coords: {
x1: start,
y1: 0,
x2: end,
y2: 0,
},
colorStops: [
{ offset: 0.0, color: `rgb(${ncbiBlastGradient[0].join(',')})` },
{ offset: 0.199999, color: `rgb(${ncbiBlastGradient[0].join(',')})` },
{ offset: 0.2, color: `rgb(${ncbiBlastGradient[40].join(',')})` },
{ offset: 0.399999, color: `rgb(${ncbiBlastGradient[40].join(',')})` },
{ offset: 0.4, color: `rgb(${ncbiBlastGradient[50].join(',')})` },
{ offset: 0.599999, color: `rgb(${ncbiBlastGradient[50].join(',')})` },
{ offset: 0.6, color: `rgb(${ncbiBlastGradient[80].join(',')})` },
{ offset: 0.799999, color: `rgb(${ncbiBlastGradient[80].join(',')})` },
{ offset: 0.8, color: `rgb(${ncbiBlastGradient[200].join(',')})` },
{ offset: 1.0, color: `rgb(${ncbiBlastGradient[200].join(',')})` },
],
})
);
}
Loading

0 comments on commit d7fc617

Please sign in to comment.