From 2174bb5930eb7f0f9dc85e41cb0bc4a1645d5f94 Mon Sep 17 00:00:00 2001 From: Daiki Ikeda Date: Mon, 21 Apr 2025 05:25:37 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E3=82=B9=E3=82=BF=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=A8=E3=82=B3=E3=83=BC=E3=83=89=E3=81=AE=E6=95=B4=E5=BD=A2?= =?UTF-8?q?=E3=82=92=E6=94=B9=E5=96=84=E3=81=97=E3=80=81=E5=8F=AF=E8=AA=AD?= =?UTF-8?q?=E6=80=A7=E3=82=92=E5=90=91=E4=B8=8A=E3=81=95=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 266 +++++++++++++++++++++++++++++------------------------ script.js | 46 ++++----- 2 files changed, 170 insertions(+), 142 deletions(-) diff --git a/index.html b/index.html index ab48989..2e77810 100644 --- a/index.html +++ b/index.html @@ -1,137 +1,161 @@ - - - Script Printer - シナリオテキストを収録用台本に変換 - - - - -
-

- - -

-

-

-
- -
- - - + + body { + margin: 0; + } + } + + + + + +
+

+ + +

+

+

+
+ +
+ + + + \ No newline at end of file diff --git a/script.js b/script.js index 283ae39..6b28c8f 100644 --- a/script.js +++ b/script.js @@ -25,13 +25,13 @@ function loadScript() { input.style.display = "none"; title.removeAttribute("style"); title.style.width = 0; - title.style.width = title.scrollWidth + "px"; + title.style.width = `${title.scrollWidth}px`; title.addEventListener("input", e => { const title = e.target; document.title = title.value; title.style.width = 0; - title.style.width = title.scrollWidth + "px"; + title.style.width = `${title.scrollWidth}px`; }); } } @@ -51,14 +51,14 @@ function displayScript(text) { const pattern = patterns.pattern1; let lastIndex = 0; // マッチングの開始位置を追跡 - let match; - while ((match = pattern.exec(text)) !== null) { + let match = pattern.exec(text); + while (match !== null) { // マッチする前のテキストを追加 if (lastIndex < match.index) { const textBeforeMatch = text.slice(lastIndex, match.index - 1); - textBeforeMatch.split("\n").forEach(line => { + for (const line of textBeforeMatch.split("\n")) { addDialogueToContainer("", line, scriptContainer); - }); + } } // マッチしたテキストを追加 @@ -68,13 +68,14 @@ function displayScript(text) { characterList.add(toZenKaku(characterName)); lastIndex = pattern.lastIndex + 1; + match = pattern.exec(text); } // 最後のマッチ後のテキストを追加 const textAfterLastMatch = text.slice(lastIndex); - textAfterLastMatch.split("\n").forEach(line => { + for (const line of textAfterLastMatch.split("\n")) { addDialogueToContainer("", line, scriptContainer); - }); + } displayCharacterCheckboxes(characterList); } @@ -108,7 +109,7 @@ function displayCharacterCheckboxes(characterList) { const checkbox = document.createElement("input"); checkbox.type = "checkbox"; checkbox.value = character; - checkbox.onchange = function(event) { + checkbox.onchange = (event) => { toggleCharacterHighlight(event); calculateSelectedCharactersDialogues(); }; @@ -130,16 +131,18 @@ function toggleCharacterHighlight(event) { const isChecked = event.target.checked; // 対象のキャラクター名を含む全てのチェックボックスを操作 - document.querySelectorAll('#characterList input[type="checkbox"]').forEach(checkbox => { + const checkboxes = document.querySelectorAll('#characterList input[type="checkbox"]'); + for (const checkbox of checkboxes) { if (checkbox.value.includes(character)) { checkbox.checked = isChecked; } - }); + } // 元々あったダイアログのハイライト更新処理 - document.querySelectorAll(".character-dialogue").forEach(charDialogueDiv => { + const charDialogueDivs = document.querySelectorAll(".character-dialogue"); + for (const charDialogueDiv of charDialogueDivs) { const characterSpan = charDialogueDiv.querySelector(".character-name"); - if (characterSpan && characterSpan.textContent.includes(character)) { + if (characterSpan?.textContent.includes(character)) { if (isChecked) { charDialogueDiv.classList.add("highlighted"); charDialogueDiv.addEventListener("click", toggleHighlight); @@ -148,7 +151,7 @@ function toggleCharacterHighlight(event) { charDialogueDiv.removeEventListener("click", toggleHighlight); } } - }); + } } // ハイライトのクラスを切り替え、"ボイスなし"のテキストを追加/削除する関数 @@ -165,7 +168,7 @@ function toggleHighlight(e) { noVoiceElement.textContent = "【ボイス不要】"; dialogue.querySelector(".character-name").prepend(noVoiceElement); } else if (noVoiceElement) { - noVoiceElement.remove(); + noVoiceElement.remove(); } dialogue.classList.toggle("highlighted"); @@ -176,15 +179,16 @@ function toggleHighlight(e) { // 選択されたキャラクターのセリフに番号をつける関数 function calculateSelectedCharactersDialogues() { const selectedCharacters = new Set(); - document.querySelectorAll('#characterList input[type="checkbox"]:checked').forEach(checkbox => { + for (const checkbox of document.querySelectorAll('#characterList input[type="checkbox"]:checked')) { selectedCharacters.add(checkbox.value); - }); + } let dialogueNumber = 0; - document.querySelectorAll(".character-dialogue").forEach(dialogueDiv => { + const dialogueDivs = document.querySelectorAll(".character-dialogue"); + for (const dialogueDiv of dialogueDivs) { const characterSpan = dialogueDiv.querySelector(".character-name"); let dialogueIndex = dialogueDiv.querySelector(".dialogue-index"); - + if (selectedCharacters.has(characterSpan.textContent) && dialogueDiv.classList.contains("highlighted")) { dialogueNumber++; // 既存の番号があれば更新、なければ新しく追加 @@ -198,9 +202,9 @@ function calculateSelectedCharactersDialogues() { // 選択されていないキャラクターのセリフ番号を削除 if (dialogueIndex) dialogueIndex.remove(); } - }); + } // 結果を表示する要素を更新 const resultDisplay = document.getElementById("dialogueCountResult"); - resultDisplay.textContent = dialogueNumber > 0 ? "ワード数 " + toZenKaku(String(dialogueNumber)) : ""; + resultDisplay.textContent = dialogueNumber > 0 ? `ワード数 ${toZenKaku(String(dialogueNumber))}` : ""; } From 3c3a4191530fad21f1b491410705c9e791817084 Mon Sep 17 00:00:00 2001 From: Daiki Ikeda Date: Mon, 21 Apr 2025 05:36:32 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8D=B0=E5=88=B7=E6=99=82=E3=81=AEScriptS?= =?UTF-8?q?ummary=E3=81=AE=E6=AC=A0=E3=81=91=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.html b/index.html index 2e77810..daaf1eb 100644 --- a/index.html +++ b/index.html @@ -139,6 +139,11 @@ body { margin: 0; } + + #scriptSummary { + background: none; + position: static; + } } From 88e7b900860266cf14de1b59804fc151b26dd2dc Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 20 May 2025 19:22:01 +0000 Subject: [PATCH 3/3] Refactor: Migrate project to Vite and TypeScript - I set up the Vite and TypeScript environment with the necessary dependencies and configuration files (package.json, vite.config.ts, tsconfig.json). - I restructured the project to use an `src` directory with `main.ts` as the entry point. - I converted the JavaScript in `script.js` to TypeScript in `src/main.ts`, adding type annotations and ensuring type safety. - I moved the inline CSS from `index.html` to a separate `src/style.css` file and imported it into the TypeScript module. - I maintained the existing application functionality for script parsing, display, character highlighting, and word counting. - The build and development processes are now managed by Vite scripts. --- .gitignore | 1 + index.html | 144 +----- package-lock.json | 981 +++++++++++++++++++++++++++++++++++++++ package.json | 16 + sample.txt | 5 + script.js => src/main.ts | 110 +++-- src/style.css | 140 ++++++ tsconfig.json | 21 + vite.config.ts | 6 + 9 files changed, 1238 insertions(+), 186 deletions(-) create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 sample.txt rename script.js => src/main.ts (60%) create mode 100644 src/style.css create mode 100644 tsconfig.json create mode 100644 vite.config.ts diff --git a/.gitignore b/.gitignore index e43b0f9..646ac51 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .DS_Store +node_modules/ diff --git a/index.html b/index.html index daaf1eb..ab15264 100644 --- a/index.html +++ b/index.html @@ -4,148 +4,6 @@ Script Printer - シナリオテキストを収録用台本に変換 - @@ -160,7 +18,7 @@

- + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..397c807 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,981 @@ +{ + "name": "vite-typescript-project", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "vite-typescript-project", + "version": "0.0.0", + "devDependencies": { + "@types/node": "^22.15.20", + "typescript": "^5.8.3", + "vite": "^6.3.5" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.4.tgz", + "integrity": "sha512-1VCICWypeQKhVbE9oW/sJaAmjLxhVqacdkvPLEjwlttjfwENRSClS8EjBz0KzRyFSCPDIkuXW34Je/vk7zdB7Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.4.tgz", + "integrity": "sha512-QNdQEps7DfFwE3hXiU4BZeOV68HHzYwGd0Nthhd3uCkkEKK7/R6MTgM0P7H7FAs5pU/DIWsviMmEGxEoxIZ+ZQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.4.tgz", + "integrity": "sha512-bBy69pgfhMGtCnwpC/x5QhfxAz/cBgQ9enbtwjf6V9lnPI/hMyT9iWpR1arm0l3kttTr4L0KSLpKmLp/ilKS9A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.4.tgz", + "integrity": "sha512-TVhdVtQIFuVpIIR282btcGC2oGQoSfZfmBdTip2anCaVYcqWlZXGcdcKIUklfX2wj0JklNYgz39OBqh2cqXvcQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.4.tgz", + "integrity": "sha512-Y1giCfM4nlHDWEfSckMzeWNdQS31BQGs9/rouw6Ub91tkK79aIMTH3q9xHvzH8d0wDru5Ci0kWB8b3up/nl16g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.4.tgz", + "integrity": "sha512-CJsry8ZGM5VFVeyUYB3cdKpd/H69PYez4eJh1W/t38vzutdjEjtP7hB6eLKBoOdxcAlCtEYHzQ/PJ/oU9I4u0A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.4.tgz", + "integrity": "sha512-yYq+39NlTRzU2XmoPW4l5Ifpl9fqSk0nAJYM/V/WUGPEFfek1epLHJIkTQM6bBs1swApjO5nWgvr843g6TjxuQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.4.tgz", + "integrity": "sha512-0FgvOJ6UUMflsHSPLzdfDnnBBVoCDtBTVyn/MrWloUNvq/5SFmh13l3dvgRPkDihRxb77Y17MbqbCAa2strMQQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.4.tgz", + "integrity": "sha512-kro4c0P85GMfFYqW4TWOpvmF8rFShbWGnrLqlzp4X1TNWjRY3JMYUfDCtOxPKOIY8B0WC8HN51hGP4I4hz4AaQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.4.tgz", + "integrity": "sha512-+89UsQTfXdmjIvZS6nUnOOLoXnkUTB9hR5QAeLrQdzOSWZvNSAXAtcRDHWtqAUtAmv7ZM1WPOOeSxDzzzMogiQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.4.tgz", + "integrity": "sha512-yTEjoapy8UP3rv8dB0ip3AfMpRbyhSN3+hY8mo/i4QXFeDxmiYbEKp3ZRjBKcOP862Ua4b1PDfwlvbuwY7hIGQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.4.tgz", + "integrity": "sha512-NeqqYkrcGzFwi6CGRGNMOjWGGSYOpqwCjS9fvaUlX5s3zwOtn1qwg1s2iE2svBe4Q/YOG1q6875lcAoQK/F4VA==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.4.tgz", + "integrity": "sha512-IcvTlF9dtLrfL/M8WgNI/qJYBENP3ekgsHbYUIzEzq5XJzzVEV/fXY9WFPfEEXmu3ck2qJP8LG/p3Q8f7Zc2Xg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.4.tgz", + "integrity": "sha512-HOy0aLTJTVtoTeGZh4HSXaO6M95qu4k5lJcH4gxv56iaycfz1S8GO/5Jh6X4Y1YiI0h7cRyLi+HixMR+88swag==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.4.tgz", + "integrity": "sha512-i8JUDAufpz9jOzo4yIShCTcXzS07vEgWzyX3NH2G7LEFVgrLEhjwL3ajFE4fZI3I4ZgiM7JH3GQ7ReObROvSUA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.4.tgz", + "integrity": "sha512-jFnu+6UbLlzIjPQpWCNh5QtrcNfMLjgIavnwPQAfoGx4q17ocOU9MsQ2QVvFxwQoWpZT8DvTLooTvmOQXkO51g==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.4.tgz", + "integrity": "sha512-6e0cvXwzOnVWJHq+mskP8DNSrKBr1bULBvnFLpc1KY+d+irZSgZ02TGse5FsafKS5jg2e4pbvK6TPXaF/A6+CA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.4.tgz", + "integrity": "sha512-vUnkBYxZW4hL/ie91hSqaSNjulOnYXE1VSLusnvHg2u3jewJBz3YzB9+oCw8DABeVqZGg94t9tyZFoHma8gWZQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.4.tgz", + "integrity": "sha512-XAg8pIQn5CzhOB8odIcAm42QsOfa98SBeKUdo4xa8OvX8LbMZqEtgeWE9P/Wxt7MlG2QqvjGths+nq48TrUiKw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.4.tgz", + "integrity": "sha512-Ct2WcFEANlFDtp1nVAXSNBPDxyU+j7+tId//iHXU2f/lN5AmO4zLyhDcpR5Cz1r08mVxzt3Jpyt4PmXQ1O6+7A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.4.tgz", + "integrity": "sha512-xAGGhyOQ9Otm1Xu8NT1ifGLnA6M3sJxZ6ixylb+vIUVzvvd6GOALpwQrYrtlPouMqd/vSbgehz6HaVk4+7Afhw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.4.tgz", + "integrity": "sha512-Mw+tzy4pp6wZEK0+Lwr76pWLjrtjmJyUB23tHKqEDP74R3q95luY/bXqXZeYl4NYlvwOqoRKlInQialgCKy67Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.4.tgz", + "integrity": "sha512-AVUP428VQTSddguz9dO9ngb+E5aScyg7nOeJDrF1HPYu555gmza3bDGMPhmVXL8svDSoqPCsCPjb265yG/kLKQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.4.tgz", + "integrity": "sha512-i1sW+1i+oWvQzSgfRcxxG2k4I9n3O9NRqy8U+uugaT2Dy7kLO9Y7wI72haOahxceMX8hZAzgGou1FhndRldxRg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.4.tgz", + "integrity": "sha512-nOT2vZNw6hJ+z43oP1SPea/G/6AbN6X+bGNhNuq8NtRHy4wsMhw765IKLNmnjek7GvjWBYQ8Q5VBoYTFg9y1UQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.41.0.tgz", + "integrity": "sha512-KxN+zCjOYHGwCl4UCtSfZ6jrq/qi88JDUtiEFk8LELEHq2Egfc/FgW+jItZiOLRuQfb/3xJSgFuNPC9jzggX+A==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.41.0.tgz", + "integrity": "sha512-yDvqx3lWlcugozax3DItKJI5j05B0d4Kvnjx+5mwiUpWramVvmAByYigMplaoAQ3pvdprGCTCE03eduqE/8mPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.41.0.tgz", + "integrity": "sha512-2KOU574vD3gzcPSjxO0eyR5iWlnxxtmW1F5CkNOHmMlueKNCQkxR6+ekgWyVnz6zaZihpUNkGxjsYrkTJKhkaw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.41.0.tgz", + "integrity": "sha512-gE5ACNSxHcEZyP2BA9TuTakfZvULEW4YAOtxl/A/YDbIir/wPKukde0BNPlnBiP88ecaN4BJI2TtAd+HKuZPQQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.41.0.tgz", + "integrity": "sha512-GSxU6r5HnWij7FoSo7cZg3l5GPg4HFLkzsFFh0N/b16q5buW1NAWuCJ+HMtIdUEi6XF0qH+hN0TEd78laRp7Dg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.41.0.tgz", + "integrity": "sha512-KGiGKGDg8qLRyOWmk6IeiHJzsN/OYxO6nSbT0Vj4MwjS2XQy/5emsmtoqLAabqrohbgLWJ5GV3s/ljdrIr8Qjg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.41.0.tgz", + "integrity": "sha512-46OzWeqEVQyX3N2/QdiU/CMXYDH/lSHpgfBkuhl3igpZiaB3ZIfSjKuOnybFVBQzjsLwkus2mjaESy8H41SzvA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.41.0.tgz", + "integrity": "sha512-lfgW3KtQP4YauqdPpcUZHPcqQXmTmH4nYU0cplNeW583CMkAGjtImw4PKli09NFi2iQgChk4e9erkwlfYem6Lg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.41.0.tgz", + "integrity": "sha512-nn8mEyzMbdEJzT7cwxgObuwviMx6kPRxzYiOl6o/o+ChQq23gfdlZcUNnt89lPhhz3BYsZ72rp0rxNqBSfqlqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.41.0.tgz", + "integrity": "sha512-l+QK99je2zUKGd31Gh+45c4pGDAqZSuWQiuRFCdHYC2CSiO47qUWsCcenrI6p22hvHZrDje9QjwSMAFL3iwXwQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.41.0.tgz", + "integrity": "sha512-WbnJaxPv1gPIm6S8O/Wg+wfE/OzGSXlBMbOe4ie+zMyykMOeqmgD1BhPxZQuDqwUN+0T/xOFtL2RUWBspnZj3w==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.41.0.tgz", + "integrity": "sha512-eRDWR5t67/b2g8Q/S8XPi0YdbKcCs4WQ8vklNnUYLaSWF+Cbv2axZsp4jni6/j7eKvMLYCYdcsv8dcU+a6QNFg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.41.0.tgz", + "integrity": "sha512-TWrZb6GF5jsEKG7T1IHwlLMDRy2f3DPqYldmIhnA2DVqvvhY2Ai184vZGgahRrg8k9UBWoSlHv+suRfTN7Ua4A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.41.0.tgz", + "integrity": "sha512-ieQljaZKuJpmWvd8gW87ZmSFwid6AxMDk5bhONJ57U8zT77zpZ/TPKkU9HpnnFrM4zsgr4kiGuzbIbZTGi7u9A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.41.0.tgz", + "integrity": "sha512-/L3pW48SxrWAlVsKCN0dGLB2bi8Nv8pr5S5ocSM+S0XCn5RCVCXqi8GVtHFsOBBCSeR+u9brV2zno5+mg3S4Aw==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.41.0.tgz", + "integrity": "sha512-XMLeKjyH8NsEDCRptf6LO8lJk23o9wvB+dJwcXMaH6ZQbbkHu2dbGIUindbMtRN6ux1xKi16iXWu6q9mu7gDhQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.41.0.tgz", + "integrity": "sha512-m/P7LycHZTvSQeXhFmgmdqEiTqSV80zn6xHaQ1JSqwCtD1YGtwEK515Qmy9DcB2HK4dOUVypQxvhVSy06cJPEg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.41.0.tgz", + "integrity": "sha512-4yodtcOrFHpbomJGVEqZ8fzD4kfBeCbpsUy5Pqk4RluXOdsWdjLnjhiKy2w3qzcASWd04fp52Xz7JKarVJ5BTg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.41.0.tgz", + "integrity": "sha512-tmazCrAsKzdkXssEc65zIE1oC6xPHwfy9d5Ta25SRCDOZS+I6RypVVShWALNuU9bxIfGA0aqrmzlzoM5wO5SPQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.41.0.tgz", + "integrity": "sha512-h1J+Yzjo/X+0EAvR2kIXJDuTuyT7drc+t2ALY0nIcGPbTatNOf0VWdhEA2Z4AAjv6X1NJV7SYo5oCTYRJhSlVA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", + "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "dev": true + }, + "node_modules/@types/node": { + "version": "22.15.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.20.tgz", + "integrity": "sha512-A6BohGFRGHAscJsTslDCA9JG7qSJr/DWUvrvY8yi9IgnGtMxCyat7vvQ//MFa0DnLsyuS3wYTpLdw4Hf+Q5JXw==", + "dev": true, + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/esbuild": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.4.tgz", + "integrity": "sha512-8pgjLUcUjcgDg+2Q4NYXnPbo/vncAY4UmyaCm0jZevERqCHZIaWwdJHkf8XQtu4AxSKCdvrUbT0XUr1IdZzI8Q==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.4", + "@esbuild/android-arm": "0.25.4", + "@esbuild/android-arm64": "0.25.4", + "@esbuild/android-x64": "0.25.4", + "@esbuild/darwin-arm64": "0.25.4", + "@esbuild/darwin-x64": "0.25.4", + "@esbuild/freebsd-arm64": "0.25.4", + "@esbuild/freebsd-x64": "0.25.4", + "@esbuild/linux-arm": "0.25.4", + "@esbuild/linux-arm64": "0.25.4", + "@esbuild/linux-ia32": "0.25.4", + "@esbuild/linux-loong64": "0.25.4", + "@esbuild/linux-mips64el": "0.25.4", + "@esbuild/linux-ppc64": "0.25.4", + "@esbuild/linux-riscv64": "0.25.4", + "@esbuild/linux-s390x": "0.25.4", + "@esbuild/linux-x64": "0.25.4", + "@esbuild/netbsd-arm64": "0.25.4", + "@esbuild/netbsd-x64": "0.25.4", + "@esbuild/openbsd-arm64": "0.25.4", + "@esbuild/openbsd-x64": "0.25.4", + "@esbuild/sunos-x64": "0.25.4", + "@esbuild/win32-arm64": "0.25.4", + "@esbuild/win32-ia32": "0.25.4", + "@esbuild/win32-x64": "0.25.4" + } + }, + "node_modules/fdir": { + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", + "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", + "dev": true, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true + }, + "node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.3", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz", + "integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "dependencies": { + "nanoid": "^3.3.8", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rollup": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.41.0.tgz", + "integrity": "sha512-HqMFpUbWlf/tvcxBFNKnJyzc7Lk+XO3FGc3pbNBLqEbOz0gPLRgcrlS3UF4MfUrVlstOaP/q0kM6GVvi+LrLRg==", + "dev": true, + "dependencies": { + "@types/estree": "1.0.7" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.41.0", + "@rollup/rollup-android-arm64": "4.41.0", + "@rollup/rollup-darwin-arm64": "4.41.0", + "@rollup/rollup-darwin-x64": "4.41.0", + "@rollup/rollup-freebsd-arm64": "4.41.0", + "@rollup/rollup-freebsd-x64": "4.41.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.41.0", + "@rollup/rollup-linux-arm-musleabihf": "4.41.0", + "@rollup/rollup-linux-arm64-gnu": "4.41.0", + "@rollup/rollup-linux-arm64-musl": "4.41.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.41.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.41.0", + "@rollup/rollup-linux-riscv64-gnu": "4.41.0", + "@rollup/rollup-linux-riscv64-musl": "4.41.0", + "@rollup/rollup-linux-s390x-gnu": "4.41.0", + "@rollup/rollup-linux-x64-gnu": "4.41.0", + "@rollup/rollup-linux-x64-musl": "4.41.0", + "@rollup/rollup-win32-arm64-msvc": "4.41.0", + "@rollup/rollup-win32-ia32-msvc": "4.41.0", + "@rollup/rollup-win32-x64-msvc": "4.41.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz", + "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==", + "dev": true, + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true + }, + "node_modules/vite": { + "version": "6.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz", + "integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==", + "dev": true, + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..37b6803 --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "vite-typescript-project", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "@types/node": "^22.15.20", + "typescript": "^5.8.3", + "vite": "^6.3.5" + } +} diff --git a/sample.txt b/sample.txt new file mode 100644 index 0000000..892cd8b --- /dev/null +++ b/sample.txt @@ -0,0 +1,5 @@ +CharacterA「Hello」 +CharacterB「Hi there!」 +CharacterA「How are you?」 +Narrator「The sun is shining.」 +CharacterB「I'm fine, thanks!」 diff --git a/script.js b/src/main.ts similarity index 60% rename from script.js rename to src/main.ts index 6b28c8f..4dc8352 100644 --- a/script.js +++ b/src/main.ts @@ -1,49 +1,53 @@ -function toZenKaku(str) { +import './style.css'; + +function toZenKaku(str: string): string { // 半角数字を全角数字に変換する return str.replace(/[A-Za-z0-9]/g, s => String.fromCharCode(s.charCodeAt(0) + 0xfee0)); } -function preprocessText(text) { +function preprocessText(text: string): string { return text.split(/\r\n|\r|\n/g).map(line => line.trim()).join("\n"); } // テキストファイルを読み込んで台本を表示する関数 -function loadScript() { - const input = document.getElementById("fileInput"); - const title = document.getElementById("fileTitle"); - if ("files" in input && input.files.length > 0) { +function loadScript(): void { + const input = document.getElementById("fileInput") as HTMLInputElement; + const title = document.getElementById("fileTitle") as HTMLTextAreaElement; + if (input && input.files && input.files.length > 0) { const file = input.files[0]; const reader = new FileReader(); - reader.onload = e => { - const text = e.target.result; - displayScript(preprocessText(text)); + reader.onload = (e: ProgressEvent) => { + const text = e.target?.result as string; + if (text) { + displayScript(preprocessText(text)); + } }; reader.readAsText(file, "UTF-8"); document.title = title.value = file.name; input.style.display = "none"; title.removeAttribute("style"); - title.style.width = 0; + title.style.width = "0"; title.style.width = `${title.scrollWidth}px`; - title.addEventListener("input", e => { - const title = e.target; - document.title = title.value; - title.style.width = 0; - title.style.width = `${title.scrollWidth}px`; + title.addEventListener("input", (e: Event) => { + const target = e.target as HTMLTextAreaElement; + document.title = target.value; + target.style.width = "0"; + target.style.width = `${target.scrollWidth}px`; }); } } -function displayScript(text) { +function displayScript(text: string): void { // HTML要素をクリア - const scriptContainer = document.getElementById("scriptContainer"); - const characterList = new Set(); + const scriptContainer = document.getElementById("scriptContainer") as HTMLDivElement; + const characterList = new Set(); scriptContainer.innerHTML = ""; // 正規表現パターンを個別に定義 - const patterns = { + const patterns: { [key: string]: RegExp } = { pattern1: /^(.+?)「(.+?)」$/gm, pattern2: /^【(.+?)】\s+?((?:.+?\n){1,}\n+^)/gm, }; @@ -80,7 +84,7 @@ function displayScript(text) { displayCharacterCheckboxes(characterList); } -function addDialogueToContainer(character, dialogue, container) { +function addDialogueToContainer(character: string, dialogue: string, container: HTMLDivElement): void { const charDialogueDiv = document.createElement("div"); charDialogueDiv.className = "character-dialogue"; @@ -98,8 +102,8 @@ function addDialogueToContainer(character, dialogue, container) { } // Displays checkboxes for each character in the script -function displayCharacterCheckboxes(characterList) { - const listContainer = document.getElementById("characterList"); +function displayCharacterCheckboxes(characterList: Set): void { + const listContainer = document.getElementById("characterList") as HTMLParagraphElement; listContainer.innerHTML = "キャラクターリスト "; // Clear previous content Array.from(characterList).forEach((character, index) => { @@ -109,7 +113,7 @@ function displayCharacterCheckboxes(characterList) { const checkbox = document.createElement("input"); checkbox.type = "checkbox"; checkbox.value = character; - checkbox.onchange = (event) => { + checkbox.onchange = (event: Event) => { toggleCharacterHighlight(event); calculateSelectedCharactersDialogues(); }; @@ -126,12 +130,13 @@ function displayCharacterCheckboxes(characterList) { } // Toggle the highlighted class for the dialogues of the selected character -function toggleCharacterHighlight(event) { - const character = event.target.value; - const isChecked = event.target.checked; +function toggleCharacterHighlight(event: Event): void { + const target = event.target as HTMLInputElement; + const character = target.value; + const isChecked = target.checked; // 対象のキャラクター名を含む全てのチェックボックスを操作 - const checkboxes = document.querySelectorAll('#characterList input[type="checkbox"]'); + const checkboxes = document.querySelectorAll('#characterList input[type="checkbox"]'); for (const checkbox of checkboxes) { if (checkbox.value.includes(character)) { checkbox.checked = isChecked; @@ -139,10 +144,10 @@ function toggleCharacterHighlight(event) { } // 元々あったダイアログのハイライト更新処理 - const charDialogueDivs = document.querySelectorAll(".character-dialogue"); + const charDialogueDivs = document.querySelectorAll(".character-dialogue"); for (const charDialogueDiv of charDialogueDivs) { - const characterSpan = charDialogueDiv.querySelector(".character-name"); - if (characterSpan?.textContent.includes(character)) { + const characterSpan = charDialogueDiv.querySelector(".character-name"); + if (characterSpan?.textContent?.includes(character)) { if (isChecked) { charDialogueDiv.classList.add("highlighted"); charDialogueDiv.addEventListener("click", toggleHighlight); @@ -155,18 +160,18 @@ function toggleCharacterHighlight(event) { } // ハイライトのクラスを切り替え、"ボイスなし"のテキストを追加/削除する関数 -function toggleHighlight(e) { - const dialogue = e.currentTarget; +function toggleHighlight(e: MouseEvent): void { + const dialogue = e.currentTarget as HTMLDivElement; const isHighlighted = dialogue.classList.contains("highlighted"); // "ボイスなし"を示す要素が既に存在するかチェック - let noVoiceElement = dialogue.querySelector(".no-voice"); + let noVoiceElement = dialogue.querySelector(".no-voice"); if (isHighlighted && !noVoiceElement) { noVoiceElement = document.createElement("span"); noVoiceElement.classList.add("no-voice"); noVoiceElement.textContent = "【ボイス不要】"; - dialogue.querySelector(".character-name").prepend(noVoiceElement); + dialogue.querySelector(".character-name")?.prepend(noVoiceElement); } else if (noVoiceElement) { noVoiceElement.remove(); } @@ -177,19 +182,19 @@ function toggleHighlight(e) { } // 選択されたキャラクターのセリフに番号をつける関数 -function calculateSelectedCharactersDialogues() { - const selectedCharacters = new Set(); - for (const checkbox of document.querySelectorAll('#characterList input[type="checkbox"]:checked')) { +function calculateSelectedCharactersDialogues(): void { + const selectedCharacters = new Set(); + for (const checkbox of document.querySelectorAll('#characterList input[type="checkbox"]:checked')) { selectedCharacters.add(checkbox.value); } let dialogueNumber = 0; - const dialogueDivs = document.querySelectorAll(".character-dialogue"); + const dialogueDivs = document.querySelectorAll(".character-dialogue"); for (const dialogueDiv of dialogueDivs) { - const characterSpan = dialogueDiv.querySelector(".character-name"); - let dialogueIndex = dialogueDiv.querySelector(".dialogue-index"); + const characterSpan = dialogueDiv.querySelector(".character-name"); + let dialogueIndex = dialogueDiv.querySelector(".dialogue-index"); - if (selectedCharacters.has(characterSpan.textContent) && dialogueDiv.classList.contains("highlighted")) { + if (characterSpan && selectedCharacters.has(characterSpan.textContent!) && dialogueDiv.classList.contains("highlighted")) { dialogueNumber++; // 既存の番号があれば更新、なければ新しく追加 if (!dialogueIndex) { @@ -205,6 +210,25 @@ function calculateSelectedCharactersDialogues() { } // 結果を表示する要素を更新 - const resultDisplay = document.getElementById("dialogueCountResult"); - resultDisplay.textContent = dialogueNumber > 0 ? `ワード数 ${toZenKaku(String(dialogueNumber))}` : ""; + const resultDisplay = document.getElementById("dialogueCountResult") as HTMLParagraphElement; + if (resultDisplay) { + resultDisplay.textContent = dialogueNumber > 0 ? `ワード数 ${toZenKaku(String(dialogueNumber))}` : ""; + } } + +// Make functions available globally on the window object for HTML event handlers +declare global { + interface Window { + loadScript: () => void; + toggleCharacterHighlight: (event: Event) => void; + calculateSelectedCharactersDialogues: () => void; + toggleHighlight: (event: MouseEvent) => void; + } +} + +window.loadScript = loadScript; +// toggleCharacterHighlight, calculateSelectedCharactersDialogues, and toggleHighlight are called by other functions, +// or as event handlers assigned directly in JS, not from HTML, so they don't strictly need to be on window. +// However, if any are dynamically assigned or might be called from a string context, it's safer. +// For now, only loadScript is essential for the onchange attribute in index.html. +// displayCharacterCheckboxes and addDialogueToContainer are internal. diff --git a/src/style.css b/src/style.css new file mode 100644 index 0000000..13dbf20 --- /dev/null +++ b/src/style.css @@ -0,0 +1,140 @@ +:root { + --font-size: 12pt; + --font-size-large: 15pt; + --font-serif: "ヒラギノ明朝 Pro", "Hiragino Mincho Pro", serif; + --font-sans: "ヒラギノ角ゴ ProN", "Hiragino Kaku Gothic ProN", sans-serif; + --height: 210mm; + --padding-bottom: 40mm; + --margin: 10mm; + --highlight-color: #666666; +} + +body { + writing-mode: vertical-rl; + font-family: var(--font-serif); + margin: var(--margin); + padding: 0; + height: var(--height); +} + +.page { + box-sizing: border-box; + padding-bottom: var(--padding-bottom); + font-size: var(--font-size); +} + +.character-dialogue { + display: inline-block; + /* キャラクター名とセリフを縦に表示 */ + margin-block: 3mm; + /* キャラクター名とセリフのブロック間の余白 */ + height: 100%; + position: relative; +} + +.character-name { + font-weight: bold; + font-family: var(--font-sans); + position: absolute; + height: 40mm; + text-align: end; + padding-bottom: 2mm; +} + +.dialogue { + margin-top: 50mm; + /* キャラクター名とセリフの間の余白 */ + display: block; +} + +.highlighted { + font-weight: bold; + user-select: none; + cursor: pointer; +} + +.highlighted .character-name { + background-color: var(--highlight-color); + color: white; + -webkit-print-color-adjust: exact; + print-color-adjust: exact; +} + +.highlighted .dialogue { + font-size: var(--font-size-large); +} + +.dialogue-index { + position: absolute; + right: calc(-0.95 * var(--font-size)); + color: var(--highlight-color); + font-family: var(--font-sans); + font-size: calc(0.75 * var(--font-size)); +} + +/* サマリのスタイル */ +#scriptSummary { + padding-left: var(--margin); + position: sticky; + right: 0; + background: linear-gradient(to left, white 0%, rgba(255, 255, 255, 0.7) 70%, transparent 100%); + z-index: 100000; + + input, + textarea { + font: inherit; + background: none; + padding: 0; + border: none; + height: 100%; + width: auto; + resize: none; + } + + #characterList, + #dialogueCountResult { + font-family: var(--font-sans); + color: var(--highlight-color); + user-select: none; + } + + label { + padding: 2px; + margin: 2px; + display: inline-block; + cursor: pointer; + border: 1px solid transparent; + + &:has(input:checked) { + background-color: var(--highlight-color); + /* チェックされたキャラクターの背景色 */ + color: white; + font-weight: bold; + } + + &:hover { + border: 1px solid var(--highlight-color); + } + + input { + display: none; + } + } +} + +/* 印刷時のスタイル */ +@media print { + @page { + size: A4 landscape; + margin: var(--margin); + } + + body { + margin: 0; + } + + #scriptSummary { + background: none; + position: static; + } +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..42d1dcf --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "lib": ["ESNext", "DOM", "DOM.Iterable"], + "skipLibCheck": true, + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src", "vite.config.ts"] +} diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..4cebd1c --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,6 @@ +import { defineConfig } from 'vite' + +export default defineConfig({ + // project specific plugins could be added here + // build options could be specified here +})