rig-review 4.3.0 → 4.5.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/package.json +1 -1
- package/src/job-front.ts +15 -7
- package/src/job-session.ts +24 -9
- package/src/job-source.ts +21 -5
- package/src/job-store.ts +13 -0
- package/src/manifest.ts +11 -3
- package/src/open-workspace-state.ts +12 -3
- package/src/open.ts +2 -1
- package/src/parts-view.ts +3 -4
- package/src/reference.ts +3 -3
- package/web/catalog-en.ts +6 -1
- package/web/catalog-ko.ts +1116 -1111
- package/web/compare.ts +1 -1
- package/web/interview-panel.ts +17 -3
- package/web/job-rig-screen.ts +56 -13
- package/web/job-session.ts +20 -7
- package/web/main.ts +56 -17
- package/web/parts-viewport-provider.ts +9 -3
- package/web/rig-host.ts +3 -0
- package/web/scene-plates.ts +31 -0
- package/web/stage-comments.ts +8 -6
- package/web/styles.css +6 -4
- package/web/view-controls.ts +15 -9
- package/web/viewport-controller.ts +2 -2
package/web/compare.ts
CHANGED
|
@@ -438,7 +438,7 @@ function bind(): void {
|
|
|
438
438
|
// #331: a plain drag on either rig pans and carries both rigs, each by its own root scale, so A and B take the same
|
|
439
439
|
// stimulus; the reference pane only pans, as the Family viewer's does.
|
|
440
440
|
const carryBoth={threshold:CLICK_SLOP_PX,move:(dx:number,dy:number)=>{for(const side of ['a','b'] as const){const impulse=dragImpulse(dx,dy,rigScales[side]);if(impulse)players[side]?.moved(impulse);}}};
|
|
441
|
-
viewDisposers.push(viewport.bindNavigation(target=>target==='reference'?undefined:carryBoth,
|
|
441
|
+
viewDisposers.push(viewport.bindNavigation(target=>target==='reference'?undefined:carryBoth,panOnly=>!comments?.active()||!!panOnly));
|
|
442
442
|
for(const [id,key] of [['layer-images','images'],['layer-mesh','mesh'],['layer-bones','bones']] as const)input(id).onchange=()=>{layers[key]=input(id).checked;redrawOverlays(false);};
|
|
443
443
|
input('idle-repeat').onchange=()=>{renderIdle();if(canRepeatIdle())void playComparison().catch(error=>message(describe(error),true));};
|
|
444
444
|
el('inspector-feedback').addEventListener('focusin',()=>{idleHeld=true;const current=lastPresented?.time;stop();if(current!==undefined&&!seeking)void seekTo(current);});
|
package/web/interview-panel.ts
CHANGED
|
@@ -222,7 +222,8 @@ export function createInterviewForm(options:{question:InterviewDisplayQuestion;i
|
|
|
222
222
|
const node:InterviewText=(tag,key)=>{const result=options.node?options.node(tag,key):element(tag,key===undefined?undefined:t(key));if(key!==undefined)copy.set(result,key);return result;};
|
|
223
223
|
const form=options.form??make('form'),fields=options.fieldset??make('fieldset');
|
|
224
224
|
if(!options.fieldset)form.append(fields);
|
|
225
|
-
|
|
225
|
+
const joined=options.id.startsWith('joined-interview-');
|
|
226
|
+
form.className='interview-answer interview-grid';form.dataset.interviewAnswered=String(options.answered??Boolean((joined&&question.saved)||question.answer));
|
|
226
227
|
fields.className='interview-answer-fields';fields.id=options.id;fields.disabled=!question.editable;
|
|
227
228
|
const heading=make('h3',question.set.question);fields.append(heading);
|
|
228
229
|
const historical=question.answer?.choice as {picks?:Picks['picks'];note?:string}|undefined;
|
|
@@ -236,7 +237,14 @@ export function createInterviewForm(options:{question:InterviewDisplayQuestion;i
|
|
|
236
237
|
const answer=interviewAskGroup(item,{text:node,name:'choice.'+item.id,otherName:'other.'+item.id,pick,pendingHidden});
|
|
237
238
|
fields.append(answer.group);return {item,answer};
|
|
238
239
|
});
|
|
239
|
-
|
|
240
|
+
const noteId=options.id+'-note',noteLabel=node('label','interview.noteLabel'),noteInput=make('textarea'),noteView=make('pre');
|
|
241
|
+
noteLabel.htmlFor=noteId;noteLabel.setAttribute('for',noteId);
|
|
242
|
+
noteInput.id=noteId;noteInput.setAttribute('id',noteId);noteInput.name='note';noteInput.setAttribute('name','note');
|
|
243
|
+
noteInput.maxLength=10000;noteInput.setAttribute('maxlength','10000');noteInput.value=retainedNote??'';
|
|
244
|
+
noteView.className='interview-note';
|
|
245
|
+
const readOnly=()=>!question.editable||joined||form.dataset.interviewAnswered==='true',editableOnInit=!readOnly();
|
|
246
|
+
if(editableOnInit)fields.append(noteLabel,noteInput);
|
|
247
|
+
else if(retainedNote){noteView.textContent=retainedNote;fields.append(noteView);}
|
|
240
248
|
const context=make('div');context.id=options.id+'-source';context.className='interview-image-context';
|
|
241
249
|
if(options.source)context.append(options.source);
|
|
242
250
|
context.append(node('h2',question.hasParts?'interview.parts':'interview.source'));
|
|
@@ -250,6 +258,12 @@ export function createInterviewForm(options:{question:InterviewDisplayQuestion;i
|
|
|
250
258
|
const showImage=(index:number)=>{view?.dispose();view?.element.remove();view=interviewImageView(options.images,index,showImage,context);art.append(view.element);};
|
|
251
259
|
const refresh=()=>preserveScrollAndFocus(fields,()=>{
|
|
252
260
|
submit.hidden=!question.editable||form.dataset.interviewAnswered==='true';
|
|
261
|
+
noteInput.placeholder=t('interview.notePlaceholder');noteInput.setAttribute('placeholder',noteInput.placeholder);
|
|
262
|
+
if(readOnly()&¬eInput.parentElement){
|
|
263
|
+
noteLabel.remove();
|
|
264
|
+
if(noteInput.value){noteView.textContent=noteInput.value;if(typeof noteInput.replaceWith==='function')noteInput.replaceWith(noteView);else{noteInput.remove();fields.append(noteView);}}
|
|
265
|
+
else noteInput.remove();
|
|
266
|
+
}
|
|
253
267
|
provenance.textContent=t('interview.provenance',[question.set.drafted_by,question.set.drafted_at]);
|
|
254
268
|
const questions=typeof options.questions==='function'?options.questions():options.questions;
|
|
255
269
|
const items=questions?.map((item,index)=>({...item,answered:index===(options.selected??0)?form.dataset.interviewAnswered==='true':item.answered}))??[{label:question.set.question+' · '+question.set.id,answered:form.dataset.interviewAnswered==='true'}];
|
|
@@ -264,6 +278,6 @@ export function createInterviewForm(options:{question:InterviewDisplayQuestion;i
|
|
|
264
278
|
form.addEventListener('input',refresh);form.addEventListener('change',refresh);form.addEventListener('job-form-language',localize);
|
|
265
279
|
try{if(!options.mainView&&options.images.length)showImage(0);else{art.hidden=true;fields.append(context);}fields.append(submit);refresh();}catch(error){dispose();throw error;}
|
|
266
280
|
return {form,fieldset:fields,submit,status,retainedNote,
|
|
267
|
-
read:()=>jobInterviewValue(question.set.question,question.set.asks,item=>answers.find(answer=>answer.item===item)!.answer.value(),retainedNote??''),
|
|
281
|
+
read:()=>jobInterviewValue(question.set.question,question.set.asks,item=>answers.find(answer=>answer.item===item)!.answer.value(),editableOnInit?noteInput.value:(retainedNote??'')),
|
|
268
282
|
localize,dispose};
|
|
269
283
|
}
|
package/web/job-rig-screen.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type {ReviewManifest, ReviewedSource} from '../src/manifest.ts';
|
|
|
10
10
|
import {checkpointNoteComments, feedbackItemComments, projectComments} from '../src/stage-comment.ts';
|
|
11
11
|
import {createJobRigSubmission, freezeJobRigStage} from './job-rig-capture.ts';
|
|
12
12
|
import {setRigHost, rigHost, type RigHost, type RigHostScreen, type RigHostCommit, type RigHostNavigation} from './rig-host.ts';
|
|
13
|
+
import {setSourceAttribute, setSourceText, sourceAttribute, sourceTextContent} from './i18n.ts';
|
|
13
14
|
import type {InstanceAccess} from './instance-access.ts';
|
|
14
15
|
|
|
15
16
|
/** The shared screen hosts model packages and parts drafts; records have their own shared host seam. */
|
|
@@ -104,7 +105,14 @@ export function createJobRigScreen(options: {
|
|
|
104
105
|
load(): Promise<unknown>;
|
|
105
106
|
}) {
|
|
106
107
|
let mounted: JobRigScreenPrepared | null = null, screen: RigHostScreen | null = null, drawGeneration = 0;
|
|
108
|
+
let lastMessage: [text: string, error?: boolean, diagnostic?: string] = ['', false];
|
|
109
|
+
let streamReport: {message: [text: string, error?: boolean, diagnostic?: string]; footer: {source: string; title: string; sourceTitle: string | null; error: boolean} | null; header: {source: string; error: boolean} | null; applied: string} | null = null;
|
|
107
110
|
let transition:{rollback():Promise<void>;finalize():void}|null=null;
|
|
111
|
+
const say=(text:string,error?:boolean,diagnostic?:string,title?:string)=>{
|
|
112
|
+
streamReport=null;lastMessage=[text,error,diagnostic];screen?.message(text,error,diagnostic);
|
|
113
|
+
const notice=title!==undefined&&typeof document!=='undefined'?document.getElementById?.('message'):null;
|
|
114
|
+
if(notice)notice.title=title!;
|
|
115
|
+
};
|
|
108
116
|
const attempts = new Map<string, {key: string; submissionId: string; rig: ReturnType<typeof createJobRigSubmission>; commit: Omit<RigHostCommit, 'at'>}>();
|
|
109
117
|
async function prepare(display: DisplayPublicationV3, signal: AbortSignal, backdropOnly=false): Promise<JobRigScreenPrepared | null> {
|
|
110
118
|
if(signal.aborted)throw new Error('JOB_PRELOAD_CANCELLED');
|
|
@@ -246,7 +254,7 @@ export function createJobRigScreen(options: {
|
|
|
246
254
|
read:(path,method)=>method==='GET'&&backdrop?backdrop.read(path,method):Promise.reject(new Error('JOB_REVIEW_READ_ONLY')),
|
|
247
255
|
submit:async()=>{throw new Error('JOB_REVIEW_READ_ONLY');},
|
|
248
256
|
submitParts:async()=>{throw new Error('JOB_REVIEW_READ_ONLY');},
|
|
249
|
-
attach:value=>{screen=value;screen.pendingSubjects?.(pendingSubjects());refreshRecordForms();},
|
|
257
|
+
attach:value=>{screen=value;lastMessage=['',false];streamReport=null;screen.pendingSubjects?.(pendingSubjects());refreshRecordForms();},
|
|
250
258
|
displayed:()=>ready.resolve(),failed:error=>ready.reject(error)};
|
|
251
259
|
}
|
|
252
260
|
if(!review&&!prepared.parts)throw new Error('JOB_DISPLAY_MISMATCH');
|
|
@@ -277,7 +285,7 @@ export function createJobRigScreen(options: {
|
|
|
277
285
|
return Promise.reject(new Error('JOB_REVIEW_READ_ONLY'));
|
|
278
286
|
},
|
|
279
287
|
submit,
|
|
280
|
-
attach: value => {screen = value;screen.pendingSubjects?.(pendingSubjects());refreshRecordForms();},
|
|
288
|
+
attach: value => {screen = value;lastMessage=['',false];streamReport=null;screen.pendingSubjects?.(pendingSubjects());refreshRecordForms();},
|
|
281
289
|
displayed: () => ready.resolve(),
|
|
282
290
|
failed: error => ready.reject(error)};
|
|
283
291
|
}
|
|
@@ -290,10 +298,39 @@ export function createJobRigScreen(options: {
|
|
|
290
298
|
for(const [id,entry]of record.forms){const ask=state.pending.find(ask=>ask.askId===id);entry.fieldset.disabled=entry.submitting||ask?.status!=='pending'||state.preparing||state.closed||!state.receipt||!options.access.capability;}
|
|
291
299
|
screen?.recordForms?.([...record.forms.values()].map(entry=>entry.form));
|
|
292
300
|
}
|
|
301
|
+
/** Mount the shared composition before source data exists; the first paint resumes it. */
|
|
302
|
+
async function waiting():Promise<void> {
|
|
303
|
+
let attached!:()=>void,failed!:(error:unknown)=>void;
|
|
304
|
+
const ready=new Promise<void>((resolve,reject)=>{attached=resolve;failed=reject;});
|
|
305
|
+
setRigHost({waiting:true,access:{base:location.pathname,key:options.pageId,capability:options.access.capability,
|
|
306
|
+
route:()=>{throw new Error('JOB_DISPLAY_MISMATCH');},headers:init=>options.access.headers(init)},
|
|
307
|
+
read:()=>Promise.reject(new Error('JOB_DISPLAY_MISMATCH')),
|
|
308
|
+
submit:async()=>{throw new Error('JOB_ACT_SOURCE_STALE');},
|
|
309
|
+
attach:value=>{screen=value;attached();},displayed:()=>{},failed});
|
|
310
|
+
await options.load();await ready;
|
|
311
|
+
}
|
|
293
312
|
return {
|
|
294
|
-
prepare,
|
|
313
|
+
prepare,waiting,
|
|
295
314
|
mounted: () => mounted,
|
|
296
|
-
report
|
|
315
|
+
report(error:unknown,fallback?:string):void {
|
|
316
|
+
const text=options.refusal(error,fallback),title=jobSubmissionRefusal(error).title;
|
|
317
|
+
if(fallback!=='JOB_STREAM_FAILED'){say(text,true,title);return;}
|
|
318
|
+
const footer=typeof document!=='undefined'?document.getElementById?.('message'):null,header=typeof document!=='undefined'?document.getElementById?.('review-message'):null;
|
|
319
|
+
if(!streamReport||(footer&&(footer.textContent??'')!==streamReport.applied)){
|
|
320
|
+
streamReport={message:footer?[sourceTextContent(footer),footer.classList?.contains('error')??false,footer.title||undefined]:lastMessage,
|
|
321
|
+
footer:footer?{source:sourceTextContent(footer),title:footer.title,sourceTitle:sourceAttribute(footer,'title'),error:footer.classList?.contains('error')??false}:null,
|
|
322
|
+
header:header?{source:sourceTextContent(header),error:header.classList?.contains('error')??false}:null,applied:''};
|
|
323
|
+
}
|
|
324
|
+
screen?.message(text,true,title);streamReport.applied=footer?footer.textContent??text:text;
|
|
325
|
+
},
|
|
326
|
+
clearReport():void {
|
|
327
|
+
if(!streamReport)return;
|
|
328
|
+
const current=streamReport,footer=typeof document!=='undefined'?document.getElementById?.('message'):null,header=typeof document!=='undefined'?document.getElementById?.('review-message'):null;
|
|
329
|
+
streamReport=null;if(footer&&(footer.textContent??'')!==current.applied)return;
|
|
330
|
+
screen?.message(...current.message);
|
|
331
|
+
if(current.footer&&footer){setSourceText(footer,current.footer.source);if(current.footer.sourceTitle!==null)setSourceAttribute(footer,'title',current.footer.sourceTitle);footer.title=current.footer.title;footer.classList?.toggle('error',current.footer.error);}
|
|
332
|
+
if(current.header&&header){setSourceText(header,current.header.source);header.classList?.toggle('error',current.header.error);}
|
|
333
|
+
},
|
|
297
334
|
commit(prepared: JobRigScreenPrepared) {
|
|
298
335
|
const previous=mounted;mounted=prepared;
|
|
299
336
|
return {async rollback(){try{await transition?.rollback();}finally{transition=null;mounted=previous;}},finalize(){try{transition?.finalize();}finally{transition=null;if(previous!==prepared){const modal=previous?.record??previous?.modals;for(const entry of modal?.forms.values()??[])entry.dispose?.();modal?.inspection.dispose();}}}};
|
|
@@ -309,15 +346,21 @@ export function createJobRigScreen(options: {
|
|
|
309
346
|
let candidate:{dispose?():void}|undefined,finished=false,recovery:Promise<void>|null=null;
|
|
310
347
|
const rollback=():Promise<void>=>{
|
|
311
348
|
if(finished)return recovery??Promise.resolve();finished=true;
|
|
312
|
-
if(candidate?.dispose)candidate.dispose();else if(screen!==previous)screen?.dispose?.();screen=previous;
|
|
349
|
+
if(filling)screen?.dispose?.();else if(candidate?.dispose)candidate.dispose();else if(screen!==previous)screen?.dispose?.();screen=previous;
|
|
313
350
|
options.host.replaceChildren(...previousNodes);setRigHost(previousHost);document.title=previousTitle;
|
|
314
351
|
if(previousUrl)history.replaceState(null,'',previousUrl);
|
|
315
352
|
if(document.body){if(previousReady===null)document.body.removeAttribute('data-ready');else document.body.setAttribute('data-ready',previousReady);document.body.inert=previousInert??false;}
|
|
316
|
-
|
|
353
|
+
// Filling consumes the waiting screen's one-shot continuation. Recreate that same shared
|
|
354
|
+
// composition after disposing its mutated candidate, so the next transaction can fill it again.
|
|
355
|
+
if(filling){screen=null;recovery=waiting();}
|
|
356
|
+
else recovery=Promise.resolve(previous?.resume?.());
|
|
357
|
+
return recovery;
|
|
317
358
|
};
|
|
318
|
-
|
|
359
|
+
const filling=!!previousHost?.waiting&&!!previous?.publish;
|
|
360
|
+
transition={rollback,finalize(){if(finished)return;finished=true;if(!filling)previous?.dispose?.();}};
|
|
319
361
|
try {
|
|
320
|
-
|
|
362
|
+
const nextHost=host(prepared,ready,navigation);setRigHost(nextHost);
|
|
363
|
+
if(filling){previous!.publish!(nextHost);await shown;if(signal.aborted)throw new Error('JOB_PRELOAD_CANCELLED');return;}
|
|
321
364
|
const app = document.createElement('div');app.id = 'app';
|
|
322
365
|
options.host.replaceChildren(app);document.body?.removeAttribute('data-ready');
|
|
323
366
|
const loaded=await options.load();
|
|
@@ -329,16 +372,16 @@ export function createJobRigScreen(options: {
|
|
|
329
372
|
/** Unsupported asks stay on the shared screen with a named explanation. */
|
|
330
373
|
changed(state: {readonly pending: readonly PendingAskV3[]; readonly closed: boolean; readonly preparing?:boolean; readonly error?:string|null; readonly errorOrigin?:string; readonly previousLabel?:string|null; readonly displayed?:DisplayPublicationV3|null}): void {
|
|
331
374
|
if (!mounted) return;
|
|
332
|
-
if(mounted.record){screen?.pendingSubjects?.(pendingSubjects());refreshRecordForms();if(mounted.refusal)
|
|
375
|
+
if(mounted.record){screen?.pendingSubjects?.(pendingSubjects());refreshRecordForms();if(mounted.refusal)say(options.translate('job.refusal.'+mounted.refusal),true,undefined,mounted.refusal);if(state.closed)say(options.translate('job.closed'),true);return;}
|
|
333
376
|
const refusal=jobRigScreenRefusal(mounted.display,state.pending,mounted.checkpoints);
|
|
334
|
-
if(refusal){
|
|
377
|
+
if(refusal){say(options.translate('job.refusal.'+refusal),true,undefined,refusal);return;}
|
|
335
378
|
screen?.pendingSubjects?.(pendingSubjects());
|
|
336
379
|
refreshRecordForms();
|
|
337
|
-
if(state.error)
|
|
338
|
-
else if (state.closed)
|
|
380
|
+
if(state.error)say(options.translate('job.failed')+' · '+options.refusal(state.error),true,jobSubmissionRefusal(new Error(state.error,{cause:state.errorOrigin})).title);
|
|
381
|
+
else if (state.closed) say(options.translate('job.closed'), true);
|
|
339
382
|
else if(!state.preparing&&state.displayed?.publication.publicationId===mounted.display.publication.publicationId){
|
|
340
383
|
const label=state.previousLabel?options.translate('job.updated',[state.previousLabel,mounted.display.publication.label]):mounted.display.publication.label;
|
|
341
|
-
|
|
384
|
+
say(label+(screen?.incompatible?.()?' · '+options.translate('job.incompatible'):''));
|
|
342
385
|
}
|
|
343
386
|
},
|
|
344
387
|
};
|
package/web/job-session.ts
CHANGED
|
@@ -514,7 +514,7 @@ export function createJobWindowTransport(access: JobWindowAccess, fetcher: typeo
|
|
|
514
514
|
};
|
|
515
515
|
}
|
|
516
516
|
/** Bounded newline events. Reconnects resume after the last fully parsed event. */
|
|
517
|
-
export async function* jobWindowEvents(access: JobWindowAccess, after: string | null, signal: AbortSignal, fetcher: typeof fetch = fetch): AsyncGenerator<EventV3> {
|
|
517
|
+
export async function* jobWindowEvents(access: JobWindowAccess, after: string | null, signal: AbortSignal, fetcher: typeof fetch = fetch, connected?: () => void): AsyncGenerator<EventV3> {
|
|
518
518
|
const path = 'events' + (after === null ? '' : '?after=' + encodeURIComponent(after));
|
|
519
519
|
const response = await fetcher(access.route(path), { signal, headers: access.headers() });
|
|
520
520
|
if (!response.ok || !response.body)
|
|
@@ -524,6 +524,7 @@ export async function* jobWindowEvents(access: JobWindowAccess, after: string |
|
|
|
524
524
|
let buffered = '';
|
|
525
525
|
const limit = 1024 * 1024;
|
|
526
526
|
try {
|
|
527
|
+
if (!signal.aborted) connected?.();
|
|
527
528
|
for (;;) {
|
|
528
529
|
const next = await reader.read();
|
|
529
530
|
if (next.done) {
|
|
@@ -598,11 +599,13 @@ export function startJobWindowEvents(options: {
|
|
|
598
599
|
signal: AbortSignal;
|
|
599
600
|
event(value: EventV3): void;
|
|
600
601
|
refused(error: unknown): void;
|
|
602
|
+
connected?(): void;
|
|
601
603
|
fetcher?: typeof fetch;
|
|
602
604
|
}) {
|
|
603
605
|
let cursor: string | null = null;
|
|
604
606
|
let reader: AbortController | null = null;
|
|
605
607
|
let wake: (() => void) | null = null;
|
|
608
|
+
let failed = false;
|
|
606
609
|
const stopped = () => { reader?.abort(); wake?.(); };
|
|
607
610
|
options.signal.addEventListener('abort', stopped, {once: true});
|
|
608
611
|
function wait(milliseconds?: number): Promise<void> {
|
|
@@ -619,14 +622,22 @@ export function startJobWindowEvents(options: {
|
|
|
619
622
|
const current = new AbortController();
|
|
620
623
|
reader = current;
|
|
621
624
|
try {
|
|
622
|
-
for await (const event of jobWindowEvents(options.access, cursor, current.signal, options.fetcher)
|
|
625
|
+
for await (const event of jobWindowEvents(options.access, cursor, current.signal, options.fetcher, () => {
|
|
626
|
+
if (failed && !current.signal.aborted && !options.signal.aborted) {
|
|
627
|
+
failed = false;
|
|
628
|
+
options.connected?.();
|
|
629
|
+
}
|
|
630
|
+
})) {
|
|
623
631
|
// Only complete, delivered events advance replay, including a final event racing hide.
|
|
624
632
|
options.event(event);
|
|
625
633
|
cursor = event.cursor;
|
|
626
634
|
if (event.type === 'closed') return;
|
|
627
635
|
}
|
|
628
636
|
} catch (error) {
|
|
629
|
-
if (!current.signal.aborted && !options.signal.aborted)
|
|
637
|
+
if (!current.signal.aborted && !options.signal.aborted) {
|
|
638
|
+
failed = true;
|
|
639
|
+
options.refused(error);
|
|
640
|
+
}
|
|
630
641
|
} finally { reader = null; }
|
|
631
642
|
if (!options.signal.aborted && !current.signal.aborted) await wait(500);
|
|
632
643
|
}
|
|
@@ -1642,18 +1653,20 @@ export async function mountJobScreen(host:HTMLElement):Promise<()=>void> {
|
|
|
1642
1653
|
const rigScreen=createJobRigScreen({host,pageId,access,translate:(key,values)=>i18n.t(key,values,'en'),refusal:jobWindowRefusal,formDependencies:dependencies,
|
|
1643
1654
|
window:{state:()=>window.state(),submit:input=>window.submit(input)},readPublication:(id,signal)=>transport.readPublication(id,signal),
|
|
1644
1655
|
routes:display=>jobPublicationRoutes(display,location.origin),load:async()=>(await import('./main.ts')).mountRigScreen()});
|
|
1645
|
-
let bootstrapNotice:HTMLElement|null=null;
|
|
1646
|
-
const report=(error:unknown,fallback?:string)=>{if(rigScreen.mounted()){rigScreen.report(error,fallback);return;}if(!bootstrapNotice){bootstrapNotice=node('p');bootstrapNotice.setAttribute('role','status');bootstrapNotice.setAttribute('translate','no');host.prepend(bootstrapNotice);}
|
|
1656
|
+
let bootstrapNotice:HTMLElement|null=null,bootstrapStream=false,bootstrapPrior:{text:string;title:string}|null=null;
|
|
1657
|
+
const report=(error:unknown,fallback?:string)=>{const stream=fallback==='JOB_STREAM_FAILED';if(rigScreen.mounted()){rigScreen.report(error,fallback);return;}if(!bootstrapNotice){bootstrapNotice=node('p');bootstrapNotice.setAttribute('role','status');bootstrapNotice.setAttribute('translate','no');host.prepend(bootstrapNotice);}const text=jobWindowRefusal(error,fallback),code=error instanceof Error?error.message:error,title=typeof code==='string'&&/^[A-Z][A-Z0-9_]*$/.test(code)&&Object.hasOwn(enCatalog,code)&&Object.hasOwn(koCatalog,code)?code:fallback??'JOB_WINDOW_FAILED';if(stream)bootstrapStream=true;else{bootstrapStream=false;bootstrapPrior={text,title};}bootstrapNotice.textContent=text;bootstrapNotice.title=title;};
|
|
1658
|
+
const clear=()=>{rigScreen.clearReport?.();if(!bootstrapStream)return;bootstrapStream=false;if(bootstrapPrior&&bootstrapNotice){bootstrapNotice.textContent=bootstrapPrior.text;bootstrapNotice.title=bootstrapPrior.title;return;}if(bootstrapNotice){bootstrapNotice.textContent='';bootstrapNotice.title='';bootstrapNotice.remove?.();bootstrapNotice=null;}};
|
|
1647
1659
|
const window=createJobWindow<JobRigScreenPrepared|null>({jobId:access.jobId,pageId,transport,adapter:{
|
|
1648
1660
|
async prepare(display,signal){return rigScreen.prepare(display,signal);},
|
|
1649
1661
|
captureDraft(){drafts.saveDraft();const forms=modalState()?.forms;const dirty=forms?[...forms].filter(([,entry])=>entry.dirty):[];return dirty.length?dirty.map(([askId,entry])=>({askId,value:entry.read()})):null;},
|
|
1650
1662
|
commit:prepared=>prepared?rigScreen.commit(prepared):{rollback(){},finalize(){}},
|
|
1651
1663
|
async painted(prepared,signal){if(stopped||signal.aborted)return;if(prepared)await rigScreen.painted(prepared,signal);},
|
|
1652
1664
|
discard:prepared=>{const modal=prepared?.record??prepared?.modals;for(const entry of modal?.forms.values()??[])entry.dispose?.();modal?.inspection.dispose();},
|
|
1653
|
-
changed(state){rigScreen.changed(state);if(state.error&&(!rigScreen.mounted()||rigScreen.mounted()?.record))report(state.error);},
|
|
1665
|
+
changed(state){rigScreen.changed(state);if(!state.error&&rigScreen.mounted())bootstrapPrior=null;if(state.error&&(!rigScreen.mounted()||rigScreen.mounted()?.record))report(state.error);},
|
|
1654
1666
|
}});
|
|
1655
1667
|
const localize=i18n.onLanguageChange(()=>{for(const element of host.querySelectorAll<HTMLElement>('[data-job-text]'))element.textContent=t(element.dataset.jobText!);for(const form of host.querySelectorAll('form.interview-answer'))form.dispatchEvent(new Event('job-form-language'));});
|
|
1656
|
-
|
|
1668
|
+
await rigScreen.waiting();
|
|
1669
|
+
startJobWindowEvents({access,signal:abort.signal,event:event=>window.event(event),refused:error=>report(error,'JOB_STREAM_FAILED'),connected:clear});
|
|
1657
1670
|
const stop=()=>{if(stopped)return;stopped=true;drafts.saveDraft();abort.abort();window.stop();const modal=modalState();for(const entry of modal?.forms.values()??[])entry.dispose?.();modal?.inspection.dispose();localize();globalThis.removeEventListener('pagehide',stop);};
|
|
1658
1671
|
globalThis.addEventListener('pagehide',stop,{once:true});return stop;
|
|
1659
1672
|
}
|
package/web/main.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {hasTransientQuestionImage} from './interview-panel.ts';
|
|
2
|
-
import {bindScenePlates,loadScenePlates,takeSample} from './scene-plates.ts';
|
|
2
|
+
import {advanceTake,bindScenePlates,loadScenePlates,takeSample} from './scene-plates.ts';
|
|
3
3
|
import type {SceneInspection} from '../src/scene-inspection.ts';
|
|
4
4
|
import type {InterviewSubjectEntry} from '../src/joined-project.ts';
|
|
5
5
|
import {mountJobScreen,joinedInterviewForms,mediaReady,jobSubmissionRefusal} from './job-session.ts';
|
|
@@ -52,7 +52,7 @@ import {mountRigInspector,bindInspectorBlocks,activeBlocksUI,restoreActiveBlocks
|
|
|
52
52
|
import {connectControl} from './control.ts';
|
|
53
53
|
import {connectLiveWindow} from './live-connection.ts';
|
|
54
54
|
import {pageInstanceAccess,readOnlyReason} from './instance-access.ts';
|
|
55
|
-
import {rigHost,type RigHostStage} from './rig-host.ts';
|
|
55
|
+
import {rigHost,type RigHost,type RigHostStage} from './rig-host.ts';
|
|
56
56
|
import {controlComparison,type ControlCommand,type ControlInspection,type ControlView} from '../src/control.ts';
|
|
57
57
|
import {singleEligibility,videoReferenceAt,type InputState,type SingleLayout} from '../src/comparison-eligibility.ts';
|
|
58
58
|
import {parseBookmark,connectInspectionPersistence,serializableView,restoredZoom,restoreTransaction,captureInputs,restoreInputs,type InspectionBookmark,type InspectionBinding,type PersistenceConnection} from './inspection-persistence.ts';
|
|
@@ -111,8 +111,9 @@ const option = (value: string, label: string) => { const item = document.createE
|
|
|
111
111
|
const errorText = (error: unknown) => error instanceof Error ? error.message : String(error);
|
|
112
112
|
// Capability is consumed before shell composition or any URL-dependent binding.
|
|
113
113
|
// A live job (#709) hosts this screen for a rig subject: its routes, its session and its submit.
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
let host=rigHost(),access=host?.access??pageInstanceAccess();
|
|
115
|
+
let partsOnly=host?.subject==='parts'||screenRoot.dataset.reviewScreen==='parts';
|
|
116
|
+
let firstPublicationPrompt=!!host?.waiting;
|
|
116
117
|
const app=el('app');app.innerHTML=rigWorkspaceMarkup+rigFeedbackMarkup;
|
|
117
118
|
const rigStatusBar=mountStatusBar({
|
|
118
119
|
message:'Loading local review package…',
|
|
@@ -166,8 +167,11 @@ let sceneComposite:ReturnType<typeof bindScenePlates>|undefined;
|
|
|
166
167
|
const activeScene=()=>sceneComposite&&data.direction&&(!stageSource||stageSource.url===inspectedModel?.url)?data.direction:undefined;
|
|
167
168
|
const sceneBox=()=>{const direction=activeScene();return direction?takeSample(direction,time).box:null;};
|
|
168
169
|
const rebuildFramingBoxes=new WeakMap<ModelAssets,PoseBounds>();
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
let viewportProvider=partsOnly?createPartsViewportProvider({el,canvas:partsCanvas,message,reference:()=>partsReference.width>0?partsReference:null,frameSize:target=>target==='reference'&&activeInterviewImage&&referenceSize?{w:referenceSize.width,h:referenceSize.height}:partsSubject?.frameSize(target)??null},viewportState):createRigViewportProvider({fitLabel:'Fit',framingBox:()=>sceneBox()??(assets?rebuildFramingBoxes.get(assets)??null:null),el,player:()=>player,assets:()=>assets,referenceSize:()=>referenceSize,view:()=>view,referenceGeneration:()=>referenceGeneration,parts:()=>parts,text,message,redrawOverlay,raster:rigRaster},viewportState);
|
|
171
|
+
// The first publication selects the existing provider without replacing the empty viewport.
|
|
172
|
+
const viewport=createViewportController(new Proxy(viewportProvider,{get:(_target,key)=>{
|
|
173
|
+
const value=Reflect.get(viewportProvider,key,viewportProvider);return typeof value==='function'?value.bind(viewportProvider):value;
|
|
174
|
+
}}),viewportState);
|
|
171
175
|
const {fitCamera,paneFrame,availableCamera,alignCameras,renderCameraControls,setCameraSync,cameraAction,updateCamera,fitActiveCamera}=viewport;
|
|
172
176
|
// First, before any URL use: take the `#cap=` handoff into memory/session storage and strip it.
|
|
173
177
|
if(!host)connectLiveWindow(access);
|
|
@@ -386,7 +390,7 @@ function renderCheckpoint(): void {
|
|
|
386
390
|
}
|
|
387
391
|
|
|
388
392
|
function setView(value: typeof view): void {view=value;renderLayout();}
|
|
389
|
-
function chooseInspectionView(id:string):void {
|
|
393
|
+
async function chooseInspectionView(id:string):Promise<void> {
|
|
390
394
|
if(activeInterviewImages){const image=activeInterviewImages[Number(id.replace('interview-image-',''))];if(id.startsWith('interview-image-')&&image){activeInterviewImage=image;void showReference('',image);}return;}
|
|
391
395
|
if(!partsSubject){
|
|
392
396
|
if(id==='difference'){
|
|
@@ -407,8 +411,9 @@ function chooseInspectionView(id:string):void {
|
|
|
407
411
|
return;
|
|
408
412
|
}
|
|
409
413
|
const overlay=document.getElementById('parts-overlay') as HTMLInputElement;
|
|
414
|
+
const subject=partsSubject;
|
|
415
|
+
if(!await subject.setComparison(id==='difference'?'difference':overlay.checked?'overlay':'part')||partsSubject!==subject)return;
|
|
410
416
|
if(id==='difference')overlay.checked=false;
|
|
411
|
-
partsSubject.setComparison(id==='difference'?'difference':overlay.checked?'overlay':'part');
|
|
412
417
|
setView(id==='difference'?'rig':id as SingleLayout);
|
|
413
418
|
}
|
|
414
419
|
/** Availability follows the actual loaded image and declared native rig canvas, never a resized reference. */
|
|
@@ -819,7 +824,7 @@ function tickPlaying(now: number): void {
|
|
|
819
824
|
const stepped = next.steps.reduce((sum, step) => sum + step, 0);
|
|
820
825
|
// The wrap does what the replaced seek(0) did besides the player: restart the wind clock and re-hold the reference at the wrapped time.
|
|
821
826
|
if (next.wrapped) { stopAudio(); clipMoved({ kind: 'replay' }); if (video) { if (video.readyState >= 1) holdVideoReference(video, referenceGeneration); void video.play().catch(error => { pause(); message(errorText(error), true); }); } }
|
|
822
|
-
if (player && player.current && next.steps.length) { try { const direction=activeScene();if(direction){stepEnvironment(stepped);drawRig(()=>{player
|
|
827
|
+
if (player && player.current && next.steps.length) { try { const direction=activeScene();if(direction){stepEnvironment(stepped);drawRig(()=>{advanceTake(player!,direction,previous,next.steps);player!.draw();});}else{stepEnvironment(stepped); drawRig(()=>{ for (const step of next.steps) player!.advance(step); player!.draw(); });} } catch (error) { pause(); message(errorText(error), true); } }
|
|
823
828
|
if (video && video.readyState >= 1 && time > video.duration) { if (referenceInput.state !== 'out-of-domain') holdVideoReference(video, referenceGeneration); } else if (video && referenceInput.state === 'loaded' && Math.abs(video.currentTime - time) > .15) video.currentTime = time;
|
|
824
829
|
if (input('sync-audio').checked) for (const cue of activeCues()) if (cueDue(cue.time, previous, next, duration)) void audition(cue.clip);
|
|
825
830
|
renderSequenceFrame(); renderTransport(); if (next.ended) pause(); lastFrame = now;
|
|
@@ -1251,7 +1256,7 @@ function bind(): void {
|
|
|
1251
1256
|
retargetPanel=bindRetargetPanel({apply:body=>applyRetarget(body),reset:()=>{void resetRebuild(stageWorld());},seek:seekReading});
|
|
1252
1257
|
requirementsPanel=bindRequirementsPanel({check:runRequirements,seek:seekReading,animation:()=>animation,slot:()=>parts?.value()?.slot??stageDraftSelection?.slot??null,hash:sha256Hex});
|
|
1253
1258
|
const tickResize=new ResizeObserver(()=>renderReadingTicks());tickResize.observe(el('transport'));viewDisposers.push(()=>tickResize.disconnect());
|
|
1254
|
-
viewDisposers.push(viewport.bindNavigation(rigPanCarry({player:()=>player},viewport.state),
|
|
1259
|
+
viewDisposers.push(viewport.bindNavigation(rigPanCarry({player:()=>player},viewport.state),panOnly=>!comments?.active()||!!panOnly));
|
|
1255
1260
|
for(const [id,key] of [['layer-images','images'],['layer-mesh','mesh'],['layer-bones','bones']] as const)input(id).onchange=()=>{layers[key]=input(id).checked;redrawOverlay(false);};
|
|
1256
1261
|
viewDisposers.push(bindLayerShortcuts(document));describeLayerToggles(document,el('layer-state').textContent??'');
|
|
1257
1262
|
input('idle-repeat').onchange=()=>{syncPlayerLoop();renderIdle();if(canRepeatIdle())void playPreview();};
|
|
@@ -1265,16 +1270,48 @@ function bind(): void {
|
|
|
1265
1270
|
}
|
|
1266
1271
|
|
|
1267
1272
|
/** The one shell and block binding, for either subject. */
|
|
1268
|
-
function bindWorkspace(hasModel=false):void {
|
|
1273
|
+
function bindWorkspace(hasModel=false,empty=false):void {
|
|
1274
|
+
if(!workspace){
|
|
1269
1275
|
workspace=bindWorkspaceUI({root:screenRoot,regions:{layout:screenRoot.querySelector<HTMLElement>('.layout')!,left:screenRoot.querySelector<HTMLElement>('.left-panel')!,main:el('stage-layout').parentElement!,stage:el('stage-layout'),bottom:screenRoot.querySelector<HTMLElement>('.inspector')!,columns:{left:'rightWidth',right:null}},language:shell.language!,bottomPanel:rigInspector,changed:fitCamera,defaultTheme:theme=>appearance?.set(theme),currentTheme:()=>appearance?.get()});
|
|
1270
1276
|
viewport.state.cameraSync=workspace.defaults().defaultCameraSync;input('camera-sync').checked=viewport.state.cameraSync;input('idle-repeat').checked=workspace.defaults().defaultIdleRepeat;
|
|
1271
1277
|
appearance=bindAppearance(select('settings-theme'),workspace.defaults().theme);
|
|
1278
|
+
}
|
|
1279
|
+
if(empty)return;
|
|
1272
1280
|
bindReviewDialog();
|
|
1273
1281
|
screenRoot.querySelector<HTMLElement>('.inspector-body')!.append(questionPanel);
|
|
1274
1282
|
inspectorBlocks=bindInspectorBlocks({sections:[el('inspector-rig'),el('inspector-playback')],available:host?.record&&(!host.record.hasPicture||!hasModel&&!partsOnly)?['feedback']:undefined,bottom:{strip:rigInspector.strip,comment:rigInspector.comments.button,panel:rigInspector.comments.panel},changed:()=>{syncQuestionImage();workspace?.refresh();persistence?.save();}});
|
|
1275
1283
|
}
|
|
1276
1284
|
async function start(): Promise<void> {
|
|
1277
1285
|
try {
|
|
1286
|
+
if(host?.waiting){
|
|
1287
|
+
bindWorkspace(false,true);
|
|
1288
|
+
el('rig-pane').hidden=false;el('reference-pane').hidden=false;
|
|
1289
|
+
const partStatus=screenRoot.querySelector<HTMLElement>('[data-part-status]')!;
|
|
1290
|
+
const loadingCopy=[['message',sourceTextContent(el('message'))],['layout-state',sourceTextContent(el('layout-state'))]] as const,partStatusCopy=sourceTextContent(partStatus);
|
|
1291
|
+
for(const id of ['package-title','revision','rig-empty','reference-empty','dirty','message','layout-state'])text(id,'');
|
|
1292
|
+
setSourceText(partStatus,'');
|
|
1293
|
+
const controls=[...screenRoot.querySelectorAll<HTMLInputElement|HTMLSelectElement|HTMLButtonElement>('input,select,textarea,button')]
|
|
1294
|
+
.filter(control=>control.id!=='settings-language').map(control=>({control,disabled:control.disabled}));
|
|
1295
|
+
for(const {control}of controls)control.disabled=true;
|
|
1296
|
+
for(const control of [button('save'),requestChanges,select('review-status'),screenRoot.querySelector<HTMLElement>('label[for="review-status"]')!])control.hidden=true;
|
|
1297
|
+
askHeadline.hidden=false;setSourceText(askHeadline,t('job.waiting',undefined,'en'));rigInspector.act.hidden=false;rigInspector.syncActRow();
|
|
1298
|
+
await workspace?.settle();if(disposed)return;
|
|
1299
|
+
const next=await new Promise<RigHost>((resolve,reject)=>{
|
|
1300
|
+
lifecycle.signal.addEventListener('abort',()=>reject(new Error('JOB_PRELOAD_CANCELLED')),{once:true});
|
|
1301
|
+
host!.attach({publish:resolve,stage:()=>null,redraw:()=>{},
|
|
1302
|
+
message:(value,error,diagnostic)=>message(value,error,false,diagnostic),suspend:()=>{},dispose:disposeScreen});
|
|
1303
|
+
});
|
|
1304
|
+
if(disposed)return;
|
|
1305
|
+
host=next;access=next.access;partsOnly=next.subject==='parts';
|
|
1306
|
+
for(const [id,value]of loadingCopy)text(id,value);
|
|
1307
|
+
setSourceText(partStatus,partStatusCopy);
|
|
1308
|
+
for(const {control,disabled}of controls)control.disabled=disabled;
|
|
1309
|
+
if(partsOnly){
|
|
1310
|
+
partsCanvas.id='parts-canvas';el('rig-root').append(partsCanvas);el('reference-content').append(partsReference);
|
|
1311
|
+
viewportProvider=createPartsViewportProvider({el,canvas:partsCanvas,message,reference:()=>partsReference.width>0?partsReference:null,
|
|
1312
|
+
frameSize:target=>target==='reference'&&activeInterviewImage&&referenceSize?{w:referenceSize.width,h:referenceSize.height}:partsSubject?.frameSize(target)??null},viewportState);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1278
1315
|
if(host?.record&&!host.record.hasPicture){await startRecord();return;}
|
|
1279
1316
|
let writes: { capabilityRequired: boolean; control?: boolean };
|
|
1280
1317
|
const opened=await api<ReviewResponse|PartsSubjectEntry|InterviewSubjectEntry>('/api/review');
|
|
@@ -1325,7 +1362,7 @@ async function start(): Promise<void> {
|
|
|
1325
1362
|
await restorePublicationNavigation();document.body.dataset.ready='true';
|
|
1326
1363
|
host.attach({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});showInspector(data.manifest.model?'playback':'rig');host.displayed();
|
|
1327
1364
|
}
|
|
1328
|
-
} catch (error) { message(`Could not open review package: ${errorText(error)}`, true); text('dirty', 'Load failed'); host?.failed(error); }
|
|
1365
|
+
} catch (error) { if(disposed)return;message(`Could not open review package: ${errorText(error)}`, true); text('dirty', 'Load failed'); host?.failed(error); }
|
|
1329
1366
|
}
|
|
1330
1367
|
/** Parts have a verdict and image-space pixels, never fabricated model/session fields. */
|
|
1331
1368
|
async function startParts(opened:PartsSubjectEntry,saved:PartsSubjectSession,writes:{capabilityRequired:boolean}):Promise<void>{
|
|
@@ -1562,7 +1599,8 @@ function renderPendingSubjects(subjects:readonly {kind:string;stage?:string}[]):
|
|
|
1562
1599
|
const requests:Record<string,string>={'parts-verdict':'Check the parts and meshes.','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.','reopen':'Review the reopened stage.'};
|
|
1563
1600
|
const labels=subjects.map(subject=>requests[subject.kind+':'+subject.stage]??requests[subject.kind]).filter((label):label is string=>!!label);
|
|
1564
1601
|
pendingAnswers=subjects;
|
|
1565
|
-
askHeadline.hidden=false;setSourceText(askHeadline,labels.join(' · ')||'Nothing is waiting for your answer.');
|
|
1602
|
+
askHeadline.hidden=false;setSourceText(askHeadline,labels.join(' · ')||(firstPublicationPrompt?t('job.waiting',undefined,'en'):'Nothing is waiting for your answer.'));
|
|
1603
|
+
if(subjects.length)firstPublicationPrompt=false;
|
|
1566
1604
|
renderDraftState();
|
|
1567
1605
|
}
|
|
1568
1606
|
/** Answer controls compose the existing act bar and submit handlers; act payloads stay unchanged. */
|
|
@@ -1576,10 +1614,9 @@ function renderAnswerControls():void {
|
|
|
1576
1614
|
const save=button('save');
|
|
1577
1615
|
if((host||subjects.some(subject=>subject.kind==='interview-picks'))&&subjects.length&&!rigInspector.actBar.saveState())rigInspector.actBar.setSaveState({kind:'unsaved',text:'Not submitted'});
|
|
1578
1616
|
select('review-status').hidden=true;document.querySelector<HTMLLabelElement>('label[for="review-status"]')!.hidden=true;
|
|
1579
|
-
save.
|
|
1617
|
+
save.classList.toggle('primary',verdict&&!(subjects.some(subject=>subject.kind==='parts-verdict')&&liveIssueCount()>0));
|
|
1580
1618
|
requestChanges.classList.toggle('primary',verdict&&subjects.some(subject=>subject.kind==='parts-verdict')&&liveIssueCount()>0);
|
|
1581
|
-
|
|
1582
|
-
rigAsk.hidden=!dialog;rigAsk.classList.toggle('primary',dialog);
|
|
1619
|
+
rigAsk.classList.toggle('primary',dialog);
|
|
1583
1620
|
const kind=subjects.find(subject=>!subject.kind.endsWith('verdict'))?.kind;
|
|
1584
1621
|
setSourceText(rigAsk,kind==='signoff'?'Approve…':kind==='interview-picks'||readable?'Answer…':'Review…');
|
|
1585
1622
|
rigAsk.disabled=(!enabled&&!readable)||(enabled&&blocked);
|
|
@@ -1596,7 +1633,9 @@ function renderAnswerControls():void {
|
|
|
1596
1633
|
requestChanges.onclick=()=>{if(requestChanges.disabled)return;if(parts){void save.onclick?.call(save,new PointerEvent('click'));}else{session.status='changes-requested';select('review-status').value=session.status;void verdictSubmit?.(new MouseEvent('click'));}};
|
|
1597
1634
|
}
|
|
1598
1635
|
for(const root of [recordDialog,...questionForms])for(const control of root?.querySelectorAll<HTMLButtonElement>('button[type="submit"]')??[])control.disabled=blocked||verdict;
|
|
1599
|
-
|
|
1636
|
+
// The waiting row is already visible: finish labels, state and handlers before revealing any answer.
|
|
1637
|
+
save.hidden=!verdict||firstPublicationPrompt;requestChanges.hidden=save.hidden;rigAsk.hidden=!dialog||firstPublicationPrompt;
|
|
1638
|
+
if(host){rigInspector.answersRendered=true;rigInspector.act.hidden=subjects.length===0&&!firstPublicationPrompt;rigInspector.syncActRow?.();}
|
|
1600
1639
|
}
|
|
1601
1640
|
let verdictSubmit:((event:MouseEvent)=>unknown)|null=null;
|
|
1602
1641
|
/** The rig pane for a live job's still (#709): the job binds and copies it, this screen keeps its view. */
|
|
@@ -89,6 +89,8 @@ export function bindPartsSubject(host:{
|
|
|
89
89
|
let selected:string|null=null,solo=false,comparison:PartsComparison=defaultPartsComparison(),token=0,disposed=false,busy=false,failed=false;
|
|
90
90
|
let drawnFrame:{w:number;h:number}|null=null,drawnReferenceFrame:{w:number;h:number}|null=null;
|
|
91
91
|
let drawnRegion:Box|null=null,drawnSolo=false;
|
|
92
|
+
let drawnComparison:PartsComparison|null=null;
|
|
93
|
+
let drawnNavigation:{selected:string|null;solo:boolean;hidden:string[]}|null=null;
|
|
92
94
|
let original:Promise<HTMLImageElement>|null=null,comments:ReturnType<typeof bindStageComments<CommentRow,PartsPose>>|null=null;
|
|
93
95
|
const makeCanvas=(w:number,h:number)=>Object.assign(document.createElement('canvas'),{width:w,height:h});
|
|
94
96
|
const item=()=>data.items.find(item=>item.name===selected)??data.items[0]!;
|
|
@@ -143,10 +145,14 @@ export function bindPartsSubject(host:{
|
|
|
143
145
|
const selectionChanged=drawnRegion?.name!==referenceBox?.name||drawnSolo!==!assembled();
|
|
144
146
|
drawnRegion=referenceBox;drawnSolo=!assembled();
|
|
145
147
|
if(reference){host.referenceCanvas.width=reference.width;host.referenceCanvas.height=reference.height;host.referenceCanvas.getContext('2d')!.drawImage(reference,0,0);drawnReferenceFrame={w:reference.width,h:reference.height};}
|
|
146
|
-
drawnFrame={w:frame.w,h:frame.h};failed=false;host.drawn({state:'loaded'});host.el('rig-empty').hidden=true;host.el('rig-label').textContent=t(assembled()?'Assembled parts':'Selected part');
|
|
148
|
+
drawnFrame={w:frame.w,h:frame.h};drawnComparison={...comparison};drawnNavigation={selected,solo,hidden:[...hidden]};failed=false;host.drawn({state:'loaded'});host.el('rig-empty').hidden=true;host.el('rig-label').textContent=t(assembled()?'Assembled parts':'Selected part');
|
|
147
149
|
if(data.painting&&host.viewport.state.cameraSync&&selectionChanged)host.viewport.requestFit();
|
|
148
150
|
host.viewport.fitCamera();comments?.refresh();
|
|
149
|
-
}catch(error){if(!disposed&&navigation===token){
|
|
151
|
+
}catch(error){if(!disposed&&navigation===token){
|
|
152
|
+
if(comparison.mode==='difference'&&drawnComparison&&drawnFrame&&drawnNavigation){comparison={...drawnComparison};selected=drawnNavigation.selected;solo=drawnNavigation.solo;hidden.clear();for(const name of drawnNavigation.hidden)hidden.add(name);host.selectionChanged();host.drawn({state:'loaded'});}
|
|
153
|
+
else{failed=true;drawnFrame=null;drawnReferenceFrame=null;host.drawn({state:'failed',reason:error instanceof Error?error.message:'PARTS_PAINT_FAILED'});host.canvas.getContext('2d')?.clearRect(0,0,host.canvas.width,host.canvas.height);host.referenceCanvas.getContext('2d')?.clearRect(0,0,host.referenceCanvas.width,host.referenceCanvas.height);}
|
|
154
|
+
host.message(error instanceof Error?error.message:'PARTS_PAINT_FAILED',true);throw error;
|
|
155
|
+
}}
|
|
150
156
|
finally{for(const bitmap of bitmaps)bitmap.close();if(navigation===token){busy=false;host.el('stage-layout').setAttribute('aria-busy','false');comments?.refresh();}}
|
|
151
157
|
}
|
|
152
158
|
const redraw=()=>{void paint().catch(()=>{});};
|
|
@@ -207,7 +213,7 @@ export function bindPartsSubject(host:{
|
|
|
207
213
|
select:(name:string|null)=>{selected=name;if(name===null)solo=false;redraw();host.selectionChanged();},isolate:(value:boolean)=>{solo=value;redraw();host.selectionChanged();},
|
|
208
214
|
show:(name:string,value:boolean)=>{if(value)hidden.delete(name);else hidden.add(name);redraw();},
|
|
209
215
|
differenceAvailable:()=>data.differenceAvailable&&!!data.painting&&!failed,
|
|
210
|
-
comparison:()=>comparison,setComparison:(mode:PartsComparison['mode'])=>{
|
|
216
|
+
comparison:()=>comparison,setComparison:async(mode:PartsComparison['mode'])=>{const next:PartsComparison=mode==='difference'?{mode,opacity:comparison.opacity,threshold:0}:{mode,opacity:comparison.opacity};comparison=next;const navigation=token+1;try{await paint();return !disposed&&navigation===token&&comparison===next;}catch{return false;}},
|
|
211
217
|
opacity:(value:number)=>{comparison.opacity=value;redraw();},paint,redraw,
|
|
212
218
|
async ready(){if(data.painting)host.viewport.state.cameraSync=true;await paint();},
|
|
213
219
|
dispose(){disposed=true;++token;comments?.dispose();images.clear();loaded.clear();assemblyAlpha.clear();},
|
package/web/rig-host.ts
CHANGED
|
@@ -17,6 +17,8 @@ export type RigHostStage = Omit<JobRigStage, 'source' | 'presentation'> & {
|
|
|
17
17
|
export type RigHostNavigation = {subject:'rig';bookmark:InspectionBookmark} |
|
|
18
18
|
{subject:'parts';part:string|null;solo:boolean;view:string;camera:ControlView};
|
|
19
19
|
export interface RigHostScreen {
|
|
20
|
+
/** Fill the pre-publication frame once, keeping its shell and viewport nodes. */
|
|
21
|
+
publish?(host:RigHost):void;
|
|
20
22
|
navigation?():RigHostNavigation;
|
|
21
23
|
incompatible?():boolean;
|
|
22
24
|
suspend?():void;
|
|
@@ -37,6 +39,7 @@ export interface RigHostCommit {
|
|
|
37
39
|
readonly review?: Pick<ReviewSession, 'status' | 'feedback'>;
|
|
38
40
|
}
|
|
39
41
|
export interface RigHost {
|
|
42
|
+
readonly waiting?:boolean;
|
|
40
43
|
readonly subject?:'parts';
|
|
41
44
|
readonly unavailable?:string;
|
|
42
45
|
readonly direction?:{readonly publicationId:string;readonly sourceHash:string};
|
package/web/scene-plates.ts
CHANGED
|
@@ -112,6 +112,37 @@ export function takeSample(direction:DirectionInspection,time:number):{box:Scene
|
|
|
112
112
|
for(const key of ['x','y','width','height'] as const)box[key]+=(camera.b.box[key]-box[key])*camera.mix;
|
|
113
113
|
return {box,sourceTime:timing.a.source_time+(timing.b.source_time-timing.a.source_time)*timing.mix};
|
|
114
114
|
}
|
|
115
|
+
|
|
116
|
+
/** Advance authored source deltas, splitting at timing keys and take wraps, without replaying physics. */
|
|
117
|
+
export function advanceTake(player:RigPlayer,direction:DirectionInspection,from:number,steps:readonly number[]):void{
|
|
118
|
+
// Source deltas are already retimed by the take, rather than wall-time steps to scale again.
|
|
119
|
+
const timeScale=player.timeScale;player.timeScale=1;
|
|
120
|
+
try{
|
|
121
|
+
const duration=direction.take.duration,clipDuration=player.entry(0)?.duration??0;
|
|
122
|
+
const start=takeSample(direction,0).sourceTime,end=takeSample(direction,duration).sourceTime,span=end-start;
|
|
123
|
+
// Only equal source phases join continuously. A partial-clip restart is an authored jump.
|
|
124
|
+
const continuous=span===0||(clipDuration>0&&span>0&&Math.abs(span-Math.round(span/clipDuration)*clipDuration)<=1e-9);
|
|
125
|
+
let at=from;
|
|
126
|
+
for(const step of steps){
|
|
127
|
+
let remaining=step;
|
|
128
|
+
while(remaining>0){
|
|
129
|
+
if(at>=duration){if(!direction.take.loop)break;if(!continuous)player.seek(start);at=0;}
|
|
130
|
+
const index=direction.timing.findIndex(key=>key.time>at),key=direction.timing[index<0?direction.timing.length-1:Math.max(0,index-1)]!;
|
|
131
|
+
const boundary=direction.timing[index]?.time??duration,to=Math.min(at+remaining,boundary,duration),elapsed=to-at;
|
|
132
|
+
const before=takeSample(direction,at).sourceTime,after=takeSample(direction,to).sourceTime;
|
|
133
|
+
const delta=after-before;
|
|
134
|
+
if(key.easing==='hold'||delta===0){
|
|
135
|
+
// Authored holds freeze the track, while the existing held-step API lets physics settle.
|
|
136
|
+
const held=player.held;player.hold(true);try{player.advance(elapsed);}finally{player.hold(held);}
|
|
137
|
+
if(after!==before)player.seek(after);
|
|
138
|
+
}else if(delta>0)player.advance(delta);
|
|
139
|
+
else player.seek(after); // The current direction reader rejects reverse keys; never advance a negative delta.
|
|
140
|
+
remaining=to===at+remaining?0:remaining-elapsed;at=to;
|
|
141
|
+
if(at===duration&&direction.take.loop){if(!continuous)player.seek(start);at=0;}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}finally{player.timeScale=timeScale;}
|
|
145
|
+
}
|
|
115
146
|
/** Load only the byte identities already validated by the package reader; never follow a scene URL. */
|
|
116
147
|
export async function loadScenePlates(scene:SceneInspection,url:(path:string)=>string):Promise<Map<string,HTMLImageElement>>{
|
|
117
148
|
const images=new Map<string,HTMLImageElement>();
|