소비 라인 · 런타임
풀에서 고른 컴포넌트를 캔버스에 앉히는 구간.
생성과 대치가 같은 경로를 쓴다.
대치 3종(내용 · 스타일 · 이미지)은 전부 모양(sheet json)을 고치지만,
무엇을 근거로 고치는지는 셋이 다르다.
ColorProfile,
AI 프레젠테이션은 오프라인 파일 ThemeRegistry 를 쓴다.recolorComponent 다.CmdReplaceComponent
BySignature
EventHandler.ts:71
build
:95 에서 호출 · 4단계
Component
:118 → 캔버스 반영
packages/engine/editor/src/text-visualization/CmdReplaceComponentBySignatureEventHandler.ts 기준이다.comp-sign 시그니처(structureHash)로 후보를 검색하고 하나를 고른다.
서버가 돌려주는 것은 후보키와 파일 URL 이고,
큰 컬럼(텍스트 지도·노드 롤)은 브라우저가 그 URL 로 따로 받아 온다.
이 payload 가 §2 의 입력이 된다. 서버·브라우저 경계의 전체 지도는 web-2 역할 분담, 시그니처 자체의 구성은 Component Signature 에 있다.
원본 도식은 role 폰트 → 내용 → 스타일 → 이미지 였지만,
코드는 내용(:108) → role 폰트(:110) → 스타일(:116) → 이미지(:129) 다.
폰트 주입이 contentMappedSheetJson 을 입력으로 받으므로
순서가 뒤바뀔 수 없다 — 도식 쪽이 틀렸다.
여기가 도식과 코드가 가장 크게 갈리는 곳이다. «Style Meta 에 맞춘다»는 두 개의 서로 다른 구현을 하나로 뭉뚱그린 서술이었다.
| A · 내용시각화 (이 문서의 흐름) | B · AI 프레젠테이션 | |
|---|---|---|
| 진입 | TemplateStyleMapper.getMappedStyles | applyColorMapping |
| 테마 출처 | 런타임 추출 — getTemplateV2ByIdx 로 템플릿 페이지를 받아 buildColorProfile() | 오프라인 파일 — getTemplateStyleMetadata → styleMetadataFileUrl fetch |
| 테마 타입 | ColorProfile = { groups } | ThemeRegistry |
| 적용 함수 | recolorComponent(profile, targetBgHex, sheet) | 같은 iui 패키지의 색 매핑 |
| Component RLSC | 쓰지 않는다 — 계약 호환용으로 받기만 한다 | — |
| 캐시 | StyleMapperMemoryCache (최대 20) | fetch 결과 |
recolorComponent 의 입력
ColorProfile — 현재 템플릿 페이지에서 추출모양 + 테마 + 배경색. 의미(RLSC)는 들어가지 않는다.
테마는 어디서 오나
현재 페이지의 templateReference.key 를 읽어 템플릿 idx 를 얻고,
그 템플릿 페이지들을 받아 buildColorProfile() 로 색 프로파일을 만든다.
groups 가 비어 있으면 매핑 자체를 건너뛴다.
즉 목적지 색은 «지금 이 디자인이 쓰고 있는 템플릿»이 정한다 — 컴포넌트가 원래 무슨 색이었는지가 아니라.
mapComponentToThemeV2
(slots → keys → Visual Tree → features → candidates → scorer → Hungarian → apply)는
실재한다 — packages/color-mapper/src/v2/index.ts 머리말에 여덟 단계가 그대로 적혀 있다.
그런데 miricanvas-web-2 어디에서도 부르지 않는다.
고정 커밋에서 저장소 전체를 훑어 호출처가 0 임을 확인했다.
현재 사용처는 iui 저장소 안의 문서와 평가 스크립트뿐이다.
런타임이 실제로 쓰는 것은 같은 패키지의 recolor.ts:3181 recolorComponent 이고,
테마는 recolor.ts:1849 buildColorProfile 이 만든다.
v2 는 다음 세대이고, 지금 프로덕션은 recolor 다.
검색 · 랭킹
comp-sign 시그니처의 원료. 무엇을 후보로 올릴지와 그 순서를 정한다.
role 폰트 주입
2단계. 현 디자인의 role 별 폰트를 후보의 텍스트 노드에 입힌다.
structuredContent 를 직접 받는다.
이미지 대치의 role 게이트
4단계. 노드에 role 이 있고 그것이 Decoration 이 아닐 때만 후보로 삼고,
Background 는 따로 다룬다.
③의 근거는 replaceComponentImages.ts:116
(isCandidate(node.id) && !!node.role && normalizeRole(node.role) !== 'Decoration') 와
같은 파일 :169 (normalizeRole(node.role) === 'Background') 다.
대치 3종은 전부 모양(sheet json)을 고친다.
판단 근거는 의미(RLSC) — 단 검색·폰트·이미지 게이트에서만이고,
색 재배정에는 들어가지 않는다.
색의 목적지는 현재 템플릿에서 추출한 ColorProfile 이다.
| 단계 | 파일 · 줄 | 저장소 |
|---|---|---|
| 진입 (핸들러) | text-visualization/CmdReplaceComponentBySignatureEventHandler.ts:71 | web-2 |
| 4단계 오케스트레이션 | text-visualization/buildMappedComponentSheetJson.ts:91-138 | web-2 |
| 1 · 내용 대치 | node/item/component/buildSignatureMappedSheetJson.ts | web-2 |
| 2 · role 폰트 | style_replacement/_utils/ApplyRoleFontsToTextNodes.ts:60 | web-2 |
| 3 · 스타일 대치 | style_replacement/TemplateStyleMapper.ts:46 | web-2 |
| 3-내부 · recolor | packages/color-mapper/src/recolor.ts:3181 | iui |
| 3-내부 · 테마 추출 | packages/color-mapper/src/recolor.ts:1849 | iui |
| 3-차세대 · v2 8단계 | packages/color-mapper/src/v2/index.ts 미사용 | iui |
| 4 · 이미지 대치 | node/item/component/image-replacement/replaceComponentImages.ts:141 | web-2 |
| 검색 후보 해석 | miricanvas-legacy/.../text_visualization/_core/compSignSearch.ts:147 | web-2 |
| AIP 테마 경로 | style_replacement/colorMapping.ts | web-2 |
| 캔버스 반영 | node/item/component/ComponentItemReplaceCommand | web-2 |
web-2 경로는 별도 표기가 없으면 packages/engine/editor/src/ 아래다.