rig-review 2.11.0 → 2.13.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/DESIGN.md +145 -74
- package/docs/PANELS.md +20 -12
- package/docs/PARTS_VIEW.md +31 -11
- package/docs/REVIEW_PACKAGE.md +215 -0
- package/docs/STABILITY.md +98 -2
- package/docs/WORKFLOWS.md +40 -12
- package/package.json +2 -1
- package/skills/rig-review/SKILL.md +29 -1
- package/src/build.ts +10 -2
- package/src/cli.ts +14 -12
- package/src/comment-crops.ts +6 -1
- package/src/compare-html.ts +22 -24
- package/src/compare-server.ts +1 -1
- package/src/compare-session.ts +41 -3
- package/src/create-pin-gate.ts +3 -0
- package/src/feedback-export.ts +67 -0
- package/src/front.ts +10 -16
- package/src/interview-routes.ts +1 -1
- package/src/job-act.ts +39 -21
- package/src/job-api.ts +291 -0
- package/src/job-cli.ts +20 -11
- package/src/job-contract.ts +91 -3
- package/src/job-front.ts +15 -7
- package/src/job-host.ts +15 -0
- package/src/job-hub.ts +4 -4
- package/src/job-image-set.ts +32 -9
- package/src/job-session.ts +19 -11
- package/src/job-source.ts +74 -30
- package/src/joined-project.ts +61 -4
- package/src/open-workspace.ts +12 -12
- package/src/open.ts +17 -9
- package/src/parts-comment.ts +31 -1
- package/src/parts-server.ts +19 -7
- package/src/parts-view.ts +103 -20
- package/src/server.ts +30 -21
- package/src/session.ts +58 -0
- package/src/stage-comment.ts +39 -0
- package/src/stage-parts.ts +18 -10
- package/web/animation-inspection.ts +1 -1
- package/web/bones-panel.ts +1 -3
- package/web/catalog-en.ts +76 -12
- package/web/catalog-ko.ts +76 -12
- package/web/cloth-panel.ts +1 -2
- package/web/compare.css +3 -9
- package/web/compare.html +3 -3
- package/web/compare.ts +69 -64
- package/web/cuts-panel.ts +1 -3
- package/web/density-strip-panel.ts +1 -2
- package/web/i18n.ts +13 -1
- package/web/idle-panel.ts +1 -2
- package/web/index.html +1 -5
- package/web/inspection-persistence.ts +2 -1
- package/web/inspector-blocks.ts +144 -39
- package/web/instance-access.ts +24 -5
- package/web/interview-panel.ts +224 -175
- package/web/job-hub.ts +50 -69
- package/web/job-rig-capture.ts +103 -10
- package/web/job-rig-screen.ts +317 -0
- package/web/job-session.ts +927 -1365
- package/web/main.ts +535 -129
- package/web/mesh-panel.ts +1 -2
- package/web/owner-workspace.ts +88 -109
- package/web/part-selection.ts +47 -6
- package/web/part-thumbnails.ts +20 -6
- package/web/parts-viewport-provider.ts +166 -9
- package/web/physics-panel.ts +1 -2
- package/web/readings-panel.ts +1 -2
- package/web/requirements-panel.ts +1 -3
- package/web/retained-frame-stage.ts +105 -0
- package/web/retarget-panel.ts +2 -3
- package/web/rig-fields-panel.ts +1 -2
- package/web/rig-host.ts +62 -0
- package/web/rig-viewport-provider.ts +63 -16
- package/web/stage-comments.ts +29 -26
- package/web/styles.css +127 -43
- package/web/view-controls.ts +201 -12
- package/web/viewport-controller.ts +97 -26
- package/web/viewport-pair.ts +2 -1
- package/web/workspace-preferences.ts +5 -4
- package/web/workspace-ui.ts +152 -19
- package/src/interview-server.ts +0 -54
- package/web/interview.css +0 -28
- package/web/interview.html +0 -17
- package/web/interview.ts +0 -40
- package/web/job-hub.css +0 -14
- package/web/job-hub.html +0 -5
- package/web/owner-workspace.css +0 -14
- package/web/owner-workspace.html +0 -5
- package/web/parts-flags.ts +0 -48
- package/web/parts-page.ts +0 -217
- package/web/parts.css +0 -116
- package/web/parts.html +0 -15
- package/web/parts.ts +0 -986
- package/web/stage-nav.ts +0 -136
package/web/stage-nav.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/** Four inspection stages. Existing tools remain mounted; navigation never submits or applies. */
|
|
2
|
-
import {getLanguage,onLanguageChange,t} from './i18n.ts';
|
|
3
|
-
import {interviewErrors} from './interview-panel.ts';
|
|
4
|
-
import {pageInstanceAccess,type InstanceAccess} from './instance-access.ts';
|
|
5
|
-
export const reviewStages = ['1 Parts + mesh','2 Interview','3 Rig + animation','4 Direction'] as const;
|
|
6
|
-
export type ReviewStage = 1|2|3|4;
|
|
7
|
-
export interface StagePartsState {
|
|
8
|
-
inspectionSourceHash:string;part:string;imageHash:string;box:{x:number;y:number;w:number;h:number};mapping:{skin:string;slot:string;attachment:string};
|
|
9
|
-
rig:{zoom:number;center:{x:number;y:number}|null};reference:{zoom:number;center:{x:number;y:number}|null};cameraSync:boolean;
|
|
10
|
-
bg:string;alpha:boolean;footprints:boolean;view:'item'|'page'|'assembled';mesh:boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface StagePartsWindow extends Window {rigReviewStageParts?:{snapshot:()=>StagePartsState|null}}
|
|
13
|
-
/** Navigation state transfers only over exact original-art/package identity and the same draft address. */
|
|
14
|
-
export function stagePartsSelectionIndex(data:{inspectionSourceHash?:string;items:{name:string;imageHash?:string;x:number;y:number;w:number;h:number}[];draft?:{mappings:{part:string;skin:string;slot:string;attachment:string}[]}},saved:StagePartsState):number {
|
|
15
|
-
const i=data.items.findIndex(item=>item.name===saved.part&&item.imageHash===saved.imageHash&&(['x','y','w','h']as const).every(k=>item[k]===saved.box[k]));
|
|
16
|
-
const m=data.draft?.mappings.find(m=>m.part===saved.part);
|
|
17
|
-
if(i<0||data.inspectionSourceHash!==saved.inspectionSourceHash||!m||(['skin','slot','attachment']as const).some(k=>m[k]!==saved.mapping[k]))throw new Error('STAGE_DRAFT_MISMATCH');
|
|
18
|
-
return i;
|
|
19
|
-
}
|
|
20
|
-
export function stageReason(stage:ReviewStage,model:boolean,direction=false,interview=false,preRig=false):string|null {
|
|
21
|
-
if(stage===2&&!interview)return 'INTERVIEW_UNAVAILABLE: No interview is attached to this inspection.';
|
|
22
|
-
if(preRig&&stage===3)return 'RIG_VERSION_UNAVAILABLE: this draft has no recorded rig review package.';
|
|
23
|
-
if(preRig&&stage===4)return 'DIRECTION_VERSION_UNAVAILABLE: this draft has no recorded rig review package.';
|
|
24
|
-
if(stage===4&&!direction)return 'DIRECTION_UNAVAILABLE: no direction inspection contract is installed.';
|
|
25
|
-
if(stage===3&&!model)return 'MODEL_UNAVAILABLE: no compiled model is supplied in this inspection.';
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
function stageFrameRoute(access:InstanceAccess,path:'/stage-parts.html'|'/stage-interview.html',side?:'a'|'b'):string {
|
|
29
|
-
const query=new URLSearchParams({stageEmbed:'1',lang:getLanguage()});
|
|
30
|
-
if(side)query.set('side',side);
|
|
31
|
-
// Managed paths already identify the slot and their front accepts only the closed stage query.
|
|
32
|
-
if(access.base==='/'&&/^[a-f0-9]{64}$/.test(access.key))query.set('handoff',access.key);
|
|
33
|
-
return access.route(path)+'?'+query;
|
|
34
|
-
}
|
|
35
|
-
export function bindStageNav(options:{preRig?:boolean;interviewOnly?:boolean;interview?:boolean;access?:InstanceAccess;partsOnly?:boolean;model:boolean;direction?:(active:boolean)=>void;side?:()=> 'a'|'b';setup?:()=>void;draftBuild?:()=>string;refresh?:(fn:()=>void)=>void;correction?:(request:{part:string;sourceHash:string;buildId:string;instrument:string})=>Promise<void>}):()=>void {
|
|
36
|
-
const host=document.querySelector<HTMLElement>('[data-stage-nav]');if(!host)return ()=>{};
|
|
37
|
-
if(options.interviewOnly){
|
|
38
|
-
const button=document.createElement('button');button.type='button';button.dataset.reviewStage='2';button.setAttribute('aria-current','step');host.append(button);
|
|
39
|
-
const render=()=>{button.textContent=t(reviewStages[1]);host.setAttribute('aria-label',t('Inspection stages'));};
|
|
40
|
-
document.documentElement.dataset.inspectionStage='2';render();
|
|
41
|
-
const language=onLanguageChange(render);return ()=>{language();button.remove();};
|
|
42
|
-
}
|
|
43
|
-
const embedded=new URL(location.href).searchParams.get('stageEmbed')==='1';
|
|
44
|
-
if(embedded){host.hidden=true;return ()=>{};}
|
|
45
|
-
const access=options.access??pageInstanceAccess(),panel=document.createElement('section');panel.className='review-stage-panel';panel.hidden=true;panel.setAttribute('aria-live','polite');document.body.append(panel);
|
|
46
|
-
const status=document.createElement('p');status.setAttribute('role','status');panel.append(status);
|
|
47
|
-
let interview:HTMLIFrameElement|undefined,interviewError:string|null=null,entry=0;
|
|
48
|
-
const sourcePicker=document.getElementById('mode-build-picker');
|
|
49
|
-
const attr=(el:Element,name:string)=>typeof el.getAttribute==='function'?el.getAttribute(name):null;
|
|
50
|
-
const setOrRemove=(el:Element,name:string,value:string|null)=>{if(value===null)el.removeAttribute?.(name);else el.setAttribute(name,value);};
|
|
51
|
-
const modeSwitches=[...document.querySelectorAll<HTMLElement>('.mode-switch')].map(el=>({el,hidden:Boolean(el.hidden)}));
|
|
52
|
-
const modeControls=[...document.querySelectorAll<HTMLButtonElement>('[data-mode],[data-inspector]')].map(button=>({
|
|
53
|
-
button,disabled:Boolean(button.disabled),title:attr(button,'title'),pressed:attr(button,'aria-pressed'),selected:attr(button,'aria-selected'),
|
|
54
|
-
}));
|
|
55
|
-
const pickerState=sourcePicker?{hidden:Boolean(sourcePicker.hidden),label:attr(sourcePicker,'aria-label')}:null;
|
|
56
|
-
const frames=new Map<string,HTMLIFrameElement>();let lastFrame:HTMLIFrameElement|null=null;let current:ReviewStage=(options.partsOnly||options.preRig)?1:3;let correctionActive=false;
|
|
57
|
-
const workspace=document.querySelector<HTMLElement>(options.partsOnly?'.pv-layout':'.layout');const wasInert=workspace?.inert??false;
|
|
58
|
-
const reasonFor=(stage:ReviewStage)=>stageReason(stage,options.model,!!options.direction,!!options.interview,options.preRig);
|
|
59
|
-
const activeReason=(stage:ReviewStage)=>stage===3&&correctionActive?null:reasonFor(stage);
|
|
60
|
-
const buttons=reviewStages.map((label,index)=>{const button=document.createElement('button');button.type='button';button.dataset.reviewStage=String(index+1);button.onclick=()=>{if(index+1===3)correctionActive=false;show(index+1 as ReviewStage);};host.append(button);return button;});
|
|
61
|
-
const mesh=document.createElement('button');mesh.type='button';mesh.onclick=()=>{if(reasonFor(3))return;show(3);options.setup?.();};panel.append(mesh);
|
|
62
|
-
const syncRigControls=()=>{
|
|
63
|
-
const rigReason=activeReason(3),refused=Boolean(activeReason(current));
|
|
64
|
-
if(refused)document.documentElement.dataset.stageRefused='true';else delete document.documentElement.dataset.stageRefused;
|
|
65
|
-
for(const item of modeSwitches)item.el.hidden=current!==3||Boolean(rigReason)?true:item.hidden;
|
|
66
|
-
if(sourcePicker&&pickerState&&rigReason&¤t===3)sourcePicker.hidden=true;
|
|
67
|
-
if(!rigReason){
|
|
68
|
-
for(const item of modeControls){
|
|
69
|
-
item.button.disabled=item.disabled;item.button.title=item.title??'';setOrRemove(item.button,'title',item.title);
|
|
70
|
-
}
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const reasonText=t(rigReason);
|
|
74
|
-
for(const item of modeControls){
|
|
75
|
-
item.button.disabled=true;item.button.title=reasonText;item.button.setAttribute('title',reasonText);
|
|
76
|
-
if(item.pressed!==null&&attr(item.button,'aria-pressed')!=='false')item.button.setAttribute('aria-pressed','false');
|
|
77
|
-
if(item.selected!==null&&attr(item.button,'aria-selected')!=='false')item.button.setAttribute('aria-selected','false');
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
const render=()=>{buttons.forEach((b,i)=>{b.textContent=t(reviewStages[i]!);b.setAttribute('aria-current',current===i+1?'step':'false');});host.setAttribute('aria-label',t('Inspection stages'));if(sourcePicker)sourcePicker.setAttribute('aria-label',t(current===1?'Atlas source build':'Picked build for Setup and Animate'));mesh.textContent=t('Open setup mesh instruments');syncRigControls();};
|
|
81
|
-
const place=()=>{panel.style.top=`${(host.closest('header')??host).getBoundingClientRect().bottom}px`;};
|
|
82
|
-
const setFrameLanguage=(frame:HTMLIFrameElement)=>frame.contentWindow?.postMessage({type:'review-stage-language',language:getLanguage()},location.origin);
|
|
83
|
-
async function showInterview(revision:number) {
|
|
84
|
-
try {
|
|
85
|
-
const response=await fetch(access.route('/api/interview'));
|
|
86
|
-
if(!response.ok){const {error}=await response.json();throw new Error(error);}
|
|
87
|
-
if(revision!==entry)return;
|
|
88
|
-
if(!interview){
|
|
89
|
-
interview=document.createElement('iframe');
|
|
90
|
-
interview.title=t('interview.title');interview.className='review-interview-frame';
|
|
91
|
-
const url=new URL(stageFrameRoute(access,'/stage-interview.html'),location.href);
|
|
92
|
-
if(access.capability)url.hash='cap='+access.capability;
|
|
93
|
-
const frame=interview;
|
|
94
|
-
frame.src=url.href;frame.addEventListener('load',()=>setFrameLanguage(frame));
|
|
95
|
-
panel.append(frame);
|
|
96
|
-
}
|
|
97
|
-
status.textContent='';showParts();interview.hidden=false;panel.classList.add('with-interview');
|
|
98
|
-
} catch(error) {
|
|
99
|
-
if(revision!==entry)return;
|
|
100
|
-
interviewError=error instanceof Error ? (error.message==='INTERVIEW_OPTIONS_STALE' ? error.message : interviewErrors[error.message]??'interview.failed') : 'interview.failed';
|
|
101
|
-
status.textContent=t(interviewError);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
function show(stage:ReviewStage):void {
|
|
105
|
-
if(stage!==3)correctionActive=false;
|
|
106
|
-
current=stage;document.documentElement.dataset.inspectionStage=String(stage);render();place();const reason=activeReason(stage);const revision=++entry;interviewError=null;
|
|
107
|
-
options.direction?.(stage===4);
|
|
108
|
-
panel.hidden=!reason&&(stage===(options.partsOnly?1:3)||stage===4)&&(!options.preRig||(stage===3&&correctionActive));
|
|
109
|
-
if(workspace)workspace.inert=!panel.hidden||wasInert;
|
|
110
|
-
status.textContent=reason?t(reason):stage===1&&!options.partsOnly?t(options.correction||options.preRig?'Draft rig · structure evidence only':'Atlas inspection, read only — inspected package. Applied scratch atlas, pre-rig parts, mesh sign-off and draft corrections are unavailable here.'):'';mesh.hidden=stage!==1||Boolean(reasonFor(3))||!!options.partsOnly;
|
|
111
|
-
for(const frame of frames.values())frame.hidden=true;
|
|
112
|
-
if(interview)interview.hidden=true;
|
|
113
|
-
panel.classList.remove('with-interview');
|
|
114
|
-
if(stage===1&&!options.partsOnly)showParts();
|
|
115
|
-
if(stage===2&&!reason){status.textContent=t('interview.loading');void showInterview(revision);}
|
|
116
|
-
}
|
|
117
|
-
function showParts(){
|
|
118
|
-
const saved=(lastFrame?.contentWindow as StagePartsWindow|null)?.rigReviewStageParts?.snapshot()??null;const side=options.side?.(),buildId=options.draftBuild?.()??'inspected',key=(side??'single')+':'+buildId;let frame=frames.get(key);if(!frame){if(options.correction){for(const old of frames.values())old.remove();frames.clear();}frame=document.createElement('iframe');frame.title=t('Parts and atlas inspection');frame.src=stageFrameRoute(access,'/stage-parts.html',side);frame.addEventListener('load',()=>{frame!.contentWindow?.postMessage({type:'review-stage-language',language:getLanguage()},location.origin);frame!.contentWindow?.postMessage({type:'review-stage-source',buildId,state:saved},location.origin);});frames.set(key,frame);panel.append(frame);}else if(options.correction||options.preRig){frame.contentWindow?.postMessage({type:'review-stage-revalidate',buildId,state:lastFrame!==frame?saved:null},location.origin);}frame.hidden=false;lastFrame=frame;
|
|
119
|
-
}
|
|
120
|
-
options.refresh?.(()=>{if(current===1&&!options.partsOnly)showParts();});
|
|
121
|
-
const correction=async(event:MessageEvent)=>{if(event.origin!==location.origin||![...frames.values()].some(f=>f.contentWindow===event.source)||event.data?.type!=='review-stage-correction'||!options.correction)return;const r=event.data;if(typeof r.part!=='string'||typeof r.sourceHash!=='string'||typeof r.buildId!=='string'||!['chest','mesh','delta'].includes(r.instrument))return;const prev=correctionActive;correctionActive=true;syncRigControls();try{await options.correction(r);show(3);}catch(error){correctionActive=prev;syncRigControls();status.textContent=error instanceof Error?error.message:String(error);}};
|
|
122
|
-
window.addEventListener('message',correction);
|
|
123
|
-
// Legacy Setup/Animate/Compare selectors keep their IDs, payloads and behavior.
|
|
124
|
-
const legacy=(event?:Event)=>{if(activeReason(3)){event?.preventDefault?.();event?.stopImmediatePropagation?.();syncRigControls();return;}show(3);};
|
|
125
|
-
modeControls.forEach(({button})=>button.addEventListener('click',legacy,true));
|
|
126
|
-
// A side choice reuses the canonical closed A/B picker, then reveals that side's retained atlas.
|
|
127
|
-
let pickingSource=false;
|
|
128
|
-
const sourceChanged=()=>{if(current!==1)return;pickingSource=true;show(1);queueMicrotask(()=>{pickingSource=false;});};
|
|
129
|
-
sourcePicker?.querySelectorAll('[data-build-side]').forEach(button=>button.addEventListener('click',sourceChanged));
|
|
130
|
-
// Legacy bookmark/control restoration writes these canonical attributes even when a mode is unchanged.
|
|
131
|
-
const canonical=new MutationObserver(()=>{if(activeReason(3)){syncRigControls();return;}if(current!==3&&!options.partsOnly&&!options.preRig&&!pickingSource)show(3);});
|
|
132
|
-
document.querySelectorAll('[data-inspector]').forEach(button=>canonical.observe(button,{attributes:true,attributeFilter:['aria-selected','aria-pressed']}));
|
|
133
|
-
const language=onLanguageChange(()=>{render();if(!panel.hidden)status.textContent=t(activeReason(current)??(current===2?(interviewError??(interview&&!interview.hidden?'':'interview.loading')):current===1&&(options.correction||options.preRig)?'Draft rig · structure evidence only':current===1?'Atlas inspection, read only — inspected package. Applied scratch atlas, pre-rig parts, mesh sign-off and draft corrections are unavailable here.':''));for(const f of frames.values()){f.title=t('Parts and atlas inspection');setFrameLanguage(f);}if(interview){interview.title=t('interview.title');setFrameLanguage(interview);}});
|
|
134
|
-
window.addEventListener('resize',place);show(current);
|
|
135
|
-
return ()=>{entry++;window.removeEventListener('message',correction);language();canonical.disconnect();sourcePicker?.querySelectorAll('[data-build-side]').forEach(button=>button.removeEventListener('click',sourceChanged));delete document.documentElement.dataset.inspectionStage;delete document.documentElement.dataset.stageRefused;for(const item of modeSwitches)item.el.hidden=item.hidden;if(sourcePicker&&pickerState){sourcePicker.hidden=pickerState.hidden;setOrRemove(sourcePicker,'aria-label',pickerState.label);}if(reasonFor(3))for(const item of modeControls){item.button.disabled=item.disabled;item.button.title=item.title??'';setOrRemove(item.button,'title',item.title);setOrRemove(item.button,'aria-pressed',item.pressed);setOrRemove(item.button,'aria-selected',item.selected);}if(workspace)workspace.inert=wasInert;buttons.forEach(b=>b.remove());panel.remove();window.removeEventListener('resize',place);modeControls.forEach(({button})=>button.removeEventListener('click',legacy,true));};
|
|
136
|
-
}
|