@rig-c/review 1.10.2 → 1.12.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/PARTS_VIEW.md +5 -0
- package/docs/REVIEW_PACKAGE.md +53 -2
- package/docs/WORKFLOWS.md +63 -0
- package/package.json +1 -1
- package/src/cli.ts +47 -10
- package/src/correction-handoff.ts +186 -0
- package/src/direction-inspection.ts +65 -0
- package/src/feedback-export.ts +14 -0
- package/src/handoff.ts +12 -2
- package/src/interview-picks.ts +89 -0
- package/src/interview-project.ts +260 -0
- package/src/interview-routes.ts +96 -0
- package/src/interview-server.ts +55 -0
- package/src/manifest.ts +16 -4
- package/src/open.ts +1 -1
- package/src/parts-view.ts +9 -0
- package/src/rebuild.ts +114 -21
- package/src/server.ts +19 -3
- package/src/session.ts +4 -2
- package/src/strip-render.ts +5 -2
- package/web/catalog-en.ts +70 -2
- package/web/catalog-ko.ts +70 -2
- package/web/direction-panel.ts +88 -0
- package/web/index.html +1 -1
- package/web/interview-panel.ts +180 -0
- package/web/interview.css +26 -0
- package/web/interview.html +17 -0
- package/web/interview.ts +27 -0
- package/web/main.ts +106 -13
- package/web/parts.html +1 -1
- package/web/parts.ts +2 -1
- package/web/stage-nav.ts +14 -7
- package/web/styles.css +3 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { HistoricalInterview, InterviewQuestion } from '../src/interview-project.ts';
|
|
2
|
+
import type { Picks } from '../src/interview-picks.ts';
|
|
3
|
+
import { onLanguageChange, t } from './i18n.ts';
|
|
4
|
+
import type { InstanceAccess } from './instance-access.ts';
|
|
5
|
+
|
|
6
|
+
type Question = Omit<InterviewQuestion,'images'> & {images:{name:string;url:string}[]; saved:Picks|null};
|
|
7
|
+
export const interviewErrors: Readonly<Record<string,string>> = {
|
|
8
|
+
INTERVIEW_CHOICE_INVALID:'interview.invalid',
|
|
9
|
+
INTERVIEW_CHOICE_CONSTRAINT:'interview.constraint',
|
|
10
|
+
INTERVIEW_CHOICE_REQUIRED:'interview.required',
|
|
11
|
+
INTERVIEW_OPTIONS_INVALID:'interview.invalidOptions',
|
|
12
|
+
INTERVIEW_OPTIONS_FILE:'interview.file',
|
|
13
|
+
INTERVIEW_OPTIONS_STALE:'interview.stale',
|
|
14
|
+
INTERVIEW_PICKS_OUTPUT:'interview.output',
|
|
15
|
+
};
|
|
16
|
+
function element<K extends keyof HTMLElementTagNameMap>(tag: K, content?: string): HTMLElementTagNameMap[K] {
|
|
17
|
+
const el = document.createElement(tag);
|
|
18
|
+
if (content !== undefined) el.textContent = content;
|
|
19
|
+
return el;
|
|
20
|
+
}
|
|
21
|
+
function errorKey(error: unknown) {
|
|
22
|
+
return error instanceof Error ? interviewErrors[error.message] ?? 'interview.failed' : 'interview.failed';
|
|
23
|
+
}
|
|
24
|
+
async function request(access: InstanceAccess, path: string, body?: Picks) {
|
|
25
|
+
const response = await fetch(access.route(path), body ? {
|
|
26
|
+
method:'POST', headers:access.headers({'Content-Type':'application/json'}), body:JSON.stringify(body),
|
|
27
|
+
} : undefined);
|
|
28
|
+
const result = await response.json();
|
|
29
|
+
if (!response.ok) throw new Error(result.error);
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function mountInterview(host: HTMLElement, access: InstanceAccess) {
|
|
34
|
+
let data: {questions:Question[];historical:HistoricalInterview[]};
|
|
35
|
+
try {data = await request(access, '/api/interview');}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const render = () => {host.textContent = t(errorKey(error));};
|
|
38
|
+
onLanguageChange(render); render(); return;
|
|
39
|
+
}
|
|
40
|
+
const {questions, historical:legacy} = data;
|
|
41
|
+
const drafts = questions.map(question => {
|
|
42
|
+
const saved = question.editable ? question.saved : null;
|
|
43
|
+
return {
|
|
44
|
+
picks:new Map(saved?.picks.map(pick => [pick.ask, pick])),
|
|
45
|
+
note:saved?.note,
|
|
46
|
+
image:0,
|
|
47
|
+
status:saved ? 'interview.saved' : '',
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
let selected = 0;
|
|
51
|
+
let busy = false;
|
|
52
|
+
const render = () => {
|
|
53
|
+
const archive = element('details');
|
|
54
|
+
archive.append(element('summary', t('interview.legacy')));
|
|
55
|
+
for (const answer of legacy) {
|
|
56
|
+
const item = element('section');
|
|
57
|
+
item.append(element('h3', answer.question), element('p', [answer.by,answer.at].filter(Boolean).join(' · ')),
|
|
58
|
+
element('pre', answer.verbatim));
|
|
59
|
+
archive.append(item);
|
|
60
|
+
}
|
|
61
|
+
if (!questions.length) {
|
|
62
|
+
host.replaceChildren(element('p', t('interview.empty')));
|
|
63
|
+
if (legacy.length) {archive.open = true; host.append(archive);}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const question = questions[selected]!;
|
|
67
|
+
const state = drafts[selected]!;
|
|
68
|
+
const picker = element('select');
|
|
69
|
+
picker.setAttribute('aria-label', t('interview.question'));
|
|
70
|
+
questions.forEach((item, index) => {
|
|
71
|
+
const entry = element('option', item.set.question + ' · ' + item.set.id + (item.editable ? '' : ' · ' + t('interview.history')));
|
|
72
|
+
entry.value = String(index); picker.append(entry);
|
|
73
|
+
});
|
|
74
|
+
picker.value = String(selected);
|
|
75
|
+
picker.disabled = busy;
|
|
76
|
+
picker.onchange = () => {selected = Number(picker.value); render();};
|
|
77
|
+
|
|
78
|
+
const grid = element('div'); grid.className = 'interview-grid';
|
|
79
|
+
const art = element('aside');
|
|
80
|
+
art.append(element('h2', t(question.hasParts ? 'interview.parts' : 'interview.source')));
|
|
81
|
+
if (!question.hasParts) art.append(element('p', t('interview.noParts')));
|
|
82
|
+
if (question.partsUnavailable) art.append(element('p', t('interview.partsUnavailable')));
|
|
83
|
+
const image = question.images[state.image];
|
|
84
|
+
if (image) {
|
|
85
|
+
const tabs = element('div');
|
|
86
|
+
question.images.forEach((asset, index) => {
|
|
87
|
+
const button = element('button', asset.name);
|
|
88
|
+
button.type = 'button';
|
|
89
|
+
button.setAttribute('aria-pressed', String(index === state.image));
|
|
90
|
+
button.onclick = () => {state.image = index; render();};
|
|
91
|
+
tabs.append(button);
|
|
92
|
+
});
|
|
93
|
+
const preview = element('img'); preview.alt = image.name; preview.src = access.route(image.url);
|
|
94
|
+
const unavailable = element('p', t('interview.imageUnavailable'));
|
|
95
|
+
unavailable.setAttribute('role','status');
|
|
96
|
+
unavailable.hidden = true;
|
|
97
|
+
preview.onerror = () => {preview.hidden = true; unavailable.hidden = false;};
|
|
98
|
+
art.append(tabs, preview, unavailable);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const form = element('form');
|
|
102
|
+
const fields = element('fieldset'); fields.disabled = !question.editable || !access.capability || busy;
|
|
103
|
+
const provenance = element('p', t('interview.provenance', [question.set.drafted_by, question.set.drafted_at]));
|
|
104
|
+
const binding = element('code', question.ref.path + ' · ' + question.ref.sha256);
|
|
105
|
+
form.append(provenance, binding);
|
|
106
|
+
const historical = question.answer?.choice as {picks?:Picks['picks'];note?:string} | undefined;
|
|
107
|
+
const status = element('p'); status.setAttribute('role','status');
|
|
108
|
+
const markUnsaved = () => {
|
|
109
|
+
state.status = 'interview.unsaved';
|
|
110
|
+
status.textContent = t(state.status);
|
|
111
|
+
};
|
|
112
|
+
for (const ask of question.set.asks) {
|
|
113
|
+
const group = element('fieldset');
|
|
114
|
+
group.append(element('legend', ask.prompt));
|
|
115
|
+
const pick = state.picks.get(ask.id) ?? historical?.picks?.find(pick => pick.ask === ask.id);
|
|
116
|
+
const other = element('textarea');
|
|
117
|
+
other.setAttribute('aria-label', t('interview.other'));
|
|
118
|
+
other.value = pick?.other_text ?? '';
|
|
119
|
+
other.hidden = pick?.other_text === undefined && !ask.options.some(option => option.id === pick?.option_id && option.kind === 'other');
|
|
120
|
+
other.oninput = () => {
|
|
121
|
+
const previous = state.picks.get(ask.id);
|
|
122
|
+
if (previous) {state.picks.set(ask.id, {...previous, other_text:other.value}); markUnsaved();}
|
|
123
|
+
};
|
|
124
|
+
for (const option of ask.options) {
|
|
125
|
+
const label = element('label'); label.className = 'interview-option';
|
|
126
|
+
const radio = element('input'); radio.type = 'radio'; radio.name = ask.id; radio.value = option.id;
|
|
127
|
+
radio.required = true; radio.checked = option.id === pick?.option_id;
|
|
128
|
+
radio.onchange = () => {
|
|
129
|
+
const next = {ask:ask.id, option_id:option.id};
|
|
130
|
+
state.picks.set(ask.id, option.kind === 'other' ? {...next, other_text:other.value} : next);
|
|
131
|
+
markUnsaved();
|
|
132
|
+
other.hidden = option.kind !== 'other';
|
|
133
|
+
other.required = option.kind === 'other';
|
|
134
|
+
pending.hidden = option.kind === 'value';
|
|
135
|
+
pending.textContent = t(option.kind === 'other' ? 'interview.otherPending' : 'interview.autoPending');
|
|
136
|
+
};
|
|
137
|
+
label.append(radio, element('strong', option.label), element('span', option.effect));
|
|
138
|
+
if (option.recommended) label.append(element('b', t('interview.recommended')), element('span', option.reason));
|
|
139
|
+
group.append(label);
|
|
140
|
+
}
|
|
141
|
+
const kind = ask.options.find(option => option.id === pick?.option_id)?.kind;
|
|
142
|
+
const autoResolved = !question.editable && Array.isArray((question.answer?.agent_decision as {fragments?:unknown}|undefined)?.fragments) &&
|
|
143
|
+
((question.answer!.agent_decision as {fragments:{ask:string}[]}).fragments).some(fragment => fragment.ask === ask.id);
|
|
144
|
+
const pending = element('p', t(kind === 'other' ? 'interview.otherPending' : 'interview.autoPending'));
|
|
145
|
+
pending.hidden = !(kind === 'auto' && !autoResolved || kind === 'other' && !(pick && 'other_fragment' in pick));
|
|
146
|
+
other.required = kind === 'other';
|
|
147
|
+
group.append(other, pending);
|
|
148
|
+
fields.append(group);
|
|
149
|
+
}
|
|
150
|
+
const noteLabel = element('label', t('interview.note'));
|
|
151
|
+
const note = element('textarea');
|
|
152
|
+
note.value = state.note ?? historical?.note ?? '';
|
|
153
|
+
note.oninput = () => {state.note = note.value; markUnsaved();};
|
|
154
|
+
noteLabel.append(note);
|
|
155
|
+
fields.append(noteLabel);
|
|
156
|
+
if (question.editable) {
|
|
157
|
+
const submit = element('button', t('interview.save')); submit.type = 'submit'; fields.append(submit);
|
|
158
|
+
}
|
|
159
|
+
status.textContent = state.status ? t(state.status) : t(!question.editable ? 'interview.history' : access.capability ? 'interview.choose' : 'interview.readOnly');
|
|
160
|
+
form.append(fields, status);
|
|
161
|
+
form.onsubmit = async event => {
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
if (!question.editable || !access.capability || busy) return;
|
|
164
|
+
const ordered = question.set.asks.map(ask => state.picks.get(ask.id));
|
|
165
|
+
if (ordered.some(pick => !pick)) return;
|
|
166
|
+
busy = true; fields.disabled = true; picker.disabled = true;
|
|
167
|
+
try {
|
|
168
|
+
await request(access, '/api/interview/picks', {
|
|
169
|
+
schema:'rig-review/interview-picks@1', set:question.ref, picks:ordered as Picks['picks'],
|
|
170
|
+
...(state.note !== undefined ? {note:state.note} : {}), by:'user', at:new Date().toISOString(),
|
|
171
|
+
});
|
|
172
|
+
state.status = 'interview.saved';
|
|
173
|
+
} catch (error) {state.status = errorKey(error);}
|
|
174
|
+
finally {busy = false; render();}
|
|
175
|
+
};
|
|
176
|
+
grid.append(art, form); host.replaceChildren(picker, grid);
|
|
177
|
+
if (legacy.length) host.append(archive);
|
|
178
|
+
};
|
|
179
|
+
onLanguageChange(render); render();
|
|
180
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
:root { color-scheme: dark; font-family: system-ui, sans-serif; background: #14171c; color: #edf0f4; }
|
|
2
|
+
body { max-width: 88rem; margin: auto; padding: 1.25rem; }
|
|
3
|
+
header { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1rem; }
|
|
4
|
+
header h1 { margin: 0; }
|
|
5
|
+
header select { margin-inline-start: auto; }
|
|
6
|
+
button, select, textarea { font: inherit; color: inherit; background: #202630; border: 1px solid #637386; border-radius: .3rem; padding: .45rem; }
|
|
7
|
+
button[aria-pressed="true"], button[aria-current="step"] { border-color: #a4cbfa; }
|
|
8
|
+
.interview-grid { display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(20rem, 2fr); gap: 1rem; align-items: start; margin-top: 1rem; }
|
|
9
|
+
aside, form { background: #1a1f27; border: 1px solid #414e60; border-radius: .45rem; padding: 1rem; min-width: 0; }
|
|
10
|
+
aside { position: sticky; top: 1rem; }
|
|
11
|
+
aside img:not([hidden]) { display: block; max-width: 100%; max-height: 65vh; margin: 1rem auto; background: #272e3b; }
|
|
12
|
+
fieldset { border: 0; padding: .5rem 0; margin: 0; min-width: 0; }
|
|
13
|
+
fieldset fieldset { border-top: 1px solid #414e60; margin: .75rem 0; }
|
|
14
|
+
legend, .interview-option span, .interview-option strong { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
15
|
+
.interview-option { display: grid; grid-template-columns: min-content 1fr; gap: .3rem .6rem; padding: .6rem; margin: .35rem 0; background: #242b36; border-radius: .3rem; }
|
|
16
|
+
.interview-option span, .interview-option b { grid-column: 2; }
|
|
17
|
+
.interview-option b { color: #a4cbfa; }
|
|
18
|
+
textarea:not([hidden]) { display: block; box-sizing: border-box; width: 100%; min-height: 4rem; margin-bottom: .75rem; }
|
|
19
|
+
code { overflow-wrap: anywhere; }
|
|
20
|
+
@media (max-width: 42rem) {
|
|
21
|
+
.interview-grid { grid-template-columns: minmax(0, 1fr); }
|
|
22
|
+
aside { position: static; }
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
details { margin-block: 1rem; }
|
|
26
|
+
pre { white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<link rel="stylesheet" href="interview.css">
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<header>
|
|
10
|
+
<h1></h1>
|
|
11
|
+
<nav data-stage-nav></nav>
|
|
12
|
+
<select><option value="en">English</option><option value="ko">한국어</option></select>
|
|
13
|
+
</header>
|
|
14
|
+
<main></main>
|
|
15
|
+
<script type="module" src="interview.js"></script>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
package/web/interview.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { getLanguage, setLinkLanguage, setLanguagePreference, t } from './i18n.ts';
|
|
2
|
+
import { pageInstanceAccess } from './instance-access.ts';
|
|
3
|
+
import { mountInterview } from './interview-panel.ts';
|
|
4
|
+
import { connectLiveWindow } from './live-connection.ts';
|
|
5
|
+
import { bindStageNav } from './stage-nav.ts';
|
|
6
|
+
|
|
7
|
+
const access = pageInstanceAccess();
|
|
8
|
+
const lang = new URL(location.href).searchParams.get('lang');
|
|
9
|
+
setLanguagePreference(lang === 'en' || lang === 'ko' ? lang : 'system');
|
|
10
|
+
const title = document.querySelector('h1')!;
|
|
11
|
+
const languages = document.querySelector('select')!;
|
|
12
|
+
function localize() {
|
|
13
|
+
document.title = title.textContent = t('interview.title');
|
|
14
|
+
languages.setAttribute('aria-label', t('interview.language'));
|
|
15
|
+
}
|
|
16
|
+
languages.value = getLanguage();
|
|
17
|
+
languages.onchange = () => {
|
|
18
|
+
setLinkLanguage(null);
|
|
19
|
+
setLanguagePreference(languages.value === 'ko' ? 'ko' : 'en');
|
|
20
|
+
localize();
|
|
21
|
+
};
|
|
22
|
+
localize();
|
|
23
|
+
bindStageNav({interviewOnly:true, model:false});
|
|
24
|
+
connectLiveWindow(access);
|
|
25
|
+
const host = document.querySelector('main')!;
|
|
26
|
+
host.textContent = t('interview.loading');
|
|
27
|
+
await mountInterview(host, access);
|
package/web/main.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import {bindDirectionPanel} from './direction-panel.ts';
|
|
2
|
+
import type {DirectionInspection} from '../src/direction-inspection.ts';
|
|
1
3
|
import {bindStageNav} from './stage-nav.ts';
|
|
2
4
|
import {timeOnlyBasis,feedbackTimingLabel,requireFeedbackFrames,isTimeOnlyFeedback} from '../src/stage-comment.ts';
|
|
3
5
|
import {bindStageComments,type CommentPose} from './stage-comments.ts';
|
|
@@ -71,7 +73,7 @@ import {assertRigFieldOps,RIG_FIELDS_READOUT_BARS,TURN_BONE} from '../src/rig-fi
|
|
|
71
73
|
import {IDLE_READOUT_BARS,type LocalChannel} from '../src/idle-tracks.ts';
|
|
72
74
|
import type {PatchOp} from '../src/config-patch.ts';
|
|
73
75
|
|
|
74
|
-
interface ReviewResponse { referenceHashes?:Record<string,string>; initialAnimation?:string|null; manifest: ReviewManifest; referenceBinding?:ReferenceBinding; explicitReference?:{id:string;name:string;sha256:string;url:string}; sourcePainting?:{id:string;path:string;sha256:string;url:string}; sourceHash: string; reviewedSource: ReviewedSource; report: ReportSeeds | null; feedbackCatalog: FeedbackCatalog; assetsBase: string; capabilities: { playback: boolean; modeling: false; motion: false; feedback: boolean; audio: boolean } }
|
|
76
|
+
interface ReviewResponse { direction?:DirectionInspection; setsHash?:string; referenceHashes?:Record<string,string>; initialAnimation?:string|null; manifest: ReviewManifest; referenceBinding?:ReferenceBinding; explicitReference?:{id:string;name:string;sha256:string;url:string}; sourcePainting?:{id:string;path:string;sha256:string;url:string}; sourceHash: string; reviewedSource: ReviewedSource; report: ReportSeeds | null; feedbackCatalog: FeedbackCatalog; assetsBase: string; capabilities: { playback: boolean; modeling: false; motion: false; feedback: boolean; audio: boolean } }
|
|
75
77
|
interface PoseReference { schema: 'rig-review-pose/1'; coordinateSystem: 'image-pixels-y-down'; width: number; height: number; joints: { id: string; x: number; y: number; parent?: string }[] }
|
|
76
78
|
interface SequenceJoint { state: 'observed' | 'occluded' | 'missing' | 'inferred'; at?: [number, number]; score?: number }
|
|
77
79
|
interface PoseSequence { spec: 'rig-pose-sequence/1'; space: { units: 'picture-px'; origin: 'top-left'; y: 'down' }; width: number; height: number; source?: string; frames: { t: number; people: { id: string; joints: Record<string, SequenceJoint> }[] }[]; camera?: { s: number; tx: number; ty: number; inliers: number }[]; cameraSource?: unknown }
|
|
@@ -97,6 +99,7 @@ const access = pageInstanceAccess();
|
|
|
97
99
|
connectLiveWindow(access);
|
|
98
100
|
let readOnly: string | null = null;
|
|
99
101
|
let data: ReviewResponse;
|
|
102
|
+
let directionPanel:ReturnType<typeof bindDirectionPanel>|undefined;
|
|
100
103
|
let session: ReviewSession;
|
|
101
104
|
let dirty = false;
|
|
102
105
|
let saving = false;
|
|
@@ -666,6 +669,30 @@ function configureTurnPad(model:unknown):void {
|
|
|
666
669
|
if(previous&&turnPad){try{turnPad.restore(previous);}catch{message('TURN_STATE_MODEL_MISMATCH: turn values reset for this build.',true);}}
|
|
667
670
|
workspace?.refresh();
|
|
668
671
|
}
|
|
672
|
+
/** Verify the same response consumed by Play, rather than a second read of its source. */
|
|
673
|
+
function stageLoadInputs(modelUrl:string, modelHash:string) {
|
|
674
|
+
const setsUrl=modelUrl===inspectedModel?.url&&data.manifest.sets&&data.setsHash
|
|
675
|
+
?new URL(assetUrl(data.manifest.sets),location.href).href:null;
|
|
676
|
+
const checkedFetch=new Proxy(fetch,{apply:async(_target,_this,args:Parameters<typeof fetch>)=>{
|
|
677
|
+
const expected=String(args[0])===modelUrl?modelHash:String(args[0])===setsUrl?data.setsHash:null;
|
|
678
|
+
if(!expected)throw new Error('DIRECTION_SOURCE_CHANGED: undeclared playback input');
|
|
679
|
+
const response=await fetch(...args);
|
|
680
|
+
if(!response.ok)return response;
|
|
681
|
+
const bytes=await response.clone().arrayBuffer();
|
|
682
|
+
const sha256=Array.from(new Uint8Array(await crypto.subtle.digest('SHA-256',bytes)),v=>v.toString(16).padStart(2,'0')).join('');
|
|
683
|
+
if(sha256!==expected)throw new Error('DIRECTION_SOURCE_CHANGED: playback bytes differ from the bound SHA-256');
|
|
684
|
+
return response;
|
|
685
|
+
}});
|
|
686
|
+
return {setsUrl,fetch:checkedFetch};
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
function configurePartSets(keep=''):void {
|
|
690
|
+
const picker=select('part-set'),presets=player?.sets()??[];
|
|
691
|
+
picker.replaceChildren(option('', 'Original set'),...presets.map(set=>option(set.name,set.name)));
|
|
692
|
+
picker.disabled=!presets.length;
|
|
693
|
+
if(keep&&presets.some(set=>set.name===keep)){player!.setSet(keep);picker.value=keep;}
|
|
694
|
+
}
|
|
695
|
+
|
|
669
696
|
async function initPlayer(initialCheckpoint?:Checkpoint): Promise<void> {
|
|
670
697
|
text('renderer-state',rendererStatus(null,'pending').label);
|
|
671
698
|
if (!data.manifest.model) { text('player-state', 'No rig supplied · reference review is available'); return; }
|
|
@@ -673,7 +700,7 @@ async function initPlayer(initialCheckpoint?:Checkpoint): Promise<void> {
|
|
|
673
700
|
try {
|
|
674
701
|
const modelUrl = new URL(assetUrl(data.manifest.model), location.href).href;
|
|
675
702
|
inspectedModel={url:modelUrl,prefix:access.route('/assets/'),sha256:data.reviewedSource.rig?.sha256??''};stageModelHash=inspectedModel.sha256||null;
|
|
676
|
-
assets = await loadModel({ modelUrl,
|
|
703
|
+
assets = await loadModel({ modelUrl, ...stageLoadInputs(modelUrl,inspectedModel.sha256), resolvePage: (name, url) => {
|
|
677
704
|
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;
|
|
678
705
|
} });
|
|
679
706
|
player = new RigPlayer(el('rig-root'), assets);
|
|
@@ -687,7 +714,7 @@ async function initPlayer(initialCheckpoint?:Checkpoint): Promise<void> {
|
|
|
687
714
|
const names=assets.animations.map(clip=>clip.name),initial=initialIdleAnimation(names,initialPlayerAnimation(names,data.initialAnimation??undefined,initialCheckpoint),!!data.initialAnimation||!!initialCheckpoint?.animation||!!initialCheckpoint?.axis);
|
|
688
715
|
if(initial)chooseAnimation(initial);else drawRig(()=>player!.draw());
|
|
689
716
|
el('rig-empty').hidden = true; text('player-state', '@rig-c/play · Actual rig');
|
|
690
|
-
|
|
717
|
+
configurePartSets();
|
|
691
718
|
const validAxes = data.manifest.axes.filter(axis => assets?.animations.some(item => item.name === axis.animation));
|
|
692
719
|
text('axis-state', validAxes.length ? `${validAxes.length} axes` : 'No inspection axes supplied');
|
|
693
720
|
select('axis-select').replaceChildren(); for (const axis of validAxes) select('axis-select').append(option(axis.id, axis.label));
|
|
@@ -697,6 +724,7 @@ async function initPlayer(initialCheckpoint?:Checkpoint): Promise<void> {
|
|
|
697
724
|
describeLayerToggles(document,el('layer-state').textContent??'');
|
|
698
725
|
fitCamera();
|
|
699
726
|
} 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); }
|
|
727
|
+
directionPanel?.refresh();
|
|
700
728
|
}
|
|
701
729
|
|
|
702
730
|
function chooseAxis(): void {
|
|
@@ -722,6 +750,27 @@ function renderProposals(): void {
|
|
|
722
750
|
for (const feedback of session.feedback) {
|
|
723
751
|
const item = document.createElement('div'); item.className = 'proposal-item'; const title = document.createElement('strong'); title.className = 'feedback-heading'; title.textContent = `${feedback.category} · ${feedback.target.kind}:${feedback.target.name} · ${feedbackTimingLabel(feedback)}`; const description = document.createElement('span'); description.className = 'feedback-summary'; description.textContent = feedback.summary;
|
|
724
752
|
item.append(title, description);
|
|
753
|
+
const context = feedback.context as Record<string, Json> | undefined;
|
|
754
|
+
const correction = context?.correction as {path?: string;selector?:{kind?:string}} | undefined;
|
|
755
|
+
if (correction) {
|
|
756
|
+
const label = document.createElement('p');
|
|
757
|
+
const schema=(context?.applied as {schema?:string}|undefined)?.schema;
|
|
758
|
+
const unsupported=correction.selector?.kind==='post'||schema!=='rig-review-applied/2';
|
|
759
|
+
setSourceText(label, correction.path === 'described' ? 'Unresolved correction request' :
|
|
760
|
+
unsupported ? 'Unsupported correction operation' : 'Made correction evidence');
|
|
761
|
+
item.append(label);
|
|
762
|
+
}
|
|
763
|
+
if ((context?.comment as {schema?: string} | undefined)?.schema === 'rig-review-comment/1' &&
|
|
764
|
+
!submittedBaseline?.feedback.some(row => row.id === feedback.id)) {
|
|
765
|
+
const describe = document.createElement('button');
|
|
766
|
+
describe.type = 'button';
|
|
767
|
+
setSourceText(describe, 'Use as described correction');
|
|
768
|
+
describe.onclick = () => {
|
|
769
|
+
try { feedback.context = { ...context, correction: correctionSelection('described') }; markDirty(); renderProposals(); }
|
|
770
|
+
catch (error) { message(errorText(error), true); }
|
|
771
|
+
};
|
|
772
|
+
item.append(describe);
|
|
773
|
+
}
|
|
725
774
|
for (const warning of session.feedbackWarnings.filter(value => value.id === feedback.id)) { const note = document.createElement('p'); note.className = 'hint'; note.textContent = `Validation warning · ${warning.error}`; item.append(note); }
|
|
726
775
|
const details = document.createElement('details'), summary = document.createElement('summary'), source = document.createElement('pre'); summary.textContent = 'Saved feedback and inspection context'; source.className = 'feedback-json'; source.textContent = JSON.stringify(feedback, null, 2); details.append(summary, source);
|
|
727
776
|
const remove = document.createElement('button'); remove.type = 'button'; remove.textContent = 'Delete'; remove.onclick = () => { session.feedback = session.feedback.filter(item => item.id !== feedback.id); session.feedbackWarnings = session.feedbackWarnings.filter(warning => warning.id !== feedback.id); markDirty(); renderProposals(); };
|
|
@@ -730,6 +779,24 @@ function renderProposals(): void {
|
|
|
730
779
|
updateSavedState();
|
|
731
780
|
}
|
|
732
781
|
|
|
782
|
+
function syncCorrectionStage(): void {
|
|
783
|
+
el('correction-post-fields').hidden = select('correction-stage').value !== 'direction-review';
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
function correctionSelection(path: 'described' | 'made'): Json {
|
|
787
|
+
const stage = select('correction-stage').value, identity = input('correction-selector').value;
|
|
788
|
+
if (stage === 'parts-review' && /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(identity)) {
|
|
789
|
+
return { path, selector: { stage, kind: 'draft', id: identity } };
|
|
790
|
+
}
|
|
791
|
+
const version = Number(identity);
|
|
792
|
+
if (/^[1-9][0-9]*$/.test(identity) && Number.isSafeInteger(version)) {
|
|
793
|
+
if (stage === 'rig-review') return { path, selector: { stage, kind: 'rig', version } };
|
|
794
|
+
const modelFile = input('correction-model').value;
|
|
795
|
+
if (stage === 'direction-review' && modelFile) return { path, selector: { stage, kind: 'post', version, modelFile } };
|
|
796
|
+
}
|
|
797
|
+
throw new Error(tr('Choose the explicit Create source identity.'));
|
|
798
|
+
}
|
|
799
|
+
|
|
733
800
|
function propose(tool: string): void {
|
|
734
801
|
if (tool === 'angle' && !input('axis-value').disabled) { showInspector('playback');chooseAxis(); return; }
|
|
735
802
|
const choices: Record<string, { target: Feedback['target']['kind']; hint: string }> = {
|
|
@@ -800,7 +867,7 @@ function bind(): void {
|
|
|
800
867
|
button('chest-export').onclick = () => { void exportChest(); };
|
|
801
868
|
for (const event of ['input', 'change']) el('chest-regions').addEventListener(event, renderChest);
|
|
802
869
|
// A discarded local draft restores the form after its button's own handler; re-read the tool then.
|
|
803
|
-
for (const id of ['draft-recovery', 'review-draft-recovery']) el(id).addEventListener('click', () => { renderChest(); restoreEnvironment(); physicsPanel?.restore(); bonesPanel?.restore(); cutsPanel?.restore(); clothPanel?.restore(); idlePanel?.restore(); rigFieldsPanel?.restore(); });
|
|
870
|
+
for (const id of ['draft-recovery', 'review-draft-recovery']) el(id).addEventListener('click', () => { renderChest(); restoreEnvironment(); physicsPanel?.restore(); bonesPanel?.restore(); cutsPanel?.restore(); clothPanel?.restore(); idlePanel?.restore(); rigFieldsPanel?.restore(); syncCorrectionStage(); });
|
|
804
871
|
for (const id of ['strip-scope', 'strip-reference', 'strip-format']) select(id).onchange = () => stripStatus('Selection changed. Check the ranges, animation and reference video before downloading.');
|
|
805
872
|
for (const item of document.querySelectorAll<HTMLButtonElement>('[data-view]')) item.onclick = () => {setView(item.dataset.view as typeof view);const menu=document.getElementById('view-menu') as HTMLDetailsElement|null;if(menu)menu.open=false;};
|
|
806
873
|
for (const item of document.querySelectorAll<HTMLButtonElement>('[data-proposal]')) item.onclick = () => propose(item.dataset.proposal ?? '');
|
|
@@ -831,18 +898,34 @@ function bind(): void {
|
|
|
831
898
|
el<HTMLTextAreaElement>('checkpoint-note').oninput = () => { const entry = checkpointEntry(); if (entry) { entry.note = el<HTMLTextAreaElement>('checkpoint-note').value; markDirty(); } };
|
|
832
899
|
for (const radio of document.querySelectorAll<HTMLInputElement>('input[name="outcome"]')) radio.onchange = () => { const entry = checkpointEntry(); if (entry) { entry.outcome = radio.value as typeof entry.outcome; markDirty(); renderCheckpoints(); } };
|
|
833
900
|
select('feedback-target-kind').onchange = () => renderFeedbackTargets();
|
|
834
|
-
button('add-proposal').onclick = () => {
|
|
901
|
+
button('add-proposal').onclick = async () => {
|
|
835
902
|
const start = input('feedback-start').value.trim(), end = input('feedback-end').value.trim(), frameStart = Number(start), frameEnd = Number(end);
|
|
836
|
-
const name = input('feedback-target-name').value.trim()
|
|
903
|
+
const name = input('feedback-target-name').value.trim();
|
|
904
|
+
const path = select('correction-path').value, capturedApply = appliedOnStage;
|
|
905
|
+
let summary = input('feedback-summary').value.trim(), correction: ReturnType<typeof correctionSelection> | undefined;
|
|
906
|
+
if (path === 'described' || path === 'made') {
|
|
907
|
+
try {
|
|
908
|
+
correction = correctionSelection(path);
|
|
909
|
+
summary = input('feedback-summary').value;
|
|
910
|
+
const file = input('correction-words').files?.[0];
|
|
911
|
+
if (file) {
|
|
912
|
+
if (file.size > 4000) throw new Error(tr('Correction text must be valid UTF-8 and at most 1,000 characters.'));
|
|
913
|
+
summary = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true }).decode(await file.arrayBuffer());
|
|
914
|
+
}
|
|
915
|
+
if (!summary.trim() || summary.length > 1000) throw new Error(tr('Correction text must be valid UTF-8 and at most 1,000 characters.'));
|
|
916
|
+
if (path === 'made' && (!capturedApply || capturedApply !== appliedOnStage)) throw new Error(tr('CORRECTION_APPLY_PENDING: Apply and check the correction first.'));
|
|
917
|
+
} catch (error) { message(errorText(error), true); return; }
|
|
918
|
+
}
|
|
837
919
|
if (!start || !end || !Number.isSafeInteger(frameStart) || !Number.isSafeInteger(frameEnd) || frameStart < 0 || frameEnd < frameStart) { message('Enter nonnegative integer start and end frames, with the end at or after the start.', true); return; }
|
|
838
920
|
if (!['bone', 'slot', 'rig'].includes(select('feedback-target-kind').value) || !['defect', 'quality'].includes(select('feedback-category').value)) { message('Select a target type and defect or quality category.', true); return; }
|
|
839
|
-
if (!name || !summary || /[\r\n]/.test(summary) || summary.length > 1000) { message('Enter the actual target name and a one-line summary of up to 1,000 characters.', true); return; }
|
|
921
|
+
if (!name || !summary || (!correction && /[\r\n]/.test(summary)) || summary.length > 1000) { message('Enter the actual target name and a one-line summary of up to 1,000 characters.', true); return; }
|
|
840
922
|
const target: Feedback['target'] = { kind: select('feedback-target-kind').value as Feedback['target']['kind'], name };
|
|
841
923
|
const selectedAnimation = feedbackAnimation();
|
|
842
924
|
try { validateFeedbackSelection(data.feedbackCatalog, { frameStart, frameEnd, target, animation: selectedAnimation }); } catch (error) { message(errorText(error), true); return; }
|
|
843
925
|
const box = assets?.stage ?? player?.bounds();
|
|
844
926
|
const center = viewport.state.cameraCenter ?? (box ? { x: box.x + box.width / 2, y: box.y + box.height / 2 } : null);
|
|
845
927
|
session.feedback.push({ id: crypto.randomUUID(), frameStart, frameEnd, target, category: select('feedback-category').value as Feedback['category'], summary, context: {...(turnPad?{turn:JSON.parse(JSON.stringify(turnPad.snapshot())) as Json}:{}),part:parts?.feedback()??null,
|
|
928
|
+
...(correction ? { correction } : {}),
|
|
846
929
|
interval: { frameStart, frameEnd, inclusive: true },
|
|
847
930
|
checkpoint: checkpoint?.id ?? null, animation: selectedAnimation, time, frame: frameAtTime(activeFrameClock(), time),
|
|
848
931
|
reference: select('reference-select').value || null, person: selectedPerson || null,
|
|
@@ -861,7 +944,7 @@ function bind(): void {
|
|
|
861
944
|
requirements: (requirementsPanel?.context() ?? null) as unknown as Json,
|
|
862
945
|
reportEvent: selectedReportEvent ? { id: selectedReportEvent.id, field: selectedReportEvent.field, source: { ...selectedReportEvent.source }, frames: selectedReportEvent.frames ? [...selectedReportEvent.frames] : null, exactTime: eventSeekTime(selectedReportEvent, selectedReportTime), targets: selectedReportEvent.targets.map(target => ({ ...target })) } : null,
|
|
863
946
|
} });
|
|
864
|
-
input('feedback-summary').value = ''; markDirty(); renderProposals(); message('Added structured feedback. Submit the review to save it.');
|
|
947
|
+
input('feedback-summary').value = ''; input('correction-words').value = ''; markDirty(); renderProposals(); message('Added structured feedback. Submit the review to save it.');
|
|
865
948
|
};
|
|
866
949
|
button('save').onclick = async () => {
|
|
867
950
|
if(readOnly){message(readOnly,true);return;}
|
|
@@ -875,7 +958,16 @@ function bind(): void {
|
|
|
875
958
|
} catch (error) { message(`Submission failed: ${errorText(error)}`, true); } finally { saving = false; updateSavedState(); }
|
|
876
959
|
};
|
|
877
960
|
// Saved browser defaults seed a new inspection; explicit links and source drafts restore over them.
|
|
878
|
-
|
|
961
|
+
directionPanel=bindDirectionPanel(el('stage-layout'),()=>{
|
|
962
|
+
const inspected=!!inspectedModel&&(!stageSource||stageSource.url===inspectedModel.url);
|
|
963
|
+
const model=player&&stageModelHash?{path:inspected?data.manifest.model!:new URL(stageSource!.url).pathname,sha256:stageModelHash,inspected}:null;
|
|
964
|
+
return {model,revision:data.manifest.revision,sourceHash:data.sourceHash,runtime:data.reviewedSource.runtimeVersion,
|
|
965
|
+
dials:player?turnPad?.state.dials??[]:[],sets:player?.sets().map(set=>set.name)??[],activeSet:select('part-set').value,authored:data.direction};
|
|
966
|
+
},name=>{
|
|
967
|
+
const picker=select('part-set');picker.value=name;picker.dispatchEvent(new Event('change',{bubbles:true}));
|
|
968
|
+
});
|
|
969
|
+
viewDisposers.push(()=>directionPanel?.dispose());
|
|
970
|
+
viewDisposers.push(bindStageNav({model:!!data.manifest.model,direction:active=>directionPanel?.show(active),setup:()=>showInspector('rig'),draftBuild:()=>appliedOnStage?.buildId??'inspected',correction:openStageCorrection}));
|
|
879
971
|
workspace=bindWorkspaceUI({changed:fitCamera,defaultTheme:theme=>appearance?.set(theme),currentTheme:()=>appearance?.get()});
|
|
880
972
|
viewport.state.cameraSync=workspace.defaults().defaultCameraSync;input('camera-sync').checked=viewport.state.cameraSync;input('idle-repeat').checked=workspace.defaults().defaultIdleRepeat;
|
|
881
973
|
appearance=bindAppearance(select('settings-theme'),workspace.defaults().theme);
|
|
@@ -972,10 +1064,11 @@ async function start(): Promise<void> {
|
|
|
972
1064
|
function showInspector(name:string,reveal=true):void {if(name==='feedback'){if(reveal)openReview();return;}if(reveal)workspace?.revealInspector();const selector=document.querySelector<HTMLButtonElement>(`[data-inspector="${name}"]`);if(selector&&selector.getAttribute('aria-pressed')!=='true'&&selector.getAttribute('aria-selected')!=='true')selector.click();}
|
|
973
1065
|
function bindInspector():void {bindInspectorTabs(()=>{workspace?.afterTab();fitCamera();},()=>workspace?.beforeTab());}
|
|
974
1066
|
/** Opening the review pauses playback, as selecting Feedback did. Its inputs stay in the document whether or not it is open, so the draft keeps them. */
|
|
975
|
-
function openReview():void {document.querySelector<HTMLButtonElement>('[data-review-stage="3"]')?.click();const dialog=el<HTMLDialogElement>('review-dialog');for(const drawer of document.querySelectorAll<HTMLDialogElement>('dialog.workspace-drawer[open]'))drawer.close();pause();if(!dialog.open)dialog.showModal();}
|
|
1067
|
+
function openReview():void {document.querySelector<HTMLButtonElement>('[data-review-stage="3"]')?.click();const dialog=el<HTMLDialogElement>('review-dialog');for(const drawer of document.querySelectorAll<HTMLDialogElement>('dialog.workspace-drawer[open]'))drawer.close();pause();syncCorrectionStage();if(!dialog.open)dialog.showModal();}
|
|
976
1068
|
function bindReviewDialog():void {
|
|
977
1069
|
const dialog=el<HTMLDialogElement>('review-dialog');
|
|
978
1070
|
button('write-review').onclick=openReview;button('review-dialog-close').onclick=()=>dialog.close();
|
|
1071
|
+
select('correction-stage').onchange=syncCorrectionStage;
|
|
979
1072
|
// Escape closes the native modal; every close returns focus to the button that opens it.
|
|
980
1073
|
dialog.addEventListener('close',()=>{button('write-review').setAttribute('aria-expanded','false');button('write-review').focus();});
|
|
981
1074
|
dialog.addEventListener('toggle',()=>{if(dialog.open)button('write-review').setAttribute('aria-expanded','true');});
|
|
@@ -2125,14 +2218,14 @@ async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWo
|
|
|
2125
2218
|
const keepPart=stageCorrectionPart?parts?.value():null;
|
|
2126
2219
|
const keepAnimation=animation,keepTime=time,wasPlaying=playing,keepSet=select('part-set').disabled?'':select('part-set').value;
|
|
2127
2220
|
inspectionSourceState='pending';partModel=null;pause();refreshAnimationInspection();
|
|
2128
|
-
const next=await loadModel({modelUrl,
|
|
2221
|
+
const next=await loadModel({modelUrl,...stageLoadInputs(modelUrl,sha256),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;});
|
|
2129
2222
|
physicsPanel?.clearPreview();
|
|
2130
2223
|
pause();player?.dispose();assets?.dispose();assets=next;player=new RigPlayer(el('rig-root'),assets);setupChestWorld=readSetupChest(player);stageModelHash=sha256;stageSource={url:modelUrl,prefix,hash:sha256};
|
|
2131
2224
|
// A scratch build may hold another set of animations (a retarget adds one, #114): the picker lists what this build has.
|
|
2132
2225
|
{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;}
|
|
2133
2226
|
player.on('event',event=>{text('event-log',`Runtime event: ${event.name} · ${event.time.toFixed(2)} s`);});
|
|
2134
2227
|
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);}
|
|
2135
|
-
|
|
2228
|
+
configurePartSets(keepSet);
|
|
2136
2229
|
// The same world before the first pose: a physics Apply resumes the wind (clock and pulse), the pending jolts, gravity and
|
|
2137
2230
|
// whether the controls are engaged as they stood when Apply was pressed; then the seek re-poses under that world.
|
|
2138
2231
|
if(world){wind.resume(world.wind);joltQueue=world.jolts.map(step=>({...step}));input('environment-applied').checked=world.applied;input('gravity').value=String(world.gravity);syncEnvironmentInputs();}
|
|
@@ -2149,7 +2242,7 @@ async function swapRig(modelUrl:string,prefix:string,sha256:string,world:StageWo
|
|
|
2149
2242
|
// The preview (#104) drives the new player once its bone setups are read (an idle Apply cleared it first).
|
|
2150
2243
|
stageDocumentSet=true;void loadModelDocument(modelUrl,sha256).then(loaded=>{if(loaded.ok&&stageModelHash===sha256)idlePanel?.model(boneSetup(loaded.document));});
|
|
2151
2244
|
if(wasPlaying)void playPreview();
|
|
2152
|
-
}finally{stageCorrectionRebinding--;}
|
|
2245
|
+
}finally{stageCorrectionRebinding--;directionPanel?.refresh();}
|
|
2153
2246
|
}
|
|
2154
2247
|
/**
|
|
2155
2248
|
* Mesh Apply (#106): the pending `meshes.<part>` entry becomes one config patch — `replace /meshes/<part>` and nothing
|
package/web/parts.html
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
</main>
|
|
28
28
|
<aside class="pv-side">
|
|
29
29
|
<section><h2>PRODUCER FLAGS</h2><ul id="pv-flags" data-pv-flags></ul><p id="pv-flag-sources" class="pv-subtle"></p></section>
|
|
30
|
-
<section class="pv-verdict"><h2>VERDICT</h2>
|
|
30
|
+
<section class="pv-verdict"><h2>VERDICT</h2><p id="parts-correction-hint" class="subtle" hidden>Saved part notes and pointed comments can be handed off as described corrections.</p>
|
|
31
31
|
<div class="pv-outcomes" role="radiogroup" aria-label="Part outcome">
|
|
32
32
|
<label><input type="radio" name="pv-outcome" value="pending" data-pv-outcome> Pending</label>
|
|
33
33
|
<label><input type="radio" name="pv-outcome" value="clean" data-pv-outcome> Clean</label>
|
package/web/parts.ts
CHANGED
|
@@ -414,6 +414,7 @@ async function boot(): Promise<void> {
|
|
|
414
414
|
const data = await res.json() as ViewData & { error?: string };
|
|
415
415
|
if (!res.ok) { const status=$('pv-load');status.textContent=t(data.error??'Load failed.');status.dataset.result='refused';return; }
|
|
416
416
|
state.data = data;if(!data.differenceAvailable)document.querySelector('[data-pv-comparison="difference"]')?.remove();if(stageEmbedded)for(const item of data.items)if(item.mesh)state.meshShown.add(item.name);$('reference-empty').textContent=data.painting?'':t('PARTS_REFERENCE_UNAVAILABLE: supply --painting to compare the original painting');$('reference-empty').hidden=!!data.painting;if(data.painting)viewport.state.cameraSync=true;comments.push(...data.verdict?.comments??[]);setupPartsComments();viewport.bindNavigation(undefined,()=>!commentUi?.active());viewport.observeResize();
|
|
417
|
+
document.getElementById('parts-correction-hint')!.hidden = data.mode !== 'parts' || stageEmbedded;
|
|
417
418
|
for (const item of data.items) state.verdict.set(item.name, { outcome: 'pending', note: '', ...(item.mesh ? { mesh: { outcome: 'pending' as Outcome, note: '' } } : {}) });
|
|
418
419
|
if (data.verdict) { for (const [name, v] of Object.entries(data.verdict.parts)) if (state.verdict.has(name)) state.verdict.set(name, { outcome: v.outcome, note: v.note ?? '', ...(v.mesh ? { mesh: v.mesh } : {}) }); $<HTMLSelectElement>('pv-overall').value = data.verdict.status; }
|
|
419
420
|
document.title = data.title;
|
|
@@ -501,7 +502,7 @@ function renderCorrections():void {
|
|
|
501
502
|
for(const [instrument,title,operation]of [['chest','Chest regions',t('rig-parts remesh --mesh')],['mesh','Mesh parameters',t('rig-parts remesh --mesh')],['delta','Edit Mesh',t('rig-parts remesh --delta')]]){
|
|
502
503
|
const button=document.createElement('button');button.type='button';button.textContent=t(title!);button.title=`${mapping.part} · ${operation}`;button.onclick=()=>parent.postMessage({type:'review-stage-correction',part:mapping.part,sourceHash:data.sourceHash,buildId:data.draft!.buildId,instrument},location.origin);host.append(button);
|
|
503
504
|
}
|
|
504
|
-
const
|
|
505
|
+
const guidance=document.createElement('p');guidance.textContent=t('Use Write review, choose Parts review and name the Create draft. Export the saved item with the feedback CLI. Mesh deltas retain evidence as unsupported operations.');host.append(guidance);
|
|
505
506
|
}
|
|
506
507
|
|
|
507
508
|
function stagePartsSnapshot():StagePartsState|null {
|
package/web/stage-nav.ts
CHANGED
|
@@ -16,14 +16,20 @@ export function stagePartsSelectionIndex(data:{inspectionSourceHash?:string;item
|
|
|
16
16
|
if(i<0||data.inspectionSourceHash!==saved.inspectionSourceHash||!m||(['skin','slot','attachment']as const).some(k=>m[k]!==saved.mapping[k]))throw new Error('STAGE_DRAFT_MISMATCH');
|
|
17
17
|
return i;
|
|
18
18
|
}
|
|
19
|
-
export function stageReason(stage:ReviewStage,model:boolean):string|null {
|
|
20
|
-
if(stage===2)return 'INTERVIEW_UNAVAILABLE:
|
|
21
|
-
if(stage===4)return 'DIRECTION_UNAVAILABLE: no direction inspection contract is installed.';
|
|
19
|
+
export function stageReason(stage:ReviewStage,model:boolean,direction=false):string|null {
|
|
20
|
+
if(stage===2)return 'INTERVIEW_UNAVAILABLE: Open a designated create project with rig-review interview.';
|
|
21
|
+
if(stage===4&&!direction)return 'DIRECTION_UNAVAILABLE: no direction inspection contract is installed.';
|
|
22
22
|
if(stage===3&&!model)return 'MODEL_UNAVAILABLE: no compiled model is supplied in this inspection.';
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
export function bindStageNav(options:{partsOnly?:boolean;model:boolean;side?:()=> 'a'|'b';setup?:()=>void;draftBuild?:()=>string;correction?:(request:{part:string;sourceHash:string;buildId:string;instrument:string})=>Promise<void>}):()=>void {
|
|
25
|
+
export function bindStageNav(options:{interviewOnly?:boolean;partsOnly?:boolean;model:boolean;direction?:(active:boolean)=>void;side?:()=> 'a'|'b';setup?:()=>void;draftBuild?:()=>string;correction?:(request:{part:string;sourceHash:string;buildId:string;instrument:string})=>Promise<void>}):()=>void {
|
|
26
26
|
const host=document.querySelector<HTMLElement>('[data-stage-nav]');if(!host)return ()=>{};
|
|
27
|
+
if(options.interviewOnly){
|
|
28
|
+
const button=document.createElement('button');button.type='button';button.dataset.reviewStage='2';button.setAttribute('aria-current','step');host.append(button);
|
|
29
|
+
const render=()=>{button.textContent=t(reviewStages[1]);host.setAttribute('aria-label',t('Inspection stages'));};
|
|
30
|
+
document.documentElement.dataset.inspectionStage='2';render();
|
|
31
|
+
const language=onLanguageChange(render);return ()=>{language();button.remove();};
|
|
32
|
+
}
|
|
27
33
|
const embedded=new URL(location.href).searchParams.get('stageEmbed')==='1';
|
|
28
34
|
if(embedded){host.hidden=true;return ()=>{};}
|
|
29
35
|
const access=pageInstanceAccess(),panel=document.createElement('section');panel.className='review-stage-panel';panel.hidden=true;panel.setAttribute('aria-live','polite');document.body.append(panel);
|
|
@@ -36,8 +42,9 @@ export function bindStageNav(options:{partsOnly?:boolean;model:boolean;side?:()=
|
|
|
36
42
|
const render=()=>{buttons.forEach((b,i)=>{b.textContent=t(reviewStages[i]!);b.setAttribute('aria-current',current===i+1?'step':'false');});host.setAttribute('aria-label',t('Inspection stages'));if(sourcePicker)sourcePicker.setAttribute('aria-label',t(current===1?'Atlas source build':'Picked build for Setup and Animate'));mesh.textContent=t('Open setup mesh instruments');};
|
|
37
43
|
const place=()=>{panel.style.top=`${(host.closest('header')??host).getBoundingClientRect().bottom}px`;};
|
|
38
44
|
function show(stage:ReviewStage):void {
|
|
39
|
-
current=stage;document.documentElement.dataset.inspectionStage=String(stage);render();place();const reason=stageReason(stage,options.model);
|
|
40
|
-
|
|
45
|
+
current=stage;document.documentElement.dataset.inspectionStage=String(stage);render();place();const reason=stageReason(stage,options.model,!!options.direction);
|
|
46
|
+
options.direction?.(stage===4);
|
|
47
|
+
panel.hidden=!reason&&(stage===(options.partsOnly?1:3)||stage===4);
|
|
41
48
|
if(workspace)workspace.inert=!panel.hidden||wasInert;
|
|
42
49
|
status.textContent=reason?t(reason):stage===1&&!options.partsOnly?t(options.correction?'Draft rig · structure evidence only':'Atlas inspection, read only — inspected package. Applied scratch atlas, pre-rig parts, mesh sign-off and draft corrections are unavailable here.'):'';mesh.hidden=stage!==1||!options.model||!!options.partsOnly;
|
|
43
50
|
for(const frame of frames.values())frame.hidden=true;
|
|
@@ -54,7 +61,7 @@ export function bindStageNav(options:{partsOnly?:boolean;model:boolean;side?:()=
|
|
|
54
61
|
// Legacy bookmark/control restoration writes these canonical attributes even when a mode is unchanged.
|
|
55
62
|
const canonical=new MutationObserver(()=>{if(current!==3&&!options.partsOnly&&!pickingSource)show(3);});
|
|
56
63
|
document.querySelectorAll('[data-inspector]').forEach(button=>canonical.observe(button,{attributes:true,attributeFilter:['aria-selected','aria-pressed']}));
|
|
57
|
-
const language=onLanguageChange(()=>{render();if(!panel.hidden)status.textContent=t(stageReason(current,options.model)??(current===1&&options.correction?'Draft rig · structure evidence only':current===1?'Atlas inspection, read only — inspected package. Applied scratch atlas, pre-rig parts, mesh sign-off and draft corrections are unavailable here.':''));for(const f of frames.values()){f.title=t('Parts and atlas inspection');f.contentWindow?.postMessage({type:'review-stage-language',language:getLanguage()},location.origin);}});
|
|
64
|
+
const language=onLanguageChange(()=>{render();if(!panel.hidden)status.textContent=t(stageReason(current,options.model,!!options.direction)??(current===1&&options.correction?'Draft rig · structure evidence only':current===1?'Atlas inspection, read only — inspected package. Applied scratch atlas, pre-rig parts, mesh sign-off and draft corrections are unavailable here.':''));for(const f of frames.values()){f.title=t('Parts and atlas inspection');f.contentWindow?.postMessage({type:'review-stage-language',language:getLanguage()},location.origin);}});
|
|
58
65
|
window.addEventListener('resize',place);show(current);
|
|
59
66
|
return ()=>{window.removeEventListener('message',correction);language();canonical.disconnect();sourcePicker?.querySelectorAll('[data-build-side]').forEach(button=>button.removeEventListener('click',sourceChanged));delete document.documentElement.dataset.inspectionStage;if(workspace)workspace.inert=wasInert;panel.remove();window.removeEventListener('resize',place);document.querySelectorAll('[data-mode],[data-inspector]').forEach(b=>b.removeEventListener('click',legacy));};
|
|
60
67
|
}
|
package/web/styles.css
CHANGED
|
@@ -412,3 +412,6 @@ main{position:relative}.toolbar{anchor-name:--stage-comment-bar}#stage-comment{w
|
|
|
412
412
|
:root[data-inspection-stage="1"] #mode-build-picker{display:flex!important}
|
|
413
413
|
:root[data-inspection-stage="1"] #mode-build-picker>.eyebrow{display:none}
|
|
414
414
|
:root[data-inspection-stage="2"] #mode-build-picker,:root[data-inspection-stage="4"] #mode-build-picker{display:none!important}
|
|
415
|
+
#direction-panel{flex:none;max-height:40%;overflow:auto;padding:.5rem .75rem;overflow-wrap:anywhere}
|
|
416
|
+
#direction-panel ul{margin:.4rem 0;padding-inline-start:1.4rem}
|
|
417
|
+
#direction-panel pre{max-height:12rem;overflow:auto}
|