@kokoa/clotho-editor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +54 -0
- package/dist/chunk-UE32Q6U5.js +943 -0
- package/dist/chunk-UE32Q6U5.js.map +1 -0
- package/dist/clotho-editor.css +1921 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.js +425 -0
- package/dist/index.js.map +1 -0
- package/dist/main-SWHHYTLM.js +16214 -0
- package/dist/main-SWHHYTLM.js.map +1 -0
- package/docs/PORTING.md +136 -0
- package/package.json +64 -0
package/docs/PORTING.md
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Studio → clotho-editor 이식 계획
|
|
2
|
+
|
|
3
|
+
기존 Studio(비주얼 에디터)를 clotho 기반 독립 패키지로 옮기는 계획.
|
|
4
|
+
clotho 저장소의 [`TASKS.md`](../../clotho/TASKS.md) Phase 8에 대응한다.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. 조사 결과 (8.1)
|
|
9
|
+
|
|
10
|
+
Studio는 두 저장소에 거의 동일한 코드로 존재한다.
|
|
11
|
+
|
|
12
|
+
| 위치 | LOC | 비고 |
|
|
13
|
+
| -------------------------------------------------- | ----: | --------------------- |
|
|
14
|
+
| `shinkeonkim.github.io/src/dev-only/studio/` | 8,980 | 테스트 2개 포함 |
|
|
15
|
+
| `oh-my-blog/packages/animation-studio/src/legacy/` | 8,751 | 위를 패키지로 감싼 것 |
|
|
16
|
+
|
|
17
|
+
**clotho 코어에 대한 의존 경계가 좁다.** 엔진에서 가져오는 심볼을 전수 조사한 결과:
|
|
18
|
+
|
|
19
|
+
| 심볼 | 사용 파일 수 | clotho 대응 |
|
|
20
|
+
| -------------------------------------------------------------------------------- | -----------: | ------------------------- |
|
|
21
|
+
| `AnimationElement` 및 요소별 타입 | 12 | 동일 |
|
|
22
|
+
| `AnimationDef` | 11 | `AnimationDocument` |
|
|
23
|
+
| `animationDefSchema` | 4 | `animationDocumentSchema` |
|
|
24
|
+
| `SnapshotMap` | 4 | 동일 |
|
|
25
|
+
| `Anchor` | 4 | 동일 |
|
|
26
|
+
| `Appearance` / `PropertyTrack` / `TrackKeyframe` / `Chapter` / `AnimationEffect` | 각 1~3 | 동일 |
|
|
27
|
+
| `EntryMode` / `ExitMode` | 각 1 | 동일 |
|
|
28
|
+
| `computeSnapshot` / `activeAppearance` | 각 1 | 동일 |
|
|
29
|
+
| `ID_RE` | 2 | 동일 |
|
|
30
|
+
| `ANIM_DIR` (loader) | 2 | 호스트가 정한다 |
|
|
31
|
+
|
|
32
|
+
즉 **스키마와 런타임뿐이며 렌더러는 쓰지 않는다.** Studio는 자체 캔버스 미리보기를
|
|
33
|
+
갖고 있다(`canvas-preview.ts`). 이식은 import 경로 변경이 대부분이다.
|
|
34
|
+
|
|
35
|
+
### 규모가 큰 모듈
|
|
36
|
+
|
|
37
|
+
| 파일 | LOC | 성격 |
|
|
38
|
+
| ----------------- | -----: | -------------------------------------------- |
|
|
39
|
+
| `icon-data.ts` | 2,016 | 아이콘 SVG 데이터. 호스트 자산으로 분리 후보 |
|
|
40
|
+
| `canvas.ts` | 1,207 | 캔버스 상호작용(드래그·리사이즈·선택) |
|
|
41
|
+
| `properties.ts` | 623 | 속성 패널 |
|
|
42
|
+
| `timeline.ts` | 394 | 타임라인 |
|
|
43
|
+
| `canvas-utils.ts` | 318 | 좌표 변환 |
|
|
44
|
+
| `state/*` | 약 900 | 상태·히스토리·요소·타임라인 |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 2. clotho가 이미 대체하는 것
|
|
49
|
+
|
|
50
|
+
이식하지 말고 clotho를 쓸 것:
|
|
51
|
+
|
|
52
|
+
| Studio가 갖고 있던 것 | clotho |
|
|
53
|
+
| ---------------------------------------- | --------------------------------------------- |
|
|
54
|
+
| 자체 스냅샷 계산 | `computeSnapshot` |
|
|
55
|
+
| 자체 캔버스 미리보기 렌더 | `buildScene` + `clotho/dom` `patchScene` |
|
|
56
|
+
| 자체 타임라인 스크럽 시각 계산 | `createPlayer` — `seek()`가 그대로 스크럽이다 |
|
|
57
|
+
| 자체 앵커 좌표 계산 (`anchor-system.ts`) | `anchorPoint` / `resolveEndpoints` |
|
|
58
|
+
| 자체 좌표 변환 일부 (`canvas-utils.ts`) | `geometry/matrix` |
|
|
59
|
+
| 저장 전 검증 | `validateDocument` — 미지의 속성까지 잡는다 |
|
|
60
|
+
|
|
61
|
+
`canvas-preview.ts`를 `patchScene`으로 바꾸면 **에디터 미리보기와 배포된 애니메이션이
|
|
62
|
+
같은 렌더 경로를 쓴다.** 지금은 두 구현이 갈라져 있어 에디터에서 맞게 보이는 것이
|
|
63
|
+
사이트에서 다르게 보일 수 있다.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 3. v1 때문에 반드시 바뀌는 것
|
|
68
|
+
|
|
69
|
+
| 영역 | 변경 | 영향 |
|
|
70
|
+
| -------------------------- | --------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
71
|
+
| `studio-groups.ts` (187줄) | `childIds` → `parentId` | 그룹 편집 UI 재작성. **legacy 그룹은 렌더된 적이 없으므로 여기서 처음으로 실제 동작한다** |
|
|
72
|
+
| 이미지 요소 | `src` → `assetId` + `assets` 레지스트리 | 이미지 첨부 UI 신설 (`encodeImageAsset`) |
|
|
73
|
+
| `studio-image-upload.ts` | 업로드 엔드포인트 전제 | `inline`(base64) / `external` / `ref` 3택 |
|
|
74
|
+
| `state/types.ts` | `AnimationDef` | `AnimationDocument` |
|
|
75
|
+
| 트랙 편집 | — | `interpolate` 모드 선택 UI 추가 가능 |
|
|
76
|
+
| 검증 표시 | 없음 | `validateDocument` 결과를 패널에 표시 |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 4. 이식 결과 (8.3~8.6, 완료)
|
|
81
|
+
|
|
82
|
+
`oh-my-blog/packages/animation-studio`의 **v1 마이그레이션이 끝난 상태**를 원본으로
|
|
83
|
+
가져왔다. 재작성이 아니라 이식이고, v1 전환 작업(그룹 `parentId`, 이미지 `assetId`,
|
|
84
|
+
미리보기 교체)이 이미 반영돼 있었기 때문이다.
|
|
85
|
+
|
|
86
|
+
| 항목 | 결과 |
|
|
87
|
+
| --------- | ------------------------------------------- |
|
|
88
|
+
| 이식 규모 | 약 8,900 LOC (26 파일 + Studio/StudioMount) |
|
|
89
|
+
| typecheck | 0 errors |
|
|
90
|
+
| build | ESM + `.d.ts` + `styles.css` |
|
|
91
|
+
| 테스트 | 17 pass (그룹 9 · 에셋 7 · API 1) |
|
|
92
|
+
|
|
93
|
+
### 이식하며 바꾼 것
|
|
94
|
+
|
|
95
|
+
- **미리보기가 clotho를 쓴다.** `canvas-preview.ts`가 `clotho/dom`의 `mountStage`를
|
|
96
|
+
호출한다. 에디터와 배포본이 같은 `buildScene` + `patchScene`을 지나므로 두 렌더가
|
|
97
|
+
갈라질 수 없다.
|
|
98
|
+
- **`Studio.tsx`가 `AnimationStage` + `usePlayer`로 바뀌었다.** 에디터가 타임라인의
|
|
99
|
+
주인이고 플레이어는 미리보기 중일 때만 시계를 공급한다.
|
|
100
|
+
- **호스트 의존을 설정으로 뺐다** (8.6). `configureApi({ baseUrl })`와
|
|
101
|
+
`configureHost({ placeholderImageUrl })`. 기본값은 원래 값이라 기존 호스트는
|
|
102
|
+
아무것도 바꿀 필요가 없다.
|
|
103
|
+
- **그룹(8.4)·이미지(8.5)에 회귀 테스트를 붙였다.** 둘 다 legacy에 없던 동작이라
|
|
104
|
+
테스트가 없으면 동작 여부를 확인할 방법이 없다.
|
|
105
|
+
|
|
106
|
+
### 남은 정리
|
|
107
|
+
|
|
108
|
+
- `noUncheckedIndexedAccess`가 꺼져 있다. 켜면 84개 에러가 나오는데 전부 테스트 없이
|
|
109
|
+
도착한 코드의 미검사 인덱스 접근이다. 눈감고 고치면 버그를 찾는 게 아니라 동작을
|
|
110
|
+
바꾸게 되므로, `legacy/`를 모듈 단위로 다시 쓸 때 함께 켠다. clotho 본체는 켜져 있다.
|
|
111
|
+
- `legacy/` 라는 디렉터리 이름 자체가 정리 대상이다. clotho가 대체한 것
|
|
112
|
+
(`anchor-system`의 앵커 계산, `canvas-utils`의 좌표 변환 일부)을 걷어내면서
|
|
113
|
+
모듈을 제 위치로 옮긴다.
|
|
114
|
+
- `icon-data.ts` 2,016줄은 아이콘 SVG 데이터다. 호스트 자산으로 분리 후보.
|
|
115
|
+
|
|
116
|
+
## 5. 원래 계획했던 순서 (참고)
|
|
117
|
+
|
|
118
|
+
1. **상태 계층** (`state/*`) — v1 타입으로. 여기가 나머지 전부의 기반이다.
|
|
119
|
+
2. **히스토리** (`studio-history.ts`) — 순수하므로 그대로.
|
|
120
|
+
3. **캔버스 미리보기** → `buildScene` + `patchScene`으로 교체.
|
|
121
|
+
4. **캔버스 상호작용** (`canvas.ts`, `canvas-handles.ts`) — 좌표 변환은
|
|
122
|
+
`geometry/matrix`로.
|
|
123
|
+
5. **타임라인** → `createPlayer.seek()` 기반.
|
|
124
|
+
6. **속성 패널** — v1 필드에 맞춰. `parentId`, `assetId`, `interpolate` 추가.
|
|
125
|
+
7. **그룹 편집 UI** (8.4) — `parentId` 모델. 신규.
|
|
126
|
+
8. **이미지 첨부 UI** (8.5) — `encodeImageAsset` + `AssetResolver`.
|
|
127
|
+
9. **호스트 의존 기능 어댑터화** (8.6) — 아이콘 라이브러리, 저장/불러오기 API,
|
|
128
|
+
이미지 업로드. 전부 주입 인터페이스로.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 6. 전제 조건
|
|
133
|
+
|
|
134
|
+
`@kokoa/clotho`가 설치 가능해야 한다. 배포 전에는 `package.json`의 의존이
|
|
135
|
+
`"file:../clotho"`이며, 이 상태로 typecheck·build·테스트가 전부 통과한다. 배포 후
|
|
136
|
+
버전 지정으로 바꾼다.
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kokoa/clotho-editor",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Visual editor for clotho animation documents",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"packageManager": "bun@1.3.14",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE",
|
|
12
|
+
"docs"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./styles.css": "./dist/clotho-editor.css",
|
|
23
|
+
"./package.json": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsup",
|
|
27
|
+
"dev": "tsup --watch",
|
|
28
|
+
"test": "bun test",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"lint": "eslint .",
|
|
31
|
+
"format": "prettier --write .",
|
|
32
|
+
"format:check": "prettier --check .",
|
|
33
|
+
"release:check": "bun scripts/release-check.ts"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@kokoa/clotho": "^0.1.0",
|
|
37
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
38
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"react": {
|
|
42
|
+
"optional": true
|
|
43
|
+
},
|
|
44
|
+
"react-dom": {
|
|
45
|
+
"optional": true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@kokoa/clotho": "file:../clotho",
|
|
50
|
+
"@types/bun": "^1.1.14",
|
|
51
|
+
"@types/react": "^19.0.0",
|
|
52
|
+
"@types/react-dom": "^19.0.0",
|
|
53
|
+
"react": "^19.0.0",
|
|
54
|
+
"react-dom": "^19.0.0",
|
|
55
|
+
"typescript": "^5.7.2",
|
|
56
|
+
"tsup": "^8.3.5"
|
|
57
|
+
},
|
|
58
|
+
"keywords": [
|
|
59
|
+
"clotho",
|
|
60
|
+
"animation",
|
|
61
|
+
"editor",
|
|
62
|
+
"svg"
|
|
63
|
+
]
|
|
64
|
+
}
|