rig-review 0.25.2 → 1.0.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/docs/PANELS.md +4 -0
- package/docs/REVIEW_PACKAGE.md +1 -1
- package/package.json +2 -2
- package/src/front.ts +1 -1
- package/src/turn-pad.ts +17 -0
- package/web/catalog-en.ts +49 -0
- package/web/catalog-ko.ts +49 -0
- package/web/compare.css +2 -2
- package/web/i18n.ts +411 -15
- package/web/part-selection.ts +1 -1
- package/web/styles.css +2 -2
- package/web/turn-pad.ts +4 -4
package/docs/PANELS.md
CHANGED
|
@@ -397,6 +397,10 @@ are supported. No degrees or range are inferred from the art or the bone name.
|
|
|
397
397
|
|
|
398
398
|
**Applied** is the eased value sent through published Play's `player.adjust` /
|
|
399
399
|
`BoneAdjust`, before constraints and physics; **target** is the pointer's value.
|
|
400
|
+
Each readout reserves monospace character width from its dial's own `[min, max]`
|
|
401
|
+
range and display precision (rounded to two decimals, or scaled for sub-unit
|
|
402
|
+
spans) so live values never change the pad's row wrapping or height; the number
|
|
403
|
+
field and `data-value` retain the exact value.
|
|
400
404
|
The number field edits the target, applies that exact value immediately and turns
|
|
401
405
|
**Hold** on. Hold freezes the current applied values and cancels pending travel;
|
|
402
406
|
**Reset 0** applies zero and holds it. Neither operation changes inspection time.
|
package/docs/REVIEW_PACKAGE.md
CHANGED
|
@@ -587,7 +587,7 @@ Browser players retain play's default DOM mode and default mesh backend. Rigid
|
|
|
587
587
|
parts remain DOM images; a WebGL mesh label does not claim full-frame GL drawing.
|
|
588
588
|
WebGL is requested by the published default, with Canvas2D as the supported mesh
|
|
589
589
|
fallback. Accurate public actual-flush telemetry requires play 1.11.1 or later;
|
|
590
|
-
this checkout consumes pinned 1.
|
|
590
|
+
this checkout consumes pinned 1.22.1. The consumer does not probe GL or inspect
|
|
591
591
|
private renderer state. The separate Node strip exporter remains Canvas2D.
|
|
592
592
|
|
|
593
593
|
The backend badge is sampled only after successful draw/frame calls. Fresh mesh
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rig-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local human rig inspection and structured feedback export",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@napi-rs/canvas": "1.0.11",
|
|
22
|
-
"@rig-c/play": "1.
|
|
22
|
+
"@rig-c/play": "1.22.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/bun": "^1.3.0",
|
package/src/front.ts
CHANGED
|
@@ -164,7 +164,7 @@ export function startFront(options:{control:string;port:number;nonce:string;fing
|
|
|
164
164
|
}});
|
|
165
165
|
return {origin,stop:()=>server.stop(true),idleMs:()=>performance.now()-last,active:()=>active};
|
|
166
166
|
}
|
|
167
|
-
async function liveInstances(control:string):Promise<boolean>{for(const name of
|
|
167
|
+
async function liveInstances(control:string):Promise<boolean>{let names:string[];try{names=await readdir(control);}catch(e){if((e as NodeJS.ErrnoException).code==='ENOENT')return false;throw e;}for(const name of names){if(/^[a-f0-9]{64}\.claim$/.test(name))return true;if(/^[a-f0-9]{64}\.json$/.test(name)){const row=await readRecord(join(control,name),name.slice(0,64)).catch(()=>null);if(row&&running(row.pid))return true;}}return false;}
|
|
168
168
|
export async function runFront(requestPath:string):Promise<void>{
|
|
169
169
|
const spec=await smallJson(requestPath) as FrontRequest;if(spec?.schema!=='rig-review-front-request/1'||!uuid.test(spec.nonce??'')||!hex64.test(spec.fingerprint??'')||!Number.isSafeInteger(spec.port)||spec.port<1||spec.port>65535||!Number.isSafeInteger(spec.idleMs)||spec.idleMs<100)throw new Error('front: invalid request');
|
|
170
170
|
const control=await realpath(spec.control);if(dirname(await realpath(requestPath))!==control||spec.request!==requestPath||spec.record!==join(control,frontName(spec.port)+'.json'))throw new Error('front: invalid state locations');
|
package/src/turn-pad.ts
CHANGED
|
@@ -33,6 +33,23 @@ export function pointerPosition(x:number,y:number,rect:{left:number;top:number;w
|
|
|
33
33
|
return rect.width>0&&rect.height>0?[clamp((x-rect.left)/rect.width*2-1,-1,1),clamp(1-(y-rect.top)/rect.height*2,-1,1)]:[0,0];
|
|
34
34
|
}
|
|
35
35
|
export function normalizedDial(n:number,range:{min:number;max:number}):number {const v=clamp(n,-1,1),zero=clamp(0,range.min,range.max);return clamp(zero+Math.abs(v)*((v<0?range.min:range.max)-zero),range.min,range.max);}
|
|
36
|
+
/** Display precision for `<output>` readouts: 2 decimals for spans >= 1, scaled up (at most 6) for sub-unit ranges. */
|
|
37
|
+
export function turnDialPrecision(range:{min:number;max:number},precision?:number):number {
|
|
38
|
+
if(precision!==undefined){if(!Number.isInteger(precision)||precision<0||precision>6)throw new Error('TURN_PRECISION_INVALID');return precision;}
|
|
39
|
+
const span=Math.abs(range.max-range.min);
|
|
40
|
+
return span>0&&span<1?Math.min(6,Math.max(2,Math.ceil(-Math.log10(span))+2)):2;
|
|
41
|
+
}
|
|
42
|
+
/** Rounded display text for `<output>`; the number input and `dataset.value` keep the exact value. */
|
|
43
|
+
export function formatTurnValue(value:number,range:{min:number;max:number},precision=turnDialPrecision(range)):string {
|
|
44
|
+
const p=turnDialPrecision(range,precision);
|
|
45
|
+
return String(Number(value.toFixed(p))||0);
|
|
46
|
+
}
|
|
47
|
+
/** Widest character count (`ch`) reachable in `[range.min, range.max]` at `precision`, including minus sign and decimal point. */
|
|
48
|
+
export function turnDialWidthCh(range:{min:number;max:number},precision=turnDialPrecision(range)):number {
|
|
49
|
+
if(!finite(range.min)||!finite(range.max)||range.min>=range.max)throw new Error('TURN_RANGE_INVALID');
|
|
50
|
+
const p=turnDialPrecision(range,precision);
|
|
51
|
+
return Math.max(range.min.toFixed(p).length,range.max.toFixed(p).length);
|
|
52
|
+
}
|
|
36
53
|
/** Exact critically damped solution from https://rig-c.org/demos/head-turn/bundle/app.js (HEAD_SPRING_OMEGA0=20). */
|
|
37
54
|
export function springStep(s:{x:number;v:number},target:number,dt:number,omega=20):void {
|
|
38
55
|
if(!(dt>0)||!finite(dt))return;const e=s.x-target,tau=omega*dt,exp=Math.exp(-tau),x=target+(e*(1+tau)+s.v*dt)*exp,v=(s.v*(1-tau)-omega*omega*dt*e)*exp;
|
package/web/catalog-en.ts
CHANGED
|
@@ -2953,4 +2953,53 @@ export const enCatalog: Readonly<Record<string, string>> = {
|
|
|
2953
2953
|
"Comment {0}: {1}": "Comment {0}: {1}",
|
|
2954
2954
|
"Comment {0}:": "Comment {0}:",
|
|
2955
2955
|
"{0} s (seconds basis) · frame is unavailable: no explicit producer frame index at this time (COMMENT_FRAME_UNAVAILABLE)": "{0} s (seconds basis) · frame is unavailable: no explicit producer frame index at this time (COMMENT_FRAME_UNAVAILABLE)",
|
|
2956
|
+
"{0} split at": "{0} split at",
|
|
2957
|
+
"{0} split into": "{0} split into",
|
|
2958
|
+
"{0} hold tip": "{0} hold tip",
|
|
2959
|
+
"{0} length ratio": "{0} length ratio",
|
|
2960
|
+
"{0} strength trunk": "{0} strength trunk",
|
|
2961
|
+
"{0} strength branch": "{0} strength branch",
|
|
2962
|
+
"{0} strength edge": "{0} strength edge",
|
|
2963
|
+
"{0} alternate damping": "{0} alternate damping",
|
|
2964
|
+
"{0} wind [root, tip]": "{0} wind [root, tip]",
|
|
2965
|
+
"{0} gravity [root, tip]": "{0} gravity [root, tip]",
|
|
2966
|
+
"{0} swing scales": "{0} swing scales",
|
|
2967
|
+
"{0} influence across": "{0} influence across",
|
|
2968
|
+
"{0} influence max": "{0} influence max",
|
|
2969
|
+
"{0} influence shape": "{0} influence shape",
|
|
2970
|
+
"{0} influence radius": "{0} influence radius",
|
|
2971
|
+
"built by {0}": "built by {0}",
|
|
2972
|
+
"{0} regions": "{0} regions",
|
|
2973
|
+
"{0} stops": "{0} stops",
|
|
2974
|
+
"blink": "blink",
|
|
2975
|
+
"Inspect {0}": "Inspect {0}",
|
|
2976
|
+
" · region {0}": " · region {0}",
|
|
2977
|
+
" · sequence {0}": " · sequence {0}",
|
|
2978
|
+
"region {0}": "region {0}",
|
|
2979
|
+
"sequence {0}": "sequence {0}",
|
|
2980
|
+
" · bone · parent {0} · bones[{1}]": " · bone · parent {0} · bones[{1}]",
|
|
2981
|
+
" · chain · parent {0} · bones[{1}]": " · chain · parent {0} · bones[{1}]",
|
|
2982
|
+
" · physics · bone {0} · {1}": " · physics · bone {0} · {1}",
|
|
2983
|
+
"Apex L, Cleavage": "Apex L, Cleavage",
|
|
2984
|
+
"Apex R, Cleavage": "Apex R, Cleavage",
|
|
2985
|
+
"Apex R, Apex L": "Apex R, Apex L",
|
|
2986
|
+
"baseline: not run — {0}": "baseline: not run — {0}",
|
|
2987
|
+
"baseline: not run — {0} ({1} s)": "baseline: not run — {0} ({1} s)",
|
|
2988
|
+
"baseline: reproduced — rig.json {0}… = inspected {1}…": "baseline: reproduced — rig.json {0}… = inspected {1}…",
|
|
2989
|
+
"baseline: reproduced — rig.json {0}… = inspected {1}… ({2} s)": "baseline: reproduced — rig.json {0}… = inspected {1}… ({2} s)",
|
|
2990
|
+
"baseline: not reproduced — {0}": "baseline: not reproduced — {0}",
|
|
2991
|
+
"baseline: not reproduced — {0} ({1} s)": "baseline: not reproduced — {0} ({1} s)",
|
|
2992
|
+
"baseline: unavailable — MODELING_INPUT_UNAVAILABLE: {0}": "baseline: unavailable — MODELING_INPUT_UNAVAILABLE: {0}",
|
|
2993
|
+
"image · {0}": "image · {0}",
|
|
2994
|
+
"{0} · image": "{0} · image",
|
|
2995
|
+
"video · {0}": "video · {0}",
|
|
2996
|
+
"{0} · video": "{0} · video",
|
|
2997
|
+
"pose · {0}": "pose · {0}",
|
|
2998
|
+
"{0} · pose": "{0} · pose",
|
|
2999
|
+
"maxInfluences (influences)": "maxInfluences (influences)",
|
|
3000
|
+
"absent": "absent",
|
|
3001
|
+
"front": "front",
|
|
3002
|
+
"back": "back",
|
|
3003
|
+
"@rig-c/pose is not installed beside the package or beside review, and review does not install it — bun add -d @rig-c/pose": "@rig-c/pose is not installed beside the package or beside review, and review does not install it — bun add -d @rig-c/pose",
|
|
3004
|
+
"CHEST_REGION_VALUE_INVALID contour tolerance": "CHEST_REGION_VALUE_INVALID contour tolerance",
|
|
2956
3005
|
};
|
package/web/catalog-ko.ts
CHANGED
|
@@ -2953,4 +2953,53 @@ export const koCatalog: Readonly<Record<string, string>> = {
|
|
|
2953
2953
|
"Comment {0}: {1}": "코멘트 {0}: {1}",
|
|
2954
2954
|
"Comment {0}:": "코멘트 {0}:",
|
|
2955
2955
|
"{0} s (seconds basis) · frame is unavailable: no explicit producer frame index at this time (COMMENT_FRAME_UNAVAILABLE)": "{0}초 (초 기준) · 프레임을 사용할 수 없음: 현재 시간에 명시적 프로듀서 프레임 인덱스가 없습니다 (COMMENT_FRAME_UNAVAILABLE)",
|
|
2956
|
+
"{0} split at": "{0} 분할 지점(split at)",
|
|
2957
|
+
"{0} split into": "{0} 분할 개수(split into)",
|
|
2958
|
+
"{0} hold tip": "{0} 팁 고정(hold tip)",
|
|
2959
|
+
"{0} length ratio": "{0} 길이 비율",
|
|
2960
|
+
"{0} strength trunk": "{0} 줄기 강도(strength trunk)",
|
|
2961
|
+
"{0} strength branch": "{0} 가지 강도(strength branch)",
|
|
2962
|
+
"{0} strength edge": "{0} 가장자리 강도(strength edge)",
|
|
2963
|
+
"{0} alternate damping": "{0} 교차 감쇠(alternate damping)",
|
|
2964
|
+
"{0} wind [root, tip]": "{0} 바람 [루트, 팁]",
|
|
2965
|
+
"{0} gravity [root, tip]": "{0} 중력 [루트, 팁]",
|
|
2966
|
+
"{0} swing scales": "{0} 스윙 배율(swing scales)",
|
|
2967
|
+
"{0} influence across": "{0} 가로 영향력(influence across)",
|
|
2968
|
+
"{0} influence max": "{0} 최대 영향력(influence max)",
|
|
2969
|
+
"{0} influence shape": "{0} 영향 형태(influence shape)",
|
|
2970
|
+
"{0} influence radius": "{0} 영향 반경(influence radius)",
|
|
2971
|
+
"built by {0}": "빌드 방식: {0}",
|
|
2972
|
+
"{0} regions": "영역 {0}개",
|
|
2973
|
+
"{0} stops": "스톱 {0}개",
|
|
2974
|
+
"blink": "눈 깜빡임",
|
|
2975
|
+
"Inspect {0}": "{0} 점검",
|
|
2976
|
+
" · region {0}": " · 영역 {0}",
|
|
2977
|
+
" · sequence {0}": " · 시퀀스 {0}",
|
|
2978
|
+
"region {0}": "영역 {0}",
|
|
2979
|
+
"sequence {0}": "시퀀스 {0}",
|
|
2980
|
+
" · bone · parent {0} · bones[{1}]": " · 본 · 부모 {0} · bones[{1}]",
|
|
2981
|
+
" · chain · parent {0} · bones[{1}]": " · 체인 · 부모 {0} · bones[{1}]",
|
|
2982
|
+
" · physics · bone {0} · {1}": " · 물리 · 본 {0} · {1}",
|
|
2983
|
+
"Apex L, Cleavage": "왼쪽 정점(Apex L), 골(Cleavage)",
|
|
2984
|
+
"Apex R, Cleavage": "오른쪽 정점(Apex R), 골(Cleavage)",
|
|
2985
|
+
"Apex R, Apex L": "오른쪽 정점(Apex R), 왼쪽 정점(Apex L)",
|
|
2986
|
+
"baseline: not run — {0}": "베이스라인: 실행 안 됨 — {0}",
|
|
2987
|
+
"baseline: not run — {0} ({1} s)": "베이스라인: 실행 안 됨 — {0} ({1}초)",
|
|
2988
|
+
"baseline: reproduced — rig.json {0}… = inspected {1}…": "베이스라인: 재현됨 — rig.json {0}… = 점검 대상 {1}…",
|
|
2989
|
+
"baseline: reproduced — rig.json {0}… = inspected {1}… ({2} s)": "베이스라인: 재현됨 — rig.json {0}… = 점검 대상 {1}… ({2}초)",
|
|
2990
|
+
"baseline: not reproduced — {0}": "베이스라인: 재현되지 않음 — {0}",
|
|
2991
|
+
"baseline: not reproduced — {0} ({1} s)": "베이스라인: 재현되지 않음 — {0} ({1}초)",
|
|
2992
|
+
"baseline: unavailable — MODELING_INPUT_UNAVAILABLE: {0}": "베이스라인: 사용 불가 — MODELING_INPUT_UNAVAILABLE: {0}",
|
|
2993
|
+
"image · {0}": "이미지 · {0}",
|
|
2994
|
+
"{0} · image": "{0} · 이미지",
|
|
2995
|
+
"video · {0}": "비디오 · {0}",
|
|
2996
|
+
"{0} · video": "{0} · 비디오",
|
|
2997
|
+
"pose · {0}": "포즈 · {0}",
|
|
2998
|
+
"{0} · pose": "{0} · 포즈",
|
|
2999
|
+
"maxInfluences (influences)": "최대 영향 수(maxInfluences)",
|
|
3000
|
+
"absent": "없음",
|
|
3001
|
+
"front": "앞",
|
|
3002
|
+
"back": "뒤",
|
|
3003
|
+
"@rig-c/pose is not installed beside the package or beside review, and review does not install it — bun add -d @rig-c/pose": "패키지 또는 리뷰 옆에 @rig-c/pose가 설치되어 있지 않으며 리뷰가 직접 설치하지 않습니다 — bun add -d @rig-c/pose",
|
|
3004
|
+
"CHEST_REGION_VALUE_INVALID contour tolerance": "CHEST_REGION_VALUE_INVALID: 윤곽 허용 오차(contour tolerance)",
|
|
2956
3005
|
};
|
package/web/compare.css
CHANGED
|
@@ -127,8 +127,8 @@ body{display:grid;grid-template-rows:auto minmax(0,1fr) auto}.layout{grid-templa
|
|
|
127
127
|
.turn-pad{display:flex;align-items:center;flex-wrap:wrap;gap:8px 14px;padding:8px 12px}
|
|
128
128
|
.turn-pad>span{color:var(--fg-muted);font-size:11px}
|
|
129
129
|
.turn-pad label{display:flex;align-items:center;gap:5px;font-size:11px;white-space:nowrap}
|
|
130
|
-
.turn-pad input[type=number]{width:
|
|
131
|
-
.turn-pad output{font-variant-numeric:tabular-nums;color:var(--fg-strong)}
|
|
130
|
+
.turn-pad input[type=number]{width:64px;color:var(--fg);background:var(--rv-control);border:1px solid var(--border-strong);padding:4px}
|
|
131
|
+
.turn-pad output{display:inline-block;font-family:var(--font-mono);font-variant-numeric:tabular-nums;text-align:right;color:var(--fg-strong)}
|
|
132
132
|
.turn-pad button[aria-pressed=true]{border-color:var(--pass);color:var(--pass)}
|
|
133
133
|
#turn-pad-host>p{margin:0 12px 6px}
|
|
134
134
|
|
package/web/i18n.ts
CHANGED
|
@@ -170,6 +170,12 @@ function ensureMaps(): { enToKo: Map<string, string>; koToEn: Map<string, string
|
|
|
170
170
|
if (!enToKoMap.has(enSub)) enToKoMap.set(enSub, koSub);
|
|
171
171
|
if (!koToEnMap.has(koSub)) koToEnMap.set(koSub, enSub);
|
|
172
172
|
}
|
|
173
|
+
if (/^ \([^(){}]+\)$/.test(en) && /^ \([^(){}]+\)$/.test(ko)) {
|
|
174
|
+
const enPre = `{0}${en}`;
|
|
175
|
+
const koPre = `{0}${ko}`;
|
|
176
|
+
if (!enToKoMap.has(enPre)) enToKoMap.set(enPre, koPre);
|
|
177
|
+
if (!koToEnMap.has(koPre)) koToEnMap.set(koPre, enPre);
|
|
178
|
+
}
|
|
173
179
|
const enCode = /^([A-Z][A-Z0-9_]{2,}):\s+([\s\S]+)$/.exec(en);
|
|
174
180
|
const koCode = /^([A-Z][A-Z0-9_]{2,}):\s+([\s\S]+)$/.exec(ko);
|
|
175
181
|
if (enCode && koCode && enCode[1] === koCode[1]) {
|
|
@@ -184,6 +190,14 @@ function ensureMaps(): { enToKo: Map<string, string>; koToEn: Map<string, string
|
|
|
184
190
|
if (!enToKoMap.has(enTrim)) enToKoMap.set(enTrim, koTrim);
|
|
185
191
|
if (!koToEnMap.has(koTrim)) koToEnMap.set(koTrim, enTrim);
|
|
186
192
|
}
|
|
193
|
+
if (en.endsWith('.') && !en.endsWith('..') && ko.endsWith('.') && !ko.endsWith('..')) {
|
|
194
|
+
const enNoDot = en.slice(0, -1);
|
|
195
|
+
const koNoDot = ko.slice(0, -1);
|
|
196
|
+
if (enNoDot && koNoDot) {
|
|
197
|
+
if (!enToKoMap.has(enNoDot)) enToKoMap.set(enNoDot, koNoDot);
|
|
198
|
+
if (!koToEnMap.has(koNoDot)) koToEnMap.set(koNoDot, enNoDot);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
187
201
|
}
|
|
188
202
|
return { enToKo: enToKoMap, koToEn: koToEnMap };
|
|
189
203
|
}
|
|
@@ -215,33 +229,67 @@ function buildPatterns(fromCatalog: Readonly<Record<string, string>>, toCatalog:
|
|
|
215
229
|
if (!srcPattern || !dstPattern || srcPattern === dstPattern) continue;
|
|
216
230
|
if (!srcPattern.includes('{0}')) continue;
|
|
217
231
|
const literalOnly = srcPattern.replace(tokenRe, '').trim();
|
|
232
|
+
const alphaKoOnly = literalOnly.replace(/[^A-Za-z가-힣]+/g, '');
|
|
218
233
|
// Skip bare structural patterns that have no alphabetic or Korean words of their own
|
|
219
|
-
if (
|
|
234
|
+
if (alphaKoOnly.length === 0 || alphaKoOnly === '의') {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
220
237
|
const paramOrder: number[] = [];
|
|
238
|
+
const hasDotSep = srcPattern.includes(' · ') && literalOnly.length > 8;
|
|
239
|
+
const charUnit = hasDotSep
|
|
240
|
+
? '[\\s\\S]'
|
|
241
|
+
: alphaKoOnly.length < 2
|
|
242
|
+
? '(?:(?!\\. |\\n| · )[\\s\\S])'
|
|
243
|
+
: '(?:(?! · )[\\s\\S])';
|
|
221
244
|
const isShortOpenEnded =
|
|
222
|
-
/^\{\d+\}
|
|
223
|
-
/\{\d+\}$/.test(srcPattern) &&
|
|
245
|
+
/^\{\d+\} [A-Za-z가-힣()/+-]+ \{\d+\}$/.test(srcPattern) &&
|
|
224
246
|
literalOnly.length < 10 &&
|
|
225
247
|
!literalOnly.includes('·') &&
|
|
226
248
|
!literalOnly.includes(':');
|
|
227
249
|
let regexBody = '^';
|
|
228
250
|
let lastIndex = 0;
|
|
229
251
|
let match: RegExpExecArray | null;
|
|
252
|
+
let prevWasOptionalPrefix = false;
|
|
230
253
|
tokenRe.lastIndex = 0;
|
|
231
254
|
while ((match = tokenRe.exec(srcPattern)) !== null) {
|
|
232
255
|
const literalChunk = srcPattern.slice(lastIndex, match.index);
|
|
233
256
|
regexBody += literalChunk.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
234
257
|
paramOrder.push(Number(match[1]));
|
|
258
|
+
const tokenStart = match.index;
|
|
235
259
|
lastIndex = match.index + match[0].length;
|
|
236
260
|
const isAtEnd = lastIndex === srcPattern.length;
|
|
237
|
-
const
|
|
261
|
+
const afterToken = srcPattern.slice(lastIndex);
|
|
262
|
+
const beforeToken = srcPattern.slice(0, tokenStart);
|
|
263
|
+
const nextIsToken = afterToken.startsWith('{');
|
|
264
|
+
const isOptionalPrefix: boolean =
|
|
265
|
+
(tokenStart === 0 || (beforeToken.endsWith('}') && prevWasOptionalPrefix)) &&
|
|
266
|
+
(afterToken.startsWith('Readings of ') ||
|
|
267
|
+
afterToken.startsWith('retarget ') ||
|
|
268
|
+
afterToken.startsWith('build ') ||
|
|
269
|
+
afterToken.startsWith('빌드 ') ||
|
|
270
|
+
/^\{\d+\}(?: op\b| ops\b| 작업\b|build |빌드 | \{\d+\} \+ (?:compile|컴파일) | 측정: )/.test(afterToken));
|
|
271
|
+
const prevIsNonPrefixToken = beforeToken.endsWith('}') && !prevWasOptionalPrefix;
|
|
272
|
+
const isAttachedAfterWord = /(?:[a-z가-힣]|[A-Z]{2}|[)\]]|\}\u2026)$/.test(beforeToken);
|
|
273
|
+
const isAttachedBeforePunct = /^(?:[.,):;]| · | — )/.test(afterToken);
|
|
274
|
+
const isOptionalSuffix =
|
|
275
|
+
prevIsNonPrefixToken ||
|
|
276
|
+
(isAttachedAfterWord && (isAttachedBeforePunct || nextIsToken || isAtEnd));
|
|
277
|
+
// A bare space opens a suffix only after a literal: beside another placeholder it would split that placeholder's value.
|
|
278
|
+
const spaceDelim = beforeToken.endsWith('}') ? '' : '| ';
|
|
279
|
+
const optDelim = '(?:|(?: · | — | \\(|, |; |\\[| —' + spaceDelim + ')' + charUnit + '*?)';
|
|
280
|
+
const optDelimEnd = '(?:|(?: · | — | \\(|, |; |\\[| —' + spaceDelim + ')' + charUnit + '*)';
|
|
238
281
|
regexBody += isShortOpenEnded
|
|
239
282
|
? '([^\\s]+)'
|
|
240
|
-
:
|
|
241
|
-
?
|
|
242
|
-
:
|
|
243
|
-
?
|
|
244
|
-
|
|
283
|
+
: isOptionalPrefix
|
|
284
|
+
? `(${charUnit}*?)`
|
|
285
|
+
: isOptionalSuffix
|
|
286
|
+
? isAtEnd
|
|
287
|
+
? `(${optDelimEnd})`
|
|
288
|
+
: `(${optDelim})`
|
|
289
|
+
: isAtEnd
|
|
290
|
+
? `(${charUnit}*)`
|
|
291
|
+
: `(${charUnit}+?)`;
|
|
292
|
+
prevWasOptionalPrefix = isOptionalPrefix;
|
|
245
293
|
}
|
|
246
294
|
regexBody += srcPattern.slice(lastIndex).replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '$';
|
|
247
295
|
try {
|
|
@@ -307,6 +355,7 @@ const KNOWN_SHORT_PROSE = new Set([
|
|
|
307
355
|
'pass',
|
|
308
356
|
'error',
|
|
309
357
|
'none',
|
|
358
|
+
'blink',
|
|
310
359
|
'not read',
|
|
311
360
|
'not drawn',
|
|
312
361
|
'not loaded',
|
|
@@ -363,6 +412,26 @@ function translateCore(text: string, lang: ResolvedLanguage, depth: number): str
|
|
|
363
412
|
}
|
|
364
413
|
}
|
|
365
414
|
|
|
415
|
+
// Preserve required-field ' *' suffix across translation
|
|
416
|
+
if (text.endsWith(' *')) {
|
|
417
|
+
const stem = text.slice(0, -2);
|
|
418
|
+
if (stem) {
|
|
419
|
+
const translatedStem = translateCore(stem, lang, depth + 1);
|
|
420
|
+
if (translatedStem !== stem) {
|
|
421
|
+
return `${translatedStem} *`;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Bare seconds readout '<number> s' <-> '<number>초'
|
|
427
|
+
if (lang === 'ko') {
|
|
428
|
+
const secMatch = /^(-?\d+(?:\.\d+)?) s$/.exec(text);
|
|
429
|
+
if (secMatch) return `${secMatch[1]}초`;
|
|
430
|
+
} else {
|
|
431
|
+
const secMatch = /^(-?\d+(?:\.\d+)?)초$/.exec(text);
|
|
432
|
+
if (secMatch) return `${secMatch[1]} s`;
|
|
433
|
+
}
|
|
434
|
+
|
|
366
435
|
// Preserve ERROR_CODE: <detail> prefix before wildcard pattern matching
|
|
367
436
|
const codeMatch = /^([A-Z][A-Z0-9_]{2,}):\s+([\s\S]+)$/.exec(text);
|
|
368
437
|
if (codeMatch) {
|
|
@@ -403,7 +472,10 @@ function translateCore(text: string, lang: ResolvedLanguage, depth: number): str
|
|
|
403
472
|
sep === ' · ' && /^(?:[◈◇]\s+)?[AB]$/.test(parts[0]?.trim() ?? '');
|
|
404
473
|
const slotIdx = sep === ' · ' ? (sidePrefix ? 1 : 0) : -1;
|
|
405
474
|
const mapped = parts.map((part, idx) => {
|
|
406
|
-
if (
|
|
475
|
+
if (
|
|
476
|
+
(idx === slotIdx && /^[a-z0-9_.-]+$/.test(part.trim()) && !KNOWN_SHORT_PROSE.has(part.trim())) ||
|
|
477
|
+
(sep === ' · ' && CONTEXT_LOWER_KEYS.has(part.trim()))
|
|
478
|
+
) {
|
|
407
479
|
return part;
|
|
408
480
|
}
|
|
409
481
|
if (sep === ' · ' && idx > slotIdx) {
|
|
@@ -447,7 +519,20 @@ function normalizeHtmlKey(html: string): string {
|
|
|
447
519
|
return html.replace(/\s+/g, ' ').trim();
|
|
448
520
|
}
|
|
449
521
|
|
|
450
|
-
const CONTEXT_LOWER_KEYS = new Set([
|
|
522
|
+
const CONTEXT_LOWER_KEYS = new Set([
|
|
523
|
+
'back',
|
|
524
|
+
'bone',
|
|
525
|
+
'box',
|
|
526
|
+
'from',
|
|
527
|
+
'front',
|
|
528
|
+
'root',
|
|
529
|
+
'silhouette',
|
|
530
|
+
'slot',
|
|
531
|
+
'tip',
|
|
532
|
+
'to',
|
|
533
|
+
'turbulence',
|
|
534
|
+
'vs'
|
|
535
|
+
]);
|
|
451
536
|
|
|
452
537
|
function isExemptElement(el: Element | null): boolean {
|
|
453
538
|
let cur: Element | null = el;
|
|
@@ -498,7 +583,9 @@ function isExemptElement(el: Element | null): boolean {
|
|
|
498
583
|
selectId === 'mesh-segment-bone' ||
|
|
499
584
|
selectId === 'chest-0-bone' ||
|
|
500
585
|
selectId === 'chest-1-bone' ||
|
|
501
|
-
selectId === 'person-select'
|
|
586
|
+
selectId === 'person-select' ||
|
|
587
|
+
parentSelect?.getAttribute?.('data-cuts-add') === 'from' ||
|
|
588
|
+
Boolean(parentSelect?.closest?.('#rig-fields-region'))) &&
|
|
502
589
|
(cur as HTMLOptionElement).value !== ''
|
|
503
590
|
) {
|
|
504
591
|
return true;
|
|
@@ -588,13 +675,19 @@ function applyTextNodeI18n(node: Node, lang: ResolvedLanguage): void {
|
|
|
588
675
|
enText = existing.en;
|
|
589
676
|
}
|
|
590
677
|
|
|
591
|
-
const enTrimmed = enText.trim();
|
|
678
|
+
const enTrimmed = enText.trim().replace(/ \*$/, '');
|
|
592
679
|
if (CONTEXT_LOWER_KEYS.has(enTrimmed) || (/^[a-z0-9_.-]+$/.test(enTrimmed) && enTrimmed !== 'none')) {
|
|
593
680
|
const parentTag = parent.tagName?.toUpperCase();
|
|
594
681
|
const allow =
|
|
595
682
|
parentTag === 'LABEL' ||
|
|
596
|
-
(parentTag === 'SPAN' && enTrimmed === 'vs') ||
|
|
597
|
-
(parentTag === 'OPTION' &&
|
|
683
|
+
(parentTag === 'SPAN' && (enTrimmed === 'vs' || Boolean(parent.parentElement?.classList?.contains('cloth-field')))) ||
|
|
684
|
+
(parentTag === 'OPTION' &&
|
|
685
|
+
(enTrimmed === 'silhouette' ||
|
|
686
|
+
enTrimmed === 'box' ||
|
|
687
|
+
enTrimmed === 'front' ||
|
|
688
|
+
enTrimmed === 'back' ||
|
|
689
|
+
parent.parentElement?.id === 'cuts-add' ||
|
|
690
|
+
parent.parentElement?.getAttribute?.('data-cuts-add') === 'draw'));
|
|
598
691
|
if (!allow) return;
|
|
599
692
|
}
|
|
600
693
|
|
|
@@ -1152,3 +1245,306 @@ export function checkWebHardcodedStrings(
|
|
|
1152
1245
|
exemptions
|
|
1153
1246
|
};
|
|
1154
1247
|
}
|
|
1248
|
+
|
|
1249
|
+
export interface KoreanDomViolation {
|
|
1250
|
+
readonly kind: 'text' | 'title' | 'aria-label' | 'placeholder';
|
|
1251
|
+
readonly reason: 'half-translated' | 'untranslated-english';
|
|
1252
|
+
readonly tag: string;
|
|
1253
|
+
readonly id: string;
|
|
1254
|
+
readonly text: string;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
export interface KoreanDomContext {
|
|
1258
|
+
readonly kind?: 'text' | 'title' | 'aria-label' | 'placeholder';
|
|
1259
|
+
readonly tag?: string;
|
|
1260
|
+
readonly id?: string;
|
|
1261
|
+
readonly cls?: string;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
const SINGLE_WORD_FIELD_IDS = new Set([
|
|
1265
|
+
'strength',
|
|
1266
|
+
'damping',
|
|
1267
|
+
'inertia',
|
|
1268
|
+
'mass',
|
|
1269
|
+
'wind',
|
|
1270
|
+
'gravity',
|
|
1271
|
+
'mix',
|
|
1272
|
+
'limit',
|
|
1273
|
+
'chains',
|
|
1274
|
+
'links',
|
|
1275
|
+
'translate',
|
|
1276
|
+
'part',
|
|
1277
|
+
'parts',
|
|
1278
|
+
'grid',
|
|
1279
|
+
'stray',
|
|
1280
|
+
'exponent',
|
|
1281
|
+
'rule',
|
|
1282
|
+
'floor',
|
|
1283
|
+
'amp',
|
|
1284
|
+
'period',
|
|
1285
|
+
'phase',
|
|
1286
|
+
'base',
|
|
1287
|
+
'lag',
|
|
1288
|
+
'squash',
|
|
1289
|
+
'brow_drop',
|
|
1290
|
+
'loop',
|
|
1291
|
+
'legs',
|
|
1292
|
+
'rest',
|
|
1293
|
+
'as',
|
|
1294
|
+
'short',
|
|
1295
|
+
'bends',
|
|
1296
|
+
'stance',
|
|
1297
|
+
'x',
|
|
1298
|
+
'y',
|
|
1299
|
+
'rotate',
|
|
1300
|
+
'rx',
|
|
1301
|
+
'ry',
|
|
1302
|
+
'rz',
|
|
1303
|
+
'tx',
|
|
1304
|
+
'ty',
|
|
1305
|
+
'sx',
|
|
1306
|
+
'sy',
|
|
1307
|
+
'dx',
|
|
1308
|
+
'dy'
|
|
1309
|
+
]);
|
|
1310
|
+
|
|
1311
|
+
const ENGLISH_PROSE_WORDS = new Set([
|
|
1312
|
+
'no',
|
|
1313
|
+
'not',
|
|
1314
|
+
'the',
|
|
1315
|
+
'by',
|
|
1316
|
+
'of',
|
|
1317
|
+
'in',
|
|
1318
|
+
'to',
|
|
1319
|
+
'for',
|
|
1320
|
+
'with',
|
|
1321
|
+
'from',
|
|
1322
|
+
'at',
|
|
1323
|
+
'on',
|
|
1324
|
+
'is',
|
|
1325
|
+
'are',
|
|
1326
|
+
'was',
|
|
1327
|
+
'were',
|
|
1328
|
+
'be',
|
|
1329
|
+
'or',
|
|
1330
|
+
'and',
|
|
1331
|
+
'then',
|
|
1332
|
+
'into',
|
|
1333
|
+
'across',
|
|
1334
|
+
'built',
|
|
1335
|
+
'accepts',
|
|
1336
|
+
'installed',
|
|
1337
|
+
'reader',
|
|
1338
|
+
'compiled',
|
|
1339
|
+
'binding',
|
|
1340
|
+
'regions',
|
|
1341
|
+
'stops',
|
|
1342
|
+
'sequence',
|
|
1343
|
+
'absent',
|
|
1344
|
+
'blink',
|
|
1345
|
+
'image',
|
|
1346
|
+
'video',
|
|
1347
|
+
'pose',
|
|
1348
|
+
'inspect',
|
|
1349
|
+
'planted',
|
|
1350
|
+
'untranslated'
|
|
1351
|
+
]);
|
|
1352
|
+
|
|
1353
|
+
let koCatalogValueSet: Set<string> | null = null;
|
|
1354
|
+
function getKoCatalogValueSet(): Set<string> {
|
|
1355
|
+
if (!koCatalogValueSet) {
|
|
1356
|
+
const vals: string[] = [];
|
|
1357
|
+
for (const v of Object.values(koCatalog)) {
|
|
1358
|
+
vals.push(v.replace(/\s+/g, ' ').trim());
|
|
1359
|
+
if (v.includes('<') || v.includes('&')) {
|
|
1360
|
+
vals.push(
|
|
1361
|
+
decodeHtmlEntities(v.replace(/<[^>]+>/g, ''))
|
|
1362
|
+
.replace(/\s+/g, ' ')
|
|
1363
|
+
.trim()
|
|
1364
|
+
);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
koCatalogValueSet = new Set(vals);
|
|
1368
|
+
}
|
|
1369
|
+
return koCatalogValueSet;
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1372
|
+
function isAllowedPureEnglishSegment(s: string, ctx?: KoreanDomContext): boolean {
|
|
1373
|
+
const t = s.trim().replace(/^[◈◇●·]\s*/, '').replace(/\s*\*$/, '');
|
|
1374
|
+
if (!t || !/[A-Za-z]/.test(t)) return true;
|
|
1375
|
+
const tagUpper = ctx?.tag?.toUpperCase();
|
|
1376
|
+
if (tagUpper === 'CODE' || tagUpper === 'KBD') return true;
|
|
1377
|
+
if (tr(t, 'ko') !== t) {
|
|
1378
|
+
if (ctx?.kind === 'text' && (CONTEXT_LOWER_KEYS.has(t) || (/^[a-z0-9_.-]+$/.test(t) && t !== 'none'))) {
|
|
1379
|
+
const allow =
|
|
1380
|
+
tagUpper === 'LABEL' ||
|
|
1381
|
+
(tagUpper === 'SPAN' && t === 'vs') ||
|
|
1382
|
+
(tagUpper === 'OPTION' &&
|
|
1383
|
+
(t === 'silhouette' || t === 'box' || t === 'front' || t === 'back' || ctx.id === 'cuts-add'));
|
|
1384
|
+
if (!allow) return true;
|
|
1385
|
+
}
|
|
1386
|
+
return false;
|
|
1387
|
+
}
|
|
1388
|
+
if (/^[A-Z][A-Z0-9_]{2,}(?::\s*[\s\S]*|\*?)$/.test(t)) return true;
|
|
1389
|
+
if (
|
|
1390
|
+
t === 'a, b, …' ||
|
|
1391
|
+
/^(?:Space|Shift|Alt|Ctrl|Cmd|Meta|Tab|Enter|Esc|Escape|Backspace|Delete|Home|End|English|WebGL|Canvas2D|CLEAN|RETARGET|FPS|JSON|PNG|SVG)$/.test(
|
|
1392
|
+
t
|
|
1393
|
+
)
|
|
1394
|
+
) {
|
|
1395
|
+
return true;
|
|
1396
|
+
}
|
|
1397
|
+
if (/^-?\d+(?:\.\d+)?\s*(?:px|ms|fps|Hz|s⁻¹|%|°|×)$/.test(t)) return true;
|
|
1398
|
+
if (/^(?:yaw|pitch|body) · [a-z0-9_]+ \[-?\d+, -?\d+\] °$/.test(t)) return true;
|
|
1399
|
+
if (/^[a-z0-9_]+ -?\d+(?:\.\d+)?°$/.test(t)) return true;
|
|
1400
|
+
if (/^[a-z0-9_.-]+ → [a-z0-9_.-]+$/.test(t)) return true;
|
|
1401
|
+
if (/^(?:rotate|x|y) \(-?\d+(?:\.\d+)?\)$/.test(t)) return true;
|
|
1402
|
+
if (
|
|
1403
|
+
/^(?:back hair|front hair|rig --config|rig-parts build|rig-parts rig|default \/ [a-z0-9_.-]+|[a-z0-9_.-]+ \/ default \/ [a-z0-9_.-]+)$/.test(
|
|
1404
|
+
t
|
|
1405
|
+
)
|
|
1406
|
+
) {
|
|
1407
|
+
return true;
|
|
1408
|
+
}
|
|
1409
|
+
const fieldMatch = /^(?:[a-z0-9_.-]+|back hair|front hair) ([a-z0-9_.-]+)$/i.exec(t);
|
|
1410
|
+
if (fieldMatch && SINGLE_WORD_FIELD_IDS.has(fieldMatch[1]!)) return true;
|
|
1411
|
+
if (/^(?:#\d+ )?[a-z0-9_.-]+(?: · [a-zA-Z0-9_.-]+)+$/.test(t)) {
|
|
1412
|
+
const parts = t.replace(/^#\d+ /, '').split(' · ');
|
|
1413
|
+
if (parts.every((p) => /^[a-zA-Z0-9_.-]+$/.test(p) && !ENGLISH_PROSE_WORDS.has(p.toLowerCase()))) {
|
|
1414
|
+
return true;
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
if (!t.includes(' ')) {
|
|
1418
|
+
if (ENGLISH_PROSE_WORDS.has(t.toLowerCase())) return false;
|
|
1419
|
+
if (/^[A-Z][a-z]{2,}$/.test(t)) return false;
|
|
1420
|
+
return true;
|
|
1421
|
+
}
|
|
1422
|
+
return false;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
export function classifyKoreanDomString(
|
|
1426
|
+
rawText: string,
|
|
1427
|
+
ctx?: KoreanDomContext
|
|
1428
|
+
): 'ok' | 'half-translated' | 'untranslated-english' {
|
|
1429
|
+
const t = rawText.replace(/\s+/g, ' ').trim();
|
|
1430
|
+
if (!t || !/[A-Za-z]/.test(t)) return 'ok';
|
|
1431
|
+
if (!/[가-힣]/.test(t)) {
|
|
1432
|
+
return isAllowedPureEnglishSegment(t, ctx) ? 'ok' : 'untranslated-english';
|
|
1433
|
+
}
|
|
1434
|
+
if (getKoCatalogValueSet().has(t)) return 'ok';
|
|
1435
|
+
const enRound = tr(t, 'en');
|
|
1436
|
+
if (enRound === t || tr(enRound, 'ko') !== t) return 'half-translated';
|
|
1437
|
+
const segments = t.split(' · ');
|
|
1438
|
+
for (let i = 0; i < segments.length; i++) {
|
|
1439
|
+
const cleanSeg = segments[i]!.trim().replace(/^[◈◇●]\s*/, '');
|
|
1440
|
+
if (!cleanSeg || !/[A-Za-z]/.test(cleanSeg)) continue;
|
|
1441
|
+
if (!/[가-힣]/.test(cleanSeg)) {
|
|
1442
|
+
if (i === 0 && /^[a-z0-9_.-]+$/.test(cleanSeg) && !ENGLISH_PROSE_WORDS.has(cleanSeg)) continue;
|
|
1443
|
+
if (!isAllowedPureEnglishSegment(cleanSeg, ctx)) return 'half-translated';
|
|
1444
|
+
continue;
|
|
1445
|
+
}
|
|
1446
|
+
const stripped = cleanSeg
|
|
1447
|
+
.replace(/\([^()]*\)/g, ' ')
|
|
1448
|
+
.replace(/@[a-z0-9_-]+\/[a-z0-9_-]+/gi, ' ')
|
|
1449
|
+
.replace(/[a-z0-9_]+(?:[/.][a-z0-9_]+)+/gi, ' ')
|
|
1450
|
+
.replace(/--[a-z0-9-]+/g, ' ')
|
|
1451
|
+
.replace(/<[a-z0-9_-]+>/g, ' ');
|
|
1452
|
+
const words = stripped.match(/\b[A-Za-z]{2,}\b/g) ?? [];
|
|
1453
|
+
for (const w of words) {
|
|
1454
|
+
if (ENGLISH_PROSE_WORDS.has(w.toLowerCase()) || w === 'hold') return 'half-translated';
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
return 'ok';
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
export function checkKoreanDomI18n(root: Document | Element): {
|
|
1461
|
+
readonly ok: boolean;
|
|
1462
|
+
readonly violations: readonly KoreanDomViolation[];
|
|
1463
|
+
} {
|
|
1464
|
+
const violations: KoreanDomViolation[] = [];
|
|
1465
|
+
const rootEl: Element | null =
|
|
1466
|
+
'documentElement' in root && root.documentElement
|
|
1467
|
+
? root.documentElement
|
|
1468
|
+
: 'body' in root && (root as Document).body
|
|
1469
|
+
? (root as Document).body
|
|
1470
|
+
: 'getAttribute' in root
|
|
1471
|
+
? (root as Element)
|
|
1472
|
+
: null;
|
|
1473
|
+
if (!rootEl) return { ok: true, violations };
|
|
1474
|
+
|
|
1475
|
+
function nearestId(el: Element | null): string {
|
|
1476
|
+
let cur = el;
|
|
1477
|
+
while (cur) {
|
|
1478
|
+
if (cur.id) return cur.id;
|
|
1479
|
+
cur = cur.parentElement;
|
|
1480
|
+
}
|
|
1481
|
+
return '';
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
const allElements: Element[] = [rootEl];
|
|
1485
|
+
if (typeof rootEl.querySelectorAll === 'function') {
|
|
1486
|
+
allElements.push(...Array.from(rootEl.querySelectorAll('*')));
|
|
1487
|
+
} else if ('children' in rootEl) {
|
|
1488
|
+
const stack: Element[] = [...Array.from(rootEl.children)];
|
|
1489
|
+
while (stack.length > 0) {
|
|
1490
|
+
const cur = stack.shift()!;
|
|
1491
|
+
allElements.push(cur);
|
|
1492
|
+
if (cur.children) stack.push(...Array.from(cur.children));
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
for (const el of allElements) {
|
|
1497
|
+
if (isExemptElement(el)) continue;
|
|
1498
|
+
const tag = el.tagName?.toUpperCase() ?? '';
|
|
1499
|
+
if (tag === 'SCRIPT' || tag === 'STYLE' || tag === 'PRE' || tag === 'TEXTAREA') continue;
|
|
1500
|
+
const id = nearestId(el);
|
|
1501
|
+
const cls = typeof el.className === 'string' ? el.className : '';
|
|
1502
|
+
for (const attr of ['title', 'aria-label', 'placeholder'] as const) {
|
|
1503
|
+
const val = el.getAttribute(attr);
|
|
1504
|
+
if (!val || !val.trim()) continue;
|
|
1505
|
+
const verdict = classifyKoreanDomString(val, { kind: attr, tag, id, cls });
|
|
1506
|
+
if (verdict !== 'ok') {
|
|
1507
|
+
violations.push({ kind: attr, reason: verdict, tag, id, text: val.replace(/\s+/g, ' ').trim() });
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
function walkTextNodes(el: Element): void {
|
|
1513
|
+
if (isExemptElement(el)) return;
|
|
1514
|
+
const tag = el.tagName?.toUpperCase() ?? '';
|
|
1515
|
+
if (tag === 'SCRIPT' || tag === 'STYLE' || tag === 'PRE' || tag === 'TEXTAREA') return;
|
|
1516
|
+
if (tag === 'P' && el.classList?.contains('hint') && el.children.length > 0) {
|
|
1517
|
+
const txt = el.textContent ?? '';
|
|
1518
|
+
if (txt.trim()) {
|
|
1519
|
+
const id = nearestId(el);
|
|
1520
|
+
const cls = typeof el.className === 'string' ? el.className : '';
|
|
1521
|
+
const verdict = classifyKoreanDomString(txt, { kind: 'text', tag, id, cls });
|
|
1522
|
+
if (verdict !== 'ok') {
|
|
1523
|
+
violations.push({ kind: 'text', reason: verdict, tag, id, text: txt.replace(/\s+/g, ' ').trim() });
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
const id = nearestId(el);
|
|
1529
|
+
const cls = typeof el.className === 'string' ? el.className : '';
|
|
1530
|
+
for (const child of Array.from(el.childNodes ?? [])) {
|
|
1531
|
+
if (child.nodeType === 3) {
|
|
1532
|
+
const raw = child.nodeValue ?? '';
|
|
1533
|
+
if (!raw.trim()) continue;
|
|
1534
|
+
const verdict = classifyKoreanDomString(raw, { kind: 'text', tag, id, cls });
|
|
1535
|
+
if (verdict !== 'ok') {
|
|
1536
|
+
violations.push({ kind: 'text', reason: verdict, tag, id, text: raw.replace(/\s+/g, ' ').trim() });
|
|
1537
|
+
}
|
|
1538
|
+
} else if (child.nodeType === 1) {
|
|
1539
|
+
walkTextNodes(child as Element);
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
walkTextNodes(rootEl);
|
|
1545
|
+
|
|
1546
|
+
return {
|
|
1547
|
+
ok: violations.length === 0,
|
|
1548
|
+
violations
|
|
1549
|
+
};
|
|
1550
|
+
}
|
package/web/part-selection.ts
CHANGED
|
@@ -58,7 +58,7 @@ export function copyPartIdentity(snapshot:SlotIdentitySnapshot,frame:PosedFrame,
|
|
|
58
58
|
for(const row of frame.order){const identity=bySlot.get(row.slot);if(!identity||identity.reason!==null||identity.z!==row.z||row.z<=lastZ)throw new Error(`PART_IDENTITY_FRAME_MISMATCH: slot "${row.slot}" does not match held frame order`);lastZ=row.z;}
|
|
59
59
|
// Identity-known slots need not have a visible primitive (zero alpha/empty
|
|
60
60
|
// geometry/nonvisual setup). A known key is not a pixel or fit guarantee.
|
|
61
|
-
return {generation:snapshot.generation,set:snapshot.set,skin:snapshot.skin,slots};
|
|
61
|
+
return {generation:snapshot.generation,set:snapshot.set,sets:[...snapshot.sets],skin:snapshot.skin,slots};
|
|
62
62
|
}
|
|
63
63
|
export function orderedParts(entries:readonly PartEntry[],frame:PosedFrame|null,identity:SlotIdentitySnapshot|null=null):PartEntry[]{
|
|
64
64
|
const z=new Map(identity?.slots.map(row=>[row.slot,row.z])??frame?.order.map(row=>[row.slot,row.z])??[]),setup=new Map(entries.map((entry,i)=>[entry.slot,i]));
|
package/web/styles.css
CHANGED
|
@@ -382,8 +382,8 @@ footer.status-bar{flex-wrap:nowrap}
|
|
|
382
382
|
.turn-pad{display:flex;align-items:center;flex-wrap:wrap;gap:8px 14px;padding:8px 12px}
|
|
383
383
|
.turn-pad>span{color:var(--fg-muted);font-size:11px}
|
|
384
384
|
.turn-pad label{display:flex;align-items:center;gap:5px;font-size:11px;white-space:nowrap}
|
|
385
|
-
.turn-pad input[type=number]{width:
|
|
386
|
-
.turn-pad output{font-variant-numeric:tabular-nums;color:var(--fg-strong)}
|
|
385
|
+
.turn-pad input[type=number]{width:64px;color:var(--fg);background:var(--rv-control);border:1px solid var(--border-strong);padding:4px}
|
|
386
|
+
.turn-pad output{display:inline-block;font-family:var(--font-mono);font-variant-numeric:tabular-nums;text-align:right;color:var(--fg-strong)}
|
|
387
387
|
.turn-pad button[aria-pressed=true]{border-color:var(--pass);color:var(--pass)}
|
|
388
388
|
#turn-pad-host>p{margin:0 12px 6px}
|
|
389
389
|
|
package/web/turn-pad.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {TurnState,type TurnDial,type TurnSnapshot,type TurnAxis,pointerPosition} from '../src/turn-pad.ts';
|
|
1
|
+
import {TurnState,type TurnDial,type TurnSnapshot,type TurnAxis,pointerPosition,turnDialWidthCh,formatTurnValue} from '../src/turn-pad.ts';
|
|
2
2
|
export interface TurnPad {state:TurnState;snapshot():TurnSnapshot;restore(value:unknown,redraw?:boolean):void;dispose():void}
|
|
3
3
|
/** One pad owns the shared values. It never touches the model document or writes animation keys. */
|
|
4
4
|
export function bindTurnPad(options:{host:HTMLElement;stages:HTMLElement[];dials:readonly TurnDial[];draw:(state:TurnState)=>void;save:()=>void;blocked?:()=>boolean;error:(text:string)=>void}):TurnPad|null {
|
|
@@ -10,9 +10,9 @@ export function bindTurnPad(options:{host:HTMLElement;stages:HTMLElement[];dials
|
|
|
10
10
|
const reset=document.createElement('button');reset.type='button';reset.textContent='Reset 0';panel.append(reset);
|
|
11
11
|
const smoothLabel=document.createElement('label'),smooth=document.createElement('input');smooth.type='checkbox';smooth.checked=true;smooth.setAttribute('aria-label','Turn smoothing');smoothLabel.append(smooth,' Smoothing ω₀ ');
|
|
12
12
|
const omega=document.createElement('input');omega.type='number';omega.min='1';omega.max='100';omega.step='1';omega.value='20';omega.setAttribute('aria-label','Turn smoothing omega');smoothLabel.append(omega,' s⁻¹');panel.append(smoothLabel);
|
|
13
|
-
const rows=new Map<TurnAxis,{number:HTMLInputElement;output:HTMLOutputElement;target:HTMLOutputElement}>();
|
|
14
|
-
for(const d of dials){const label=document.createElement('label');label.textContent=`${d.axis} · ${d.bone} [${d.min}, ${d.max}] ${d.channel==='rotation'?'°':d.channel}`;const number=document.createElement('input');number.type='number';number.min=String(d.min);number.max=String(d.max);number.step='any';number.value='0';number.setAttribute('aria-label',`Turn ${d.axis} value`);label.title=d.provenance??'';const output=document.createElement('output');output.dataset.turnAxis=d.axis;output.setAttribute('aria-label',`Current ${d.axis}`);const target=document.createElement('output');target.dataset.turnTarget=d.axis;label.append(number,' Applied ',output,' · target ',target);panel.append(label);rows.set(d.axis,{number,output,target});number.onchange=()=>{try{if(!number.value.trim())throw new Error('TURN_VALUE_REQUIRED');state.exact(d.axis,Number(number.value));commit();}catch(error){options.error(String(error));render();}};}
|
|
15
|
-
function render():void {hold.setAttribute('aria-pressed',String(state.held));smooth.checked=state.smoothing!==0;omega.disabled=!smooth.checked;if(state.smoothing)omega.value=String(state.smoothing);for(const [axis,row] of rows){const value=state.values[axis]!;row.output.value=
|
|
13
|
+
const rows=new Map<TurnAxis,{dial:TurnDial;number:HTMLInputElement;output:HTMLOutputElement;target:HTMLOutputElement}>();
|
|
14
|
+
for(const d of dials){const label=document.createElement('label');label.textContent=`${d.axis} · ${d.bone} [${d.min}, ${d.max}] ${d.channel==='rotation'?'°':d.channel}`;const number=document.createElement('input');number.type='number';number.min=String(d.min);number.max=String(d.max);number.step='any';number.value='0';number.setAttribute('aria-label',`Turn ${d.axis} value`);label.title=d.provenance??'';const width=`${turnDialWidthCh(d)}ch`;const output=document.createElement('output');output.dataset.turnAxis=d.axis;output.style.width=width;output.style.minWidth=width;output.setAttribute('aria-label',`Current ${d.axis}`);const target=document.createElement('output');target.dataset.turnTarget=d.axis;target.style.width=width;target.style.minWidth=width;label.append(number,' Applied ',output,' · target ',target);panel.append(label);rows.set(d.axis,{dial:d,number,output,target});number.onchange=()=>{try{if(!number.value.trim())throw new Error('TURN_VALUE_REQUIRED');state.exact(d.axis,Number(number.value));commit();}catch(error){options.error(String(error));render();}};}
|
|
15
|
+
function render():void {hold.setAttribute('aria-pressed',String(state.held));smooth.checked=state.smoothing!==0;omega.disabled=!smooth.checked;if(state.smoothing)omega.value=String(state.smoothing);for(const [axis,row] of rows){const value=state.values[axis]!,targetValue=state.targets[axis]!;row.output.value=formatTurnValue(value,row.dial);row.output.dataset.value=String(value);row.target.value=formatTurnValue(targetValue,row.dial);row.target.dataset.value=String(targetValue);if(document.activeElement!==row.number)row.number.value=String(targetValue);}}
|
|
16
16
|
let saveTimer:ReturnType<typeof setTimeout>|undefined;
|
|
17
17
|
function commit():void {options.draw(state);render();if(saveTimer)clearTimeout(saveTimer);saveTimer=setTimeout(options.save,150);}
|
|
18
18
|
hold.onclick=()=>{state.hold(!state.held);commit();};reset.onclick=()=>{state.reset();commit();};
|