Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .devcontainer/devcontainer.json

This file was deleted.

2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*]
max_line_length = 100
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"downloadjs": "^1.4.7",
"i18next": "^25.3.2",
"i18next-browser-languagedetector": "8.2.0",
"lodash": "^4.17.5",
"lodash-es": "^4.17.21",
"mobx": "^6.13.0",
"mobx-react-observer": "^1.1.0",
"react": "^19.1.0",
Expand Down
3 changes: 1 addition & 2 deletions src/ColorDropDownField.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { range } from "lodash";
import Color from "color";

import DropDownField from "./DropDownField";
Expand All @@ -7,7 +6,7 @@ const colors = [
{ key: "transparent" },
{ key: "black" },
{ key: "gray" },
...range(1, 10).map((v) => ({
...Array.from({ length: 9 }, (_, i) => i + 1).map((v) => ({
key: Color.rgb(255, 255, 255)
.darken(v / 10.0)
.string(),
Expand Down
6 changes: 2 additions & 4 deletions src/PracticePage.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { times } from "lodash";

import LineSet from "./LineSet";
import WatermarkSVG from "./WatermarkSVG";

Expand Down Expand Up @@ -36,7 +34,7 @@ const PracticePage = ({ store }) => {
style={{ backgroundColor: "white" }}
>
<g key="X">
{times(count, (i) => (
{[...Array(count)].map((_, i) => (
<text
key={`x-${i}`}
x={1}
Expand All @@ -48,7 +46,7 @@ const PracticePage = ({ store }) => {
</text>
))}
</g>
{times(count, (i) => (
{[...Array(count)].map((_, i) => (
<g key={`lineset-${i}`}>
<rect {...gapRect} y={1 + lineSetHeight * i + workHeight} />
<LineSet
Expand Down
10 changes: 5 additions & 5 deletions src/ga.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { debounce, partial } from "lodash";
import debounce from "lodash-es/debounce";
import { reaction } from "mobx";

export const gtagEvent = (action, params) => {
Expand All @@ -16,13 +16,13 @@ export const trackEvent = (action, label) => {
gtagEvent(action, { eventLabel: label });
};

export const presetChange = partial(trackEvent, "select_preset");
export const presetChange = (label) => trackEvent("select_preset", label);

export const ratiosChange = partial(trackEvent, "change_ratios");
export const ratiosChange = (label) => trackEvent("change_ratios", label);

export const xHeightChange = partial(trackEvent, "change_x_height");
export const xHeightChange = (label) => trackEvent("change_x_height", label);

export const outputAttempt = partial(trackEvent, "output_attempt");
export const outputAttempt = (label) => trackEvent("output_attempt", label);

export const gaLangChange = (lng) => {
gtagEvent("language_change", { language: lng });
Expand Down
14 changes: 6 additions & 8 deletions src/lines.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { merge } from "lodash";

export const basicLine = (width, offset) => {
return {
x1: 0,
Expand All @@ -25,12 +23,12 @@ export const lineDash = (name) => {
};

export const composeLine = (spec) => {
return merge(
basicLine(spec.width, spec.offset),
color(spec.color),
thickness(spec.thickness),
lineDash(spec.dash),
);
return {
...basicLine(spec.width, spec.offset),
...color(spec.color),
...thickness(spec.thickness),
...lineDash(spec.dash),
};
};

export const defaultLineSpec = (overrides = {}) => {
Expand Down
6 changes: 3 additions & 3 deletions src/store.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { reduce, range } from "lodash";
import { action, computed, observable, makeObservable } from "mobx";
import range from "lodash-es/range";
import { action, computed, makeObservable, observable } from "mobx";

import { composeLine, defaultLineSpec } from "./lines";

Expand Down Expand Up @@ -195,7 +195,7 @@ class PenStore {
}

get lineSetHeight() {
return reduce(this.heights, (sum, h) => sum + h, 0);
return this.heights.reduce((sum, h) => sum + h, 0);
}

get guideLineSet() {
Expand Down
14 changes: 2 additions & 12 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from "vite";

import react from "@vitejs/plugin-react";
import observerPlugin from "mobx-react-observer/babel-plugin";

Expand All @@ -8,15 +9,7 @@ export default defineConfig({
rollupOptions: {
output: {
manualChunks: {
uicore: [
"react",
"react-dom",
"mobx",
"mobx-react-observer",
"i18next",
"react-i18next",
"lodash",
],
react: ["react", "react-dom", "react-i18next", "i18next", "mobx", "mobx-react-observer"],
},
},
},
Expand All @@ -28,9 +21,6 @@ export default defineConfig({
},
}),
],
server: {
host: true,
},
test: {
environment: "jsdom",
},
Expand Down