Skip to content

Commit

Permalink
feat: Upgrade map-deck to v3
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Nov 13, 2024
1 parent 962c56a commit 22f7c15
Show file tree
Hide file tree
Showing 15 changed files with 3,129 additions and 7,544 deletions.
10,234 changes: 2,850 additions & 7,384 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"packages/composite",
"packages/dataflow",
"packages/ddl-shim",
"xpackages/deck-shim",
"packages/deck-shim",
"packages/dgrid",
"packages/dgrid-shim",
"packages/dgrid2",
Expand All @@ -30,7 +30,7 @@
"packages/leaflet-shim",
"xpackages/loader",
"packages/map",
"xpackages/map-deck",
"packages/map-deck",
"packages/markdown-it-plugins",
"xpackages/marshaller",
"packages/observable-shim",
Expand Down
4 changes: 3 additions & 1 deletion packages/deck-shim/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
},
"devDependencies": {
"@hpcc-js/bundle": "^2.12.0",
"css-loader": "7.1.2",
"style-loader": "4.0.0",
"tslib": "2.7.0"
},
"repository": {
Expand All @@ -53,4 +55,4 @@
"url": "https://github.com/hpcc-systems/Visualization/issues"
},
"homepage": "https://github.com/hpcc-systems/Visualization"
}
}
41 changes: 35 additions & 6 deletions packages/map-deck/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,47 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "test-browser",
"type": "msedge",
"request": "launch",
"url": "http://localhost:8888",
"webRoot": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
},
{
"name": "test-node",
"type": "node",
"request": "launch",
"runtimeArgs": [
"run-script",
"test-node"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
],
},
{
"name": "index.html",
"type": "chrome",
"request": "launch",
"url": "file:///${workspaceRoot}/index.html",
"type": "msedge",
"url": "file:///${workspaceFolder}/index.html",
"runtimeArgs": [
"--disable-web-security"
],
"webRoot": "${workspaceRoot}"
"webRoot": "${workspaceFolder}",
"outFiles": [
"${workspaceFolder}/**/*.js",
"!**/node_modules/**"
]
}
]
}
25 changes: 6 additions & 19 deletions packages/map-deck/.vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"version": "2.0.0",
"tasks": [
{
"label": "es6 watch",
"label": "gen-types-watch",
"type": "npm",
"script": "compile-es6-watch",
"script": "gen-types-watch",
"problemMatcher": [
"$tsc-watch"
],
Expand All @@ -13,18 +13,7 @@
}
},
{
"label": "umd watch",
"type": "npm",
"script": "compile-umd-watch",
"problemMatcher": [
"$tsc-watch"
],
"presentation": {
"group": "group-build"
}
},
{
"label": "bundle watch",
"label": "bundle-watch",
"type": "npm",
"script": "bundle-watch",
"problemMatcher": [],
Expand All @@ -35,15 +24,13 @@
{
"label": "build",
"dependsOn": [
"es6 watch",
"umd watch",
"bundle watch"
"gen-types-watch",
"bundle-watch",
],
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": []
}
}
]
}
29 changes: 29 additions & 0 deletions packages/map-deck/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { browserTpl } from "@hpcc-js/esbuild-plugins";
import pkg from "./package.json" with { type: "json" };

// config ---
await Promise.all([
browserTpl("src/index.ts", "dist/index", {
keepNames: true,
alias: {
"d3-array": "@hpcc-js/common",
"d3-brush": "@hpcc-js/common",
"d3-collection": "@hpcc-js/common",
"d3-color": "@hpcc-js/common",
"d3-dispatch": "@hpcc-js/common",
"d3-drag": "@hpcc-js/common",
"d3-dsv": "@hpcc-js/common",
"d3-ease": "@hpcc-js/common",
"d3-format": "@hpcc-js/common",
"d3-interpolate": "@hpcc-js/common",
"d3-scale": "@hpcc-js/common",
"d3-selection": "@hpcc-js/common",
"d3-time-format": "@hpcc-js/common",
"d3-transition": "@hpcc-js/common",
"d3-zoom": "@hpcc-js/common"
},
external: [
...Object.keys(pkg.dependencies),
]
})
]);
108 changes: 68 additions & 40 deletions packages/map-deck/index.html
Original file line number Diff line number Diff line change
@@ -1,57 +1,85 @@
<!doctype html>
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>@hpcc-js/chart</title>

<script>
if (window.location.protocol === "file:" || window.location.origin.indexOf("http://localhost") === 0) {
document.write('<link rel="stylesheet" href="../../packages/common/font-awesome/css/font-awesome.min.css">');
document.write('<script type="text/javascript" src="../../packages/loader/dist/index.js"><' + '/script>');
} else {
document.write('<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@hpcc-js/common/font-awesome/css/font-awesome.min.css">');
document.write('<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@hpcc-js/loader"><' + '/script>');
<title>Home</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
}
</script>

<script>
var hpccLoader = window["@hpcc-js/loader"];
</script>
h1 {
text-align: center;
margin-top: 50px;
}

<style>
#placeholder,
.placeholder {
position: absolute;
left: 8px;
top: 8px;
right: 8px;
bottom: 8px;
#placeholder {
width: 100%;
height: 500px;
background-color: #fff;
margin-top: 20px;
}
</style>
<script type="importmap">
{
"imports": {
"@observablehq/runtime": "https://cdn.jsdelivr.net/npm/@observablehq/[email protected]/dist/runtime.js",

"@hpcc-js/util": "../util/dist/index.js",
"@hpcc-js/common": "../common/dist/index.js",
"@hpcc-js/api": "../api/dist/index.js",
"@hpcc-js/chart": "../chart/dist/index.js",
"@hpcc-js/codemirror": "../codemirror/dist/index.js",
"@hpcc-js/comms": "../comms/dist/index.js",
"@hpcc-js/dgrid": "../dgrid/dist/index.js",
"@hpcc-js/dgrid2": "../dgrid2/dist/index.js",
"@hpcc-js/react": "../react/dist/index.js",
"@hpcc-js/html": "../html/dist/index.js",
"@hpcc-js/graph": "../graph/dist/index.js",
"@hpcc-js/layout": "../layout/dist/index.js",
"@hpcc-js/other": "../other/dist/index.js",
"@hpcc-js/map": "../map/dist/index.js",
"@hpcc-js/map-deck": "../map-deck/dist/index.js",
"@hpcc-js/observablehq-compiler": "../observablehq-compiler/dist/index.js"
}
}
</script>
<link rel="stylesheet" href="./dist/index.css">
</head>

<body onresize="doResize()">
<div id="placeholder">
</div>
<script>
var app;
hpccLoader.amd().then(function (require) {
require(["lib-umd/test"], function (testMod) {
<h1>ESM Quick Test</h1>
<div id="placeholder"></div>
<script type="module">
import { Polygons } from "@hpcc-js/map-deck";

app = new testMod.Test()
.target("placeholder")
.render();

});
});
window.__widget = new Polygons()
.target("placeholder")
.columns(["h3index", "polys", "weight"])
.data([
["822647fffffffff", [[-89.7485370040972, 36.65876042006413], [-87.99076359407903, 37.38207405857687], [-87.95138172303123, 39.0147883106185], [-89.72621630626134, 39.94722184718561], [-91.54335025644869, 39.22565620613393], [-91.52528283315517, 37.57043047609912]], 46],
["82489ffffffffff", [[-98.24787904177958, 28.91983357142504], [-96.56734672388515, 29.86373079369924], [-96.66289038040519, 31.61953062690852], [-98.49387337240059, 32.44435492016832], [-100.2117838202375, 31.48993750697799], [-100.061214992845, 29.72188188001257]], 14],
["82450ffffffffff", [[-88.35361313416331, 18.71869881492448], [-86.86052253318431, 19.58510743293509], [-86.81165399779584, 21.27218577811605], [-88.29590003003726, 22.12073073961633], [-89.8335894971924, 21.24816786632389], [-89.8417414487811, 19.53349485374346]], 15],
["824447fffffffff", [[-91.44305997299979, 29.03851386192278], [-89.78916802666802, 29.87606801972664], [-89.7794734704032, 31.59073781085478], [-91.4744264324729, 32.49146921600194], [-93.17771064982072, 31.65113143450284], [-93.13595107051557, 29.91330256038463]], 26],
["82265ffffffffff", [[-91.49084714009673, 34.20071647537129], [-89.75917248139794, 34.98489313139716], [-89.7485370040972, 36.65876042006413], [-91.52528283315517, 37.57043047609912], [-93.31108179083483, 36.78541768537119], [-93.26521175979074, 35.09010839353649]], 22],
["8244b7fffffffff", [[-76.8312173516333, 23.34286288063484], [-75.445541089086, 24.01255660121923], [-75.25188715193887, 25.56875428660015], [-76.47218493325147, 26.49429123770877], [-77.90890704647856, 25.83560088252219], [-78.0732653483983, 24.24011047374086]], 1],
["8226cffffffffff", [[-96.66289038040519, 31.61953062690852], [-94.94582051780957, 32.51690625937428], [-95.01750723130108, 34.24608056480459], [-96.86314528739003, 35.09305545301956], [-98.62272599746812, 34.18804644137447], [-98.49387337240059, 32.44435492016832]], 38],
["8248b7fffffffff", [[-97.90563426634658, 23.58979436809323], [-96.29745134025397, 24.55902528467453], [-96.38475070596915, 26.33013314194643], [-98.13038997835126, 27.14553087371657], [-99.77344403948946, 26.16294928512754], [-99.63585556147724, 24.37894428550873]], 14],
["82445ffffffffff", [[-89.7794734704032, 31.59073781085478], [-88.10173760069401, 32.37535444162421], [-88.0658863098819, 34.05983621723471], [-89.75917248139794, 34.98489313139716], [-91.49084714009673, 34.20071647537129], [-91.4744264324729, 32.49146921600194]], 13],
["822677fffffffff", [[-91.4762617917987, 42.44495953871468], [-93.4580322172988, 41.74324949577916], [-93.40741416499294, 40.11435457093053], [-91.54335025644869, 39.22565620613393], [-89.7262163062613, 39.94722184718562], [-89.5783976626672, 41.51855472869031]], 21]
])
.polygonColumn("polys")
.weightColumn("weight")
.render()
;

</script>
<script>
function doResize() {
if (app) {
app
.resize()
.lazyRender();
}
window.__widget?.resize()?.render();
}
</script>
</body>
Expand Down
66 changes: 31 additions & 35 deletions packages/map-deck/package.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,50 @@
{
"name": "@hpcc-js/map-deck",
"version": "2.9.0",
"version": "3.0.0",
"description": "hpcc-js - Deck.gl Maps",
"main": "dist/index.js",
"module": "dist/index.es6",
"unpkg": "dist/index.min.js",
"jsdelivr": "dist/index.min.js",
"types": "types/index.d.ts",
"typesVersions": {
"<3.8": {
"*": [
"types-3.4/index.d.ts"
]
}
"type": "module",
"exports": {
".": {
"types": "./types/index.d.ts",
"default": "./dist/index.js"
},
"./dist/*": "./dist/*"
},
"module": "./dist/index.js",
"browser": "./dist/index.js",
"types": "./types/index.d.ts",
"files": [
"dist/*",
"types/*",
"types-3.4/*",
"TopoJSON/*",
"src/*"
"src/*",
"types/*"
],
"scripts": {
"clean": "rimraf --glob lib* types dist *.tsbuildinfo",
"compile-es6": "tsc --module es6 --outDir ./lib-es6",
"compile-es6-watch": "npm run compile-es6 -- -w",
"compile-umd": "tsc --module umd --outDir ./lib-umd",
"compile-umd-watch": "npm run compile-umd -- -w",
"bundle": "rollup -c",
"bundle-watch": "npm run bundle -- -w",
"minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",
"gen-legacy-types": "downlevel-dts ./types ./types-3.4",
"build": "npm run compile-es6 && npm run bundle",
"watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch",
"clean": "rimraf --glob lib* types dist *.tsbuildinfo .turbo",
"bundle": "node esbuild.js",
"bundle-watch": "npm run bundle -- --development --watch",
"gen-types": "tsc --project tsconfig.json",
"gen-types-watch": "npm run gen-types -- --watch",
"build": "run-p gen-types bundle",
"stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js",
"lint": "eslint ./src",
"lint-fix": "eslint --fix src/**/*.ts",
"docs": "typedoc --options tdoptions.json .",
"update": "npx --yes npm-check-updates -u -t minor"
"test-browser": "vitest run --project browser",
"test": "vitest run",
"coverage": "vitest run --coverage",
"update": "npx --yes npm-check-updates -u -t minor",
"update-major": "npx --yes npm-check-updates -u"
},
"dependencies": {
"@hpcc-js/common": "^2.73.0",
"@hpcc-js/deck-shim": "^2.8.0",
"@hpcc-js/util": "^2.53.0"
"@hpcc-js/common": "^3.0.0",
"@hpcc-js/util": "^3.0.0"
},
"devDependencies": {
"@hpcc-js/bundle": "^2.12.0",
"@hpcc-js/esbuild-plugins": "^1.2.0",
"@hpcc-js/deck-shim": "^2.8.0",
"d3-array": "^1",
"d3-color": "3.1.0",
"d3-transition": "^1",
"tslib": "2.7.0"
"d3-transition": "^1"
},
"repository": {
"type": "git",
Expand All @@ -61,4 +57,4 @@
"url": "https://github.com/hpcc-systems/Visualization/issues"
},
"homepage": "https://github.com/hpcc-systems/Visualization"
}
}
Loading

0 comments on commit 22f7c15

Please sign in to comment.