@rig-c/review 4.9.1 → 4.11.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 +5 -5
- package/docs/PANELS.md +3 -1
- package/docs/REVIEW_PACKAGE.md +143 -30
- package/docs/STABILITY.md +110 -3
- package/package.json +2 -2
- package/src/chest-landmarks.ts +9 -4
- package/src/cloth-recipe.ts +27 -7
- package/src/compare-html.ts +1 -1
- package/src/feedback-export.ts +2 -2
- package/src/feedback-validation.ts +11 -6
- package/src/frame-clock.ts +20 -4
- package/src/job-act.ts +60 -71
- package/src/job-api.ts +302 -46
- package/src/job-checkpoint-evidence.ts +17 -0
- package/src/job-cli.ts +3 -2
- package/src/job-contract.ts +107 -7
- package/src/job-front.ts +48 -12
- package/src/job-host.ts +7 -1
- package/src/job-session.ts +136 -26
- package/src/job-source.ts +133 -21
- package/src/job-store.ts +7 -4
- package/src/manifest.ts +59 -7
- package/src/open-workspace-state.ts +6 -1
- package/src/open.ts +3 -3
- package/src/rebuild.ts +42 -10
- package/src/session.ts +9 -4
- package/src/stage-comment.ts +2 -1
- package/web/catalog-en.ts +31 -6
- package/web/catalog-ko.ts +79 -54
- package/web/chest-editor.ts +236 -31
- package/web/cloth-panel.ts +1 -1
- package/web/compare.css +2 -2
- package/web/environment-world.ts +9 -0
- package/web/i18n.ts +1 -3
- package/web/inspection-persistence.ts +19 -6
- package/web/interview-panel.ts +13 -80
- package/web/job-rig-screen.ts +65 -37
- package/web/job-session.ts +204 -64
- package/web/label-placement.ts +25 -8
- package/web/main.ts +350 -114
- package/web/part-selection.ts +2 -1
- package/web/parts-viewport-provider.ts +21 -8
- package/web/rebuild-client.ts +3 -5
- package/web/rig-host.ts +5 -4
- package/web/rig-overlays.ts +3 -2
- package/web/rig-viewport-provider.ts +10 -6
- package/web/stage-comments.ts +24 -21
- package/web/styles.css +23 -51
- package/web/viewport-controller.ts +4 -0
- package/web/workspace-layout.ts +4 -4
- package/web/workspace-ui.ts +8 -6
package/web/main.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {hasTransientQuestionImage} from './interview-panel.ts';
|
|
2
2
|
import {advanceTake,bindScenePlates,loadScenePlates,takeSample} from './scene-plates.ts';
|
|
3
3
|
import type {SceneInspection} from '../src/scene-inspection.ts';
|
|
4
|
-
import type {RecordSource} from '../src/job-contract.ts';
|
|
4
|
+
import type {JobProgressV3,RecordSource} from '../src/job-contract.ts';
|
|
5
5
|
import type {InterviewSubjectEntry} from '../src/joined-project.ts';
|
|
6
6
|
import {mountJobScreen,joinedInterviewForms,mediaReady,jobSubmissionRefusal} from './job-session.ts';
|
|
7
7
|
import {partsIssueComments,parsePartsIssue,assertPartsIssueBinding} from '../src/parts-comment.ts';
|
|
@@ -72,7 +72,7 @@ import {createWindModel,environmentFor,windReadout,RUNTIME_START_READOUT,joltPac
|
|
|
72
72
|
import {tuningRows,readoutRows,type InspectedCheckView} from '../src/physics-tuning.ts';
|
|
73
73
|
import {bindReadingsPanel,type ReadingsJobView,type ReadingsPanel,type ReadingsRefusal} from './readings-panel.ts';
|
|
74
74
|
import {READINGS_SCHEMA,readingSeekTime,type ReadingsContext} from '../src/readings.ts';
|
|
75
|
-
import {
|
|
75
|
+
import {windClockOnMove,type ClipMove,environmentCheckRows,scheduleContext,worldExport,type EnvironmentCheckView,type WorldExport} from './environment-world.ts';
|
|
76
76
|
import {barLine,beforeLine} from '../src/physics-tuning.ts';
|
|
77
77
|
import {bindRequirementsPanel,type RequirementsCatalogView,type RequirementsJobView,type RequirementsPanel,type RequirementsRefusal} from './requirements-panel.ts';
|
|
78
78
|
import {patchRoute} from '../src/retune-route.ts';
|
|
@@ -151,10 +151,13 @@ for(const event of ['click','change'])secondaryToolbar.addEventListener(event,()
|
|
|
151
151
|
const rigInspector=mountRigInspector(document,shell.actRow??undefined);
|
|
152
152
|
if(host)rigInspector.act.hidden=true;
|
|
153
153
|
const rigAsk=panelMake('button',{className:'workspace-act-ask',id:'workspace-pending-ask',hidden:true});rigAsk.type='button';
|
|
154
|
+
const recordAsk=panelMake('button',{className:'workspace-act-ask',id:'workspace-pending-record-ask',hidden:true,type:'button'});
|
|
154
155
|
const askHeadline=panelMake('span',{id:'workspace-ask-headline',className:'workspace-act-ask',hidden:true});
|
|
155
156
|
const requestChanges=panelMake('button',{id:'request-changes',type:'button',hidden:true});
|
|
156
|
-
rigInspector.act.prepend(askHeadline,rigAsk);button('save').after(requestChanges);
|
|
157
|
+
rigInspector.act.prepend(askHeadline,rigAsk,recordAsk);button('save').after(requestChanges);
|
|
157
158
|
let pendingAnswers:readonly {kind:string;stage?:string}[]=[],answerSaved=false;
|
|
159
|
+
let jobProgress:JobProgressV3|null=null,progressTimer:ReturnType<typeof setInterval>|undefined;
|
|
160
|
+
let askSentence='';
|
|
158
161
|
let partsAnswerBlocked:()=>boolean=()=>false;
|
|
159
162
|
mountViewportPair(el('stage-layout'));
|
|
160
163
|
const viewportState=createViewportState();
|
|
@@ -163,7 +166,11 @@ let partsSubject:ReturnType<typeof bindPartsSubject>|null=null;
|
|
|
163
166
|
let setupPartsPersistence:(()=>Promise<void>)|null=null;
|
|
164
167
|
let rigDifference:{assets:ModelAssets;painting:HTMLImageElement;camera:ReturnType<typeof createViewportState>;hidden:Map<HTMLElement,boolean>;label:string;bookmark:InspectionBookmark}|null=null;
|
|
165
168
|
let rigDifferenceFailure:string|null=null;
|
|
166
|
-
const rigRaster={el,canvas:partsCanvas,message,reference:()=>null,
|
|
169
|
+
const rigRaster={el,canvas:partsCanvas,message,reference:()=>null,
|
|
170
|
+
frameSize:(target:CameraTarget)=>activeInterviewImage
|
|
171
|
+
?target==='reference'&&referenceSize?{w:referenceSize.width,h:referenceSize.height}:null
|
|
172
|
+
:{w:partsCanvas.width,h:partsCanvas.height},
|
|
173
|
+
active:()=>!!rigDifference||!!activeInterviewImage};
|
|
167
174
|
if(partsOnly){partsCanvas.id='parts-canvas';el('rig-root').append(partsCanvas);el('reference-content').append(partsReference);}
|
|
168
175
|
let sceneComposite:ReturnType<typeof bindScenePlates>|undefined;
|
|
169
176
|
const activeScene=()=>sceneComposite&&data.direction&&(!stageSource||stageSource.url===inspectedModel?.url)?data.direction:undefined;
|
|
@@ -235,6 +242,7 @@ let idleHeld=false;
|
|
|
235
242
|
let suspendedPreview=false;
|
|
236
243
|
let controlDispose:(()=>void)|null=null;
|
|
237
244
|
const viewDisposers:(()=>void)[]=[];
|
|
245
|
+
if(host)viewDisposers.push(onLanguageChange(()=>{if(jobProgress&&!pendingAnswers.length)renderAskHeadline();}));
|
|
238
246
|
const layers={images:true,mesh:false,bones:false,meshOpacity:.65};
|
|
239
247
|
let chestMapping:CropWorldMapping={available:false,reason:'CHEST_REGION_MAPPING_UNAVAILABLE: no compiled model drawn'};
|
|
240
248
|
let setupChestWorld:{x:number;y:number}|null=null;
|
|
@@ -332,7 +340,7 @@ function renderDraftState(): void {
|
|
|
332
340
|
const live=host?.reviewState?.(liveIssueCount(),saving);
|
|
333
341
|
renderAnswerControls();
|
|
334
342
|
if (draftStatus === null && !live && !answerSaved) return;
|
|
335
|
-
rigInspector.actBar.setSaveState({ kind: actReadOnly ? 'read-only' : saving ? 'saving' : draftConflict ? 'failed' : dirty ? 'unsaved' : 'saved', text: draftConflict ? 'Saved draft could not be restored. Your draft has not been deleted. Download or discard it before submitting.' : answerSaved ? 'Answer saved' : draftStatus&&/^(
|
|
343
|
+
rigInspector.actBar.setSaveState({ kind: actReadOnly ? 'read-only' : saving ? 'saving' : draftConflict ? 'failed' : dirty ? 'unsaved' : 'saved', text: draftConflict ? 'Saved draft could not be restored. Your draft has not been deleted. Download or discard it before submitting.' : answerSaved ? 'Answer saved' : draftStatus&&/^(The source changed, so |Local draft could not be saved|Local draft storage unavailable|Local draft needs explicit recovery)/.test(draftStatus)?draftStatus:actReadOnly??live??draftStatus! });
|
|
336
344
|
if(answerSaved&&!saving&&!draftConflict&&!dirty&&!actReadOnly&&(host?.record||!host)&&
|
|
337
345
|
(host?.pendingSubjects?.()??pendingAnswers).every(subject=>subject.kind==='interview-picks')&&!el('message').classList.contains('error'))message(sourceTextContent(el('dirty')),false,true);
|
|
338
346
|
}
|
|
@@ -541,6 +549,7 @@ async function showReference(id: string, bound?:{name:string;src:string}): Promi
|
|
|
541
549
|
const content = el('reference-content'); content.replaceChildren();
|
|
542
550
|
const reference = bound?{id:'',label:bound.name,type:'image' as const,path:''}:data.manifest.references.find(item => item.id === id);
|
|
543
551
|
el('reference-empty').hidden = false;setReferenceInput(reference?{state:'pending'}:{state:'absent'});
|
|
552
|
+
if(bound)viewport.requestFit();
|
|
544
553
|
if (!reference) { text('reference-empty', 'No reference supplied.'); text('reference-info', 'Add image, video or input-pose references to the package.'); return; }
|
|
545
554
|
text('reference-label', reference.label + (reference.type === 'pose' ? ' · Static input pose' : ' · Reference'));
|
|
546
555
|
text('reference-empty', 'Loading reference…');
|
|
@@ -643,7 +652,7 @@ function renderFrameTransport(): void {
|
|
|
643
652
|
function activeTransportClock() {
|
|
644
653
|
if(activeScene())return null;
|
|
645
654
|
const active = player && player.current !== animation ? '' : animation;
|
|
646
|
-
return transportClock({ clock: data.report?.clock, animation: data.report?.animation }, active, !!player, stageClock, stageModelHash);
|
|
655
|
+
return transportClock({ clock: data.report?.clock, animation: data.report?.animation, frameClocks: data.feedbackCatalog?.frameClocks }, active, !!player, stageClock, stageModelHash);
|
|
647
656
|
}
|
|
648
657
|
function activeFrameClock() { return activeScene()?null:activeTransportClock()?.clock ?? null; }
|
|
649
658
|
|
|
@@ -659,7 +668,7 @@ function seekFrame(frame: number): void {
|
|
|
659
668
|
function drawRig(action:()=>void):void {
|
|
660
669
|
if(rigDifference&&rigDifference.assets!==assets){leaveRigDifference();renderLayout();}
|
|
661
670
|
inDrawRig=true;
|
|
662
|
-
try{const box=sceneBox();if(box&&player?.renderer instanceof CanvasRenderer)player.renderer.viewport=box;action();if(box&&player){sceneComposite?.draw(player,box);}parts?.present('single');if(box)viewport.fitCamera();if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);text('renderer-state',rendererStatus(player?.renderer??null,'succeeded').label);redrawOverlay(true);}
|
|
671
|
+
try{const box=sceneBox();if(box&&player?.renderer instanceof CanvasRenderer)player.renderer.viewport=box;action();if(box&&player){sceneComposite?.draw(player,box);}parts?.present('single');chestEditor?.syncJobTarget();if(box)viewport.fitCamera();if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);text('renderer-state',rendererStatus(player?.renderer??null,'succeeded').label);redrawOverlay(true);}
|
|
663
672
|
catch(error){animationPanel?.capture(null,undefined);overlays?.clear();text('renderer-state',rendererStatus(null,'failed').label);throw error;}
|
|
664
673
|
finally{inDrawRig=false;}
|
|
665
674
|
}
|
|
@@ -858,19 +867,26 @@ function configureTurnPad(model:unknown):void {
|
|
|
858
867
|
if(previous&&turnPad){try{turnPad.restore(previous);}catch{message('TURN_STATE_MODEL_MISMATCH: turn values reset for this build.',true);}}
|
|
859
868
|
workspace?.refresh();
|
|
860
869
|
}
|
|
861
|
-
/** Verify the same response consumed by Play, rather than a second read of its source.
|
|
870
|
+
/** Verify the same response consumed by Play, rather than a second read of its source. One request per input per
|
|
871
|
+
* load (#1050): the verified response is kept for this load, and the part catalog and model document read it again
|
|
872
|
+
* through the same fetch. A new load (a rebuild, another build) calls this again and gets a fresh request. */
|
|
862
873
|
function stageLoadInputs(modelUrl:string, modelHash:string) {
|
|
863
874
|
const setsUrl=modelUrl===inspectedModel?.url&&data.manifest.sets&&data.setsHash
|
|
864
875
|
?new URL(assetUrl(data.manifest.sets),location.href).href:null;
|
|
876
|
+
const verified=new Map<string,Promise<Response>>();
|
|
865
877
|
const checkedFetch=new Proxy(fetch,{apply:async(_target,_this,args:Parameters<typeof fetch>)=>{
|
|
866
|
-
const
|
|
878
|
+
const url=String(args[0]),expected=url===modelUrl?modelHash:url===setsUrl?data.setsHash:null;
|
|
867
879
|
if(!expected)throw new Error('DIRECTION_SOURCE_CHANGED: undeclared playback input');
|
|
868
|
-
|
|
869
|
-
if(!
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
880
|
+
let pending=verified.get(url);
|
|
881
|
+
if(!pending){pending=(async()=>{
|
|
882
|
+
const response=await fetch(...args);
|
|
883
|
+
if(!response.ok)return response;
|
|
884
|
+
const bytes=await response.arrayBuffer();
|
|
885
|
+
const sha256=Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',bytes)),v=>v.toString(16).padStart(2,'0')).join('');
|
|
886
|
+
if(sha256!==expected)throw new Error('DIRECTION_SOURCE_CHANGED: playback bytes differ from the bound SHA-256');
|
|
887
|
+
return new Response(bytes,{status:response.status,statusText:response.statusText,headers:response.headers});
|
|
888
|
+
})();verified.set(url,pending);}
|
|
889
|
+
return (await pending).clone();
|
|
874
890
|
}});
|
|
875
891
|
return {setsUrl,fetch:checkedFetch};
|
|
876
892
|
}
|
|
@@ -905,17 +921,19 @@ async function initPlayer(initialCheckpoint?:Checkpoint): Promise<void> {
|
|
|
905
921
|
try {
|
|
906
922
|
const modelUrl = new URL(assetUrl(data.manifest.model), location.href).href;
|
|
907
923
|
inspectedModel={url:modelUrl,prefix:access.route('/assets/'),sha256:data.reviewedSource.rig?.sha256??''};stageModelHash=inspectedModel.sha256||null;
|
|
908
|
-
|
|
924
|
+
const inputs=stageLoadInputs(modelUrl,inspectedModel.sha256);
|
|
925
|
+
assets = await loadModel({ modelUrl, ...inputs, resolvePage: (name, url) => {
|
|
909
926
|
const target = new URL(name, url); if (target.origin !== location.origin || !target.pathname.startsWith(access.route('/assets/'))) throw new Error(`Model page escapes local package: ${name}`); return target.href;
|
|
910
927
|
} });
|
|
911
928
|
if(data.scene){sceneComposite=bindScenePlates(data.scene,await loadScenePlates(data.scene,assetUrl));input('idle-repeat').checked=data.direction!.take.loop;input('idle-repeat').disabled=true;}
|
|
912
929
|
player = createInspectionPlayer(el('rig-root'), assets,sceneComposite?'canvas':undefined);
|
|
913
930
|
setupChestWorld = readSetupChest(player);
|
|
914
931
|
// Parts inspection is an add-on: a catalog refusal is shown in the explorer and never aborts the rig.
|
|
915
|
-
try{const catalog=await loadPartModel(modelUrl,data.reviewedSource.rig!.sha256,data.feedbackCatalog.slots??[]);inspectionSourceState='ready';partModel=catalog.model;configureTurnPad(catalog.model);refreshAnimationInspection();weightsView?.refresh();parts?.register('single',catalog.entries,player,new PartThumbnails(pageRegionTable(catalog.model),assets.pageImages));}catch(error){inspectionSourceState='failed';partModel=null;refreshAnimationInspection();parts?.refuseCatalog('single',error);}
|
|
932
|
+
try{const catalog=await loadPartModel(modelUrl,data.reviewedSource.rig!.sha256,data.feedbackCatalog.slots??[],inputs.fetch);inspectionSourceState='ready';partModel=catalog.model;configureTurnPad(catalog.model);refreshAnimationInspection();weightsView?.refresh();parts?.register('single',catalog.entries,player,new PartThumbnails(pageRegionTable(catalog.model),assets.pageImages));}catch(error){inspectionSourceState='failed';partModel=null;refreshAnimationInspection();parts?.refuseCatalog('single',error);}
|
|
916
933
|
const animations = select('animation-select'); animations.replaceChildren();
|
|
917
934
|
for (const item of assets.animations) animations.append(option(item.name, data.manifest.animations.find(a => a.id === item.name)?.label ?? item.name));
|
|
918
935
|
animations.disabled = assets.animations.length === 0 || !!data.scene;
|
|
936
|
+
if(host?.chestLandmarks?.length)updateChestMapping();
|
|
919
937
|
const names=assets.animations.map(clip=>clip.name),initial=data.scene?.animation??initialIdleAnimation(names,initialPlayerAnimation(names,data.initialAnimation??undefined,initialCheckpoint),!!data.initialAnimation||!!initialCheckpoint?.animation||!!initialCheckpoint?.axis);
|
|
920
938
|
if(initial)chooseAnimation(initial);else drawRig(()=>player!.draw());
|
|
921
939
|
el('rig-empty').hidden = true; text('player-state', '@rig-c/play · Actual rig');
|
|
@@ -925,7 +943,7 @@ async function initPlayer(initialCheckpoint?:Checkpoint): Promise<void> {
|
|
|
925
943
|
select('axis-select').replaceChildren(); for (const axis of validAxes) select('axis-select').append(option(axis.id, axis.label));
|
|
926
944
|
input('axis-value').disabled = !validAxes.length;
|
|
927
945
|
for(const id of ['layer-images','layer-mesh','layer-bones'])input(id).disabled=false;
|
|
928
|
-
enableEnvironment(modelUrl);
|
|
946
|
+
enableEnvironment(modelUrl,inputs.fetch);
|
|
929
947
|
describeLayerToggles(document,el('layer-state').textContent??'');
|
|
930
948
|
fitCamera();
|
|
931
949
|
} catch (error) { turnPad?.dispose();turnPad=null;document.getElementById('turn-pad-host')?.remove();text('renderer-state',rendererStatus(null,'failed').label);player?.dispose(); player = null; assets?.dispose(); assets = null; text('player-state', 'Rig load failed'); text('rig-empty', `Could not open rig: ${errorText(error)}`); message(errorText(error), true); }
|
|
@@ -1208,7 +1226,7 @@ function bind(): void {
|
|
|
1208
1226
|
await persistence?.submitted(submittedBaseline);
|
|
1209
1227
|
comments?.refresh(); renderProposals();
|
|
1210
1228
|
},host.direction?recordCommentWords():undefined,general);
|
|
1211
|
-
message(sent);
|
|
1229
|
+
if (sent) message(sent);
|
|
1212
1230
|
} catch (error) {
|
|
1213
1231
|
submissionFailure = jobSubmissionRefusal(error);
|
|
1214
1232
|
message(submissionFailure.text, true);
|
|
@@ -1242,7 +1260,13 @@ function bind(): void {
|
|
|
1242
1260
|
bindWorkspace(!!data.manifest.model);
|
|
1243
1261
|
overlays=new RigOverlays({canvas:el<HTMLCanvasElement>('rig-overlay'),rigRoot:el('rig-root')});
|
|
1244
1262
|
verdictSubmit=button('save').onclick as ((event:MouseEvent)=>unknown)|null;
|
|
1245
|
-
chestEditor=bindChestEditor({pane:el('rig-pane'),canvas:el('rig-overlay'),project:()=>player?rigProject():null,mapping:()=>activeChestMapping(),
|
|
1263
|
+
chestEditor=bindChestEditor({pane:el('rig-pane'),canvas:el('rig-overlay'),project:()=>player?rigProject():null,mapping:()=>activeChestMapping(),
|
|
1264
|
+
job:host?(readOnly||host.direction?'read-only':{
|
|
1265
|
+
seeds:()=>inspectionSourceState==='ready'&&stageModelHash===data.reviewedSource.rig?.sha256&&chestMapping.available?host?.chestLandmarks??[]:[],
|
|
1266
|
+
selection:()=>{const part=parts?.value();return part?{slot:part.slot,skin:part.identity?.skin??null,attachment:part.identity?.attachment??null}:null;},
|
|
1267
|
+
download:edit=>download('chest-landmarks.json',JSON.stringify(edit,null,2)+'\n','application/json'),
|
|
1268
|
+
}):undefined,
|
|
1269
|
+
changed:()=>{renderChest();if(host)renderAnswerControls();},download:()=>{void exportChest();},apply:()=>{void applyRebuild();},reset:()=>{void resetRebuild();},message,inspector:()=>selectedInspector()});viewDisposers.push(()=>chestEditor?.dispose());
|
|
1246
1270
|
const editRefusal=sealedRecordRigReadOnly();
|
|
1247
1271
|
if(editRefusal)chestEditor.unavailable(editRefusal);
|
|
1248
1272
|
meshEditor=bindMeshEditor({pane:el('rig-pane'),canvas:el('rig-overlay'),project:()=>player?rigProject():null,mapping:()=>chestMapping,inspector:()=>selectedInspector(),readOnly:!!editRefusal,source:meshSource,pause,
|
|
@@ -1327,12 +1351,12 @@ async function start(): Promise<void> {
|
|
|
1327
1351
|
.filter(control=>control.id!=='settings-language').map(control=>({control,disabled:control.disabled}));
|
|
1328
1352
|
for(const {control}of controls)control.disabled=true;
|
|
1329
1353
|
for(const control of [button('save'),requestChanges,select('review-status'),screenRoot.querySelector<HTMLElement>('label[for="review-status"]')!])control.hidden=true;
|
|
1330
|
-
|
|
1354
|
+
renderAskHeadline(t('job.waiting',undefined,'en'));syncJobActRow();
|
|
1331
1355
|
await workspace?.settle();if(disposed)return;
|
|
1332
1356
|
const next=await new Promise<RigHost>((resolve,reject)=>{
|
|
1333
1357
|
lifecycle.signal.addEventListener('abort',()=>reject(new Error('JOB_PRELOAD_CANCELLED')),{once:true});
|
|
1334
1358
|
host!.attach({publish:resolve,stage:()=>null,redraw:()=>{},
|
|
1335
|
-
message:(value,error,diagnostic)=>message(value,error,false,diagnostic),suspend:()=>{},dispose:disposeScreen});
|
|
1359
|
+
message:(value,error,diagnostic)=>message(value,error,false,diagnostic),progress:setJobProgress,suspend:()=>{},dispose:disposeScreen});
|
|
1336
1360
|
});
|
|
1337
1361
|
if(disposed)return;
|
|
1338
1362
|
host=next;access=next.access;partsOnly=next.subject==='parts';
|
|
@@ -1365,7 +1389,7 @@ async function start(): Promise<void> {
|
|
|
1365
1389
|
// Checkpoints and reference fold away when the package supplies neither.
|
|
1366
1390
|
(el('package-context') as HTMLDetailsElement).open = data.manifest.checkpoints.length > 0 || data.manifest.references.length > 0;
|
|
1367
1391
|
const sourceFiles = el('source-files'); for (const file of data.manifest.authoring) { const a = document.createElement('a'); a.href = assetUrl(file.path); a.textContent = file.label; a.className = 'source-link'; a.target = '_blank'; a.rel = 'noopener'; sourceFiles.append(a); } if (!data.manifest.authoring.length) sourceFiles.textContent = 'No source files supplied';sourceFiles.parentElement!.hidden=!data.manifest.authoring.length;
|
|
1368
|
-
populateChestBones(); bind(); parts=new PartExplorer(el('workspace-left'),el('selected-part'),previous=>{if(rigDifference){leaveRigDifference();renderLayout();}const part=parts?.value();if(!stageCorrectionRebinding&&(previous?.side!==part?.side||previous?.slot!==part?.slot||previous?.mode!==part?.mode))stageDraftRequestToken++;if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);weightsView?.refresh();redrawOverlay(true);meshEditor?.selectionChanged();if(stageCorrectionPart&&!stageCorrectionRebinding&&(part?.slot??null)!==stageCorrectionPart){stageCorrectionPart=null;document.getElementById('stage-draft-label')?.remove();}animationPanel?.fromParts(part?.slot??null);meshPanel?.select(part?.slot??null);if(part&&!stageCorrectionRebinding)void openStageCorrection({part:part.slot,instrument:'selection'});requirementsPanel?.selectionChanged();renderDropNotices();if(part){viewport.state.activeCamera='rig';if(view==='reference')setView('rig');if(selectedInspector(document)!=='playback')showInspector('rig');renderCameraControls();}if(!viewport.state.cameraRestoring&&(previous?.side!==part?.side||previous?.slot!==part?.slot))cameraAction(()=>fitActiveCamera(part?'rig':availableCamera()));persistence?.save();},part=>{select('feedback-target-kind').value='slot';renderFeedbackTargets(true);input('feedback-target-name').value=part.slot;showInspector('feedback');}); animationPanel=new AnimationInspectionPanel({hideGateBanner:!!host?.direction,readOnlyReason:sealedRecordRigReadOnly,host:el('animation-inspection'),stage:el('rig-viewport'),project:(x,y)=>rigProject()(x,y),enabled:()=>inspectionSourceState==='ready'&&selectedInspector(document)==='playback',pause,preview:fn=>{animAdjust=fn;if(!player)return;player.adjust=composeAdjust(composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust),animAdjust);if(!inDrawRig&&player.current&&!playing){if(activeScene())seek(time);else{player.seek(time);drawRig(()=>player!.draw());}}},apply:ops=>applyAnimation(ops),reset:()=>resetAnimationBuild(),seek:exact=>{if(!Number.isFinite(exact)||exact<0||exact>duration){message('KEY_TIME_OUT_OF_DOMAIN: no substitute time was used.',true);return;}seekMarker(animation,exact,'Stored key');},select:value=>{const slot=value?.kind==='slot'?value.name:null;if((parts?.value()?.slot??null)!==slot)parts?.select(slot?{side:'single',slot,mode:parts?.value()?.mode??'context'}:null);parts?.highlightBone(value?.kind==='bone'?value.name:null);redrawOverlay(false);}});viewDisposers.push(()=>animationPanel?.dispose()); updateStripControls(); stripStatus('Choose the entered start–end frames or all feedback ranges to download. Unsubmitted feedback is included; exporting does not submit the review.'); renderFeedbackTargets(true); renderFeedbackRange(); renderCheckpoints(); renderProposals(); renderProvenance(); updateSavedState(); renderCues(); initReport();
|
|
1392
|
+
populateChestBones(); bind(); parts=new PartExplorer(el('workspace-left'),el('selected-part'),previous=>{if(rigDifference){leaveRigDifference();renderLayout();}const part=parts?.value();if(!stageCorrectionRebinding&&(previous?.side!==part?.side||previous?.slot!==part?.slot||previous?.mode!==part?.mode))stageDraftRequestToken++;if(player&&inspectionSourceState==='ready')animationPanel?.capture(player,parts?.frame('single'));else animationPanel?.capture(null,undefined);weightsView?.refresh();redrawOverlay(true);meshEditor?.selectionChanged();if(stageCorrectionPart&&!stageCorrectionRebinding&&(part?.slot??null)!==stageCorrectionPart){stageCorrectionPart=null;document.getElementById('stage-draft-label')?.remove();}animationPanel?.fromParts(part?.slot??null);meshPanel?.select(part?.slot??null);if(host)chestEditor?.sync();else if(part&&!stageCorrectionRebinding)void openStageCorrection({part:part.slot,instrument:'selection'});requirementsPanel?.selectionChanged();renderDropNotices();if(part){viewport.state.activeCamera='rig';if(view==='reference')setView('rig');if(selectedInspector(document)!=='playback')showInspector('rig');renderCameraControls();}if(!viewport.state.cameraRestoring&&(previous?.side!==part?.side||previous?.slot!==part?.slot))cameraAction(()=>fitActiveCamera(part?'rig':availableCamera()));persistence?.save();},part=>{select('feedback-target-kind').value='slot';renderFeedbackTargets(true);input('feedback-target-name').value=part.slot;showInspector('feedback');}); animationPanel=new AnimationInspectionPanel({hideGateBanner:!!host?.direction,readOnlyReason:sealedRecordRigReadOnly,host:el('animation-inspection'),stage:el('rig-viewport'),project:(x,y)=>rigProject()(x,y),enabled:()=>inspectionSourceState==='ready'&&selectedInspector(document)==='playback',pause,preview:fn=>{animAdjust=fn;if(!player)return;player.adjust=composeAdjust(composeAdjust(composeAdjust(idleAdjust,dialAdjust),turnAdjust),animAdjust);if(!inDrawRig&&player.current&&!playing){if(activeScene())seek(time);else{player.seek(time);drawRig(()=>player!.draw());}}},apply:ops=>applyAnimation(ops),reset:()=>resetAnimationBuild(),seek:exact=>{if(!Number.isFinite(exact)||exact<0||exact>duration){message('KEY_TIME_OUT_OF_DOMAIN: no substitute time was used.',true);return;}seekMarker(animation,exact,'Stored key');},select:value=>{const slot=value?.kind==='slot'?value.name:null;if((parts?.value()?.slot??null)!==slot)parts?.select(slot?{side:'single',slot,mode:parts?.value()?.mode??'context'}:null);parts?.highlightBone(value?.kind==='bone'?value.name:null);redrawOverlay(false);}});viewDisposers.push(()=>animationPanel?.dispose()); updateStripControls(); stripStatus('Choose the entered start–end frames or all feedback ranges to download. Unsubmitted feedback is included; exporting does not submit the review.'); renderFeedbackTargets(true); renderFeedbackRange(); renderCheckpoints(); renderProposals(); renderProvenance(); updateSavedState(); renderCues(); initReport();
|
|
1369
1393
|
const requestedId = new URLSearchParams(location.search).get('checkpoint'),initial=initialReviewSelection(data.manifest,requestedId,data.explicitReference?.id,data.initialAnimation??undefined),first=initial.checkpoint;
|
|
1370
1394
|
rigInput=data.manifest.model?{state:'pending'}:{state:'absent'};renderLayout();
|
|
1371
1395
|
// A job rig subject lands in Animate before the model finishes loading (#709).
|
|
@@ -1373,7 +1397,7 @@ async function start(): Promise<void> {
|
|
|
1373
1397
|
if(initial.referenceId){select('reference-select').value=initial.referenceId;await showReference(initial.referenceId);}
|
|
1374
1398
|
await initPlayer(first);
|
|
1375
1399
|
// initPlayer keeps `player` only after its first draw succeeded; a declared model path alone never counts.
|
|
1376
|
-
updateChestMapping();
|
|
1400
|
+
if(!host?.chestLandmarks?.length)updateChestMapping();
|
|
1377
1401
|
rigInput=player?{state:'loaded'}:data.manifest.model?{state:'failed',reason:el('rig-empty').textContent||'compiled player unavailable'}:{state:'absent'};renderLayout();
|
|
1378
1402
|
if (first) await chooseCheckpoint(first,initial); else renderCheckpoint();
|
|
1379
1403
|
viewport.state.activeCamera=player?'rig':'reference';if(viewport.state.cameraSync)alignCameras();renderTransport();fitCamera();
|
|
@@ -1395,8 +1419,8 @@ async function start(): Promise<void> {
|
|
|
1395
1419
|
}
|
|
1396
1420
|
if(!player&&(data.manifest.model||referenceInput.state!=='loaded'))throw new Error('JOB_VISUAL_UNAVAILABLE');
|
|
1397
1421
|
await restorePublicationNavigation();document.body.dataset.ready='true';
|
|
1398
|
-
const screen:JobRigMeshScreen={recordForms:renderRecordForms,pendingSubjects:renderPendingSubjects,stage:hostStage,redraw:()=>{if(player&&!playing)drawRig(()=>player!.draw());},message:(value,error,diagnostic)=>message(value,error,false,diagnostic),...host.record?{}:{incompatible:()=>navigationMissing,navigation:()=>({subject:'rig' as const,bookmark:inspectionBookmark()})},suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen,
|
|
1399
|
-
hasMeshEdits:()=>!!meshEditor?.hasJobEdits(),meshEdits:async()=>meshEditor?.jobEdits()??null};
|
|
1422
|
+
const screen:JobRigMeshScreen={recordForms:renderRecordForms,pendingSubjects:renderPendingSubjects,progress:setJobProgress,stage:hostStage,redraw:()=>{if(player&&!playing)drawRig(()=>player!.draw());},message:(value,error,diagnostic)=>message(value,error,false,diagnostic),...host.record?{}:{incompatible:()=>navigationMissing,navigation:()=>({subject:'rig' as const,bookmark:inspectionBookmark()})},suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen,
|
|
1423
|
+
hasMeshEdits:()=>!!meshEditor?.hasJobEdits(),meshEdits:async()=>meshEditor?.jobEdits()??null,chestLandmarks:()=>chestEditor?.jobEdits()??null};
|
|
1400
1424
|
host.attach(screen);showInspector(data.manifest.model?'playback':'rig');host.displayed();
|
|
1401
1425
|
}
|
|
1402
1426
|
} catch (error) { if(disposed)return;message(`Could not open review package: ${errorText(error)}`, true); text('dirty', 'Load failed'); host?.failed(error); }
|
|
@@ -1417,17 +1441,17 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1417
1441
|
if(!response.ok){const body=await response.json();throw new Error(typeof body.error==='string'?body.error:body.error?.code??'PARTS_PAINT_FAILED');}return response;
|
|
1418
1442
|
};
|
|
1419
1443
|
const showCommentCount=()=>setSourceText(rigInspector.comments.button,`Comments (${issues.length+(generalRows?.length??0)})`);
|
|
1420
|
-
const changed=()=>{dirty=true;text('dirty','Unsubmitted changes');el('dirty').classList.add('dirty');parts?.refreshImages();rigInspector.actBar.setSaveState({kind:'unsaved',text:'Unsubmitted changes'});renderDraftState();showCommentCount();return persistence?.save();};
|
|
1444
|
+
const changed=()=>{if(/^The source changed, so /.test(draftStatus??''))draftStatus=null;dirty=true;text('dirty','Unsubmitted changes');el('dirty').classList.add('dirty');parts?.refreshImages();rigInspector.actBar.setSaveState({kind:'unsaved',text:'Unsubmitted changes'});renderDraftState();showCommentCount();return persistence?.save();};
|
|
1421
1445
|
// A parts verdict is saved only over a drawn subject: until the first paint, or after a failed one, Save stays off.
|
|
1422
1446
|
const saveBlocked=()=>!!readOnly||!!subject.legacyVerdict?.readOnly||rigInput.state!=='loaded'||draftConflict||!!persistence?.restoring();
|
|
1423
1447
|
partsAnswerBlocked=saveBlocked;
|
|
1424
1448
|
text('rig-empty','Loading package…');
|
|
1425
|
-
if(generalRows)restoreRecordComments();
|
|
1449
|
+
if(generalRows||host?.record)restoreRecordComments();
|
|
1426
1450
|
partsSubject=bindPartsSubject({data:subject,canvas:partsCanvas,referenceCanvas:partsReference,viewport,el,toolbar:primaryToolbar,commentsHost:el('comments-list-host'),openComments:openReview,hasPicture:()=>!hasTransientQuestionImage(screenRoot),issues,
|
|
1427
1451
|
...(host?.record?{recordComments}:host?.verdictComments?{generalComments:host.verdictComments,submitting:()=>saving}:{}),
|
|
1428
1452
|
request,base,paintingPath:host?'/review-painting':'/api/parts/painting',mesh:()=>layers.mesh,restoreMesh:on=>{layers.mesh=on;input('layer-mesh').checked=on;},images:()=>layers.images,
|
|
1429
1453
|
changed:()=>{if(host?.record){recordCommentsChanged();return;}if(generalRows)persistRecordComments();return changed();},
|
|
1430
|
-
selectionChanged:()=>parts?.refreshImages(),locked:id=>submittedIssues.has(id),refusal:()=>readOnly,drawn:state=>{rigInput=state;button('save').disabled=saveBlocked();renderAnswerControls();if(state.state==='failed')text('rig-empty',state.reason);text('renderer-state',state.state==='loaded'?'Parts raster drawn · Canvas2D':'Rendering failed');text('player-state',state.state==='loaded'?'Parts images · no compiled rig loaded':'Rig load failed');renderLayout();},message});
|
|
1454
|
+
selectionChanged:()=>{parts?.refreshImages();renderAnswerControls();},locked:id=>submittedIssues.has(id),refusal:()=>readOnly,drawn:state=>{rigInput=state;button('save').disabled=saveBlocked();renderAnswerControls();if(state.state==='failed')text('rig-empty',state.reason);text('renderer-state',state.state==='loaded'?'Parts raster drawn · Canvas2D':'Rendering failed');text('player-state',state.state==='loaded'?'Parts images · no compiled rig loaded':'Rig load failed');renderLayout();},message});
|
|
1431
1455
|
parts=new PartExplorer(el('workspace-left'),el('selected-part'),()=>{},()=>openReview());
|
|
1432
1456
|
const thumbnails=new PartThumbnails();viewDisposers.push(()=>thumbnails.dispose());
|
|
1433
1457
|
parts.registerImages({thumbnail:(icon,item,glyph)=>thumbnails.showOriginal(icon,item,()=>partsSubject!.image(item.index),glyph),items:subject.items,selected:partsSubject.selected,solo:partsSubject.solo,visible:partsSubject.visible,select:partsSubject.select,isolate:partsSubject.isolate,show:partsSubject.show});
|
|
@@ -1458,7 +1482,7 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1458
1482
|
const label=panelMake('label',{id:'parts-difference-operand-label',hidden:true},tr('Compare with'),operand);
|
|
1459
1483
|
const localizeOptions=()=>{
|
|
1460
1484
|
paintingOption.textContent=t('Original painting');
|
|
1461
|
-
previousOption.textContent=t('Previous accepted draft · {0}
|
|
1485
|
+
previousOption.textContent=t('Previous accepted draft · {0}',[previousDraft.id]);
|
|
1462
1486
|
};
|
|
1463
1487
|
localizeOptions();viewDisposers.push(onLanguageChange(localizeOptions));
|
|
1464
1488
|
operand.onchange=()=>{
|
|
@@ -1478,8 +1502,12 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1478
1502
|
select('review-status').hidden=true;document.querySelector<HTMLLabelElement>('label[for="review-status"]')!.hidden=true;
|
|
1479
1503
|
button('save').disabled=saveBlocked();
|
|
1480
1504
|
button('save').onclick=async()=>{
|
|
1481
|
-
if(saving||saveBlocked())return;
|
|
1505
|
+
if(saving||saveBlocked())return;
|
|
1506
|
+
if(partsSubject?.hasPendingComment()){if(!await partsSubject.commitDraft())return;}
|
|
1507
|
+
if(saving||saveBlocked())return;
|
|
1508
|
+
saving=true;button('save').disabled=true;state.setSaveState({kind:'saving',text:'Saving…'});renderDraftState();
|
|
1482
1509
|
const frozen=structuredClone(issues),general=generalRows?.map(row=>row.summary);
|
|
1510
|
+
let submissionFailure:ReturnType<typeof jobSubmissionRefusal>|null=null,saveFailed=false;
|
|
1483
1511
|
try{
|
|
1484
1512
|
if(host?.submitParts)message(await host.submitParts(frozen,general));
|
|
1485
1513
|
else await request(base+'/verdict',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({status:frozen.length?'changes-requested':'approved',issues:frozen})});
|
|
@@ -1488,8 +1516,8 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1488
1516
|
if(host)for(const issue of frozen)submittedIssues.add(issue.id);
|
|
1489
1517
|
if(general?.length){partsSubject?.refreshComments();showCommentCount();}
|
|
1490
1518
|
dirty=JSON.stringify(issues)!==JSON.stringify(frozen);partsBaseline={subject:'parts',issues:frozen};await persistence?.submitted(partsBaseline);if(disposed)return;state.setSaveState({kind:dirty?'unsaved':'saved',text:dirty?'Unsubmitted changes':'Submitted'});text('dirty',dirty?'Unsubmitted changes':'Submitted');el('dirty').classList.toggle('dirty',dirty);
|
|
1491
|
-
}catch(error){message(errorText(error),true);state.setSaveState({kind:'failed',text:'Save failed.'});}
|
|
1492
|
-
finally{saving=false;button('save').disabled=saveBlocked();renderDraftState();}
|
|
1519
|
+
}catch(error){saveFailed=true;if(host){submissionFailure=jobSubmissionRefusal(error);message(submissionFailure.text,true);}else{message(errorText(error),true);state.setSaveState({kind:'failed',text:'Save failed.'});}}
|
|
1520
|
+
finally{saving=false;button('save').disabled=saveBlocked();renderDraftState();if(submissionFailure){state.setSaveState({kind:'failed',text:submissionFailure.text,title:submissionFailure.title});el('message').title=submissionFailure.title;}else if(saveFailed)state.setSaveState({kind:'failed',text:'Save failed.'});}
|
|
1493
1521
|
};
|
|
1494
1522
|
viewDisposers.push(viewport.bindControls(unitScaleMessage),viewport.bindNavigation(undefined,()=>!el('stage-layout').getAttribute('aria-busy')?.includes('true')),bindLayerShortcuts(document));
|
|
1495
1523
|
const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
|
|
@@ -1497,7 +1525,10 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1497
1525
|
setupPartsPersistence=async()=>{
|
|
1498
1526
|
if(host?.record)return;
|
|
1499
1527
|
const binding:InspectionBinding={mode:'single',sourceHash:subject.sourceHash,rigs:[null]};
|
|
1500
|
-
const
|
|
1528
|
+
const legacyPartsScope='parts:'+access.key+':'+access.base+':'+subject.sourceHash;
|
|
1529
|
+
const partsDraftScope=host?.verdictComments?.jobId&&host?.verdictComments?.draftId?host.verdictComments.jobId+':'+host.verdictComments.draftId:access.key+':'+access.base;
|
|
1530
|
+
const partsScope='parts:'+partsDraftScope+':'+subject.sourceHash;
|
|
1531
|
+
const connection=await connectInspectionPersistence({scope:partsScope,legacyScopes:partsScope!==legacyPartsScope?[legacyPartsScope]:[],binding,baseline:partsBaseline,session:()=>({subject:'parts' as const,issues}),reviewDirty:()=>dirty,
|
|
1501
1532
|
recover:value=>{try{if(!value||typeof value!=='object')return null;const row=value as PartsSubjectSession;if(row.subject!=='parts'||!Array.isArray(row.issues)||row.issues.length>1000||Object.keys(row).some(key=>!['subject','issues'].includes(key)))return null;const items=new Map(subject.items.map(item=>[item.name,{...item,imageHash:item.imageHash!}]));const restored=row.issues.map(issue=>{const parsed=parsePartsIssue(issue,false,true,false);assertPartsIssueBinding(parsed,items,subject.sourceHash);return parsed;});if(new Set(restored.map(issue=>issue.id)).size!==restored.length)return null;return {subject:'parts' as const,issues:restored};}catch{return null;}},
|
|
1502
1533
|
restoreSession:(value,isDirty)=>{issues.splice(0,issues.length,...value.issues);dirty=isDirty;partsSubject?.refreshComments();showCommentCount();text('dirty',isDirty?'Unsubmitted changes':'Submitted');el('dirty').classList.toggle('dirty',isDirty);state.setSaveState({kind:isDirty?'unsaved':'saved',text:isDirty?'Unsubmitted changes':'Submitted'});},
|
|
1503
1534
|
bookmark:()=>({schema:'rig-review-inspection/1',binding,animation:null,time:null,theme:appearance?.get()??'system',layers:{images:layers.images,meshes:layers.mesh,bones:false},view:{schema:'rig-review-view/1',cameras:{rig:null,a:null,b:null,reference:null}},selection:{}}),
|
|
@@ -1509,7 +1540,7 @@ async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,wri
|
|
|
1509
1540
|
await setupPartsPersistence();if(disposed)return;
|
|
1510
1541
|
if(generalRows?.length)changed();
|
|
1511
1542
|
renderPendingSubjects(host?.pendingSubjects?.()??[{kind:'parts-verdict'}]);
|
|
1512
|
-
if(host){await restorePublicationNavigation();host.attach({recordForms:renderRecordForms,stage:()=>null,redraw:()=>partsSubject?.redraw(),message:(value,error,diagnostic)=>message(value,error,false,diagnostic),pendingSubjects:renderPendingSubjects,...host.record?{}:{incompatible:()=>navigationMissing,navigation:()=>({subject:'parts' as const,part:partsSubject!.selected(),solo:partsSubject!.solo(),view,camera:numericView()})},suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});host.displayed();}
|
|
1543
|
+
if(host){await restorePublicationNavigation();host.attach({recordForms:renderRecordForms,stage:()=>null,redraw:()=>partsSubject?.redraw(),message:(value,error,diagnostic)=>message(value,error,false,diagnostic),pendingSubjects:renderPendingSubjects,progress:setJobProgress,...host.record?{}:{incompatible:()=>navigationMissing,navigation:()=>({subject:'parts' as const,part:partsSubject!.selected(),solo:partsSubject!.solo(),view,camera:numericView()})},suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});host.displayed();}
|
|
1513
1544
|
|
|
1514
1545
|
document.body.dataset.ready='true';
|
|
1515
1546
|
}
|
|
@@ -1532,44 +1563,73 @@ async function startRecord(interview?:InterviewSubjectEntry):Promise<void> {
|
|
|
1532
1563
|
readOnly=tr(interview?'MODEL_UNAVAILABLE':'JOB_REVIEW_READ_ONLY');
|
|
1533
1564
|
if(!interview)actReadOnly=readOnlyReason(access,true,host?.ownerActAccess);
|
|
1534
1565
|
bindWorkspace();bindInspector(true);rigInput={state:'absent'};referenceInput={state:'absent'};renderLayout();
|
|
1535
|
-
parts=new PartExplorer(el('workspace-left'),el('selected-part'),()=>{},()=>{});text('checkpoints','No checkpoints supplied.');text('dirty','Not submitted');if(interview)message(unavailable);else message(actReadOnly??(host?.record?.
|
|
1566
|
+
parts=new PartExplorer(el('workspace-left'),el('selected-part'),()=>{},()=>{});text('checkpoints','No checkpoints supplied.');text('dirty','Not submitted');if(interview)message(unavailable);else message(actReadOnly??(host?.record?.questionPicture||host?.record?.planPicture?'':unavailable),!!actReadOnly);
|
|
1536
1567
|
text('package-title',interview?.label??host!.record!.label);text('revision','');text('source-hash',`source ${(interview?.sourceHash??host!.record!.sourceHash).slice(0,12)}`);
|
|
1537
1568
|
el('rig-pane').hidden=false;el('rig-empty').hidden=false;text('rig-empty',unavailable);
|
|
1538
|
-
for(const region of document.querySelectorAll('.inspector,.workspace-secondary-toolbar'))for(const control of region.querySelectorAll<HTMLInputElement|HTMLSelectElement|HTMLButtonElement>('input,select,textarea,button')){
|
|
1569
|
+
for(const region of document.querySelectorAll('.inspector,.workspace-secondary-toolbar'))for(const control of region.querySelectorAll<HTMLInputElement|HTMLSelectElement|HTMLTextAreaElement|HTMLButtonElement>('input,select,textarea,button')){
|
|
1570
|
+
if(control===rigInspector.collapse||(!interview&&control===rigInspector.comments.button))continue;
|
|
1571
|
+
control.disabled=true;control.removeAttribute('title');
|
|
1572
|
+
const toggleLabel=control.closest('label.layer-toggle');if(toggleLabel)toggleLabel.removeAttribute('title');
|
|
1573
|
+
if(!control.hasAttribute('aria-label')&&!control.hasAttribute('aria-labelledby')&&control.getAttribute('aria-hidden')!=='true'){
|
|
1574
|
+
const wrappingLabel=control.closest('label'),explicitLabel=control.id?document.querySelector<HTMLLabelElement>(`label[for="${control.id}"]`):null;
|
|
1575
|
+
const labelNode=control instanceof HTMLButtonElement?(control.childElementCount?control.childNodes[0]??null:control):wrappingLabel?(wrappingLabel.querySelector('span')??[...wrappingLabel.childNodes].find(node=>node.nodeType===3&&node.nodeValue?.trim())??null):explicitLabel;
|
|
1576
|
+
const labelText=sourceTextContent(labelNode).trim();
|
|
1577
|
+
if(labelText)setSourceAttribute(control,'aria-label',labelText);
|
|
1578
|
+
}
|
|
1579
|
+
setSourceAttribute(control,'aria-description',unavailable);
|
|
1580
|
+
}
|
|
1539
1581
|
if(interview){
|
|
1540
1582
|
button('stage-comment').hidden=true;
|
|
1541
|
-
button('save').disabled=true;setSourceAttribute(button('save'),'
|
|
1542
|
-
|
|
1543
|
-
label();viewDisposers.push(onLanguageChange(label));
|
|
1544
|
-
viewDisposers.push(await joinedInterviewForms(access,forms=>renderRecordForms(forms,t('interview.title'),true)));
|
|
1583
|
+
button('save').disabled=true;setSourceAttribute(button('save'),'aria-description',unavailable);
|
|
1584
|
+
viewDisposers.push(await joinedInterviewForms(access,forms=>renderRecordForms(forms,'job.pending',true)));
|
|
1545
1585
|
text('provenance-rig',unavailable);text('provenance-motion',unavailable);text('source-files','project.json');
|
|
1546
1586
|
}else{restoreRecordComments();setupComments();showRecordComments();rigInspector.comments.button.disabled=false;button('stage-comment').disabled=false;}
|
|
1547
1587
|
const resize=viewport.observeResize();viewDisposers.push(()=>resize.disconnect());
|
|
1548
1588
|
await workspace?.settle();if(disposed)return;
|
|
1549
1589
|
if(host?.unavailable){message(t('job.refusal.'+host.unavailable),true);el('message').title=host.unavailable;button('save').disabled=true;button('save').title=host.unavailable;}
|
|
1550
1590
|
document.body.dataset.ready='true';
|
|
1551
|
-
if(!interview){host!.attach({recordForms:renderRecordForms,pendingSubjects:renderPendingSubjects,stage:()=>null,redraw:()=>{},message:(value,error,diagnostic)=>message(value,error,false,diagnostic),suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});host!.displayed();}
|
|
1591
|
+
if(!interview){host!.attach({recordForms:renderRecordForms,pendingSubjects:renderPendingSubjects,progress:setJobProgress,stage:()=>null,redraw:()=>{},message:(value,error,diagnostic)=>message(value,error,false,diagnostic),suspend:suspendScreen,resume:resumeScreen,dispose:disposeScreen});host!.displayed();}
|
|
1552
1592
|
}
|
|
1553
1593
|
let recordDialog:HTMLDialogElement|null=null;
|
|
1594
|
+
let releaseRecordDrawer:(()=>void)|null=null;
|
|
1595
|
+
viewDisposers.push(()=>{releaseRecordDrawer?.();releaseRecordDrawer=null;recordDialog?.remove();recordDialog=null;});
|
|
1596
|
+
let recordDrawerTrigger:HTMLButtonElement|null=null;
|
|
1597
|
+
let unregisterQuestion:(()=>void)|null=null;
|
|
1554
1598
|
let activeInterviewImages:readonly {name:string;src:string}[]|null=null;
|
|
1555
1599
|
let activeInterviewImage:{name:string;src:string}|null=null;
|
|
1556
1600
|
let releaseInterview:(()=>void)|null=null;
|
|
1557
1601
|
const questionPanel=panelMake('section',{id:'workspace-interview-answer',className:'workspace-interview-panel',hidden:true});
|
|
1558
1602
|
let questionForms:readonly HTMLElement[]=[];
|
|
1603
|
+
/** #1004: several question forms share the Question tab; the list shows one at a time. */
|
|
1604
|
+
let selectedQuestionAsk:string|undefined;
|
|
1605
|
+
questionPanel.addEventListener('job-question-select',event=>{selectedQuestionAsk=(event.target as HTMLElement).dataset.jobAsk;showQuestionForm();});
|
|
1606
|
+
function showQuestionForm():void {
|
|
1607
|
+
const shown=questionForms.find(form=>form.dataset.jobAsk!==undefined&&form.dataset.jobAsk===selectedQuestionAsk)??questionForms.find(form=>form.dataset.interviewAnswered!=='true')??questionForms[0];
|
|
1608
|
+
for(const form of questionForms)form.hidden=form!==shown;
|
|
1609
|
+
syncQuestionImage();
|
|
1610
|
+
}
|
|
1559
1611
|
let questionFormBindings=new WeakSet<HTMLElement>();
|
|
1560
1612
|
|
|
1561
1613
|
/** Publication and source bind native comment drafts independently of inspection navigation. */
|
|
1562
1614
|
function restoreRecordComments(form?:HTMLFormElement):void {
|
|
1563
1615
|
const binding=host?.direction??host?.verdictComments??host?.record;
|
|
1564
1616
|
if(!binding||recordCommentKey)return;
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1617
|
+
const route=typeof access!=='undefined'?/^\/jobs\/([^/]+)\/publications\/([^/]+)\//.exec(access?.base??''):null;
|
|
1618
|
+
const publicationId=binding.publicationId??form?.dataset.jobPublication??route?.[2],sourceHash=binding.sourceHash;
|
|
1619
|
+
const jobId=binding.jobId??route?.[1],draftId=binding.draftId;
|
|
1620
|
+
if(!publicationId&&(!jobId||!draftId))throw new Error('JOB_DISPLAY_MISMATCH');
|
|
1621
|
+
const prefix=host?.verdictComments?'rig-review-verdict-comments/1:':'rig-review-record-comments/1:';
|
|
1622
|
+
const scopePrefix=jobId&&draftId?`${prefix}${jobId}:${draftId}:`:null;
|
|
1623
|
+
recordCommentKey=(scopePrefix??`${prefix}${publicationId}:`)+sourceHash;
|
|
1624
|
+
const fallbackKey=publicationId?`${prefix}${publicationId}:${sourceHash}`:'';
|
|
1625
|
+
const previousKey=binding.previousPublicationId?`${prefix}${binding.previousPublicationId}:${sourceHash}`:'';
|
|
1626
|
+
const target=(host?.verdictComments?.rows??recordComments) as CommentRow[]&{knownIds?:Set<string>;storageBound?:boolean};
|
|
1627
|
+
const knownIds=(target.knownIds??=new Set<string>());
|
|
1628
|
+
const parseRows=(raw:string|null,expectedPub?:string):CommentRow[]|null=>{
|
|
1629
|
+
const saved=JSON.parse(raw??'null');
|
|
1630
|
+
if(!saved||saved.sourceHash!==sourceHash||!Array.isArray(saved.comments)||saved.comments.length>1000)return null;
|
|
1631
|
+
if(expectedPub!==undefined?saved.publicationId!==expectedPub:(typeof saved.publicationId!=='string'||!saved.publicationId))return null;
|
|
1632
|
+
const ids=new Set<string>(),rows=saved.comments as CommentRow[];
|
|
1573
1633
|
for(const row of rows){
|
|
1574
1634
|
if(!row||typeof row.id!=='string'||!row.id||ids.has(row.id)||typeof row.summary!=='string'||!row.summary.trim()||row.summary.length>1000)throw new Error('JOB_ACT_INVALID');
|
|
1575
1635
|
ids.add(row.id);
|
|
@@ -1579,7 +1639,72 @@ function restoreRecordComments(form?:HTMLFormElement):void {
|
|
|
1579
1639
|
else if(Object.keys(row).some(key=>key!=='id'&&key!=='summary'))throw new Error('JOB_ACT_INVALID');
|
|
1580
1640
|
}
|
|
1581
1641
|
if(!host?.verdictComments)projectComments(rows.map(row=>'schema' in row?partsIssueComments([row as import('../src/parts-comment.ts').PartsIssue])[0]!:'target' in row?feedbackItemComments([row as Feedback])[0]!:{text:row.summary}));
|
|
1582
|
-
|
|
1642
|
+
return rows;
|
|
1643
|
+
};
|
|
1644
|
+
if(!target.storageBound&&typeof window!=='undefined'&&typeof window.addEventListener==='function'){
|
|
1645
|
+
target.storageBound=true;
|
|
1646
|
+
const onStorage=(event:Pick<StorageEvent,'key'|'newValue'>)=>{
|
|
1647
|
+
if(!recordCommentKey||event.key!==recordCommentKey)return;
|
|
1648
|
+
try{
|
|
1649
|
+
const currentRaw=typeof localStorage.getItem==='function'?localStorage.getItem(recordCommentKey):event.newValue;
|
|
1650
|
+
const incoming=currentRaw===null?[]:parseRows(currentRaw,scopePrefix?undefined:publicationId);
|
|
1651
|
+
if(!incoming)return;
|
|
1652
|
+
const incomingIds=new Set(incoming.map(row=>row.id));
|
|
1653
|
+
const localUnsaved=target.filter(row=>!knownIds.has(row.id)&&!incomingIds.has(row.id));
|
|
1654
|
+
target.splice(0,target.length,...incoming,...localUnsaved);
|
|
1655
|
+
knownIds.clear();for(const row of incoming)knownIds.add(row.id);
|
|
1656
|
+
if(typeof rigInspector!=='undefined'&&typeof setSourceText==='function'){
|
|
1657
|
+
const count=host?.verdictComments?(typeof partsOnly!=='undefined'&&partsOnly?(partsSubject?.issues().length??0)+target.length:target.length):recordComments.length;
|
|
1658
|
+
setSourceText(rigInspector.comments.button,`Comments (${count})`);
|
|
1659
|
+
}
|
|
1660
|
+
if(typeof comments!=='undefined')comments?.refresh();
|
|
1661
|
+
if(typeof partsSubject!=='undefined')partsSubject?.refreshComments();
|
|
1662
|
+
if(typeof renderProposals==='function'&&host?.verdictComments)renderProposals();
|
|
1663
|
+
if(typeof renderAnswerControls==='function')renderAnswerControls();
|
|
1664
|
+
}catch{/* Ignore malformed cross-tab storage payloads. */}
|
|
1665
|
+
};
|
|
1666
|
+
window.addEventListener('storage',onStorage,typeof lifecycle!=='undefined'?{signal:lifecycle.signal}:undefined);
|
|
1667
|
+
}
|
|
1668
|
+
try {
|
|
1669
|
+
const primaryRaw=localStorage.getItem(recordCommentKey);
|
|
1670
|
+
const fallbackRaw=primaryRaw===null&&fallbackKey&&fallbackKey!==recordCommentKey?localStorage.getItem(fallbackKey):null;
|
|
1671
|
+
const previousRaw=primaryRaw===null&&fallbackRaw===null&&previousKey&&previousKey!==recordCommentKey?localStorage.getItem(previousKey):null;
|
|
1672
|
+
const rows=primaryRaw!==null?parseRows(primaryRaw,scopePrefix?undefined:publicationId):
|
|
1673
|
+
fallbackRaw!==null?parseRows(fallbackRaw,publicationId):
|
|
1674
|
+
previousRaw!==null?parseRows(previousRaw,binding.previousPublicationId??undefined):null;
|
|
1675
|
+
if(rows){
|
|
1676
|
+
for(const row of rows){knownIds.add(row.id);if(!target.some(existing=>existing.id===row.id))target.push(row);}
|
|
1677
|
+
if(primaryRaw===null&&typeof localStorage.removeItem==='function'){
|
|
1678
|
+
persistRecordComments();
|
|
1679
|
+
if(fallbackKey&&fallbackKey!==recordCommentKey)localStorage.removeItem(fallbackKey);
|
|
1680
|
+
if(previousKey&&previousKey!==recordCommentKey)localStorage.removeItem(previousKey);
|
|
1681
|
+
}
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
if((scopePrefix||binding.previousPublicationId)&&typeof localStorage.length==='number'&&typeof localStorage.key==='function'){
|
|
1685
|
+
const partsScopePrefix=jobId&&draftId?`rig-review-draft/1:parts:${jobId}:${draftId}:`:null;
|
|
1686
|
+
let unsentCount=0;
|
|
1687
|
+
for(let i=0;i<localStorage.length;i++){
|
|
1688
|
+
const key=localStorage.key(i);
|
|
1689
|
+
if(!key||key===recordCommentKey)continue;
|
|
1690
|
+
if((scopePrefix&&key.startsWith(scopePrefix))||(binding.previousPublicationId&&key.startsWith(`${prefix}${binding.previousPublicationId}:`))){
|
|
1691
|
+
const prior=JSON.parse(localStorage.getItem(key)??'null');
|
|
1692
|
+
if(prior&&typeof prior.sourceHash==='string'&&prior.sourceHash!==sourceHash&&Array.isArray(prior.comments)&&prior.comments.length>0){
|
|
1693
|
+
unsentCount+=prior.comments.length;
|
|
1694
|
+
}
|
|
1695
|
+
}else if(partsScopePrefix&&key.startsWith(partsScopePrefix)&&!key.endsWith(':'+sourceHash)){
|
|
1696
|
+
const prior=JSON.parse(localStorage.getItem(key)??'null');
|
|
1697
|
+
if(prior&&typeof prior.sourceHash==='string'&&prior.sourceHash!==sourceHash&&prior.reviewDirty&&Array.isArray(prior.session?.issues)&&prior.session.issues.length>0){
|
|
1698
|
+
unsentCount+=prior.session.issues.length;
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
if(unsentCount>0){
|
|
1703
|
+
const notice=`The source changed, so ${unsentCount} unsent comment(s) could not be carried over. Please add them again.`;
|
|
1704
|
+
if(typeof draftStatus!=='undefined')draftStatus=notice;
|
|
1705
|
+
if(typeof renderDraftState==='function')renderDraftState();
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1583
1708
|
}catch{/* A mismatched or invalid local draft has no authority. */}
|
|
1584
1709
|
}
|
|
1585
1710
|
/** Comments remain native rows locally; the old act field carries their scalar projection only. */
|
|
@@ -1589,26 +1714,52 @@ function recordCommentWords():string {
|
|
|
1589
1714
|
function persistRecordComments():void {
|
|
1590
1715
|
const binding=host?.direction??host?.verdictComments??host?.record;
|
|
1591
1716
|
if(!binding||!recordCommentKey)return;
|
|
1592
|
-
const comments=host?.verdictComments?.rows??recordComments;
|
|
1717
|
+
const comments=(host?.verdictComments?.rows??recordComments) as CommentRow[]&{knownIds?:Set<string>};
|
|
1718
|
+
const knownIds=(comments.knownIds??=new Set<string>());
|
|
1593
1719
|
try{
|
|
1720
|
+
const raw=typeof localStorage.getItem==='function'?localStorage.getItem(recordCommentKey):null;
|
|
1721
|
+
if(raw!==null){
|
|
1722
|
+
const existing=JSON.parse(raw);
|
|
1723
|
+
const storedRows:CommentRow[]=existing?.sourceHash===binding.sourceHash&&Array.isArray(existing.comments)
|
|
1724
|
+
?existing.comments.filter((row:CommentRow)=>row&&typeof row.id==='string'&&row.id&&typeof row.summary==='string'&&row.summary.trim()&&row.summary.length<=1000):[];
|
|
1725
|
+
const storedIds=new Set(storedRows.map(row=>row.id));
|
|
1726
|
+
const survivingLocal=comments.filter(row=>!knownIds.has(row.id)||storedIds.has(row.id));
|
|
1727
|
+
const survivingIds=new Set(survivingLocal.map(row=>row.id));
|
|
1728
|
+
const addedFromOther=storedRows.filter(row=>!knownIds.has(row.id)&&!survivingIds.has(row.id));
|
|
1729
|
+
const kept=survivingLocal.filter(row=>knownIds.has(row.id));
|
|
1730
|
+
const localNew=survivingLocal.filter(row=>!knownIds.has(row.id));
|
|
1731
|
+
comments.splice(0,comments.length,...kept,...addedFromOther,...localNew);
|
|
1732
|
+
}
|
|
1733
|
+
knownIds.clear();for(const row of comments)knownIds.add(row.id);
|
|
1734
|
+
const dialogPublication=typeof recordDialog!=='undefined'?recordDialog?.querySelector<HTMLFormElement>('form[data-job-ask]')?.dataset.jobPublication:undefined;
|
|
1735
|
+
const activePub=binding.publicationId??dialogPublication;
|
|
1736
|
+
const prefix=host?.verdictComments?'rig-review-verdict-comments/1:':'rig-review-record-comments/1:';
|
|
1737
|
+
if(typeof localStorage.removeItem==='function'){
|
|
1738
|
+
if(activePub&&`${prefix}${activePub}:${binding.sourceHash}`!==recordCommentKey)localStorage.removeItem(`${prefix}${activePub}:${binding.sourceHash}`);
|
|
1739
|
+
if(binding.previousPublicationId&&`${prefix}${binding.previousPublicationId}:${binding.sourceHash}`!==recordCommentKey)localStorage.removeItem(`${prefix}${binding.previousPublicationId}:${binding.sourceHash}`);
|
|
1740
|
+
}
|
|
1594
1741
|
if(host?.verdictComments&&!comments.length)localStorage.removeItem(recordCommentKey);
|
|
1595
|
-
else localStorage.setItem(recordCommentKey,JSON.stringify({status:select('review-status').value,publicationId:
|
|
1742
|
+
else localStorage.setItem(recordCommentKey,JSON.stringify({status:select('review-status').value,publicationId:activePub,sourceHash:binding.sourceHash,comments}));
|
|
1596
1743
|
}catch{/* In-memory comments remain bound to this host. */}
|
|
1597
1744
|
}
|
|
1598
1745
|
function recordCommentsChanged():void {
|
|
1599
1746
|
if(!host?.record&&!host?.direction)return;
|
|
1747
|
+
if(/^The source changed, so /.test(draftStatus??''))draftStatus=null;
|
|
1600
1748
|
persistRecordComments();
|
|
1601
1749
|
setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);
|
|
1602
|
-
|
|
1750
|
+
renderDraftState();
|
|
1603
1751
|
for(const form of recordDialog?.querySelectorAll('form[data-job-ask]')??[])form.dispatchEvent(new Event('input',{bubbles:true}));
|
|
1604
1752
|
}
|
|
1605
|
-
/**
|
|
1753
|
+
/** Keep the shared reference viewport bound while the interview form is mounted. */
|
|
1606
1754
|
function syncQuestionImage():void {
|
|
1607
1755
|
if(disposed){releaseInterview?.();releaseInterview=null;return;}
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1610
|
-
if(
|
|
1611
|
-
|
|
1756
|
+
const form=(questionForms.find(item=>!item.hidden)??questionForms[0]) as (HTMLElement&{interviewImages?:readonly {name:string;src:string}[]})|undefined;
|
|
1757
|
+
const images=form?.interviewImages??(host?.record?.planPicture?[host.record.planPicture]:undefined);
|
|
1758
|
+
if(activeInterviewImages&&images?.length===activeInterviewImages.length&&images.every((image,index)=>{
|
|
1759
|
+
const previous=activeInterviewImages![index]!;
|
|
1760
|
+
return previous.name===image.name&&previous.src===image.src;
|
|
1761
|
+
}))return;
|
|
1762
|
+
releaseInterview?.();releaseInterview=null;
|
|
1612
1763
|
if(!images?.length)return;
|
|
1613
1764
|
const previousView=view,previousCamera=structuredClone(viewport.state);viewport.cancelFit();
|
|
1614
1765
|
const previousReferenceNodes=[...el('reference-content').childNodes],previousReferenceInput=referenceInput,previousReferenceSize=referenceSize;
|
|
@@ -1618,7 +1769,7 @@ function syncQuestionImage():void {
|
|
|
1618
1769
|
for(const button of disabled.keys())button.disabled=false;
|
|
1619
1770
|
const cameraBindings=button('zoom-in').onclick?[]:[viewport.bindControls(unitScaleMessage),viewport.bindNavigation()];
|
|
1620
1771
|
activeInterviewImages=images;activeInterviewImage=images[0]!;
|
|
1621
|
-
const restore=controls.replaceViewSwitch({currentMode:'interview-image-0',groups:[{modes:images.map((
|
|
1772
|
+
const restore=controls.replaceViewSwitch({currentMode:'interview-image-0',groups:[{modes:images.map((_image,index)=>({id:'interview-image-'+index,labelKey:images.length>1?`Reference ${index+1}`:'Reference',pressed:index===0}))}],onChange:chooseInspectionView});
|
|
1622
1773
|
viewport.state.cameraSync=false;viewport.state.activeCamera='reference';view='reference';questionPanel.dataset.questionImageActive='true';
|
|
1623
1774
|
releaseInterview=()=>{
|
|
1624
1775
|
++referenceGeneration;activeInterviewImages=null;activeInterviewImage=null;delete questionPanel.dataset.questionImageActive;restore();
|
|
@@ -1631,102 +1782,176 @@ function syncQuestionImage():void {
|
|
|
1631
1782
|
if(!disposed){renderLayout();workspace?.refresh();}
|
|
1632
1783
|
Object.assign(viewport.state,previousCamera);if(!disposed)fitCamera();
|
|
1633
1784
|
};
|
|
1785
|
+
if(sourceTextContent(el('message'))==='This request has no picture.')message(sourceTextContent(el('dirty')),false,true);
|
|
1634
1786
|
void showReference('',activeInterviewImage);
|
|
1635
1787
|
}
|
|
1636
|
-
/**
|
|
1788
|
+
/** Survey forms use the shared bottom tab. Pending text-only record forms use the drawer. */
|
|
1637
1789
|
function renderRecordForms(forms:readonly HTMLElement[],label='job.pending',standalone=false):void {
|
|
1638
1790
|
if(standalone){pendingAnswers=[{kind:'interview-picks'}];}
|
|
1639
1791
|
for(const form of forms){
|
|
1640
1792
|
if(questionFormBindings.has(form))continue;questionFormBindings.add(form);
|
|
1641
1793
|
form.addEventListener('submit',event=>{if(draftConflict||pendingAnswers.some(subject=>subject.kind.endsWith('verdict'))){event.preventDefault();event.stopImmediatePropagation();}},true);
|
|
1642
|
-
form.addEventListener('job-answer-saved',()=>{answerSaved=true;recordDialog?.close();renderDraftState();},{once:true});
|
|
1794
|
+
form.addEventListener('job-answer-saved',()=>{answerSaved=true;if(recordDialog?.contains(form))recordDialog.close();renderDraftState();},{once:true});
|
|
1643
1795
|
}
|
|
1644
1796
|
const questionTabForms=forms.filter(form=>form.dataset.interviewMain!==undefined);
|
|
1645
|
-
if(questionTabForms.
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
for(const form of questionForms)if(
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
if(
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1797
|
+
for(const form of questionForms)if(!questionTabForms.includes(form)){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
|
|
1798
|
+
questionForms=questionTabForms;
|
|
1799
|
+
if(questionForms.length){
|
|
1800
|
+
for(const form of questionForms)if(form.parentElement!==questionPanel)questionPanel.append(form);
|
|
1801
|
+
const reveal=()=>{inspectorBlocks?.select(selectedInspector()??'rig','question');workspace?.revealInspector();};
|
|
1802
|
+
rigAsk.onclick=()=>{if(!draftConflict)reveal();};
|
|
1803
|
+
if(!unregisterQuestion){
|
|
1804
|
+
unregisterQuestion=inspectorBlocks!.register({id:'question',panel:questionPanel,label:'Question',position:'first'});
|
|
1805
|
+
inspectorBlocks!.restore({rig:'question',playback:'question'});reveal();
|
|
1806
|
+
}
|
|
1807
|
+
if(questionForms.every(form=>form.dataset.interviewAnswered==='true')){answerSaved=true;firstPublicationPrompt=false;}
|
|
1808
|
+
}else{
|
|
1809
|
+
unregisterQuestion?.();unregisterQuestion=null;rigAsk.onclick=null;
|
|
1655
1810
|
}
|
|
1811
|
+
showQuestionForm();
|
|
1656
1812
|
forms=forms.filter(form=>!questionTabForms.includes(form));
|
|
1657
|
-
if(!forms.length
|
|
1813
|
+
if(!forms.length){
|
|
1814
|
+
releaseRecordDrawer?.();releaseRecordDrawer=null;recordDrawerTrigger=null;
|
|
1815
|
+
recordDialog?.remove();recordDialog=null;
|
|
1816
|
+
renderDraftState();return;
|
|
1817
|
+
}
|
|
1658
1818
|
if(!recordDialog){
|
|
1659
1819
|
recordDialog=panelMake('dialog',{id:'job-record-asks',className:'workspace-drawer'});recordDialog.setAttribute('aria-label',tr(label));
|
|
1660
|
-
|
|
1661
|
-
viewDisposers.push(bindWorkspaceDrawer({trigger:rigAsk,drawer:recordDialog,label:tr(label),close}));
|
|
1662
|
-
viewDisposers.push(()=>{recordDialog?.close();recordDialog?.remove();recordDialog=null;});
|
|
1820
|
+
recordDialog.append(panelMake('button',{className:'workspace-drawer-close',type:'button'},tr('Close')));app.append(recordDialog);
|
|
1663
1821
|
}
|
|
1664
|
-
|
|
1665
|
-
|
|
1822
|
+
const trigger=questionForms.length?recordAsk:rigAsk;
|
|
1823
|
+
if(recordDrawerTrigger!==trigger){
|
|
1824
|
+
releaseRecordDrawer?.();recordDrawerTrigger=trigger;
|
|
1825
|
+
releaseRecordDrawer=bindWorkspaceDrawer({trigger,drawer:recordDialog,label:tr(label),close:recordDialog.querySelector('button')!});
|
|
1826
|
+
}
|
|
1827
|
+
for(const form of recordDialog.querySelectorAll<HTMLFormElement>('form[data-job-ask]'))if(!forms.includes(form)){form.dispatchEvent(new Event('job-form-dispose'));form.remove();}
|
|
1666
1828
|
if(!standalone&&forms[0])restoreRecordComments(forms[0] as HTMLFormElement);
|
|
1667
|
-
const added=forms.filter(form=>!recordDialog!.contains(form));
|
|
1668
1829
|
for(const form of forms){
|
|
1669
1830
|
if(!standalone)(form as JobForm['form']).commentWords=()=>host?.record||host?.direction?recordCommentWords():partsOnly?projectComments(partsIssueComments(partsSubject?.issues()??[])):projectComments(feedbackItemComments(session.feedback));
|
|
1670
|
-
if(!recordDialog.contains(form)){
|
|
1831
|
+
if(!recordDialog.contains(form)){form.style.overflow='auto';form.style.minHeight='0';recordDialog.append(form);}
|
|
1671
1832
|
}
|
|
1672
1833
|
if(host?.record){
|
|
1673
1834
|
for(const child of el('proposal-panel').children)if(child.id!=='comments-list-host')(child as HTMLElement).hidden=true;
|
|
1674
1835
|
setSourceText(rigInspector.comments.button,`Comments (${recordComments.length})`);comments?.refresh();partsSubject?.refreshComments();
|
|
1675
|
-
button('save').onclick=()=>
|
|
1836
|
+
button('save').onclick=()=>trigger.click();
|
|
1676
1837
|
}
|
|
1677
1838
|
renderAnswerControls();
|
|
1678
|
-
if((standalone?added.length>0:added.some(form=>form.classList.contains('interview-answer')))&&!recordDialog.open)rigAsk.click();
|
|
1679
1839
|
}
|
|
1680
1840
|
/** The ask heading reads only already-pending subjects. It never synthesizes an agent request. */
|
|
1681
1841
|
function renderPendingSubjects(subjects:readonly {kind:string;stage?:string}[]):void {
|
|
1682
|
-
const requests:Record<string,string>={'parts-verdict':partsSubject?.items().some(item=>item.mesh)?'Check the parts and meshes.':'Check the parts.','interview-picks':'Answer these questions.','review-verdict:rig-review':'Check the rig and motion.','review-verdict:direction-review':'Check the direction.','review-verdict:image-review':'Check these images.','checkpoint':'Review this checkpoint.','signoff':'Approve this stage.'
|
|
1683
|
-
|
|
1842
|
+
const requests:Record<string,string>={'parts-verdict':partsSubject?.items().some(item=>item.mesh)?'Check the parts and meshes.':'Check the parts.','interview-picks':'Answer these questions.','review-verdict:rig-review':'Check the rig and motion.','review-verdict:direction-review':'Check the direction.','review-verdict:image-review':'Check these images.','checkpoint':'Review this checkpoint.','signoff':'Approve this stage.'};
|
|
1843
|
+
// #1004: several pending asks of one kind say their sentence once.
|
|
1844
|
+
const labels=[...new Set(subjects.map(subject=>requests[subject.kind+':'+subject.stage]??requests[subject.kind]).filter((label):label is string=>!!label))];
|
|
1684
1845
|
const liveVerdict=(subject:{kind:string;stage?:string})=>
|
|
1685
1846
|
partsOnly?subject.kind==='parts-verdict':subject.kind==='review-verdict'&&subject.stage==='rig-review';
|
|
1686
1847
|
const refreshVerdictComments=host?.verdictComments&&pendingAnswers.some(liveVerdict)!==subjects.some(liveVerdict);
|
|
1687
1848
|
pendingAnswers=subjects;
|
|
1688
1849
|
if(refreshVerdictComments){comments?.refresh();partsSubject?.refreshComments();}
|
|
1689
|
-
|
|
1850
|
+
renderAskHeadline(labels.join(' · ')||(firstPublicationPrompt?t('job.waiting',undefined,'en'):'Nothing is waiting for your answer.'));
|
|
1690
1851
|
if(subjects.length)firstPublicationPrompt=false;
|
|
1691
1852
|
renderDraftState();
|
|
1692
1853
|
}
|
|
1854
|
+
function syncJobActRow(subjects=pendingAnswers):void {
|
|
1855
|
+
rigInspector.act.hidden=!subjects.length&&!firstPublicationPrompt&&!jobProgress;
|
|
1856
|
+
rigInspector.syncActRow?.();
|
|
1857
|
+
}
|
|
1858
|
+
function setJobProgress(value:JobProgressV3|null):void {
|
|
1859
|
+
if(disposed||jobProgress===value)return;
|
|
1860
|
+
jobProgress=value;
|
|
1861
|
+
if(pendingAnswers.length)return;
|
|
1862
|
+
renderAskHeadline();
|
|
1863
|
+
syncJobActRow();
|
|
1864
|
+
}
|
|
1865
|
+
function stopProgressTimer():void {
|
|
1866
|
+
clearInterval(progressTimer);
|
|
1867
|
+
progressTimer=undefined;
|
|
1868
|
+
}
|
|
1869
|
+
/** Render the existing sentence. The timer writes only its age node until the quiet threshold. */
|
|
1870
|
+
function renderAskHeadline(sentence=askSentence):void {
|
|
1871
|
+
askSentence=sentence;
|
|
1872
|
+
stopProgressTimer();
|
|
1873
|
+
askHeadline.hidden=false;
|
|
1874
|
+
const progress=pendingAnswers.length ? null : jobProgress;
|
|
1875
|
+
if(!progress){
|
|
1876
|
+
askHeadline.removeAttribute('translate');
|
|
1877
|
+
askHeadline.style?.removeProperty('white-space');
|
|
1878
|
+
setSourceText(askHeadline,sentence);
|
|
1879
|
+
return;
|
|
1880
|
+
}
|
|
1881
|
+
const at=Date.parse(progress.at),age=()=>Math.max(0,Math.floor((Date.now()-at)/1000));
|
|
1882
|
+
const initialAge=age(),quiet=initialAge>=60;
|
|
1883
|
+
const phase=t('job.progress.phase.'+progress.phase);
|
|
1884
|
+
const phaseAndStep=progress.step ? phase+' · '+t('job.progress.step',[progress.step.i,progress.step.n]) : phase;
|
|
1885
|
+
const ageValue=(seconds:number)=>quiet ? String(Math.floor(seconds/60)) : seconds ? t('job.progress.seconds',[seconds]) : t('job.progress.now');
|
|
1886
|
+
const ageText=document.createTextNode(ageValue(initialAge));
|
|
1887
|
+
// Catalog fragments are already localized. Keep the agent's text as a literal across locale changes.
|
|
1888
|
+
askHeadline.setAttribute('translate','no');
|
|
1889
|
+
askHeadline.style?.setProperty('white-space','pre-wrap');
|
|
1890
|
+
if(quiet){
|
|
1891
|
+
const [before,after]=t('job.progress.quiet',['{0}',phaseAndStep]).split('{0}');
|
|
1892
|
+
askHeadline.replaceChildren(before!,ageText,after!);
|
|
1893
|
+
}else{
|
|
1894
|
+
const prefix=progress.text?phaseAndStep+' · '+progress.text:phaseAndStep;
|
|
1895
|
+
askHeadline.replaceChildren(prefix+' · ',ageText);
|
|
1896
|
+
}
|
|
1897
|
+
const tickAge=()=>{
|
|
1898
|
+
const seconds=age();
|
|
1899
|
+
if((seconds>=60)!==quiet){renderAskHeadline();return;}
|
|
1900
|
+
const value=ageValue(seconds);
|
|
1901
|
+
if(ageText.data!==value)ageText.data=value;
|
|
1902
|
+
};
|
|
1903
|
+
if(!suspended&&!disposed)progressTimer=setInterval(tickAge,1000);
|
|
1904
|
+
}
|
|
1693
1905
|
/** Answer controls compose the existing act bar and submit handlers. */
|
|
1694
1906
|
function renderAnswerControls():void {
|
|
1695
1907
|
const subjects=host?.pendingSubjects?.()??pendingAnswers;
|
|
1696
1908
|
const parts=subjects.some(subject=>subject.kind==='parts-verdict');
|
|
1697
1909
|
const verdict=parts||subjects.some(subject=>subject.kind==='review-verdict');
|
|
1698
1910
|
const dialog=subjects.some(subject=>!subject.kind.endsWith('verdict'))&&!verdict;
|
|
1699
|
-
const readable=questionForms.some(form=>form.dataset.interviewAnswered==='true')
|
|
1700
|
-
const
|
|
1911
|
+
const readable=questionForms.some(form=>form.dataset.interviewAnswered==='true');
|
|
1912
|
+
const questionEnabled=questionForms.some(form=>form.querySelector('fieldset:not(:disabled)'));
|
|
1913
|
+
const recordEnabled=!!recordDialog?.querySelector('fieldset:not(:disabled)');
|
|
1701
1914
|
const blocked=saving||draftConflict||!!actReadOnly||!!host?.unavailable;
|
|
1702
1915
|
const save=button('save');
|
|
1703
|
-
const
|
|
1916
|
+
const pendingPartComment=parts&&typeof partsSubject!=='undefined'&&!!partsSubject?.hasPendingComment?.();
|
|
1917
|
+
const pendingStageComment=!parts&&typeof comments!=='undefined'&&!!comments?.hasPendingComment?.();
|
|
1918
|
+
const hasPinnedPart=parts&&(liveIssueCount()>0||pendingPartComment);
|
|
1704
1919
|
const needsPinnedPart=parts&&!!host?.verdictComments?.rows.length&&!hasPinnedPart;
|
|
1705
1920
|
const pinRefusal='Request changes needs at least one comment pinned to a part.';
|
|
1706
1921
|
if((host||subjects.some(subject=>subject.kind==='interview-picks'))&&subjects.length&&!rigInspector.actBar.saveState())rigInspector.actBar.setSaveState({kind:'unsaved',text:'Not submitted'});
|
|
1707
1922
|
select('review-status').hidden=true;document.querySelector<HTMLLabelElement>('label[for="review-status"]')!.hidden=true;
|
|
1708
1923
|
save.classList.toggle('primary',verdict&&!hasPinnedPart);
|
|
1709
1924
|
requestChanges.classList.toggle('primary',hasPinnedPart);
|
|
1710
|
-
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1713
|
-
|
|
1925
|
+
const questionPending=subjects.some(subject=>subject.kind==='interview-picks');
|
|
1926
|
+
const recordKind=subjects.find(subject=>!subject.kind.endsWith('verdict')&&subject.kind!=='interview-picks')?.kind;
|
|
1927
|
+
const recordTrigger=questionForms.length?recordAsk:rigAsk;
|
|
1928
|
+
if(!questionPending||recordTrigger!==rigAsk){
|
|
1929
|
+
setSourceText(recordTrigger,recordKind==='signoff'?'Approve…':'Review…');
|
|
1930
|
+
recordTrigger.disabled=!recordEnabled||blocked;
|
|
1931
|
+
}
|
|
1932
|
+
if(questionPending||questionForms.length){
|
|
1933
|
+
setSourceText(rigAsk,'Answer…');
|
|
1934
|
+
rigAsk.disabled=(!questionEnabled&&!readable)||(questionEnabled&&blocked);
|
|
1935
|
+
}
|
|
1936
|
+
rigAsk.classList.toggle('primary',dialog&&(questionPending||recordTrigger===rigAsk));
|
|
1937
|
+
recordAsk.classList.toggle('primary',dialog&&!questionPending&&!!recordKind);
|
|
1714
1938
|
if(verdict){
|
|
1715
|
-
const count=host?.direction?recordComments.length:liveIssueCount();
|
|
1939
|
+
const count=(host?.direction?recordComments.length:liveIssueCount())+(pendingPartComment||pendingStageComment?1:0);
|
|
1716
1940
|
const hasChanges=count>0||!!host?.canSubmitMeshEdits?.()&&subjects.some(subject=>subject.kind==='review-verdict'&&subject.stage==='rig-review');
|
|
1717
1941
|
setSourceText(save,'Approve');setSourceText(requestChanges,'Request changes');
|
|
1718
1942
|
save.disabled=blocked||!!readOnly||!!session?.feedbackWarnings?.length||(parts&&(partsAnswerBlocked()||count>0));
|
|
1719
1943
|
requestChanges.disabled=blocked||!!readOnly||!!session?.feedbackWarnings?.length||!hasChanges||(parts&&partsAnswerBlocked());
|
|
1720
1944
|
setSourceAttribute(save,'title',parts&&count>0?'Remove the flagged parts comments before approving.':'');
|
|
1721
|
-
setSourceAttribute(requestChanges,'title',needsPinnedPart?pinRefusal:hasChanges?'':'Add a comment where changes are needed.');
|
|
1945
|
+
setSourceAttribute(requestChanges,'title',needsPinnedPart?pinRefusal:hasChanges?'':host?.verdictComments&&!parts?'Add a comment or an edit where changes are needed.':'Add a comment where changes are needed.');
|
|
1722
1946
|
if(!parts){
|
|
1723
1947
|
save.onclick=event=>{session.status='approved';select('review-status').value=session.status;return verdictSubmit?.(event);};
|
|
1724
1948
|
}
|
|
1725
|
-
requestChanges.onclick=()=>{if(requestChanges.disabled)return;if(parts){if(liveIssueCount()===0)return;void save.onclick?.call(save,new PointerEvent('click'));}else{session.status='changes-requested';select('review-status').value=session.status;void verdictSubmit?.(new MouseEvent('click'));}};
|
|
1949
|
+
requestChanges.onclick=async()=>{if(requestChanges.disabled)return;if(parts){if(typeof partsSubject!=='undefined'&&partsSubject?.hasPendingComment?.()&&!await partsSubject.commitDraft())return;if(liveIssueCount()===0)return;void save.onclick?.call(save,new PointerEvent('click'));}else{if(typeof comments!=='undefined'&&comments?.hasPendingComment?.()&&!await comments.commitDraft())return;session.status='changes-requested';select('review-status').value=session.status;void verdictSubmit?.(new MouseEvent('click'));}};
|
|
1726
1950
|
}
|
|
1727
1951
|
for(const root of [recordDialog,...questionForms])for(const control of root?.querySelectorAll<HTMLButtonElement>('button[type="submit"]')??[])control.disabled=blocked||verdict;
|
|
1728
1952
|
// The waiting row is already visible: finish labels, state and handlers before revealing any answer.
|
|
1729
|
-
save.hidden=!verdict||firstPublicationPrompt;requestChanges.hidden=save.hidden;rigAsk.hidden=!dialog||firstPublicationPrompt;
|
|
1953
|
+
save.hidden=!verdict||firstPublicationPrompt;requestChanges.hidden=save.hidden;rigAsk.hidden=!dialog||firstPublicationPrompt||!questionPending&&recordTrigger!==rigAsk;
|
|
1954
|
+
recordAsk.hidden=!dialog||firstPublicationPrompt||recordTrigger!==recordAsk||!recordKind;
|
|
1730
1955
|
if(host?.verdictComments){
|
|
1731
1956
|
const notice=el('review-message');
|
|
1732
1957
|
if(needsPinnedPart&&!save.hidden&&!save.disabled){
|
|
@@ -1741,7 +1966,7 @@ function renderAnswerControls():void {
|
|
|
1741
1966
|
notice.classList.remove('error');
|
|
1742
1967
|
}
|
|
1743
1968
|
}
|
|
1744
|
-
if(host){rigInspector.answersRendered=true;
|
|
1969
|
+
if(host){rigInspector.answersRendered=true;syncJobActRow(subjects);}
|
|
1745
1970
|
}
|
|
1746
1971
|
let verdictSubmit:((event:MouseEvent)=>unknown)|null=null;
|
|
1747
1972
|
/** The rig pane for a live job's still (#709): the job binds and copies it, this screen keeps its view. */
|
|
@@ -1788,6 +2013,7 @@ async function restorePublicationNavigation():Promise<void> {
|
|
|
1788
2013
|
}
|
|
1789
2014
|
function suspendScreen():void {
|
|
1790
2015
|
if(suspended||disposed)return;
|
|
2016
|
+
stopProgressTimer();
|
|
1791
2017
|
if(!partsOnly&&(!host?.record||host.record.hasPicture))pause();
|
|
1792
2018
|
persistence?.dispose();persistence=null;suspended=true;cancelAnimationFrame(frameHandle);
|
|
1793
2019
|
}
|
|
@@ -1800,7 +2026,8 @@ async function resumeScreen():Promise<void> {
|
|
|
1800
2026
|
if(disposed)return;
|
|
1801
2027
|
if(partsOnly){await setupPartsPersistence?.();if(disposed)return;}
|
|
1802
2028
|
else if(!host?.record||host.record.hasPicture)await setupPersistence(true);
|
|
1803
|
-
suspended=false;if(
|
|
2029
|
+
suspended=false;if(jobProgress)renderAskHeadline();
|
|
2030
|
+
if(!partsOnly&&(!host?.record||host.record.hasPicture))frameHandle=requestAnimationFrame(tick);ready=true;
|
|
1804
2031
|
}finally{screenRoot.inert=ready?wasInert:true;if(ready&&!disposed)document.body.dataset.ready='true';}
|
|
1805
2032
|
}
|
|
1806
2033
|
function disposeScreen():void {releaseInterview?.();releaseInterview=null;
|
|
@@ -2002,7 +2229,12 @@ async function setupPersistence(keepCameraOnResume=false):Promise<boolean> {
|
|
|
2002
2229
|
let restoredChestFormPart:string|null=null;
|
|
2003
2230
|
inspectionOpening=true;try{
|
|
2004
2231
|
persistence=await connectInspectionPersistence({scope:'single:'+data.manifest.id+':'+data.sourceHash,binding:inspectionBinding(),baseline:submittedBaseline!,session:()=>session,reviewDirty:()=>dirty,restoreSession:(value,isDirty)=>{session=value;dirty=isDirty;select('review-status').value=session.status;renderProposals();renderCheckpoint();renderCheckpoints();renderProvenance();updateSavedState();},bookmark:inspectionBookmark,restoreBookmark:(b,s)=>restoreInspection(b,s,session.feedback.some(f=>isTimeOnlyFeedback(f)&&JSON.stringify((f.context as any).comment.bookmark)===JSON.stringify(b)),keepCameraOnResume||bookmarkCameraKept(inspectionOpening,!!host)),
|
|
2005
|
-
ui:()=>({chestFormPart,inspectorScroll:workspace?.scroll()??'{}',...(inspectorBlocks?activeBlocksUI(inspectorBlocks.state()):{}),reportCategory:select('report-category').value,reportPage,reportEvent:selectedReportEvent?.id??null,reportTime:selectedReportTime??null,reportTarget:selectedReportTarget??null}),restoreUI:value=>{restoredChestFormPart=typeof value.chestFormPart==='string'?value.chestFormPart:null;if(typeof value.reportCategory==='string'&&[...select('report-category').options].some(o=>o.value===value.reportCategory))select('report-category').value=value.reportCategory;if(typeof value.reportPage==='number'&&Number.isSafeInteger(value.reportPage)&&value.reportPage>=0)reportPage=value.reportPage;selectedReportEvent=typeof value.reportEvent==='string'?data.report?.categories.flatMap(c=>c.events).find(e=>e.id===value.reportEvent)??null:null;selectedReportTime=typeof value.reportTime==='number'?value.reportTime:undefined;selectedReportTarget=typeof value.reportTarget==='number'?value.reportTarget:undefined;renderReportEvents();renderReportSelection();inspectorBlocks?.restore(restoreActiveBlocksUI(value));workspace?.restoreScroll(value.inspectorScroll);},afterInputs:
|
|
2232
|
+
ui:()=>({chestFormPart,...(host?{chestLandmarkDraft:chestEditor?.jobDraftText()??null}:{}),inspectorScroll:workspace?.scroll()??'{}',...(inspectorBlocks?activeBlocksUI(inspectorBlocks.state()):{}),reportCategory:select('report-category').value,reportPage,reportEvent:selectedReportEvent?.id??null,reportTime:selectedReportTime??null,reportTarget:selectedReportTarget??null}),restoreUI:value=>{restoredChestFormPart=typeof value.chestFormPart==='string'?value.chestFormPart:null;if(typeof value.reportCategory==='string'&&[...select('report-category').options].some(o=>o.value===value.reportCategory))select('report-category').value=value.reportCategory;if(typeof value.reportPage==='number'&&Number.isSafeInteger(value.reportPage)&&value.reportPage>=0)reportPage=value.reportPage;selectedReportEvent=typeof value.reportEvent==='string'?data.report?.categories.flatMap(c=>c.events).find(e=>e.id===value.reportEvent)??null:null;selectedReportTime=typeof value.reportTime==='number'?value.reportTime:undefined;selectedReportTarget=typeof value.reportTarget==='number'?value.reportTarget:undefined;renderReportEvents();renderReportSelection();inspectorBlocks?.restore(restoreActiveBlocksUI(value));workspace?.restoreScroll(value.inspectorScroll);},afterInputs:draft=>{
|
|
2233
|
+
if(host){
|
|
2234
|
+
const saved=draft?.ui.chestLandmarkDraft;
|
|
2235
|
+
chestEditor?.restoreJobDraft(typeof saved==='string'?saved:null);
|
|
2236
|
+
}
|
|
2237
|
+
chestFormPart=restoredChestFormPart??parts?.value()?.slot??null;const selected=parts?.value()?.slot;if(rebuildStatus&&selected)void openStageCorrection({part:selected,instrument:'selection'});const target=input('feedback-target-name').value;renderFeedbackTargets(true);if(select('feedback-target-kind').value!=='rig')input('feedback-target-name').value=target;renderFeedbackRange();text('audio-volume-label',`${Math.round(Number(input('audio-volume').value)*100)}%`);},onConflict:value=>{draftConflict=value;updateSavedState();},onStatus:value=>{draftStatus=value;renderDraftState();}});
|
|
2006
2238
|
}finally{inspectionOpening=false;}
|
|
2007
2239
|
return persistence.restored;
|
|
2008
2240
|
}
|
|
@@ -2011,7 +2243,8 @@ function chestField(id:string){const node=document.getElementById(id) as HTMLInp
|
|
|
2011
2243
|
function chestEvaluation(){return evaluateChestForm(chestField,chestMapping,activeSetupBones());}
|
|
2012
2244
|
function chestRegions():OverlayRegion[]{
|
|
2013
2245
|
// #345: the chest overlay is drawn only while the Chest regions toggle is on.
|
|
2014
|
-
|
|
2246
|
+
// Jobs draw the landmark derivation through chestCircles, separately from manual region rows.
|
|
2247
|
+
if(host||!chestEditor?.active())return [];
|
|
2015
2248
|
const style=getComputedStyle(document.documentElement),token=(name:string)=>style.getPropertyValue(name).trim();
|
|
2016
2249
|
return chestOverlayPolygons(chestEvaluation(),activeChestMapping()).map((region,i)=>({...region,stroke:token(i?'--rv-region-b':'--rv-region-a'),fill:token(i?'--rv-region-b-fill':'--rv-region-a-fill')}));
|
|
2017
2250
|
}
|
|
@@ -2087,7 +2320,8 @@ function stepEnvironment(dt:number):void {
|
|
|
2087
2320
|
if(environmentApplied())player.environment(environmentFor(wind.read(),gravityValue()));
|
|
2088
2321
|
renderEnvironment();
|
|
2089
2322
|
}
|
|
2090
|
-
|
|
2323
|
+
/** A standing world already in force is not set again: `environment` clears the player's seek replay cache (#935: a paused seek applies it). */
|
|
2324
|
+
function applyEnvironment():void {if(player&&environmentApplied()){const next=environmentFor(wind.read(),gravityValue()),now=player.environment();if(String(next.wind)!==String(now.wind)||String(next.gravity)!==String(now.gravity))player.environment(next);}renderEnvironment();}
|
|
2091
2325
|
function renderEnvironment():void {
|
|
2092
2326
|
if(!player)return;
|
|
2093
2327
|
const reading=wind.read();
|
|
@@ -2111,10 +2345,10 @@ function worldFor(name:string):WorldExport|{error:string} {
|
|
|
2111
2345
|
if(worldCache?.key!==key)worldCache={key,value:worldExport(wind.snapshot(),gravityValue(),environmentApplied(),name,clipDuration(name))};
|
|
2112
2346
|
return worldCache.value;
|
|
2113
2347
|
}
|
|
2114
|
-
/** A fresh wind clock at the same settings (a repeating gust restarts at 0)
|
|
2115
|
-
function restartWindClock():void {const now=wind.read().time;wind.restore(wind.snapshot());joltQueue=joltQueue.map(step=>({...step,at:Math.max(0,step.at-now)}));}
|
|
2116
|
-
/** #183: every clip restart
|
|
2117
|
-
function clipMoved(move:ClipMove):void {
|
|
2348
|
+
/** A fresh wind clock at the same settings (a repeating gust restarts at 0), advanced to `at`; pending jolts keep their distance in time. */
|
|
2349
|
+
function restartWindClock(at=0):void {const now=wind.read().time;wind.restore(wind.snapshot());if(at>0)wind.advance(at);joltQueue=joltQueue.map(step=>({...step,at:Math.max(0,step.at-now)+at}));}
|
|
2350
|
+
/** #183: every clip restart restarts the wind clock while the schedule is watched. #935: a paused seek sets it to the seek's time. */
|
|
2351
|
+
function clipMoved(move:ClipMove):void {const at=player?windClockOnMove(move,useWorld(),playing):null;if(at!==null){restartWindClock(at);applyEnvironment();}}
|
|
2118
2352
|
let scheduleShown='';
|
|
2119
2353
|
function renderSchedule():void {
|
|
2120
2354
|
const world=worldFor(animation),check=checkAnimation(),checked=check!==animation?worldFor(check):null;
|
|
@@ -2192,13 +2426,13 @@ function restoreEnvironment():void {
|
|
|
2192
2426
|
if(player){if(environmentApplied())applyEnvironment();else player.environment(null);}
|
|
2193
2427
|
}
|
|
2194
2428
|
function feedbackEnvironment(){return player?environmentJson(environmentContext(wind.read(),gravityValue(),environmentApplied(),player.environment())):null;}
|
|
2195
|
-
function enableEnvironment(modelUrl:string):void {
|
|
2429
|
+
function enableEnvironment(modelUrl:string,fetcher:typeof fetch):void {
|
|
2196
2430
|
for(const id of environmentInputs)el<HTMLInputElement|HTMLButtonElement>(id).disabled=false;
|
|
2197
2431
|
syncEnvironmentInputs();text('physics-panel-state','Reading the compiled model…');text('idle-tracks-state','Reading the compiled model…');
|
|
2198
2432
|
readingsPanel?.catalog(data.feedbackCatalog.slots??[],data.feedbackCatalog.bones??[]);readingsPanel?.status('Pick readings, then Run: each runs on the inspected build and on the latest scratch build.',false);
|
|
2199
2433
|
const rig=data.reviewedSource.rig;
|
|
2200
2434
|
if(!rig){inspectedDocumentReason='PHYSICS_TUNING_UNAVAILABLE: no reviewed rig identity';refreshPhysics();return;}
|
|
2201
|
-
void loadModelDocument(modelUrl,rig.sha256).then(loaded=>{if(loaded.ok)inspectedDocument=loaded.document;else inspectedDocumentReason=`PHYSICS_TUNING_UNAVAILABLE: ${loaded.reason}`;refreshPhysics();},error=>{inspectedDocumentReason=`PHYSICS_TUNING_UNAVAILABLE: ${errorText(error)}`;refreshPhysics();});
|
|
2435
|
+
void loadModelDocument(modelUrl,rig.sha256,fetcher).then(loaded=>{if(loaded.ok)inspectedDocument=loaded.document;else inspectedDocumentReason=`PHYSICS_TUNING_UNAVAILABLE: ${loaded.reason}`;refreshPhysics();},error=>{inspectedDocumentReason=`PHYSICS_TUNING_UNAVAILABLE: ${errorText(error)}`;refreshPhysics();});
|
|
2202
2436
|
}
|
|
2203
2437
|
/** The panel's rows: the inspected model's constraints against the handoff config's (both must be read). */
|
|
2204
2438
|
function refreshPhysics():void {
|
|
@@ -2322,7 +2556,7 @@ function rebindChestPart(status:RebuildStatusView,part:string):void {
|
|
|
2322
2556
|
}
|
|
2323
2557
|
/** `GET /api/rebuild`: whether Apply can run, and the producer config's regions to start an untouched editor from. */
|
|
2324
2558
|
async function loadRebuildStatus():Promise<RebuildStatusView|null> {
|
|
2325
|
-
try{rebuildStatus=await api<RebuildStatusView>('/api/rebuild');}catch(error){rebuildStatus=null;const reason=`REBUILD_STATUS_UNAVAILABLE: ${errorText(error)}`;chestEditor?.notify(reason,true);animationPanel?.loadSource(null,reason);return null;}
|
|
2559
|
+
try{rebuildStatus=await api<RebuildStatusView>('/api/rebuild');}catch(error){rebuildStatus=null;const reason=`REBUILD_STATUS_UNAVAILABLE: ${errorText(error)}`;if(!host)chestEditor?.notify(reason,true);animationPanel?.loadSource(null,reason);return null;}
|
|
2326
2560
|
// Restore the form owner before seeding either mode or caching a selection switch.
|
|
2327
2561
|
chestFormPart??=chestSeed(rebuildStatus).part;
|
|
2328
2562
|
const scoped=chestStatusForPart(rebuildStatus,chestFormPart);
|
|
@@ -3027,7 +3261,8 @@ async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWo
|
|
|
3027
3261
|
const keepRigCamera=structuredClone(viewport.paneCamera('rig')),keepReferenceCamera=structuredClone(viewport.paneCamera('reference'));
|
|
3028
3262
|
const keepAnimation=animation,keepTime=time,wasPlaying=playing,keepSet=select('part-set').disabled?'':select('part-set').value;
|
|
3029
3263
|
inspectionSourceState='pending';partModel=null;pause();refreshAnimationInspection();
|
|
3030
|
-
const
|
|
3264
|
+
const inputs=stageLoadInputs(modelUrl,sha256);
|
|
3265
|
+
const next=await loadModel({modelUrl,...inputs,resolvePage:(name,url)=>{const target=new URL(name,url);if(target.origin!==location.origin||!target.pathname.startsWith(prefix))throw new Error(`Model page escapes its build: ${name}`);return target.href;}}).catch(error=>{inspectionSourceState='failed';refreshAnimationInspection();throw error;});
|
|
3031
3266
|
const keepFraming=!!keepStage&&!!next.stage&&(['x','y','width','height'] as const).every(key=>keepStage[key]===next.stage![key]);
|
|
3032
3267
|
viewport.state.cameraRestoring=true;viewport.cancelFit();
|
|
3033
3268
|
// The fit-relative zoom also depends on the first-draw framing basis, not just the declared stage.
|
|
@@ -3036,7 +3271,7 @@ async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWo
|
|
|
3036
3271
|
pause();player?.dispose();assets?.dispose();assets=next;player=createInspectionPlayer(el('rig-root'),assets);setupChestWorld=readSetupChest(player);stageModelHash=sha256;stageSource={url:modelUrl,prefix,hash:sha256};
|
|
3037
3272
|
// A scratch build may hold another set of animations (a retarget adds one, #114): the picker lists what this build has.
|
|
3038
3273
|
{const animations=select('animation-select');animations.replaceChildren(...assets.animations.map(item=>option(item.name,data.manifest.animations.find(a=>a.id===item.name)?.label??item.name)));animations.disabled=assets.animations.length===0;}
|
|
3039
|
-
try{const catalog=await loadPartModel(modelUrl,sha256,data.feedbackCatalog.slots??[]);inspectionSourceState='ready';partModel=catalog.model;configureTurnPad(catalog.model);refreshAnimationInspection();weightsView?.refresh();meshEditor?.selectionChanged();parts?.register('single',catalog.entries,player,new PartThumbnails(pageRegionTable(catalog.model),assets.pageImages));}catch(error){inspectionSourceState='failed';partModel=null;refreshAnimationInspection();parts?.refuseCatalog('single',error);}
|
|
3274
|
+
try{const catalog=await loadPartModel(modelUrl,sha256,data.feedbackCatalog.slots??[],inputs.fetch);inspectionSourceState='ready';partModel=catalog.model;configureTurnPad(catalog.model);refreshAnimationInspection();weightsView?.refresh();meshEditor?.selectionChanged();parts?.register('single',catalog.entries,player,new PartThumbnails(pageRegionTable(catalog.model),assets.pageImages));}catch(error){inspectionSourceState='failed';partModel=null;refreshAnimationInspection();parts?.refuseCatalog('single',error);}
|
|
3040
3275
|
configurePartSets(keepSet);
|
|
3041
3276
|
// The same world before the first pose: a physics Apply resumes the wind (clock and pulse), the pending jolts, gravity and
|
|
3042
3277
|
// whether the controls are engaged as they stood when Apply was pressed; then the seek re-poses under that world.
|
|
@@ -3054,7 +3289,7 @@ async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWo
|
|
|
3054
3289
|
if(keepFraming){viewport.writeCamera('rig',keepRigCamera);viewport.writeCamera('reference',keepReferenceCamera);fitCamera();}
|
|
3055
3290
|
else{viewport.state.cameraRestoring=cameraRestoring;viewport.requestFit();fitCamera();}
|
|
3056
3291
|
// The preview (#104) drives the new player once its bone setups are read (an idle Apply cleared it first).
|
|
3057
|
-
stageDocumentSet=true;void loadModelDocument(modelUrl,sha256).then(loaded=>{if(loaded.ok&&stageModelHash===sha256)idlePanel?.model(boneSetup(loaded.document));});
|
|
3292
|
+
stageDocumentSet=true;void loadModelDocument(modelUrl,sha256,inputs.fetch).then(loaded=>{if(loaded.ok&&stageModelHash===sha256)idlePanel?.model(boneSetup(loaded.document));});
|
|
3058
3293
|
if(wasPlaying)void playPreview();
|
|
3059
3294
|
}finally{viewport.state.cameraRestoring=cameraRestoring;stageCorrectionRebinding--;directionPanel?.refresh();}
|
|
3060
3295
|
}
|
|
@@ -3228,7 +3463,7 @@ function setupComments():void {
|
|
|
3228
3463
|
return {mode:workspaceMode==='playback'?'animate':'setup',capture:{pane,root:view==='rig'?el('rig-root'):undefined,images:view==='reference'||layers.images,canvas:view==='rig'&&renderer instanceof CanvasRenderer?renderer.canvas:undefined,backend:renderer instanceof CanvasRenderer?renderer.backendActive:renderer?.meshBackendActive??'canvas2d'},camera,frame:index===null?null:{index,basis:'producer'},...(index===null?{timeBasis:timeOnlyBasis}:{}),time:current,animation:animation||null,turn:turnPad?.snapshot()??null,sourceHash:data.sourceHash,modelHash:view==='reference'?null:stageModelHash,referenceHash,referenceId,rig:data.manifest.id,...(view==='reference'?{media:video??el('reference-content').querySelector('img')??undefined}:{posed:parts?.frame('single'),assets:assets??undefined})} as CommentPose;
|
|
3229
3464
|
},
|
|
3230
3465
|
pause:async()=>{const running=playing||!!video&&!video.paused;pause();if(running&&video&&video.readyState>=1){seekingControl=true;try{await inspectControlTime(time,new AbortController().signal);}finally{seekingControl=false;}}if(turnPad)turnPad.restore({...turnPad.snapshot(),held:true},false);},bookmark:inspectionBookmark,restore:(b,timed)=>restoreInspection(parseBookmark(b,inspectionBinding()),new AbortController().signal,!!timed),feedback:()=>host?.record||host?.direction?recordComments:session.feedback,
|
|
3231
|
-
locked:host?.record?()=>false:host?.direction?id=>submittedDirectionComments.has(id):isSubmittedFeedback,add:f=>{if(host?.record||host?.direction)recordComments.push(f);else session.feedback.push(f as Feedback);},changed:()=>{if(host?.record||host?.direction){recordCommentsChanged();if(host?.direction){markDirty();comments?.refresh();}return;}if(host?.verdictComments)persistRecordComments();markDirty();renderProposals();return persistence?.save();},error:value=>message(value,true),
|
|
3466
|
+
locked:host?.record?()=>false:host?.direction?id=>submittedDirectionComments.has(id):isSubmittedFeedback,add:f=>{if(host?.record||host?.direction)recordComments.push(f);else session.feedback.push(f as Feedback);},changed:()=>{if(/^The source changed, so /.test(draftStatus??''))draftStatus=null;if(host?.record||host?.direction){recordCommentsChanged();if(host?.direction){markDirty();comments?.refresh();}return;}if(host?.verdictComments)persistRecordComments();markDirty();renderProposals();return persistence?.save();},draftChanged:()=>{if(typeof renderAnswerControls==='function')renderAnswerControls();},error:value=>message(value,true),
|
|
3232
3467
|
refusal:()=>host?.record&&!host.record.hasPicture?null:commentCaptureRefusal(),blocked:()=>saving||!!persistence?.restoring()||seekingControl||!!video?.seeking||!!rebuildBusy||!!appliedOnStage,shortcutBlocked:()=>!!meshEditor?.active()
|
|
3233
3468
|
});
|
|
3234
3469
|
if(host?.verdictComments)renderProposals();
|
|
@@ -3309,8 +3544,9 @@ async function prepareStageDraftBuild(
|
|
|
3309
3544
|
if(!nextModelHash)throw new Error(buildId==='inspected'?'STAGE_DRAFT_MISMATCH':'STAGE_DRAFT_STALE');
|
|
3310
3545
|
target=options?.target??await resolveStageDraftTarget(buildId);
|
|
3311
3546
|
if(target.buildId!==buildId||target.sha256!==nextModelHash||!target.url||!target.prefix)throw new Error('STAGE_DRAFT_MISMATCH');
|
|
3312
|
-
|
|
3313
|
-
|
|
3547
|
+
const inputs=stageLoadInputs(target.url,target.sha256);
|
|
3548
|
+
nextAssets=await loadModel({modelUrl:target.url,...inputs,resolvePage:(name,url)=>{const pageUrl=new URL(name,url);if(pageUrl.origin!==location.origin||!pageUrl.pathname.startsWith(target.prefix))throw new Error(`Model page escapes its build: ${name}`);return pageUrl.href;}});
|
|
3549
|
+
const loadedDoc=await loadModelDocument(target.url,target.sha256,inputs.fetch);
|
|
3314
3550
|
if(!loadedDoc.ok)throw new Error('PART_SOURCE_CHANGED: model bytes differ from reviewed SHA-256');
|
|
3315
3551
|
verifiedDoc=loadedDoc.document;
|
|
3316
3552
|
const rawSlots=verifiedDoc&&typeof verifiedDoc==='object'&&!Array.isArray(verifiedDoc)?(verifiedDoc as {slots?:unknown}).slots:null;
|