From c80b53e8a9b93c564188377d4fde18fe06004806 Mon Sep 17 00:00:00 2001 From: ChangHangeol Date: Sat, 4 Jan 2025 17:28:05 +0900 Subject: [PATCH] =?UTF-8?q?[BUILD,=20STYLE]=20style=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + copy_to_obsidian.py | 18 +-- esbuild.config.mjs | 10 ++ package-lock.json | 279 ++++++++++++++++++++++++++++++++++++++++++- package.json | 3 +- src/csvdisplay.ts | 7 +- src/styles/modal.css | 21 ++++ 7 files changed, 326 insertions(+), 13 deletions(-) create mode 100644 src/styles/modal.css diff --git a/.gitignore b/.gitignore index e09a007..0dd18bf 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ node_modules # Don't include the compiled main.js file in the repo. # They should be uploaded to GitHub releases instead. main.js +main.css # Exclude sourcemaps *.map diff --git a/copy_to_obsidian.py b/copy_to_obsidian.py index 8708f5c..0c99857 100644 --- a/copy_to_obsidian.py +++ b/copy_to_obsidian.py @@ -2,10 +2,12 @@ import os import shutil # 경로 설정 -SOURCE_FILES = [ - 'manifest.json', - 'main.js' -] +SOURCE_FILES = { + 'manifest.json' : 'manifest.json', + 'main.js' : 'main.js', + 'main.css' : 'styles.css', +} + OBSIDIAN_DIR = os.path.abspath('../obsidian/.obsidian') TARGET_DIR = os.path.join(OBSIDIAN_DIR, 'plugins', 'csv-allinone') @@ -21,13 +23,13 @@ def copy_files(): os.makedirs(TARGET_DIR, exist_ok=True) # 파일 복사 - for file_name in SOURCE_FILES: - source_path = os.path.abspath(file_name) - target_path = os.path.join(TARGET_DIR, file_name) + for source_file, target_file in SOURCE_FILES.items(): + source_path = os.path.abspath(source_file) + target_path = os.path.join(TARGET_DIR, target_file) if os.path.exists(source_path): shutil.copy2(source_path, target_path) - print(f"Copied {file_name} to {target_path}") + print(f"Copied {source_file} to {target_path}") else: print(f"Warning: Source file {source_path} not found.") diff --git a/esbuild.config.mjs b/esbuild.config.mjs index a5de8b8..78e6cd2 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -1,6 +1,7 @@ import esbuild from "esbuild"; import process from "process"; import builtins from "builtin-modules"; +import CssModulesPlugin from 'esbuild-css-modules-plugin'; const banner = `/* @@ -39,6 +40,15 @@ const context = await esbuild.context({ treeShaking: true, outfile: "main.js", minify: prod, + plugins: [ + CssModulesPlugin({ + force: true, + emitDeclarationFile: true, + localsConvention: 'camelCaseOnly', + namedExports: true, + inject: false, + }), + ], }); if (prod) { diff --git a/package-lock.json b/package-lock.json index f19bf80..b35a259 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,8 @@ "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", "builtin-modules": "3.3.0", - "esbuild": "0.17.3", + "esbuild": "^0.17.3", + "esbuild-css-modules-plugin": "^3.1.2", "obsidian": "latest", "tslib": "2.4.0" } @@ -1047,6 +1048,19 @@ "license": "MIT", "peer": true }, + "node_modules/detect-libc": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", + "integrity": "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "detect-libc": "bin/detect-libc.js" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/dir-glob": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", @@ -1112,6 +1126,23 @@ "@esbuild/win32-x64": "0.17.3" } }, + "node_modules/esbuild-css-modules-plugin": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/esbuild-css-modules-plugin/-/esbuild-css-modules-plugin-3.1.2.tgz", + "integrity": "sha512-XRpRuRT3m1Pk456djTvrq1AOEj+OB8sa8PdGN/Yha6eL8Im0TIYPq0CELgQU6DDKkHlYET++3sXZVjiF/kcgQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "lightningcss": "^1.24.1", + "lodash-es": "^4.17.21" + }, + "engines": { + "node": ">= 16.20.0" + }, + "peerDependencies": { + "esbuild": "*" + } + }, "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", @@ -1775,6 +1806,245 @@ "node": ">= 0.8.0" } }, + "node_modules/lightningcss": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.28.2.tgz", + "integrity": "sha512-ePLRrbt3fgjXI5VFZOLbvkLD5ZRuxGKm+wJ3ujCqBtL3NanDHPo/5zicR5uEKAPiIjBYF99BM4K4okvMznjkVA==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^1.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-darwin-arm64": "1.28.2", + "lightningcss-darwin-x64": "1.28.2", + "lightningcss-freebsd-x64": "1.28.2", + "lightningcss-linux-arm-gnueabihf": "1.28.2", + "lightningcss-linux-arm64-gnu": "1.28.2", + "lightningcss-linux-arm64-musl": "1.28.2", + "lightningcss-linux-x64-gnu": "1.28.2", + "lightningcss-linux-x64-musl": "1.28.2", + "lightningcss-win32-arm64-msvc": "1.28.2", + "lightningcss-win32-x64-msvc": "1.28.2" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.28.2.tgz", + "integrity": "sha512-/8cPSqZiusHSS+WQz0W4NuaqFjquys1x+NsdN/XOHb+idGHJSoJ7SoQTVl3DZuAgtPZwFZgRfb/vd1oi8uX6+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.28.2.tgz", + "integrity": "sha512-R7sFrXlgKjvoEG8umpVt/yutjxOL0z8KWf0bfPT3cYMOW4470xu5qSHpFdIOpRWwl3FKNMUdbKtMUjYt0h2j4g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.28.2.tgz", + "integrity": "sha512-l2qrCT+x7crAY+lMIxtgvV10R8VurzHAoUZJaVFSlHrN8kRLTvEg9ObojIDIexqWJQvJcVVV3vfzsEynpiuvgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.28.2.tgz", + "integrity": "sha512-DKMzpICBEKnL53X14rF7hFDu8KKALUJtcKdFUCW5YOlGSiwRSgVoRjM97wUm/E0NMPkzrTi/rxfvt7ruNK8meg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.28.2.tgz", + "integrity": "sha512-nhfjYkfymWZSxdtTNMWyhFk2ImUm0X7NAgJWFwnsYPOfmtWQEapzG/DXZTfEfMjSzERNUNJoQjPAbdqgB+sjiw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.28.2.tgz", + "integrity": "sha512-1SPG1ZTNnphWvAv8RVOymlZ8BDtAg69Hbo7n4QxARvkFVCJAt0cgjAw1Fox0WEhf4PwnyoOBaVH0Z5YNgzt4dA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.28.2.tgz", + "integrity": "sha512-ZhQy0FcO//INWUdo/iEdbefntTdpPVQ0XJwwtdbBuMQe+uxqZoytm9M+iqR9O5noWFaxK+nbS2iR/I80Q2Ofpg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.28.2.tgz", + "integrity": "sha512-alb/j1NMrgQmSFyzTbN1/pvMPM+gdDw7YBuQ5VSgcFDypN3Ah0BzC2dTZbzwzaMdUVDszX6zH5MzjfVN1oGuww==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.28.2.tgz", + "integrity": "sha512-WnwcjcBeAt0jGdjlgbT9ANf30pF0C/QMb1XnLnH272DQU8QXh+kmpi24R55wmWBwaTtNAETZ+m35ohyeMiNt+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.28.2", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.28.2.tgz", + "integrity": "sha512-3piBifyT3avz22o6mDKywQC/OisH2yDK+caHWkiMsF82i3m5wDBadyCjlCQ5VNgzYkxrWZgiaxHDdd5uxsi0/A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, "node_modules/locate-path": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", @@ -1792,6 +2062,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "dev": true, + "license": "MIT" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", diff --git a/package.json b/package.json index 38f4657..da683f0 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "@typescript-eslint/eslint-plugin": "5.29.0", "@typescript-eslint/parser": "5.29.0", "builtin-modules": "3.3.0", - "esbuild": "0.17.3", + "esbuild": "^0.17.3", + "esbuild-css-modules-plugin": "^3.1.2", "obsidian": "latest", "tslib": "2.4.0" } diff --git a/src/csvdisplay.ts b/src/csvdisplay.ts index 87c5764..d11cb22 100644 --- a/src/csvdisplay.ts +++ b/src/csvdisplay.ts @@ -1,6 +1,7 @@ import { App, Modal } from "obsidian"; import { CSVRow } from "./types"; import { readCSV_, saveCSV_ } from "./csvfilemanager"; +import './styles/modal.css'; export const createInputModal = async (app: App, headers: string[], fileName: string) => { const form = generateForm(headers); @@ -46,11 +47,11 @@ const generateForm = (headers: string[]): string => { `; } -const createInputField = (fieldName: string): string => { +const createInputField = (key: string): string => { return `
- - + +
`; } \ No newline at end of file diff --git a/src/styles/modal.css b/src/styles/modal.css new file mode 100644 index 0000000..ca10c60 --- /dev/null +++ b/src/styles/modal.css @@ -0,0 +1,21 @@ + +.css-input-form { + display: flex; + flex-direction: column; + gap: 1rem; +} + +.form-group { + display: flex; + justify-content: space-between; + gap: 0.5rem; +} + +.input-key { + text-align: left; + margin-right: 0.5rem; +} + +.input-value { + text-align: left; +} \ No newline at end of file