Skip to content

Commit ce6d87f

Browse files
authored
Merge pull request #7 from lee-sihun/refactor
Refactor
2 parents 07dda16 + 53a6262 commit ce6d87f

File tree

98 files changed

+6717
-3854
lines changed

Some content is hidden

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

98 files changed

+6717
-3854
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ node_modules
22
dist
33

44
.roo
5-
AGENTS.md
5+
AGENTS.md
6+
copilot-instructions.md

README.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,31 @@ https://github.com/user-attachments/assets/20fb118d-3982-4925-9004-9ce0936590c2
7878

7979
```
8080
DmNote/
81-
├── src/ # 소스 코드
82-
│ ├── main/ # Electron 메인 프로세스
83-
│ │ ├── config/ # 창 관련 설정
84-
│ │ ├── services/ # 백그라운드 서비스 (키보드 후킹, 설정 관리 등)
85-
│ │ └── windows/ # 창 생성 및 관리
86-
│ ├── renderer/ # React 렌더러 프로세스
87-
│ │ ├── assets/ # 정적 에셋
88-
│ │ ├── components/ # UI 컴포넌트
89-
│ │ ├── locales/ # 다국어 지원 (i18n)
90-
│ │ ├── stores/ # 전역 상태 관리 (Zustand)
91-
│ │ ├── utils/ # 유틸리티 함수
92-
│ │ └── windows/ # 각 창별 진입점
93-
│ └── types/ # TypeScript 타입 선언
94-
├── package.json # 프로젝트 의존성 및 실행 스크립트
95-
├── tailwind.config.js # Tailwind CSS 설정
96-
├── tsconfig.json # TypeScript 설정
97-
├── vite.config.ts # Vite 설정
81+
├─ src/ # 소스 코드
82+
│ ├─ main/ # Electron 메인 프로세스
83+
│ │ ├─ app/ # Application 부트스트랩
84+
│ │ ├─ core/ # ipcRouter, windowRegistry
85+
│ │ ├─ domains/ # 도메인 라우팅 (app, settings, keys, overlay, css, preset, system)
86+
│ │ │ ├─ keys/ # 키 매핑 기본값
87+
│ │ │ └─ positions/ # 키 포지션 기본값
88+
│ │ ├─ services/ # 서비스 (키보드 리스너 등)
89+
│ │ ├─ store/ # electron-store + zod 스키마
90+
│ │ ├─ windows/ # BrowserWindow 래퍼 + config
91+
│ │ ├─ preload.ts # contextBridge API 노출(window.api)
92+
│ │ └─ main.ts # 메인 진입점
93+
│ ├─ renderer/ # React 렌더러
94+
│ │ ├─ components/ # UI 컴포넌트
95+
│ │ ├─ hooks/ # 상태/동기화 훅
96+
│ │ ├─ stores/ # Zustand 스토어
97+
│ │ ├─ windows/ # 렌더러 윈도우 (main/overlay)
98+
│ │ ├─ styles/ # 전역/공통 스타일
99+
│ │ └─ assets/ # 정적 리소스
100+
│ └─ types/ # 공유 타입/스키마
101+
├─ package.json # 프로젝트 의존성 및 실행 스크립트
102+
├─ tsconfig.json # TypeScript (렌더러/공용) 설정
103+
├─ tsconfig.main.json # TypeScript (메인) 전용 설정
104+
├─ vite.config.ts # Vite (렌더러) 설정
105+
└─ dist/ # 빌드 결과물
98106
```
99107

100108
### 기본 설치 및 실행

docs/ipc-channels.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# IPC 채널 요약 (도메인별)
2+
3+
아래 표기는 메인 프로세스에서 노출하는 IPC 채널과 페이로드 개요입니다. `window.api``src/main/preload.ts`에서 래핑된 형태로 제공됩니다.
4+
5+
## 데이터 흐름 개요
6+
7+
- 초기화(앱 시작)
8+
1) 메인 `Application``electron-store` 스냅샷을 로드하고, 도메인/윈도우/서비스를 초기화합니다.
9+
2) 렌더러는 `window.api.app.bootstrap()`을 호출해 초기 스냅샷(Settings/Keys/Positions/CustomTabs/SelectedKeyType/Overlay)을 받습니다.
10+
3) `useAppBootstrap` 훅이 스냅샷을 Zustand 스토어에 반영하고, 아래 브로드캐스트 이벤트를 구독합니다.
11+
12+
- 변경(런타임)
13+
1) 렌더러가 `settings:update`, `keys:update` 등 invoke 채널을 호출합니다.
14+
2) 도메인이 입력을 `zod`로 정규화 후 `electron-store`에 저장, 필요한 부수효과(예: 오버레이 잠금/항상 위)를 적용합니다.
15+
3) 변경 결과를 각 브로드캐스트 채널(`settings:changed`, `keys:changed` 등)로 전파 → 렌더러 스토어가 구독해 동기화합니다.
16+
17+
- 입력 이벤트(키보드)
18+
- `KeyboardService`가 전역 키 이벤트를 수집하여 현재 모드에 한해 `keys:state` 이벤트로 오버레이 렌더러에 전달합니다.
19+
20+
## app
21+
- `app:bootstrap` (invoke)
22+
- 요청: `void`
23+
- 응답: `BootstrapPayload` (설정/키/포지션/커스텀탭/선택 탭/오버레이 상태)
24+
25+
## system
26+
- `window:minimize` (invoke)
27+
- `window:close` (invoke)
28+
- `app:open-external` (invoke)
29+
- 요청: `{ url: string }`
30+
- `app:restart` (invoke)
31+
32+
## settings
33+
- `settings:get` (invoke)
34+
- 응답: `SettingsState`
35+
- `settings:update` (invoke)
36+
- 요청: `Partial<SettingsState>` (중첩 필드는 필요한 부분만)
37+
- 응답: `SettingsState` (정규화된 전체 상태)
38+
- `settings:changed` (broadcast)
39+
- 페이로드: `SettingsState`
40+
41+
## keys / positions / customTabs
42+
- `keys:get` (invoke) → `KeyMappings`
43+
- `keys:update` (invoke) → 요청: `KeyMappings`, 응답: `KeyMappings`
44+
- `positions:get` (invoke) → `KeyPositions`
45+
- `positions:update` (invoke) → 요청: `KeyPositions`, 응답: `KeyPositions`
46+
- `keys:set-mode` (invoke) → 요청: `{ mode: string }`, 응답: `{ success: boolean; mode: string }`
47+
- `keys:reset-all` (invoke) → `{ keys: KeyMappings; positions: KeyPositions }`
48+
- `keys:reset-mode` (invoke) → 요청: `{ mode: string }`, 응답: `{ success: boolean; mode: string }`
49+
- `custom-tabs:list` (invoke) → `CustomTab[]`
50+
- `custom-tabs:create` (invoke) → 요청: `{ name: string }`, 응답: `{ result?: CustomTab; error?: string }`
51+
- `custom-tabs:delete` (invoke) → 요청: `{ id: string }`, 응답: `{ success: boolean; selected: string; error?: string }`
52+
- `custom-tabs:select` (invoke) → 요청: `{ id: string }`, 응답: `{ success: boolean; selected: string; error?: string }`
53+
54+
브로드캐스트
55+
- `keys:changed``KeyMappings`
56+
- `positions:changed``KeyPositions`
57+
- `keys:mode-changed``{ mode: string }`
58+
- `customTabs:changed``{ customTabs: CustomTab[]; selectedKeyType: string }`
59+
- `keys:state``{ key: string; state: string; mode: string }` (키보드 이벤트)
60+
61+
## overlay
62+
- `overlay:get` (invoke) → `{ visible: boolean; locked: boolean; anchor: string }`
63+
- `overlay:set-visible` (invoke) → 요청: `{ visible: boolean }`, 응답: `{ visible: boolean }`
64+
- `overlay:set-lock` (invoke) → 요청: `{ locked: boolean }`, 응답: `{ locked: boolean }`
65+
- `overlay:set-anchor` (invoke) → 요청: `{ anchor: string }`, 응답: `{ anchor: string }`
66+
- `overlay:resize` (invoke)
67+
- 요청: `{ width: number; height: number; anchor?: string; contentTopOffset?: number }`
68+
- 응답: `{ bounds?: { x: number; y: number; width: number; height: number }; error?: string }`
69+
70+
브로드캐스트
71+
- `overlay:visibility``{ visible: boolean }`
72+
- `overlay:lock``{ locked: boolean }`
73+
- `overlay:anchor``{ anchor: string }`
74+
- `overlay:resized``{ x: number; y: number; width: number; height: number }`
75+
76+
## css
77+
- `css:get` (invoke) → `CustomCss`
78+
- `css:get-use` (invoke) → `boolean`
79+
- `css:toggle` (invoke) → 요청: `{ enabled: boolean }`, 응답: `{ enabled: boolean }`
80+
- `css:load` (invoke) → `{ success: boolean; content?: string; path?: string; error?: string }`
81+
- `css:set-content` (invoke) → 요청: `{ content: string }`, 응답: `{ success?: true; error?: string }`
82+
- `css:reset` (invoke)
83+
84+
브로드캐스트
85+
- `css:use``{ enabled: boolean }`
86+
- `css:content``CustomCss`
87+
88+
## preset
89+
- `preset:save` (invoke) → `{ success: boolean; error?: string }`
90+
- `preset:load` (invoke) → `{ success: boolean; error?: string }`
91+
- 로드 성공 시 관련 상태 채널(`keys:*`, `positions:*`, `customTabs:changed`, `settings:changed`, `css:*`)이 일괄 브로드캐스트됩니다.

docs/readme_en.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,31 @@ Set it up in minutes and visualize your keystrokes for streams or gameplay captu
7676

7777
```
7878
DmNote/
79-
├── src/ # Source code
80-
│ ├── main/ # Electron main process
81-
│ │ ├── config/ # Window-related configuration
82-
│ │ ├── services/ # Background services (keyboard hook, settings, etc)
83-
│ │ └── windows/ # Window creation and management
84-
│ ├── renderer/ # React renderer process
85-
│ │ ├── assets/ # Static assets
86-
│ │ ├── components/ # UI components
87-
│ │ ├── locales/ # i18n files
88-
│ │ ├── stores/ # Global state (Zustand)
89-
│ │ ├── utils/ # Utility functions
90-
│ │ └── windows/ # Entry points per window
91-
│ └── types/ # TypeScript type definitions
92-
├── package.json # Dependencies and scripts
93-
├── tailwind.config.js # Tailwind CSS configuration
94-
├── tsconfig.json # TypeScript configuration
95-
├── vite.config.ts # Vite configuration
79+
├── src/ # Source code
80+
│ ├── main/ # Electron main process
81+
│ │ ├── app/ # Application bootstrap
82+
│ │ ├── core/ # ipcRouter, windowRegistry
83+
│ │ ├── domains/ # Domain routing (app, settings, keys, overlay, css, preset, system)
84+
│ │ │ ├── keys/ # Default key mappings
85+
│ │ │ └── positions/ # Default key positions
86+
│ │ ├── services/ # Services (keyboard listener, etc.)
87+
│ │ ├── store/ # electron-store + Zod schema
88+
│ │ ├── windows/ # BrowserWindow wrapper + config
89+
│ │ ├── preload.ts # Expose contextBridge API (window.api)
90+
│ │ └── main.ts # Main entry point
91+
│ ├── renderer/ # React renderer
92+
│ │ ├── components/ # UI components
93+
│ │ ├── hooks/ # State/sync hooks
94+
│ │ ├── stores/ # Zustand stores
95+
│ │ ├── windows/ # Renderer windows (main/overlay)
96+
│ │ ├── styles/ # Global/common styles
97+
│ │ └── assets/ # Static assets
98+
│ └── types/ # Shared types/schemas
99+
├── package.json # Project dependencies and scripts
100+
├── tsconfig.json # TypeScript (renderer/shared) config
101+
├── tsconfig.main.json # TypeScript (main) config
102+
├── vite.config.ts # Vite (renderer) config
103+
└── dist/ # Build output
96104
```
97105

98106
### Basic setup and run

jsconfig.json

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

0 commit comments

Comments
 (0)