Skip to content

Commit

Permalink
Merge pull request #919 from finos/remove-perspective-phosphor
Browse files Browse the repository at this point in the history
Remove `@finos/perspective-phosphor` and fix #825 regression.
  • Loading branch information
texodus authored Feb 12, 2020
2 parents e73a74b + a0c67e1 commit de37d85
Show file tree
Hide file tree
Showing 37 changed files with 364 additions and 860 deletions.
2 changes: 1 addition & 1 deletion examples/promo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"license": "Apache-2.0",
"dependencies": {
"@finos/perspective": "^0.4.2",
"@finos/perspective-phosphor": "^0.4.2",
"@finos/perspective-workspace": "^0.4.2",
"@finos/perspective-viewer": "^0.4.2",
"@finos/perspective-viewer-d3fc": "^0.4.2",
"@finos/perspective-viewer-hypergrid": "^0.4.2"
Expand Down
4 changes: 2 additions & 2 deletions examples/promo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/

import perspective from "@finos/perspective";
import {PerspectiveWorkspace, PerspectiveWidget} from "@finos/perspective-phosphor";
import {PerspectiveWorkspace, PerspectiveWidget} from "@finos/perspective-workspace";
import {Widget} from "@phosphor/widgets";
import "@finos/perspective-phosphor/src/theme/material/index.less";
import "@finos/perspective-workspace/src/theme/material/index.less";

import "@finos/perspective-viewer-hypergrid";
import "@finos/perspective-viewer-d3fc";
Expand Down
2 changes: 1 addition & 1 deletion examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "react",
"private": true,
"version": "0.4.2",
"description": "An example app built using `@finos/perspective-phosphor`.",
"description": "An example app built using `@finos/perspective-viewer`.",
"scripts": {
"start": "webpack-dev-server --open",
"webpack": "webpack --colour"
Expand Down
2 changes: 1 addition & 1 deletion examples/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "webpack",
"private": true,
"version": "0.4.2",
"description": "An example app built using `@finos/perspective-phosphor`.",
"description": "An example app built using `@finos/perspective-viewer`.",
"scripts": {
"start": "webpack-dev-server --open",
"webpack": "webpack --colour"
Expand Down
4 changes: 2 additions & 2 deletions examples/workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "workspace",
"private": true,
"version": "0.4.2",
"description": "An example app built using `@finos/perspective-phosphor`.",
"description": "An example app built using `@finos/perspective-workspace`.",
"scripts": {
"start": "webpack-dev-server --open",
"webpack": "webpack --colour"
Expand All @@ -11,7 +11,7 @@
"license": "Apache-2.0",
"dependencies": {
"@finos/perspective": "^0.4.2",
"@finos/perspective-phosphor": "^0.4.2",
"@finos/perspective-workspace": "^0.4.2",
"@finos/perspective-viewer": "^0.4.2",
"@finos/perspective-viewer-d3fc": "^0.4.2",
"@finos/perspective-viewer-hypergrid": "^0.4.2"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
"ts-loader": "^6.2.0",
"typescript": "^3.7.4",
"webpack": "^4.31.0",
"webpack-cli": "^3.3.2"
"webpack-cli": "^3.3.2",
"webpack-fix-style-only-entries": "^0.4.0"
},
"resolutions": {
"**/write-file-atomic": "2.4.1",
Expand Down
17 changes: 13 additions & 4 deletions packages/perspective-jupyterlab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,29 @@
"bench": "npm-run-all bench:build bench:run",
"bench:build": "echo \"No Benchmarks\"",
"bench:run": "echo \"No Benchmarks\"",
"test": "npm-run-all test:run",
"test:run": "jest --silent --color 2>&1",
"build": "webpack --color --config src/config/plugin.config.js",
"clean:screenshots": "rimraf \"screenshots/**/*.@(failed|diff).png\"",
"test:build": "cpx \"test/html/*\" dist/umd && cpx \"test/csv/*\" dist/umd && cpx \"test/css/*\" dist/umd",
"test:run": "jest --rootDir=. --config=../perspective-test/jest.config.js --color --verbose",
"test:webpack": "webpack --color --config src/config/webpack.config.js",
"test": "npm-run-all test:build test:run",
"build": "npm-run-all -p build:*",
"build:jupyterlab": "webpack --color --config src/config/plugin.config.js",
"build:phosphor": "webpack --color --config src/config/webpack.config.js",
"clean": "rimraf dist",
"version": "yarn build"
},
"dependencies": {
"@finos/perspective-phosphor": "^0.4.2",
"@finos/perspective-viewer": "^0.4.2",
"@finos/perspective-viewer-hypergrid": "^0.4.2",
"@finos/perspective-viewer-highcharts": "^0.4.2",
"@finos/perspective-viewer-d3fc": "^0.4.2",
"@jupyter-widgets/base": "^2.0.2",
"@jupyterlab/application": "^1.2.1",
"@phosphor/application": "^1.7.3",
"@phosphor/widgets": "^1.9.3"
},
"devDependencies": {
"@finos/perspective-test": "^0.4.2",
"@finos/perspective-webpack-plugin": "^0.4.1",
"@types/jest": "^23.3.9",
"@types/node": "^11.11.0",
Expand Down
13 changes: 0 additions & 13 deletions packages/perspective-jupyterlab/src/config/plugin.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ module.exports = {
entry: {
index: "./src/ts/index.ts"
},
resolveLoader: {
alias: {
"file-worker-loader": "@finos/perspective-webpack-plugin/src/js/psp-worker-loader.js"
}
},
resolve: {
extensions: [".ts", ".js"]
},
Expand All @@ -38,14 +33,6 @@ module.exports = {
exclude: /node_modules/,
use: [{loader: "css-loader"}]
},
{
test: /\.(wasm)$/,
type: "javascript/auto",
use: {
loader: "arraybuffer-loader",
options: {}
}
},
{
test: /\.ts$/,
exclude: /node_modules/,
Expand Down
48 changes: 48 additions & 0 deletions packages/perspective-jupyterlab/src/config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/******************************************************************************
*
* Copyright (c) 2018, the Perspective Authors.
*
* This file is part of the Perspective library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/

const path = require("path");
const webpack = require("webpack");

module.exports = {
mode: process.env.PSP_NO_MINIFY || process.env.PSP_DEBUG ? "development" : process.env.NODE_ENV || "production",
entry: {
index: "./src/ts/psp_widget.ts"
},
resolve: {
extensions: [".ts", ".js"]
},
performance: {
hints: false,
maxEntrypointSize: 512000,
maxAssetSize: 512000
},
stats: {modules: false, hash: false, version: false, builtAt: false, entrypoints: false},
plugins: [new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /(en|es|fr)$/)],
module: {
rules: [
{
test: /\.css$/,
exclude: /node_modules/,
use: [{loader: "css-loader"}]
},
{
test: /\.ts$/,
exclude: /node_modules/,
loader: "ts-loader"
}
]
},
output: {
filename: "phosphor.js",
libraryTarget: "umd",
library: "PerspectivePhosphor",
path: path.resolve(__dirname, "../../dist/umd")
}
};
2 changes: 1 addition & 1 deletion packages/perspective-jupyterlab/src/ts/arraybuffer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

declare module "@finos/perspective/dist/esm/api/client";
declare module "@finos/perspective/dist/umd/psp.async.wasm";
declare module "!!file-worker-loader?inline=true!*";
declare module "arraybuffer-loader!*";
2 changes: 1 addition & 1 deletion packages/perspective-jupyterlab/src/ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "!!style-loader!css-loader!less-loader!../less/index.less";
import "@finos/perspective-viewer-hypergrid";
import "@finos/perspective-viewer-highcharts";

import {JupyterFrontEndPlugin} from '@jupyterlab/application';
import {JupyterFrontEndPlugin} from "@jupyterlab/application";
import {perspectiveRenderers} from "./renderer";
import {PerspectiveJupyterPlugin} from "./plugin";

Expand Down
1 change: 0 additions & 1 deletion packages/perspective-jupyterlab/src/ts/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ export const PerspectiveJupyterPlugin: IPlugin<Application<Widget>, void> = {
},
autoStart: true
};

Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,17 @@ export class PerspectiveWidget extends Widget {
div.style.setProperty("flex-direction", "row");
node.appendChild(div);

if (!viewer.notifyResize) {
console.warn("Warning: not bound to real element");
} else {
const resize_observer = new MutationObserver(mutations => {
if (mutations.some(x => x.attributeName === "style")) {
viewer.notifyResize.call(viewer);
}
});
resize_observer.observe(node, {attributes: true});
}

return viewer;
}

Expand Down
Loading

0 comments on commit de37d85

Please sign in to comment.