chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 12:23:53 +08:00
commit bf6f0825b2
1681 changed files with 296950 additions and 0 deletions
+113
View File
@@ -0,0 +1,113 @@
<!doctype html>
<html>
<head>
<script type="module" src="/node_modules/@perspective-dev/viewer/dist/cdn/perspective-viewer.js"></script>
<script type="module" src="/node_modules/@perspective-dev/viewer-datagrid/dist/cdn/perspective-viewer-datagrid.js"></script>
<script type="module" src="/node_modules/@perspective-dev/viewer-charts/dist/cdn/perspective-viewer-charts.js"></script>
<link rel="stylesheet" href="/node_modules/@perspective-dev/viewer/dist/css/pro.css" />
<link rel="stylesheet" href="/node_modules/@fontsource/roboto-mono/400.css" />
<style>
html,
body {
margin: 0;
padding: 0;
height: 100%;
}
perspective-viewer {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
font-family: "Roboto Mono" !important;
--preload-fonts: "Roboto Mono:400";
}
</style>
<script type="module">
import perspective from "/node_modules/@perspective-dev/client/dist/cdn/perspective.js";
// Synthetic dataset for chart benchmarking. The columns are
// chosen to exercise the same chart shapes as the real data
// (group_by / split_by / two-numeric-axes), without depending
// on superstore.csv parsing time.
const ROW_COUNT = 10_000;
const CATEGORIES = ["Furniture", "Office Supplies", "Technology", "Apparel", "Books"];
const REGIONS = ["North", "South", "East", "West", "Central"];
const SUBCATS = ["Phones", "Chairs", "Tables", "Storage", "Binders", "Paper", "Art", "Accessories", "Copiers", "Machines"];
function build_data(n) {
const Category = new Array(n);
const Region = new Array(n);
const SubCategory = new Array(n);
const Sales = new Array(n);
const Profit = new Array(n);
const Quantity = new Array(n);
const Discount = new Array(n);
const Open = new Array(n);
const High = new Array(n);
const Low = new Array(n);
const Close = new Array(n);
// Deterministic pseudo-random so iterations are comparable.
let seed = 0x9e3779b9;
const rand = () => {
seed |= 0;
seed = (seed + 0x6d2b79f5) | 0;
let t = Math.imul(seed ^ (seed >>> 15), 1 | seed);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
for (let i = 0; i < n; i++) {
Category[i] = CATEGORIES[i % CATEGORIES.length];
Region[i] = REGIONS[(i * 7) % REGIONS.length];
SubCategory[i] = SUBCATS[(i * 13) % SUBCATS.length];
const base = 100 + rand() * 900;
Sales[i] = base;
Profit[i] = (rand() - 0.4) * base * 0.3;
Quantity[i] = 1 + Math.floor(rand() * 20);
Discount[i] = Math.round(rand() * 100) / 100;
const o = base;
const c = base + (rand() - 0.5) * base * 0.05;
Open[i] = o;
Close[i] = c;
High[i] = Math.max(o, c) + rand() * base * 0.02;
Low[i] = Math.min(o, c) - rand() * base * 0.02;
}
return {
Category,
Region,
"Sub-Category": SubCategory,
Sales,
Profit,
Quantity,
Discount,
Open,
High,
Low,
Close,
};
}
await customElements.whenDefined("perspective-viewer");
const viewer = document.querySelector("perspective-viewer");
const worker = await perspective.worker();
const table = await worker.table(build_data(ROW_COUNT), {
name: "charts-bench",
});
await viewer.load(table);
window.__TEST_WORKER__ = worker;
window.__TEST_PERSPECTIVE_READY__ = true;
</script>
</head>
<body>
<perspective-viewer></perspective-viewer>
</body>
</html>
View File
+38
View File
@@ -0,0 +1,38 @@
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<script type="module" src="/node_modules/@perspective-dev/viewer-datagrid/dist/cdn/perspective-viewer-datagrid.js"></script>
<script type="module" src="/node_modules/@perspective-dev/viewer-charts/dist/cdn/perspective-viewer-charts.js"></script>
<link rel="stylesheet" crossorigin="anonymous" href="/node_modules/@perspective-dev/viewer/dist/css/themes.css" />
<style>
perspective-viewer {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>
</head>
<body>
<perspective-viewer></perspective-viewer>
<script type="module">
import "/node_modules/@perspective-dev/viewer/dist/cdn/perspective-viewer.js";
import perspective from "/node_modules/@perspective-dev/client/dist/cdn/perspective.js";
const el = document.getElementsByTagName("perspective-viewer")[0];
el.addEventListener("perspective-config-update", async () => {
const config = await el.save();
delete config["table"];
localStorage.setItem("layout", JSON.stringify(config));
});
const websocket = await perspective.websocket("ws://localhost:8081/subscribe");
const table = await websocket.open_table("benchmarks");
const worker = await perspective.worker();
const table2 = await worker.table(await table.view());
el.load(table2);
el.restore(JSON.parse(localStorage.getItem("layout")));
</script>
</body>
</html>