Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions build.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,50 @@
const {
NodeModulesExternal,
} = require("@finos/perspective-esbuild-plugin/external");
const { build } = require("@finos/perspective-esbuild-plugin/build");
const { BuildCss } = require("@prospective.co/procss/target/cjs/procss.js");
const fs = require("fs");
const path_mod = require("path");
const esbuild = require("esbuild");

const DEFAULT_BUILD = {
target: ["es2022"],
bundle: true,
minify: !process.env.PSP_DEBUG,
sourcemap: true,
metafile: true,
entryNames: "[name]",
chunkNames: "[name]",
assetNames: "[name]",
};

/**
* An `esbuild` plugin to mark `node_modules` dependencies as external.
* @returns
*/
function NodeModulesExternal(whitelist) {
function setup(build) {
build.onResolve({ filter: /^[A-Za-z0-9\@]/ }, (args) => {
return {
path: args.path,
external: true,
namespace: "skip-node-modules",
};
});
}

return {
name: "node_modules_external",
setup,
};
}

/**
* A build convenienve wrapper.
* @param {any} config An `esbuild.build` config.
*/
async function build(config) {
await esbuild.build({
...DEFAULT_BUILD,
...config,
});
}

const BUILD = [
{
Expand Down
12 changes: 0 additions & 12 deletions examples/basic.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
<!doctype html>
<html>
<head>
<script
type="module"
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
></script>
<script
type="module"
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
></script>
<script
type="module"
src="../dist/cdn/perspective-viewer-summary.js"
></script>
<link
rel="stylesheet"
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"
Expand Down
12 changes: 0 additions & 12 deletions examples/headers-modern.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
<!doctype html>
<html>
<head>
<script
type="module"
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
></script>
<script
type="module"
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
></script>
<script
type="module"
src="../dist/cdn/perspective-viewer-summary.js"
></script>
<link
rel="stylesheet"
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"
Expand Down
12 changes: 0 additions & 12 deletions examples/headers.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
<!doctype html>
<html>
<head>
<script
type="module"
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
></script>
<script
type="module"
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
></script>
<script
type="module"
src="../dist/cdn/perspective-viewer-summary.js"
></script>
<link
rel="stylesheet"
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"
Expand Down
4 changes: 3 additions & 1 deletion examples/load-viewer-csv.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import "../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js";
import "../dist/cdn/perspective-viewer-summary.js";
import * as perspective from "../node_modules/@finos/perspective/dist/cdn/perspective.js";

async function load() {
let resp = await fetch("superstore.csv");
let csv = await resp.text();
const worker = perspective.worker();
const worker = await perspective.worker();
const table = worker.table(csv);
const viewers = document.querySelectorAll("perspective-viewer");
viewers.forEach(async (viewer) => {
Expand Down
7 changes: 5 additions & 2 deletions examples/load-workspace.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import "../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js";
import "../node_modules/@finos/perspective-workspace/dist/cdn/perspective-workspace.js";
import "../dist/cdn/perspective-viewer-summary.js";
import * as perspective from "../node_modules/@finos/perspective/dist/cdn/perspective.js";

const workspace = document.getElementById("workspace");
Expand Down Expand Up @@ -134,8 +137,8 @@ const DEFAULT_LAYOUT = {
async function load() {
let resp = await fetch("superstore.csv");
let csv = await resp.text();
const worker = perspective.shared_worker();
workspace.tables.set("superstore", await worker.table(csv));
const worker = await perspective.worker();
workspace.addTable("superstore", worker.table(csv));
workspace.restore(DEFAULT_LAYOUT);
}

Expand Down
12 changes: 0 additions & 12 deletions examples/themes.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
<!doctype html>
<html>
<head>
<script
type="module"
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
></script>
<script
type="module"
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
></script>
<script
type="module"
src="../dist/cdn/perspective-viewer-summary.js"
></script>
<link
rel="stylesheet"
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"
Expand Down
18 changes: 1 addition & 17 deletions examples/workspace.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
<!doctype html>
<html>
<head>
<script
type="module"
src="../node_modules/@finos/perspective/dist/cdn/perspective.js"
></script>
<script
type="module"
src="../node_modules/@finos/perspective-viewer/dist/cdn/perspective-viewer.js"
></script>
<script
type="module"
src="../node_modules/@finos/perspective-workspace/dist/cdn/perspective-workspace.js"
></script>
<script
type="module"
src="../dist/cdn/perspective-viewer-summary.js"
></script>
<link
rel="stylesheet"
href="../node_modules/@finos/perspective-viewer/dist/css/themes.css"
href="../node_modules/@finos/perspective-viewer/dist/css/pro-dark.css"
/>
<link
rel="stylesheet"
Expand Down
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@
"access": "public"
},
"dependencies": {
"@finos/perspective": "^2.2.0",
"@finos/perspective-viewer": "^2.1.2",
"dayjs": "^1.11.8"
},
"peerDependencies": {
"@finos/perspective": "^3.8.0",
"@finos/perspective-viewer": "^3.8.0"
},
"devDependencies": {
"@finos/perspective-esbuild-plugin": "^3.2.1",
"@finos/perspective-workspace": "^2.1.2",
"@finos/perspective": "^3.8.0",
"@finos/perspective-viewer": "^3.8.0",
"@finos/perspective-workspace": "^3.8.0",
"@playwright/test": "^1.36.2",
"@prospective.co/procss": "^0.1.13",
"esbuild": "^0.25.0",
Expand Down
8 changes: 7 additions & 1 deletion src/js/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ export class PerspectiveViewerSummaryPluginElement extends HTMLElement {

async render(view) {
// pull config
const config = await view.get_config();

// TODO(texodus): This is a bug in Perspective 3.x, fixed
// [here](https://github.com/finos/perspective/pull/3053). This can be
// be changed back by updating the bounds to 3.8.1

// const config = await view.get_config();
const config = await this.parentElement.save();

this._config = {
...this._config,
Expand Down