Skip to content

Commit 38b9a28

Browse files
Merge branch 'main' into 461-implement-perspective-warp
2 parents d77815e + 798d40d commit 38b9a28

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+227
-384
lines changed

.github/workflows/nodejs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
jobs:
1010
nodejs:
11+
# Documentation: https://github.com/zakodium/workflows#nodejs-ci
1112
uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1
1213
with:
1314
lint-check-types: true

.ncurc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
reject:
2-
# Package is now ESM-only
2+
# Package is now asynchronous
33
- 'image-type'

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGELOG.md

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
1+
<h3 align="center">
2+
<a href="https://www.zakodium.com">
3+
<img src="https://www.zakodium.com/brand/zakodium-logo-white.svg" width="50" alt="Zakodium logo" />
4+
</a>
5+
<p>
6+
Maintained by <a href="https://www.zakodium.com">Zakodium</a>
7+
</p>
8+
</h3>
9+
110
# image-js
211

3-
[![NPM version][npm-image]][npm-url]
4-
[![build status][ci-image]][ci-url]
5-
[![Test coverage][codecov-image]][codecov-url]
6-
[![npm download][download-image]][download-url]
12+
[![NPM version](https://img.shields.io/npm/v/image-js.svg)](https://www.npmjs.com/package/image-js)
13+
[![npm download](https://img.shields.io/npm/dm/image-js.svg)](https://www.npmjs.com/package/image-js)
14+
[![test coverage](https://img.shields.io/codecov/c/github/image-js-typescript/image-js-typescript.svg)](https://codecov.io/gh/image-js/image-js-typescript)
15+
[![license](https://img.shields.io/npm/l/image-js.svg)](https://github.com/image-js/image-js-typescript/blob/main/LICENSE)
716

817
Image processing and manipulation in JavaScript.
918

1019
## Installation
1120

12-
`$ npm i image-js`
21+
```console
22+
npm install image-js
23+
```
24+
25+
## API
1326

14-
## [API](https://image-js.github.io/image-js-typescript/)
27+
### [Complete API documentation](https://image-js.github.io/image-js-typescript/)
28+
29+
### [Usage docs and guides](https://image-js-docs.pages.dev/docs/Getting%20started)
1530

1631
## Development
1732

@@ -20,12 +35,3 @@ See [Development documentation](./Development.md).
2035
## License
2136

2237
[MIT](./LICENSE)
23-
24-
[npm-image]: https://img.shields.io/npm/v/image-js.svg
25-
[npm-url]: https://www.npmjs.com/package/image-js
26-
[ci-image]: https://github.com/image-js/image-js-typescript/actions/workflows/nodejs.yml/badge.svg
27-
[ci-url]: https://github.com/image-js/image-js-typescript/actions/workflows/nodejs.yml
28-
[codecov-image]: https://img.shields.io/codecov/c/github/image-js/image-js-typescript.svg
29-
[codecov-url]: https://codecov.io/gh/image-js/image-js-typescript
30-
[download-image]: https://img.shields.io/npm/dm/image-js.svg
31-
[download-url]: https://www.npmjs.com/package/image-js

api-extractor.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
104104
* DEFAULT VALUE: "<projectFolder>/tsconfig.json"
105105
*/
106-
"tsconfigFilePath": "<projectFolder>/tsconfig.esm.json"
106+
"tsconfigFilePath": "<projectFolder>/tsconfig.build.json"
107107
/**
108108
* Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
109109
* The object must conform to the TypeScript tsconfig schema:

demo/.eslintrc.yml

Whitespace-only changes.

demo/components/CameraSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function CameraSelector() {
1414
<select
1515
id="camera"
1616
name="camera"
17-
className="block w-full py-2 pl-3 pr-10 mt-1 text-base border-gray-300 rounded-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
17+
className="block w-full py-2 pl-3 pr-10 mt-1 text-base border border-gray-300 rounded-md focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm"
1818
value={selectedCamera?.device.label}
1919
onChange={(event) => {
2020
const device = cameras.find(

demo/components/CameraSnapshotButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default function CameraSnapshotButton(props: CameraSnapshotButtonProps) {
1616
const url = canvasInputRef.current.toDataURL();
1717
const image = readCanvas(canvasInputRef.current);
1818
setSnapshotUrl(url);
19+
// eslint-disable-next-line react-hooks/react-compiler
1920
snapshotImageRef.current = image;
2021
}
2122
}

demo/components/CameraTransform.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export default function CameraTransform(props: CameraTransformProps) {
4545
const canvasInput = canvasInputRef.current as HTMLCanvasElement;
4646
const canvasOutput = canvasOutputRef.current as HTMLCanvasElement;
4747
if (!canvasInput || !canvasOutput) return;
48+
// eslint-disable-next-line react-hooks/react-compiler
4849
canvasInput.height = video.videoHeight;
4950
canvasInput.width = video.videoWidth;
5051
const inputContext = canvasInput.getContext(
@@ -63,7 +64,7 @@ export default function CameraTransform(props: CameraTransformProps) {
6364
}
6465
writeCanvas(result, canvasOutput);
6566
} catch (error_) {
66-
setError(error_.stack);
67+
setError((error_ as Error).stack as string);
6768
console.error(error_);
6869
}
6970
nextFrameRequest = requestAnimationFrame(nextFrame);

demo/components/Home.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import CameraSnapshotButton from './CameraSnapshotButton.js';
77
import type { TransformFunction } from './CameraTransform.js';
88
import CameraTransform from './CameraTransform.js';
99
import Container from './Container.js';
10-
import { testGetFastKeypoints } from './testFunctions/testGetFastKeypoints.js';
10+
import { testCannyEdge } from './testFunctions/testCannyEdge.js';
1111

12-
const testTransform: TransformFunction = testGetFastKeypoints;
12+
const testTransform: TransformFunction = testCannyEdge;
1313

1414
export default function Home() {
1515
const snapshotImageRef = useRef<Image>(null);

demo/index.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import 'tailwindcss';
2+
3+
@plugin '@tailwindcss/forms';

demo/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { createRoot } from 'react-dom/client';
22

3-
import './index.css';
4-
53
import App from './components/App.js';
64

75
const root = createRoot(document.querySelector('#root') as HTMLElement);

eslint.config.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1+
import { defineConfig, globalIgnores } from 'eslint/config';
12
import react from 'eslint-config-cheminfo-react/base';
23
import typescript from 'eslint-config-cheminfo-typescript';
34

4-
export default [
5-
...typescript,
6-
...react,
5+
export default defineConfig(
6+
globalIgnores(['coverage', 'dist-types', 'lib']),
7+
typescript,
78
{
89
rules: {
910
'@typescript-eslint/restrict-template-expressions': 'off',
1011
},
1112
},
1213
{
1314
files: ['demo/**'],
15+
extends: [react],
1416
rules: { 'no-console': 'off' },
1517
},
16-
];
18+
{
19+
files: ['scripts/**'],
20+
rules: { 'no-console': 'off' },
21+
},
22+
);

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>image-js demo app</title>
7+
<link rel="stylesheet" href="/demo/index.css" />
78
</head>
89
<body>
910
<div id="root"></div>

package.json

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
{
22
"name": "image-js",
33
"version": "0.0.0",
4+
"license": "MIT",
45
"description": "Image processing and manipulation in JavaScript",
6+
"author": "Michaël Zasso",
57
"keywords": [],
68
"type": "module",
7-
"author": "Michaël Zasso",
8-
"license": "MIT",
99
"files": [
10-
"src",
10+
"dist-types",
1111
"lib",
12-
"lib-cjs",
13-
"dist-types"
12+
"src"
1413
],
15-
"main": "./lib-cjs/index.js",
16-
"module": "./lib/index.js",
17-
"browser": {
18-
"lib/save/write.js": "./lib/save/write.browser.js",
19-
"lib/load/read.js": "./lib/load/read.browser.js"
20-
},
14+
"exports": "./lib/index.js",
2115
"scripts": {
2216
"api-extractor": "rimraf dist-types && api-extractor run --local",
2317
"check-types": "tsc --noEmit",
24-
"clean": "rimraf lib lib-cjs",
18+
"clean": "rimraf coverage lib",
2519
"demo": "vite --open",
26-
"eslint": "eslint src demo --cache",
27-
"eslint-fix": "npm run eslint -- --fix",
20+
"eslint": "eslint . --cache",
21+
"eslint-fix": "eslint . --cache --fix",
2822
"prepack": "npm run tsc && npm run api-extractor",
29-
"prettier": "prettier --check src demo",
30-
"prettier-write": "prettier --write src demo",
31-
"test": "npm run check-types && npm run test-only && npm run eslint && npm run prettier",
23+
"prettier": "prettier --check .",
24+
"prettier-write": "prettier --write .",
25+
"test": "npm run test-only && npm run check-types && npm run eslint && npm run prettier",
3226
"test-only": "cross-env JEST_IMAGE_SNAPSHOT_TRACK_OBSOLETE=1 vitest run --coverage",
3327
"tsc": "npm run clean && npm run tsc-cjs && npm run tsc-esm",
3428
"tsc-cjs": "tsc --project tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > lib-cjs/package.json",
@@ -37,52 +31,54 @@
3731
"dependencies": {
3832
"bresenham-zingl": "^0.2.0",
3933
"colord": "^2.9.3",
40-
"fast-bmp": "^2.0.1",
41-
"fast-jpeg": "^2.0.1",
42-
"fast-png": "^6.2.0",
34+
"fast-bmp": "^4.0.0",
35+
"fast-jpeg": "^3.0.0",
36+
"fast-png": "^7.0.0",
4337
"image-type": "^4.1.0",
4438
"jpeg-js": "^0.4.4",
4539
"js-priority-queue": "^0.1.5",
4640
"median-quickselect": "^1.0.1",
4741
"ml-affine-transform": "^1.0.3",
4842
"ml-convolution": "^2.0.0",
49-
"ml-matrix": "^6.12.0",
43+
"ml-matrix": "^6.12.1",
5044
"ml-ransac": "^1.0.0",
5145
"ml-regression-multivariate-linear": "^2.0.4",
5246
"ml-regression-polynomial-2d": "^1.0.0",
53-
"ml-spectra-processing": "^14.9.1",
47+
"ml-spectra-processing": "^14.12.0",
5448
"robust-point-in-polygon": "^1.0.3",
5549
"ssim.js": "^3.5.0",
5650
"tiff": "^6.1.1",
5751
"ts-pattern": "^5.6.1",
5852
"uint8-base64": "^1.0.0"
5953
},
6054
"devDependencies": {
61-
"@microsoft/api-extractor": "^7.49.1",
55+
"@microsoft/api-extractor": "^7.52.8",
6256
"@tailwindcss/forms": "^0.5.10",
57+
"@tailwindcss/vite": "^4.1.10",
6358
"@types/jest-image-snapshot": "^6.4.0",
6459
"@types/js-priority-queue": "^0.0.9",
65-
"@types/node": "^22.10.7",
66-
"@types/react": "^19.0.7",
67-
"@types/react-dom": "^19.0.3",
60+
"@types/node": "^24.0.1",
61+
"@types/react": "^19.1.8",
62+
"@types/react-dom": "^19.1.6",
6863
"@types/robust-point-in-polygon": "^1.0.4",
69-
"@vitejs/plugin-react": "^4.3.4",
70-
"@vitest/coverage-v8": "^2.1.8",
71-
"@vitest/expect": "^2.1.8",
72-
"autoprefixer": "^10.4.20",
64+
"@vitejs/plugin-react": "^4.5.2",
65+
"@vitest/coverage-v8": "^3.2.3",
66+
"@vitest/expect": "^3.2.3",
67+
"@zakodium/tsconfig": "^1.0.1",
68+
"autoprefixer": "^10.4.21",
7369
"clsx": "^2.1.1",
7470
"cross-env": "^7.0.3",
75-
"eslint": "^9.18.0",
76-
"eslint-config-cheminfo-react": "^15.0.0",
77-
"eslint-config-cheminfo-typescript": "^17.0.0",
71+
"eslint": "^9.29.0",
72+
"eslint-config-cheminfo-react": "^16.1.0",
73+
"eslint-config-cheminfo-typescript": "^18.0.1",
7874
"immer": "^10.1.1",
79-
"jest-image-snapshot": "^6.4.0",
75+
"jest-image-snapshot": "^6.5.1",
8076
"jest-matcher-deep-close-to": "^3.0.2",
81-
"postcss": "^8.5.1",
82-
"prettier": "^3.4.2",
83-
"react": "^19.0.0",
84-
"react-dom": "^19.0.0",
85-
"react-router-dom": "^7.1.3",
77+
"postcss": "^8.5.5",
78+
"prettier": "^3.5.3",
79+
"react": "^19.1.0",
80+
"react-dom": "^19.1.0",
81+
"react-router-dom": "^7.6.2",
8682
"rimraf": "^6.0.1",
8783
"tailwindcss": "^3.4.17",
8884
"typescript": "~5.7.3",

postcss.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)