Skip to content

Commit 4255ce4

Browse files
committed
Update to perspective 3.8.0
1 parent 72c6f02 commit 4255ce4

File tree

10 files changed

+67
-77
lines changed

10 files changed

+67
-77
lines changed

build.js

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,50 @@
1-
const {
2-
NodeModulesExternal,
3-
} = require("@finos/perspective-esbuild-plugin/external");
4-
const { build } = require("@finos/perspective-esbuild-plugin/build");
51
const { BuildCss } = require("@prospective.co/procss/target/cjs/procss.js");
62
const fs = require("fs");
73
const path_mod = require("path");
4+
const esbuild = require("esbuild");
5+
6+
const DEFAULT_BUILD = {
7+
target: ["es2022"],
8+
bundle: true,
9+
minify: !process.env.PSP_DEBUG,
10+
sourcemap: true,
11+
metafile: true,
12+
entryNames: "[name]",
13+
chunkNames: "[name]",
14+
assetNames: "[name]",
15+
};
16+
17+
/**
18+
* An `esbuild` plugin to mark `node_modules` dependencies as external.
19+
* @returns
20+
*/
21+
function NodeModulesExternal(whitelist) {
22+
function setup(build) {
23+
build.onResolve({ filter: /^[A-Za-z0-9\@]/ }, (args) => {
24+
return {
25+
path: args.path,
26+
external: true,
27+
namespace: "skip-node-modules",
28+
};
29+
});
30+
}
31+
32+
return {
33+
name: "node_modules_external",
34+
setup,
35+
};
36+
}
37+
38+
/**
39+
* A build convenienve wrapper.
40+
* @param {any} config An `esbuild.build` config.
41+
*/
42+
async function build(config) {
43+
await esbuild.build({
44+
...DEFAULT_BUILD,
45+
...config,
46+
});
47+
}
848

949
const BUILD = [
1050
{

examples/basic.html

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
<!doctype html>
22
<html>
33
<head>
4-
<script
5-
type="module"
6-
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
7-
></script>
8-
<script
9-
type="module"
10-
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
11-
></script>
12-
<script
13-
type="module"
14-
src="../dist/cdn/perspective-viewer-summary.js"
15-
></script>
164
<link
175
rel="stylesheet"
186
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"

examples/headers-modern.html

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
<!doctype html>
22
<html>
33
<head>
4-
<script
5-
type="module"
6-
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
7-
></script>
8-
<script
9-
type="module"
10-
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
11-
></script>
12-
<script
13-
type="module"
14-
src="../dist/cdn/perspective-viewer-summary.js"
15-
></script>
164
<link
175
rel="stylesheet"
186
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"

examples/headers.html

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
<!doctype html>
22
<html>
33
<head>
4-
<script
5-
type="module"
6-
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
7-
></script>
8-
<script
9-
type="module"
10-
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
11-
></script>
12-
<script
13-
type="module"
14-
src="../dist/cdn/perspective-viewer-summary.js"
15-
></script>
164
<link
175
rel="stylesheet"
186
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"

examples/load-viewer-csv.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import "../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js";
2+
import "../dist/cdn/perspective-viewer-summary.js";
13
import * as perspective from "../node_modules/@finos/perspective/dist/cdn/perspective.js";
24

35
async function load() {
46
let resp = await fetch("superstore.csv");
57
let csv = await resp.text();
6-
const worker = perspective.worker();
8+
const worker = await perspective.worker();
79
const table = worker.table(csv);
810
const viewers = document.querySelectorAll("perspective-viewer");
911
viewers.forEach(async (viewer) => {

examples/load-workspace.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import "../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js";
2+
import "../node_modules/@finos/perspective-workspace/dist/cdn/perspective-workspace.js";
3+
import "../dist/cdn/perspective-viewer-summary.js";
14
import * as perspective from "../node_modules/@finos/perspective/dist/cdn/perspective.js";
25

36
const workspace = document.getElementById("workspace");
@@ -134,8 +137,8 @@ const DEFAULT_LAYOUT = {
134137
async function load() {
135138
let resp = await fetch("superstore.csv");
136139
let csv = await resp.text();
137-
const worker = perspective.shared_worker();
138-
workspace.tables.set("superstore", await worker.table(csv));
140+
const worker = await perspective.worker();
141+
workspace.addTable("superstore", worker.table(csv));
139142
workspace.restore(DEFAULT_LAYOUT);
140143
}
141144

examples/themes.html

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
<!doctype html>
22
<html>
33
<head>
4-
<script
5-
type="module"
6-
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
7-
></script>
8-
<script
9-
type="module"
10-
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
11-
></script>
12-
<script
13-
type="module"
14-
src="../dist/cdn/perspective-viewer-summary.js"
15-
></script>
164
<link
175
rel="stylesheet"
186
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"

examples/workspace.html

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
11
<!doctype html>
22
<html>
33
<head>
4-
<script
5-
type="module"
6-
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
7-
></script>
8-
<script
9-
type="module"
10-
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
11-
></script>
12-
<script
13-
type="module"
14-
src="../node_modules/@finos/perspective-workspace/dist/cdn/perspective-workspace.js"
15-
></script>
16-
<script
17-
type="module"
18-
src="../dist/cdn/perspective-viewer-summary.js"
19-
></script>
204
<link
215
rel="stylesheet"
22-
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"
6+
href="../node_modules/@finos/perspective-viewer/dist/css/pro-dark.css"
237
/>
248
<link
259
rel="stylesheet"

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,16 @@
3131
"access": "public"
3232
},
3333
"dependencies": {
34-
"@finos/perspective": "^2.2.0",
35-
"@finos/perspective-viewer": "^2.1.2",
3634
"dayjs": "^1.11.8"
3735
},
36+
"peerDependencies": {
37+
"@finos/perspective": "^3.8.0",
38+
"@finos/perspective-viewer": "^3.8.0"
39+
},
3840
"devDependencies": {
39-
"@finos/perspective-esbuild-plugin": "^3.2.1",
40-
"@finos/perspective-workspace": "^2.1.2",
41+
"@finos/perspective": "^3.8.0",
42+
"@finos/perspective-viewer": "^3.8.0",
43+
"@finos/perspective-workspace": "^3.8.0",
4144
"@playwright/test": "^1.36.2",
4245
"@prospective.co/procss": "^0.1.13",
4346
"esbuild": "^0.25.0",

src/js/plugin.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ export class PerspectiveViewerSummaryPluginElement extends HTMLElement {
112112

113113
async render(view) {
114114
// pull config
115-
const config = await view.get_config();
115+
116+
// TODO(texodus): This is a bug in Perspective 3.x, fixed
117+
// [here](https://github.com/finos/perspective/pull/3053). This can be
118+
// be changed back by updating the bounds to 3.8.1
119+
120+
// const config = await view.get_config();
121+
const config = await this.parentElement.save();
116122

117123
this._config = {
118124
...this._config,

0 commit comments

Comments
 (0)