diff --git a/demos/gallery/samples/samples.json b/demos/gallery/samples/samples.json index 39d68aff9f..b4559fbb98 100644 --- a/demos/gallery/samples/samples.json +++ b/demos/gallery/samples/samples.json @@ -299,6 +299,27 @@ } ] }, + { + "path": "./samples/chart/dataMeta", + "name": "dataMeta", + "type": "folder", + "children": [ + { + "path": "./samples/chart/dataMeta/PieColumn.js", + "name": "PieColumn.js", + "type": "file", + "imports": { + "@hpcc-js/chart": [ + "Column", + "Pie" + ], + "@hpcc-js/layout": [ + "FlexGrid" + ] + } + } + ] + }, { "path": "./samples/chart/Gantt", "name": "Gantt", @@ -681,27 +702,6 @@ "SummaryC" ] } - }, - { - "path": "./samples/chart/dataMeta", - "name": "dataMeta", - "type": "folder", - "children": [ - { - "path": "./samples/chart/dataMeta/PieColumn.js", - "name": "PieColumn.js", - "type": "file", - "imports": { - "@hpcc-js/chart": [ - "Column", - "Pie" - ], - "@hpcc-js/layout": [ - "FlexGrid" - ] - } - } - ] } ] }, @@ -901,22 +901,22 @@ } }, { - "path": "./samples/common/SVGWidget.js", - "name": "SVGWidget.js", + "path": "./samples/common/Shape.js", + "name": "Shape.js", "type": "file", "imports": { "@hpcc-js/common": [ - "SVGWidget" + "Shape" ] } }, { - "path": "./samples/common/Shape.js", - "name": "Shape.js", + "path": "./samples/common/SVGWidget.js", + "name": "SVGWidget.js", "type": "file", "imports": { "@hpcc-js/common": [ - "Shape" + "SVGWidget" ] } }, diff --git a/package-lock.json b/package-lock.json index 283723ab07..683d6d5b2e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,9 @@ "playwright": "1.49.0", "rimraf": "5.0.10", "typescript": "5.6.3", + "vite": "^5.4.11", + "vite-plugin-css-injected-by-js": "^3.5.2", + "vite-plugin-static-copy": "^2.1.0", "vitest": "2.1.5" } }, @@ -238,26 +241,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@dagrejs/dagre": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/@dagrejs/dagre/-/dagre-1.1.4.tgz", - "integrity": "sha512-QUTc54Cg/wvmlEUxB+uvoPVKFazM1H18kVHBQNmK2NbrDR5ihOCR6CXLnDSZzMcSQKJtabPUWridBOlJM3WkDg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@dagrejs/graphlib": "2.2.4" - } - }, - "node_modules/@dagrejs/graphlib": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/@dagrejs/graphlib/-/graphlib-2.2.4.tgz", - "integrity": "sha512-mepCf/e9+SKYy1d02/UkvSy6+6MoyXhVxP8lLDfA7BPE1X1d4dR0sZznmbM8/XVJ1GPM+Svnx7Xj6ZweByWUkw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">17.0.0" - } - }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -6129,6 +6112,13 @@ "@types/d3-selection": "^1" } }, + "node_modules/@types/dagre": { + "version": "0.7.52", + "resolved": "https://registry.npmjs.org/@types/dagre/-/dagre-0.7.52.tgz", + "integrity": "sha512-XKJdy+OClLk3hketHi9Qg6gTfe1F3y+UFnHxKA2rn9Dw+oXa4Gb378Ztz9HlMgZKSxpPmn4BNVh9wgkpvrK1uw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/dojo": { "version": "1.9.48", "resolved": "https://registry.npmjs.org/@types/dojo/-/dojo-1.9.48.tgz", @@ -7244,6 +7234,20 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/apache-arrow": { "version": "17.0.0", "resolved": "https://registry.npmjs.org/apache-arrow/-/apache-arrow-17.0.0.tgz", @@ -7545,6 +7549,19 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -7882,6 +7899,44 @@ "node": ">= 16" } }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/chownr": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", @@ -9042,6 +9097,17 @@ "d3-transition": "^1.3.2" } }, + "node_modules/dagre": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/dagre/-/dagre-0.8.5.tgz", + "integrity": "sha512-/aTqmnRta7x7MCCpExk7HQL2O4owCT2h8NT//9I1OQ9vt29Pa0BzSAkR5lwFUcQ7491yVi/3CXU9jQ5o0Mn2Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graphlib": "^2.1.8", + "lodash": "^4.17.15" + } + }, "node_modules/dargs": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/dargs/-/dargs-7.0.0.tgz", @@ -11497,6 +11563,16 @@ "dev": true, "license": "MIT" }, + "node_modules/graphlib": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/graphlib/-/graphlib-2.1.8.tgz", + "integrity": "sha512-jcLLfkpoVGmH7/InMC/1hIvOPSUh38oJtGhvrOFGzioE1DZ+0YW16RgmOJhHiuWTvGiJQ9Z1Ik43JvkRPRvE+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.15" + } + }, "node_modules/graphql": { "version": "16.9.0", "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz", @@ -12141,6 +12217,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/is-boolean-object": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", @@ -14777,6 +14866,16 @@ "node": "^16.14.0 || >=18.0.0" } }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/npm-bundled": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-3.0.1.tgz", @@ -16492,6 +16591,19 @@ "node": ">= 6" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/rechoir": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", @@ -19414,6 +19526,35 @@ "url": "https://opencollective.com/vitest" } }, + "node_modules/vite-plugin-css-injected-by-js": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/vite-plugin-css-injected-by-js/-/vite-plugin-css-injected-by-js-3.5.2.tgz", + "integrity": "sha512-2MpU/Y+SCZyWUB6ua3HbJCrgnF0KACAsmzOQt1UvRVJCGF6S8xdA3ZUhWcWdM9ivG4I5az8PnQmwwrkC2CAQrQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "vite": ">2.0.0-0" + } + }, + "node_modules/vite-plugin-static-copy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/vite-plugin-static-copy/-/vite-plugin-static-copy-2.1.0.tgz", + "integrity": "sha512-n8lEOIVM00Y/zronm0RG8RdPyFd0SAAFR0sii3NWmgG3PSCyYMsvUNRQTlb3onp1XeMrKIDwCrPGxthKvqX9OQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "chokidar": "^3.5.3", + "fast-glob": "^3.2.11", + "fs-extra": "^11.1.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "vite": "^5.0.0" + } + }, "node_modules/vite/node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -20946,17 +21087,18 @@ "@hpcc-js/util": "^3.2.0" }, "devDependencies": { - "@dagrejs/dagre": "1.1.4", "@hpcc-js/esbuild-plugins": "^1.3.0", "@hpcc-js/wasm-graphviz": "1.6.1", "@types/d3-transition": "1.3.6", + "@types/dagre": "0.7.52", "d3-force": "^1", "d3-geo": "^1", "d3-interpolate-path": "2.3.0", "d3-sankey": "^0", "d3-shape": "^1", "d3-tile": "^1", - "d3-transition": "^1" + "d3-transition": "^1", + "dagre": "0.8.5" } }, "packages/html": { diff --git a/package.json b/package.json index e8fe2e763e..56695f88f3 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,9 @@ "playwright": "1.49.0", "rimraf": "5.0.10", "typescript": "5.6.3", + "vite": "^5.4.11", + "vite-plugin-css-injected-by-js": "^3.5.2", + "vite-plugin-static-copy": "^2.1.0", "vitest": "2.1.5" }, "overrides": { @@ -51,4 +54,4 @@ "author": "HPCC Systems", "license": "Apache-2.0", "homepage": "https://github.com/hpcc-systems/Visualization" -} \ No newline at end of file +} diff --git a/packages/api/.vscode/launch.json b/packages/api/.vscode/launch.json index 3ee32e4122..f41798cc0a 100644 --- a/packages/api/.vscode/launch.json +++ b/packages/api/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "test-browser", "type": "msedge", "request": "launch", - "url": "http://localhost:8888", + "url": "http://localhost:63315", "webRoot": "${workspaceFolder}", "outFiles": [ "${workspaceFolder}/**/*.js", @@ -28,6 +28,34 @@ "${workspaceFolder}/**/*.js", "!**/node_modules/**" ], + }, + { + "name": "index.html", + "request": "launch", + "type": "msedge", + "url": "http://localhost:5173/index.html", + "runtimeArgs": [ + "--disable-web-security" + ], + "webRoot": "${workspaceFolder}", + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" + ] + }, + { + "name": "index-preview.html", + "request": "launch", + "type": "msedge", + "url": "file://${workspaceFolder}/index-preview.html", + "runtimeArgs": [ + "--disable-web-security" + ], + "webRoot": "${workspaceFolder}", + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" + ] } ] } \ No newline at end of file diff --git a/packages/api/package.json b/packages/api/package.json index 298ddf6933..902b8fea79 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -3,15 +3,17 @@ "version": "3.2.0", "description": "hpcc-js - Viz api", "type": "module", + "main": "./dist/index.umd.cjs", + "module": "./dist/index.js", "exports": { ".": { "types": "./types/index.d.ts", - "default": "./dist/index.js" + "import": "./dist/index.js", + "require": "./dist/index.umd.cjs" }, "./dist/*": "./dist/*" }, - "module": "./dist/index.js", - "browser": "./dist/index.js", + "browser": "./dist/index.umd.cjs", "types": "./types/index.d.ts", "files": [ "dist/*", @@ -20,8 +22,8 @@ ], "scripts": { "clean": "rimraf --glob lib* types dist *.tsbuildinfo .turbo", - "bundle": "node esbuild.js", - "bundle-watch": "npm run bundle -- --development --watch", + "bundle": "vite build", + "bundle-watch": "vite", "gen-types": "tsc --project tsconfig.json", "gen-types-watch": "npm run gen-types -- --watch", "build": "run-p gen-types bundle", @@ -31,7 +33,8 @@ "test-browser": "vitest run --project browser", "test": "vitest run", "coverage": "vitest run --coverage", - "update": "npx -y npm-check-updates -u -t minor" + "update": "npx --yes npm-check-updates -u -t minor", + "update-major": "npx --yes npm-check-updates -u" }, "dependencies": { "@hpcc-js/common": "^3.2.0" diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 318ecdd23e..d0b91b3df7 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -10,6 +10,7 @@ "strict": true, "noImplicitAny": false, "strictNullChecks": false, + "isolatedModules": true, "skipLibCheck": true, "allowImportingTsExtensions": true, "lib": [ diff --git a/packages/api/vite.config.ts b/packages/api/vite.config.ts new file mode 100644 index 0000000000..228e4ad83b --- /dev/null +++ b/packages/api/vite.config.ts @@ -0,0 +1,32 @@ +import { defineConfig } from "vite"; +import { resolve } from "path"; +import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js"; +import { hpccBundleNames } from "@hpcc-js/esbuild-plugins"; +import pkg from "./package.json" with { type: "json" }; + +const { alias, external, globals } = hpccBundleNames(pkg); + +export default defineConfig({ + build: { + lib: { + entry: resolve(__dirname, "src/index.ts"), + name: pkg.name, + fileName: "index", + }, + rollupOptions: { + external, + output: { + globals, + }, + }, + }, + resolve: { + alias + }, + esbuild: { + minifyIdentifiers: false + }, + plugins: [ + cssInjectedByJsPlugin() + ], +}); diff --git a/packages/api/vitest.workspace.ts b/packages/api/vitest.workspace.ts index fa7bb0720b..722950dd03 100644 --- a/packages/api/vitest.workspace.ts +++ b/packages/api/vitest.workspace.ts @@ -1,6 +1,6 @@ -import { defineWorkspace } from 'vitest/config'; -import baseWorkspace from '../../vitest.workspace.ts'; +import { defineWorkspace } from "vitest/config"; +import baseWorkspace from "../../vitest.workspace.ts"; export default defineWorkspace([ ...baseWorkspace -]) \ No newline at end of file +]); \ No newline at end of file diff --git a/packages/chart/.vscode/launch.json b/packages/chart/.vscode/launch.json index 7c2436335f..f41798cc0a 100644 --- a/packages/chart/.vscode/launch.json +++ b/packages/chart/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "test-browser", "type": "msedge", "request": "launch", - "url": "http://localhost:8888", + "url": "http://localhost:63315", "webRoot": "${workspaceFolder}", "outFiles": [ "${workspaceFolder}/**/*.js", @@ -33,7 +33,21 @@ "name": "index.html", "request": "launch", "type": "msedge", - "url": "file:///${workspaceFolder}/index.html", + "url": "http://localhost:5173/index.html", + "runtimeArgs": [ + "--disable-web-security" + ], + "webRoot": "${workspaceFolder}", + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" + ] + }, + { + "name": "index-preview.html", + "request": "launch", + "type": "msedge", + "url": "file://${workspaceFolder}/index-preview.html", "runtimeArgs": [ "--disable-web-security" ], diff --git a/packages/chart/index-preview.html b/packages/chart/index-preview.html new file mode 100644 index 0000000000..778584f12d --- /dev/null +++ b/packages/chart/index-preview.html @@ -0,0 +1,97 @@ + + + +
+