Skip to content

Commit

Permalink
chore: remove unneeded npm packages
Browse files Browse the repository at this point in the history
  • Loading branch information
puglet5 committed Nov 16, 2023
1 parent 5406acb commit 415cc49
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 896 deletions.
52 changes: 51 additions & 1 deletion app/javascript/controllers/chart_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,57 @@ import { Chart, ChartComponentLike, ChartConfiguration, ChartDataset, DatasetCha
import zoomPlugin from "chartjs-plugin-zoom"
import ChartDataLabels from "chartjs-plugin-datalabels"
import Papa from "papaparse"
import { blur } from "d3-array"

export function blur(values, r) {
if (!((r = +r) >= 0)) throw new RangeError("invalid r");

Check warning on line 8 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
let length = values.length;

Check warning on line 9 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
if (!((length = Math.floor(length)) >= 0)) throw new RangeError("invalid length");

Check warning on line 10 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
if (!length || !r) return values;

Check warning on line 11 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
const blur = blurf(r);

Check warning on line 12 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
const temp = values.slice();

Check warning on line 13 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
blur(values, temp, 0, length, 1);

Check warning on line 14 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
blur(temp, values, 0, length, 1);

Check warning on line 15 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
blur(values, temp, 0, length, 1);

Check warning on line 16 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
return values;

Check warning on line 17 in app/javascript/controllers/chart_controller.ts

View workflow job for this annotation

GitHub Actions / Linters

Extra semicolon
}

function bluri(radius) {
const w = 2 * radius + 1;
return (T, S, start, stop, step) => { // stop must be aligned!
if (!((stop -= step) >= start)) return; // inclusive stop
let sum = radius * S[start];
const s = step * radius;
for (let i = start, j = start + s; i < j; i += step) {
sum += S[Math.min(stop, i)];
}
for (let i = start, j = stop; i <= j; i += step) {
sum += S[Math.min(stop, i + s)];
T[i] = sum / w;
sum -= S[Math.max(start, i - s)];
}
};
}

function blurf(radius) {
const radius0 = Math.floor(radius);
if (radius0 === radius) return bluri(radius);
const t = radius - radius0;
const w = 2 * radius + 1;
return (T, S, start, stop, step) => { // stop must be aligned!
if (!((stop -= step) >= start)) return; // inclusive stop
let sum = radius0 * S[start];
const s0 = step * radius0;
const s1 = s0 + step;
for (let i = start, j = start + s0; i < j; i += step) {
sum += S[Math.min(stop, i)];
}
for (let i = start, j = stop; i <= j; i += step) {
sum += S[Math.min(stop, i + s0)];
T[i] = (sum + t * (S[Math.max(start, i - s1)] + S[Math.min(stop, i + s1)])) / w;
sum -= S[Math.max(start, i - s0)];
}
};
}

Chart.register(...registerables)
Chart.register(zoomPlugin as unknown as ChartComponentLike)
Expand Down
11 changes: 3 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"@client-side-validations/simple-form": "^0.4.0",
"@hotwired/stimulus": "^3.2.2",
"@hotwired/turbo-rails": "^7.3.0",
"@paralleldrive/cuid2": "^2.2.2",
"@pgrabovets/json-view": "^2.7.5",
"@popperjs/core": "^2.11.8",
"@rails/actiontext": "7.1.2",
Expand All @@ -16,12 +15,9 @@
"@uppy/core": "^3.7.1",
"@uppy/dashboard": "^3.7.1",
"@uppy/utils": "^5.6.0",
"autoprefixer": "^10.4.16",
"chart.js": "^4.4.0",
"chartjs-plugin-datalabels": "^2.2.0",
"chartjs-plugin-zoom": "^2.0.1",
"d3": "^7.8.5",
"d3-array": "^3.2.4",
"debounce": "^2.0.0",
"esbuild": "^0.19.5",
"esbuild-rails": "^1.0.7",
Expand All @@ -31,7 +27,6 @@
"jquery": "^3.7.1",
"papaparse": "^5.4.1",
"photoswipe": "^5.4.2",
"tailwindcss": "^3.3.5",
"tom-select": "^2.3.1",
"trix": "^2.0.7",
"uppy-activestorage-upload": "https://github.com/puglet5/uppy-activestorage-upload"
Expand All @@ -48,23 +43,23 @@
"build:css:dev": "tailwindcss -i ./app/assets/stylesheets/application.scss -o ./app/assets/builds/application.css",
"build:css": "yarn build:css:dev && postcss ./app/assets/builds/application.css -o ./app/assets/builds/application.css",
"build:dev": "node esbuild.config.js",
"build": "yarn build:dev && esbuild ./app/assets/builds/application.js --minify > ./app/assets/builds/application.min.js",
"tailwind-config-viewer": "tailwind-config-viewer -o"
"build": "yarn build:dev && esbuild ./app/assets/builds/application.js --minify > ./app/assets/builds/application.min.js"
},
"devDependencies": {
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
"@types/node": "^20.9.0",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"@typescript-eslint/parser": "^6.11.0",
"@yarnpkg/sdks": "^3.1.0",
"autoprefixer": "^10.4.16",
"cssnano": "^6.0.1",
"esbuild": "^0.19.5",
"esbuild-rails": "^1.0.7",
"eslint": "^8.53.0",
"postcss": "^8.4.31",
"postcss-cli": "^10.1.0",
"postcss-nesting": "^12.0.1",
"tailwind-config-viewer": "^1.7.3",
"tailwindcss": "^3.3.5",
"typescript": "^5.2.2"
},
"engines": {
Expand Down
Loading

0 comments on commit 415cc49

Please sign in to comment.