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
39 changes: 39 additions & 0 deletions examples/webgl-example/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
// ┃ This file is part of the Perspective library, distributed under the terms ┃
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

const esbuild = require("esbuild");
const fs = require("fs");
const path = require("path");

async function build() {
await esbuild.build({
entryPoints: ["src/index.js"],
outdir: "dist",
format: "esm",
bundle: true,
target: "es2022",
loader: {
".ttf": "file",
".arrow": "file",
".wasm": "file",
".glsl": "text",
},
assetNames: "[name]",
});

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

build();
24 changes: 24 additions & 0 deletions examples/webgl-example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "webgl-example",
"private": true,
"version": "4.3.0",
"description": "A WebGL chart plugin example built using `@perspective-dev/viewer-webgl`.",
"scripts": {
"build": "node build.js",
"start": "node build.js && http-server dist"
},
"keywords": [],
"license": "Apache-2.0",
"dependencies": {
"@perspective-dev/client": "workspace:",
"@perspective-dev/viewer": "workspace:",
"@perspective-dev/viewer-datagrid": "workspace:",
"@perspective-dev/viewer-d3fc": "workspace:",
"@perspective-dev/viewer-webgl": "workspace:",
"superstore-arrow": "catalog:"
},
"devDependencies": {
"esbuild": "catalog:",
"http-server": "catalog:"
}
}
7 changes: 7 additions & 0 deletions examples/webgl-example/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
perspective-viewer {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
17 changes: 17 additions & 0 deletions examples/webgl-example/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />

<title>Perspective WebGL Plugin Example</title>

<link rel="preload" href="perspective-viewer.wasm" as="fetch" type="application/wasm" crossorigin="anonymous" />
<link rel="preload" href="perspective-server.wasm" as="fetch" type="application/wasm" crossorigin="anonymous" />
<link rel="preload" href="superstore.lz4.arrow" as="fetch" type="arraybuffer" crossorigin="anonymous" />

<script type="module" src="index.js"></script>
<link rel="stylesheet" href="index.css" />
</head>
<body></body>
</html>
Loading
Loading