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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .pnpmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ignore-scripts=true
23 changes: 12 additions & 11 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,27 @@
"dependencies": {
"@docusaurus/core": "^3.7.0",
"@docusaurus/preset-classic": "^3.7.0",
"@finos/perspective": "workspace:^",
"@finos/perspective-viewer": "workspace:^",
"@finos/perspective-viewer-d3fc": "workspace:^",
"@finos/perspective-viewer-datagrid": "workspace:^",
"@finos/perspective-viewer-d3fc": "workspace:",
"@finos/perspective-viewer-datagrid": "workspace:",
"@finos/perspective-viewer": "workspace:",
"@finos/perspective": "workspace:",
"@mdx-js/react": "^3.0.0",
"blocks": "workspace:^",
"blocks": "workspace:",
"clsx": "^2.0.0",
"mkdirp": "3",
"prism-react-renderer": "^1.3.3",
"puppeteer": "^23",
"react": "^18",
"react-dom": "^18",
"superstore-arrow": "3.0.0"
"puppeteer": "catalog:",
"react-dom": "catalog:",
"react": "catalog:",
"superstore-arrow": "catalog:"
},
"devDependencies": {
"arraybuffer-loader": "^1.0.2",
"@docusaurus/module-type-aliases": "^3.7.0",
"@docusaurus/tsconfig": "^3.7.0",
"@docusaurus/types": "^3.7.0",
"typescript": "~5.2.2"
"@zip.js/zip.js": "catalog:",
"arraybuffer-loader": "catalog:",
"typescript": "catalog:"
},
"peerDependencies": {
"@docusaurus/theme-common": "^3.7.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/blocks/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bloc.ks

Examples designed to be hosted on GitHub Pages. See the individual projects in
the `src/` directory for more info.
Examples designed to be hosted on [GitHub Pages](https://perspectiv.finos.org).
See the individual projects in the `src/` directory for more info.
2 changes: 1 addition & 1 deletion examples/blocks/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const LOCAL_EXAMPLES = [
exports.LOCAL_EXAMPLES = LOCAL_EXAMPLES;

exports.get_examples = function get_examples(
root = "https://perspective.finos.org/"
root = "https://perspective.finos.org/",
) {
const standalone = [
// {
Expand Down
19 changes: 10 additions & 9 deletions examples/blocks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@
"version": "3.8.0",
"description": "A collection of simple client-side Perspective examples for `http://bl.ocks.org`.",
"scripts": {
"start": "mkdirp dist && node --experimental-wasm-memory64 --experimental-modules server.mjs",
"start": "mkdir -p dist && node --experimental-wasm-memory64 --experimental-modules server.mjs",
"repl": "node --experimental-repl-await"
},
"main": "index.mjs",
"keywords": [],
"license": "Apache-2.0",
"dependencies": {
"@finos/perspective": "workspace:^",
"@finos/perspective-viewer": "workspace:^",
"@finos/perspective-viewer-d3fc": "workspace:^",
"@finos/perspective-viewer-datagrid": "workspace:^",
"@finos/perspective-viewer-openlayers": "workspace:^",
"@finos/perspective-workspace": "workspace:^",
"superstore-arrow": "3.0.0"
"@finos/perspective": "workspace:",
"@finos/perspective-viewer": "workspace:",
"@finos/perspective-viewer-d3fc": "workspace:",
"@finos/perspective-viewer-datagrid": "workspace:",
"@finos/perspective-viewer-openlayers": "workspace:",
"@finos/perspective-workspace": "workspace:",
"superstore-arrow": "catalog:"
},
"devDependencies": {
"esbuild": "^0.25.5"
"@zip.js/zip.js": "catalog:",
"esbuild": "catalog:"
}
}
4 changes: 2 additions & 2 deletions examples/blocks/src/fractal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function get_gui_params() {
acc[x] = window[x].valueAsNumber;
return acc;
},
{}
{},
);
}

Expand Down Expand Up @@ -152,6 +152,6 @@ window.iterations.addEventListener("input", set_runnable);

run.addEventListener(
"click",
make_run_click_callback(await perspective.worker(), {})
make_run_click_callback(await perspective.worker(), {}),
);
run.dispatchEvent(new Event("click"));
8 changes: 4 additions & 4 deletions examples/blocks/src/nypd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ async function fetch_progress(url) {
}

DARK_THEME = await fetch(
"/node_modules/@finos/perspective-workspace/dist/css/pro-dark.css"
"/node_modules/@finos/perspective-workspace/dist/css/pro-dark.css",
).then((x) => x.text());

LIGHT_THEME = await fetch(
"/node_modules/@finos/perspective-workspace/dist/css/pro.css"
"/node_modules/@finos/perspective-workspace/dist/css/pro.css",
).then((x) => x.text());

document.body.innerHTML = `
Expand Down Expand Up @@ -94,12 +94,12 @@ window.workspace.addEventListener(
"workspace-new-view",
({ detail: { widget } }) => {
widget.viewer.setAttribute("theme", theme_style_node.dataset.theme);
}
},
);

window.workspace.addTable(
"ccrb",
(async () => worker.table(await fetch_progress(DATA_URL)))()
(async () => worker.table(await fetch_progress(DATA_URL)))(),
// worker.table(await fetch_progress(DATA_URL))
);

Expand Down
4 changes: 3 additions & 1 deletion examples/esbuild-example/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# `esbuild` Example

Simple `esbuild` example using `perspective-viewer` and plugins.
Simple [`esbuild`](https://esbuild.github.io/) example, demonstrating how to use
this bunlder to package `perspective`, `perspective-viewer` and plugins, as well
as initialize the WebAssembly instances.
2 changes: 1 addition & 1 deletion examples/esbuild-example/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function build() {

fs.writeFileSync(
path.join(__dirname, "dist/index.html"),
fs.readFileSync(path.join(__dirname, "src/index.html")).toString()
fs.readFileSync(path.join(__dirname, "src/index.html")).toString(),
);
}

Expand Down
14 changes: 7 additions & 7 deletions examples/esbuild-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"keywords": [],
"license": "Apache-2.0",
"dependencies": {
"@finos/perspective": "workspace:^",
"@finos/perspective-viewer": "workspace:^",
"@finos/perspective-viewer-d3fc": "workspace:^",
"@finos/perspective-viewer-datagrid": "workspace:^",
"superstore-arrow": "^3.0.0"
"@finos/perspective": "workspace:",
"@finos/perspective-viewer": "workspace:",
"@finos/perspective-viewer-d3fc": "workspace:",
"@finos/perspective-viewer-datagrid": "workspace:",
"superstore-arrow": "catalog:"
},
"devDependencies": {
"esbuild": "^0.25.5",
"http-server": "^14.1.1"
"esbuild": "catalog:",
"http-server": "catalog:"
}
}
2 changes: 1 addition & 1 deletion examples/esbuild-remote/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async function build() {

fs.writeFileSync(
path.join(__dirname, "dist/index.html"),
fs.readFileSync(path.join(__dirname, "client/index.html")).toString()
fs.readFileSync(path.join(__dirname, "client/index.html")).toString(),
);
}

Expand Down
13 changes: 6 additions & 7 deletions examples/esbuild-remote/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
"keywords": [],
"license": "Apache-2.0",
"dependencies": {
"@finos/perspective": "workspace:^",
"@finos/perspective-viewer": "workspace:^",
"@finos/perspective-viewer-d3fc": "workspace:^",
"@finos/perspective-viewer-datagrid": "workspace:^",
"express": "4.18.2",
"express-ws": "^5.0.2"
"@finos/perspective": "workspace:",
"@finos/perspective-viewer": "workspace:",
"@finos/perspective-viewer-d3fc": "workspace:",
"@finos/perspective-viewer-datagrid": "workspace:",
"ws": "catalog:"
},
"devDependencies": {
"esbuild": "^0.25.5"
"esbuild": "catalog:"
}
}
90 changes: 74 additions & 16 deletions examples/esbuild-remote/server/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,97 @@
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

import psp, { cwd_static_file_handler, make_session } from "@finos/perspective";
import express from "express";
import expressWs from "express-ws";
import { make_session } from "@finos/perspective";
import * as securities from "./securities.mjs";
import * as path from "node:path";
import { promises as fs } from "node:fs";
import http from "node:http";
import { WebSocketServer as HttpWebSocketServer } from "ws";

// Don't need this table since it won't be read from node itself, just need
// to create it so the WebSocket clients can find it.
const _TABLE = await securities.getTable();

const CONTENT_TYPES = {
".js": "text/javascript",
".mjs": "text/javascript",
".css": "text/css; charset=utf-8",
".json": "application/json",
".arrow": "arraybuffer",
".feather": "arraybuffer",
".wasm": "application/wasm",
};

// node buffer -> JS buffer
function buffer_to_arraybuffer(buffer) {
return new Int8Array(
buffer.buffer.slice(
buffer.byteOffset,
buffer.byteOffset + buffer.length
)
buffer.byteOffset + buffer.length,
),
);
}

// Don't need this table since it won't be read from node itself, just need
// to create it so the WebSocket clients can find it.
const _table = await securities.getTable();
const app = new HttpWebSocketServer({
noServer: true,
perMessageDeflate: true,
});

const app = expressWs(express()).app;
app.ws("/subscribe", async (ws) => {
app.on("connection", async (ws) => {
console.log("Connecting websocket ...");
const session = await make_session(async (proto) => {
await ws.send(buffer_to_arraybuffer(proto));
ws.send(buffer_to_arraybuffer(proto));
});

ws.on("message", (proto) => {
const x = session.handle_request(buffer_to_arraybuffer(proto));
return x;
session.handle_request(buffer_to_arraybuffer(proto));
});

ws.on("close", () => {
session.close();
});
});

app.use("/", (x, y) => cwd_static_file_handler(x, y, ["dist/"]));
const web_server = http.createServer(
async function static_files(request, response) {
let url =
request.url
?.split(/[\?\#]/)[0]
.replace(/@[\^~]?\d+.[\d\*]*.[\d\*]*/, "") || "/";

if (url === "/") {
url = "/index.html";
}

const server = app.listen(8080, () =>
console.log(`Listening on port ${server.address().port}`)
const extname = path.extname(url);
const contentType = CONTENT_TYPES[extname] || "text/html";
try {
const content = await fs.readFile(`dist/${url}`);
if (typeof content !== "undefined") {
response.writeHead(200, { "Content-Type": contentType });
response.end(content, "utf-8");
console.error(`200 ${url}`);
return;
}

console.error(`404 ${url}`);
response.writeHead(404);
response.end("", "utf-8");
} catch (error) {
console.error(`500 ${url} ${error}`);
response.writeHead(500);
response.end("", "utf-8");
}
},
);

web_server.on("upgrade", (request, socket, head) => {
console.log("200 Websocket upgrade");
app.handleUpgrade(request, socket, head, (sock) =>
app.emit("connection", sock, request),
);
});

web_server.listen(8081, () => {
console.log(`Listening on ${web_server.address().port}`);
});
15 changes: 7 additions & 8 deletions examples/python-tornado-streaming/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
"keywords": [],
"license": "Apache-2.0",
"dependencies": {
"@finos/perspective": "workspace:^",
"@finos/perspective-viewer": "workspace:^",
"@finos/perspective-viewer-d3fc": "workspace:^",
"@finos/perspective-viewer-datagrid": "workspace:^",
"@finos/perspective-workspace": "workspace:^",
"superstore-arrow": "^3.0.0"
"@finos/perspective": "workspace:",
"@finos/perspective-viewer": "workspace:",
"@finos/perspective-viewer-d3fc": "workspace:",
"@finos/perspective-viewer-datagrid": "workspace:",
"@finos/perspective-workspace": "workspace:",
"superstore-arrow": "^3.2.0"
},
"devDependencies": {
"npm-run-all": "^4.1.3",
"rimraf": "^6"
"npm-run-all": "^4.1.3"
}
}
15 changes: 7 additions & 8 deletions examples/python-tornado/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
"keywords": [],
"license": "Apache-2.0",
"dependencies": {
"@finos/perspective": "workspace:^",
"@finos/perspective-viewer": "workspace:^",
"@finos/perspective-viewer-d3fc": "workspace:^",
"@finos/perspective-viewer-datagrid": "workspace:^",
"@finos/perspective-workspace": "workspace:^",
"superstore-arrow": "^3.0.0"
"@finos/perspective": "workspace:",
"@finos/perspective-viewer": "workspace:",
"@finos/perspective-viewer-d3fc": "workspace:",
"@finos/perspective-viewer-datagrid": "workspace:",
"@finos/perspective-workspace": "workspace:",
"superstore-arrow": "^3.2.0"
},
"devDependencies": {
"npm-run-all": "^4.1.3",
"rimraf": "^6"
"npm-run-all": "^4.1.3"
}
}
2 changes: 1 addition & 1 deletion examples/react-example/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ await esbuild.build({

fs.writeFileSync(
path.join(__dirname, "dist/index.html"),
fs.readFileSync(path.join(__dirname, "src/index.html")).toString()
fs.readFileSync(path.join(__dirname, "src/index.html")).toString(),
);
Loading
Loading