@hema-to/regl-scatterplot
Advanced tools
@@ -68,2 +68,3 @@ /** | ||
| declare function createScatterplot(initialProperties?: Partial<import("./types").Properties>): { | ||
| attachSpatialIndex: (buffer: any) => void; | ||
| /** | ||
@@ -89,2 +90,3 @@ * Get whether the browser supports all necessary WebGL features | ||
| hover: (point: number, { showReticleOnce, preventEvent }?: import("./types").ScatterplotMethodOptions["hover"]) => void; | ||
| lassoSelect: (vertices: [number, number][], { merge, remove, isGl }?: import("./types").ScatterplotMethodOptions["lasso"]) => void; | ||
| redraw: () => void; | ||
@@ -91,0 +93,0 @@ refresh: () => void; |
+6
-7
@@ -13,3 +13,3 @@ type Hex = string; | ||
| type KeyAction = 'lasso' | 'rotate' | 'merge'; | ||
| type KeyAction = 'lasso' | 'rotate' | 'merge' | 'intersect' | 'remove'; | ||
| type KeyMap = Record<'alt' | 'cmd' | 'ctrl' | 'meta' | 'shift', KeyAction>; | ||
@@ -21,3 +21,2 @@ | ||
| // biome-ignore lint/style/useNamingConvention: ZWData are three words, z, w, and data | ||
| type ZWDataType = 'continuous' | 'categorical'; | ||
@@ -101,3 +100,2 @@ | ||
| // biome-ignore lint/style/useNamingConvention: HLine stands for HorizontalLine | ||
| interface AnnotationHLine extends BaseAnnotation { | ||
@@ -109,3 +107,2 @@ y: number; | ||
| // biome-ignore lint/style/useNamingConvention: HLine stands for VerticalLine | ||
| interface AnnotationVLine extends BaseAnnotation { | ||
@@ -163,3 +160,2 @@ x: number; | ||
| annotationLineWidth: number; | ||
| // biome-ignore lint/style/useNamingConvention: HVLine stands for HorizontalVerticalLine | ||
| annotationHVLineLimit: number; | ||
@@ -171,2 +167,3 @@ // Nullifiable | ||
| opacityBy: null | DataEncoding; | ||
| pointOrder: null | number[] | Int32Array | Uint32Array; | ||
| xScale: null | Scale; | ||
@@ -180,3 +177,2 @@ yScale: null | Scale; | ||
| // biome-ignore lint/style/useNamingConvention: KDBush is a library name | ||
| export interface CreateKDBushOptions { | ||
@@ -305,3 +301,6 @@ node: number; | ||
| import('pub-sub-es').Event<'pointOver' | 'pointOut', number> & | ||
| import('pub-sub-es').Event<'select' | 'focus', { points: number[] }> & | ||
| import('pub-sub-es').Event< | ||
| 'select' | 'focus', | ||
| { points: number[]; lassoMode: LassoOptions['mode'] } | ||
| > & | ||
| import('pub-sub-es').Event<'points', { points: number[][] }> & | ||
@@ -308,0 +307,0 @@ import('pub-sub-es').Event<'transitionEnd', import('regl').Regl> & |
+27
-27
| { | ||
| "name": "@hema-to/regl-scatterplot", | ||
| "version": "1.14.1+1.0.1", | ||
| "version": "1.16.0-hemato.0", | ||
| "description": "A WebGL-Powered Scalable Interactive Scatter Plot Library", | ||
@@ -42,6 +42,6 @@ "author": "Fritz Lekschas", | ||
| "dependencies": { | ||
| "@flekschas/utils": "^0.32.2", | ||
| "@flekschas/utils": "^0.33.0", | ||
| "dom-2d-camera": "^2.2.6", | ||
| "earcut": "^3.0.1", | ||
| "gl-matrix": "~3.4.3", | ||
| "earcut": "^3.0.2", | ||
| "gl-matrix": "~3.4.4", | ||
| "pub-sub-es": "~3.0.0", | ||
@@ -56,19 +56,19 @@ "regl": "~2.1.1", | ||
| "devDependencies": { | ||
| "@babel/core": "^7.26.0", | ||
| "@babel/plugin-transform-regenerator": "^7.25.9", | ||
| "@babel/core": "^7.28.6", | ||
| "@babel/plugin-transform-regenerator": "^7.28.6", | ||
| "@babel/polyfill": "^7.12.1", | ||
| "@babel/preset-env": "^7.26.0", | ||
| "@biomejs/biome": "^1.9.4", | ||
| "@rollup/plugin-babel": "^6.0.3", | ||
| "@rollup/plugin-commonjs": "^28.0.1", | ||
| "@babel/preset-env": "^7.28.6", | ||
| "@biomejs/biome": "^2.3.11", | ||
| "@rollup/plugin-babel": "^6.1.0", | ||
| "@rollup/plugin-commonjs": "^29.0.0", | ||
| "@rollup/plugin-json": "^6.0.0", | ||
| "@rollup/plugin-node-resolve": "^15.3.0", | ||
| "@rollup/plugin-terser": "^0.4.3", | ||
| "@rollup/plugin-node-resolve": "^16.0.3", | ||
| "@rollup/plugin-terser": "^1.0.0", | ||
| "@tweakpane/core": "^2.0.5", | ||
| "@types/d3-scale": "^4.0.6", | ||
| "@types/node": "^22.9.3", | ||
| "@vitest/browser": "^3.0.9", | ||
| "@vitest/coverage-v8": "^3.0.9", | ||
| "apache-arrow": "^18.0.0", | ||
| "browser-env": "^3.3.0", | ||
| "@types/d3-scale": "^4.0.9", | ||
| "@types/node": "^25.0.8", | ||
| "@vitest/browser": "^4.0.17", | ||
| "@vitest/browser-playwright": "^4.0.17", | ||
| "@vitest/coverage-v8": "^4.0.17", | ||
| "apache-arrow": "^21.1.0", | ||
| "d3-axis": "^3.0.0", | ||
@@ -79,12 +79,12 @@ "d3-random": "^3.0.1", | ||
| "esm": "^3.2.25", | ||
| "gh-pages": "^6.2.0", | ||
| "gh-pages": "^6.3.0", | ||
| "merge": "^2.1.1", | ||
| "playwright": "^1.49.0", | ||
| "rollup": "^4.27.4", | ||
| "playwright": "^1.57.0", | ||
| "rollup": "^4.55.1", | ||
| "rollup-plugin-filesize": "^10.0.0", | ||
| "tweakpane": "^4.0.5", | ||
| "typescript": "~5.7.2", | ||
| "vite": "^6.2.3", | ||
| "typescript": "~5.9.3", | ||
| "vite": "^7.3.1", | ||
| "vite-plugin-virtual-html-template": "^1.1.0", | ||
| "vitest": "^3.0.9" | ||
| "vitest": "^4.0.17" | ||
| }, | ||
@@ -95,10 +95,10 @@ "engines": { | ||
| }, | ||
| "homepage": "https://github.com/flekschas/regl-scatterplot", | ||
| "homepage": "https://github.com/hema-to/regl-scatterplot", | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git://github.com/flekschas/regl-scatterplot.git" | ||
| "url": "git+https://github.com/hema-to/regl-scatterplot.git" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/flekschas/regl-scatterplot/issues" | ||
| "url": "https://github.com/hema-to/regl-scatterplot/issues" | ||
| } | ||
| } |
+1
-0
@@ -115,2 +115,3 @@ import { | ||
| export const DEFAULT_SIZE_BY = null; | ||
| export const DEFAULT_POINT_ORDER = null; | ||
| export const DEFAULT_POINT_CONNECTION_SIZE = 2; | ||
@@ -117,0 +118,0 @@ export const DEFAULT_POINT_CONNECTION_SIZE_ACTIVE = 2; |
@@ -9,3 +9,2 @@ export default () => { | ||
| // biome-ignore lint/correctness/noUndeclaredVariables: KDBush is made available during compilation | ||
| const index = new KDBush(points.length, event.data.nodeSize); | ||
@@ -12,0 +11,0 @@ |
+2
-3
@@ -1,6 +0,4 @@ | ||
| // biome-ignore lint/style/useNamingConvention: KDBush is a library name | ||
| import createKDBushClass from './kdbush-class.js'; | ||
| import workerFn from './kdbush-worker.js'; | ||
| // biome-ignore lint/style/useNamingConvention: KDBush is a library name | ||
| const KDBush = createKDBushClass(); | ||
@@ -13,3 +11,2 @@ const WORKER_THRESHOLD = 1000000; | ||
| const workerStr = | ||
| // biome-ignore lint/style/useTemplate: Prefer one assignment per line | ||
| `const createKDBushClass = ${kdbushStr};` + | ||
@@ -70,2 +67,4 @@ 'KDBush = createKDBushClass();' + | ||
| export const kdbushFrom = (buffer) => KDBush.from(buffer); | ||
| export default createKdbush; |
@@ -12,4 +12,9 @@ import { | ||
| } from '@flekschas/utils'; | ||
| import { | ||
| DEFAULT_LASSO_LONG_PRESS_AFTER_EFFECT_TIME, | ||
| DEFAULT_LASSO_LONG_PRESS_EFFECT_DELAY, | ||
| DEFAULT_LASSO_LONG_PRESS_REVERT_EFFECT_TIME, | ||
| DEFAULT_LASSO_LONG_PRESS_TIME, | ||
| } from '../constants.js'; | ||
| import { | ||
| DEFAULT_BRUSH_SIZE, | ||
@@ -25,9 +30,2 @@ DEFAULT_LASSO_MIN_DELAY, | ||
| import { | ||
| DEFAULT_LASSO_LONG_PRESS_AFTER_EFFECT_TIME, | ||
| DEFAULT_LASSO_LONG_PRESS_EFFECT_DELAY, | ||
| DEFAULT_LASSO_LONG_PRESS_REVERT_EFFECT_TIME, | ||
| DEFAULT_LASSO_LONG_PRESS_TIME, | ||
| } from '../constants.js'; | ||
| import { | ||
| createLongPressInAnimations, | ||
@@ -34,0 +32,0 @@ createLongPressOutAnimations, |
+2
-22
@@ -68,6 +68,4 @@ import { CLEAR_OPTIONS, DEFAULT_GAMMA } from './constants.js'; | ||
| func: { | ||
| // biome-ignore lint/style/useNamingConvention: Regl internal | ||
| srcRGB: 'one', | ||
| srcAlpha: 'one', | ||
| // biome-ignore lint/style/useNamingConvention: Regl internal | ||
| dstRGB: 'one minus src alpha', | ||
@@ -152,22 +150,4 @@ dstAlpha: 'one minus src alpha', | ||
| ) => { | ||
| // We need to limit the width and height by the screen size to prevent | ||
| // a bug in VSCode where the window height is said to be taller than the | ||
| // screen height. The problem with too large dimensions is that at some | ||
| // point WebGL will break down because there's an upper limit on how large | ||
| // any buffer and texture can be. It also harms the performance quite a bit. | ||
| // | ||
| // By restricting the widht/height to the screen size we should have a safe | ||
| // upper limit for the canvas size. | ||
| // | ||
| // @see | ||
| // https://github.com/microsoft/vscode/issues/225808 | ||
| // https://github.com/flekschas/jupyter-scatter/issues/37 | ||
| const width = | ||
| customWidth === undefined | ||
| ? Math.min(window.innerWidth, window.screen.availWidth) | ||
| : customWidth; | ||
| const height = | ||
| customHeight === undefined | ||
| ? Math.min(window.innerHeight, window.screen.availHeight) | ||
| : customHeight; | ||
| const width = customWidth == null ? window.innerWidth : customWidth; | ||
| const height = customHeight == null ? window.innerHeight : customHeight; | ||
| canvas.width = width * window.devicePixelRatio; | ||
@@ -174,0 +154,0 @@ canvas.height = height * window.devicePixelRatio; |
@@ -109,3 +109,2 @@ /* eslint-env worker */ | ||
| */ | ||
| // biome-ignore lint/style/useNamingConvention: DP stands for Douglas Peucker | ||
| const simplifyDPStep = (points, first, last, tolerance, simplified) => { | ||
@@ -218,3 +217,2 @@ let maxDist = tolerance; | ||
| const isOrdered = !Number.isNaN(+points[0][5]); | ||
| // biome-ignore lint/complexity/noForEach: somehow for .. of does not work in a worker | ||
| points.forEach((point) => { | ||
@@ -235,3 +233,2 @@ const segId = point[4]; | ||
| // The filtering ensures that non-existing array entries are removed | ||
| // biome-ignore lint/complexity/noForEach: somehow for .. of does not work in a worker | ||
| Object.entries(groupedPoints).forEach((idPoints) => { | ||
@@ -238,0 +235,0 @@ groupedPoints[idPoints[0]] = idPoints[1].filter((v) => v); |
+6
-7
@@ -13,3 +13,3 @@ type Hex = string; | ||
| type KeyAction = 'lasso' | 'rotate' | 'merge'; | ||
| type KeyAction = 'lasso' | 'rotate' | 'merge' | 'intersect' | 'remove'; | ||
| type KeyMap = Record<'alt' | 'cmd' | 'ctrl' | 'meta' | 'shift', KeyAction>; | ||
@@ -21,3 +21,2 @@ | ||
| // biome-ignore lint/style/useNamingConvention: ZWData are three words, z, w, and data | ||
| type ZWDataType = 'continuous' | 'categorical'; | ||
@@ -101,3 +100,2 @@ | ||
| // biome-ignore lint/style/useNamingConvention: HLine stands for HorizontalLine | ||
| interface AnnotationHLine extends BaseAnnotation { | ||
@@ -109,3 +107,2 @@ y: number; | ||
| // biome-ignore lint/style/useNamingConvention: HLine stands for VerticalLine | ||
| interface AnnotationVLine extends BaseAnnotation { | ||
@@ -163,3 +160,2 @@ x: number; | ||
| annotationLineWidth: number; | ||
| // biome-ignore lint/style/useNamingConvention: HVLine stands for HorizontalVerticalLine | ||
| annotationHVLineLimit: number; | ||
@@ -171,2 +167,3 @@ // Nullifiable | ||
| opacityBy: null | DataEncoding; | ||
| pointOrder: null | number[] | Int32Array | Uint32Array; | ||
| xScale: null | Scale; | ||
@@ -180,3 +177,2 @@ yScale: null | Scale; | ||
| // biome-ignore lint/style/useNamingConvention: KDBush is a library name | ||
| export interface CreateKDBushOptions { | ||
@@ -305,3 +301,6 @@ node: number; | ||
| import('pub-sub-es').Event<'pointOver' | 'pointOut', number> & | ||
| import('pub-sub-es').Event<'select' | 'focus', { points: number[] }> & | ||
| import('pub-sub-es').Event< | ||
| 'select' | 'focus', | ||
| { points: number[]; lassoMode: LassoOptions['mode'] } | ||
| > & | ||
| import('pub-sub-es').Event<'points', { points: number[][] }> & | ||
@@ -308,0 +307,0 @@ import('pub-sub-es').Event<'transitionEnd', import('regl').Regl> & |
+40
-4
@@ -88,3 +88,2 @@ import createOriginalRegl from 'regl'; | ||
| */ | ||
| // biome-ignore lint/style/useNamingConvention: BBox stands for BoundingBox | ||
| export const getBBox = (positions2d) => { | ||
@@ -111,3 +110,2 @@ let xMin = Number.POSITIVE_INFINITY; | ||
| */ | ||
| // biome-ignore lint/style/useNamingConvention: BBox stands for BoundingBox | ||
| export const isValidBBox = ([xMin, yMin, xMax, yMax]) => | ||
@@ -501,3 +499,2 @@ Number.isFinite(xMin) && | ||
| // biome-ignore lint/style/useNamingConvention: LO stands for line and order | ||
| const getLO = | ||
@@ -584,5 +581,44 @@ (Array.isArray(points.lineOrder) || | ||
| export const isPolygon = (annotation) => | ||
| export const isPolygonAnnotation = (annotation) => | ||
| 'vertices' in annotation && annotation.vertices.length > 1; | ||
| /** | ||
| * Check if an array is a valid list of 2D vertices | ||
| * @param {any} arg - The argument to check | ||
| * @returns {boolean} True if argument is an array of [x, y] coordinate pairs | ||
| */ | ||
| export const isVertices = (arg) => { | ||
| if (!Array.isArray(arg) || arg.length < 3) { | ||
| return false; | ||
| } | ||
| for (const vertex of arg) { | ||
| if ( | ||
| !Array.isArray(vertex) || | ||
| vertex.length !== 2 || | ||
| typeof vertex[0] !== 'number' || | ||
| typeof vertex[1] !== 'number' | ||
| ) { | ||
| return false; | ||
| } | ||
| } | ||
| return true; | ||
| }; | ||
| /** | ||
| * Ensure a list of vertices forms a closed polygon | ||
| * @param {Array<[number, number]>} vertices - Array of [x, y] coordinates | ||
| * @returns {Array<[number, number]>} Closed polygon (first vertex repeated at end if needed) | ||
| */ | ||
| export const verticesToPolygon = (vertices) => { | ||
| const polygon = [...vertices]; | ||
| const firstVertex = vertices.at(0); | ||
| const lastVertex = vertices.at(-1); | ||
| if (firstVertex[0] !== lastVertex[0] || firstVertex[1] !== lastVertex[1]) { | ||
| polygon.push(firstVertex); | ||
| } | ||
| return polygon; | ||
| }; | ||
| export const insertionSort = (array) => { | ||
@@ -589,0 +625,0 @@ const end = array.length; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
1084679
0.7%25620
1.26%1205
8.46%0
-100%2
100%+ Added
- Removed
Updated
Updated
Updated