rig-review 1.16.2 → 1.16.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rig-review",
3
- "version": "1.16.2",
3
+ "version": "1.16.4",
4
4
  "type": "module",
5
5
  "description": "Local human rig inspection and structured feedback export",
6
6
  "license": "MIT",
@@ -42,8 +42,18 @@ export function bindDirectionPanel(before: HTMLElement, read: () => DirectionVie
42
42
  host.hidden = true;
43
43
  const title = document.createElement('summary');
44
44
  const body = document.createElement('div');
45
+ const metadata = document.createElement('div');
46
+ const details = document.createElement('details');
47
+ details.id = 'direction-authored-keys';
48
+ details.hidden = true;
49
+ const summary = document.createElement('summary');
50
+ const keys = document.createElement('pre');
51
+ keys.id = 'direction-authored-body';
52
+ summary.setAttribute('aria-controls', keys.id);
53
+ details.append(summary);
54
+ body.append(metadata, details);
45
55
  host.append(title, body);
46
- before.before(host);
56
+ before.before(host, keys);
47
57
  function refresh() {
48
58
  if (host.hidden) return;
49
59
  const view = read();
@@ -55,7 +65,7 @@ export function bindDirectionPanel(before: HTMLElement, read: () => DirectionVie
55
65
  });
56
66
  const list = document.createElement('ul');
57
67
  list.append(...rows);
58
- body.replaceChildren(list);
68
+ metadata.replaceChildren(list);
59
69
  if (view.sets.length) {
60
70
  const label = document.createElement('label');
61
71
  label.textContent = t('direction.chooseSet');
@@ -69,23 +79,22 @@ export function bindDirectionPanel(before: HTMLElement, read: () => DirectionVie
69
79
  picker.value = view.activeSet ?? '';
70
80
  picker.onchange = () => set(picker.value);
71
81
  label.append(picker);
72
- body.append(label);
82
+ metadata.append(label);
73
83
  }
74
84
  if (view.model?.inspected && view.authored) {
75
85
  const { camera, timing, take } = view.authored;
76
- const details = document.createElement('details');
77
- const summary = document.createElement('summary');
78
86
  summary.textContent = t('direction.keys');
79
- const keys = document.createElement('pre');
80
87
  keys.textContent = JSON.stringify({ camera, timing, take }, null, 2);
81
- details.append(summary, keys);
82
- body.append(details);
88
+ details.hidden = false;
89
+ } else {
90
+ details.hidden = true;
91
+ keys.textContent = '';
83
92
  }
84
93
  }
85
94
  const language = onLanguageChange(refresh);
86
95
  return {
87
96
  refresh,
88
97
  show(active: boolean) { host.hidden = !active; refresh(); },
89
- dispose() { language(); host.remove(); },
98
+ dispose() { language(); host.remove(); keys.remove(); },
90
99
  };
91
100
  }
package/web/stage-nav.ts CHANGED
@@ -25,6 +25,13 @@ export function stageReason(stage:ReviewStage,model:boolean,direction=false,inte
25
25
  if(stage===3&&!model)return 'MODEL_UNAVAILABLE: no compiled model is supplied in this inspection.';
26
26
  return null;
27
27
  }
28
+ function stageFrameRoute(access:InstanceAccess,path:'/stage-parts.html'|'/stage-interview.html',side?:'a'|'b'):string {
29
+ const query=new URLSearchParams({stageEmbed:'1',lang:getLanguage()});
30
+ if(side)query.set('side',side);
31
+ // Managed paths already identify the slot and their front accepts only the closed stage query.
32
+ if(access.base==='/'&&/^[a-f0-9]{64}$/.test(access.key))query.set('handoff',access.key);
33
+ return access.route(path)+'?'+query;
34
+ }
28
35
  export function bindStageNav(options:{preRig?:boolean;interviewOnly?:boolean;interview?:boolean;access?:InstanceAccess;partsOnly?:boolean;model:boolean;direction?:(active:boolean)=>void;side?:()=> 'a'|'b';setup?:()=>void;draftBuild?:()=>string;correction?:(request:{part:string;sourceHash:string;buildId:string;instrument:string})=>Promise<void>}):()=>void {
29
36
  const host=document.querySelector<HTMLElement>('[data-stage-nav]');if(!host)return ()=>{};
30
37
  if(options.interviewOnly){
@@ -55,8 +62,7 @@ export function bindStageNav(options:{preRig?:boolean;interviewOnly?:boolean;int
55
62
  if(!interview){
56
63
  interview=document.createElement('iframe');
57
64
  interview.title=t('interview.title');interview.className='review-interview-frame';
58
- const url=new URL(access.route('/stage-interview.html'),location.href);
59
- url.searchParams.set('stageEmbed','1');url.searchParams.set('lang',getLanguage());
65
+ const url=new URL(stageFrameRoute(access,'/stage-interview.html'),location.href);
60
66
  if(access.capability)url.hash='cap='+access.capability;
61
67
  const frame=interview;
62
68
  frame.src=url.href;frame.addEventListener('load',()=>setFrameLanguage(frame));
@@ -82,7 +88,7 @@ export function bindStageNav(options:{preRig?:boolean;interviewOnly?:boolean;int
82
88
  if(stage===2&&!reason){status.textContent=t('interview.loading');void showInterview(revision);}
83
89
  }
84
90
  function showParts(){
85
- const saved=(lastFrame?.contentWindow as StagePartsWindow|null)?.rigReviewStageParts?.snapshot()??null;const side=options.side?.(),key=(side??'single')+':'+(options.draftBuild?.()??'inspected');let frame=frames.get(key);if(!frame){if(options.correction){for(const old of frames.values())old.remove();frames.clear();}frame=document.createElement('iframe');frame.title=t('Parts and atlas inspection');frame.src=access.route('/stage-parts.html')+'?stageEmbed=1&lang='+getLanguage()+(side?'&side='+side:'');frame.addEventListener('load',()=>{frame!.contentWindow?.postMessage({type:'review-stage-language',language:getLanguage()},location.origin);frame!.contentWindow?.postMessage({type:'review-stage-source',buildId:options.draftBuild?.()??'inspected',state:saved},location.origin);});frames.set(key,frame);panel.append(frame);}else if(options.correction||options.preRig){frame.contentWindow?.postMessage({type:'review-stage-revalidate',state:lastFrame!==frame?saved:null},location.origin);}frame.hidden=false;lastFrame=frame;
91
+ const saved=(lastFrame?.contentWindow as StagePartsWindow|null)?.rigReviewStageParts?.snapshot()??null;const side=options.side?.(),key=(side??'single')+':'+(options.draftBuild?.()??'inspected');let frame=frames.get(key);if(!frame){if(options.correction){for(const old of frames.values())old.remove();frames.clear();}frame=document.createElement('iframe');frame.title=t('Parts and atlas inspection');frame.src=stageFrameRoute(access,'/stage-parts.html',side);frame.addEventListener('load',()=>{frame!.contentWindow?.postMessage({type:'review-stage-language',language:getLanguage()},location.origin);frame!.contentWindow?.postMessage({type:'review-stage-source',buildId:options.draftBuild?.()??'inspected',state:saved},location.origin);});frames.set(key,frame);panel.append(frame);}else if(options.correction||options.preRig){frame.contentWindow?.postMessage({type:'review-stage-revalidate',state:lastFrame!==frame?saved:null},location.origin);}frame.hidden=false;lastFrame=frame;
86
92
  }
87
93
  const correction=async(event:MessageEvent)=>{if(event.origin!==location.origin||![...frames.values()].some(f=>f.contentWindow===event.source)||event.data?.type!=='review-stage-correction'||!options.correction)return;const r=event.data;if(typeof r.part!=='string'||typeof r.sourceHash!=='string'||typeof r.buildId!=='string'||!['chest','mesh','delta'].includes(r.instrument))return;try{await options.correction(r);show(3);}catch(error){status.textContent=error instanceof Error?error.message:String(error);}};
88
94
  window.addEventListener('message',correction);
package/web/styles.css CHANGED
@@ -417,7 +417,13 @@ main{position:relative}.toolbar{anchor-name:--stage-comment-bar}#stage-comment{w
417
417
  :root[data-inspection-stage="2"] #mode-build-picker,:root[data-inspection-stage="4"] #mode-build-picker{display:none!important}
418
418
  #direction-panel{flex:none;max-height:40%;overflow:auto;padding:.5rem .75rem;overflow-wrap:anywhere}
419
419
  #direction-panel ul{margin:.4rem 0;padding-inline-start:1.4rem}
420
- #direction-panel pre{max-height:12rem;overflow:auto}
420
+ #direction-authored-body{display:none;flex:1;min-height:0;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;margin:0;padding:.75rem}
421
+ #direction-panel[open]:not([hidden]):has(#direction-authored-keys[open]:not([hidden])) + #direction-authored-body{
422
+ display:block
423
+ }
424
+ #direction-panel[open]:not([hidden]):has(#direction-authored-keys[open]:not([hidden])) + #direction-authored-body ~ #stage-layout{
425
+ display:none
426
+ }
421
427
  .review-stage-panel.with-interview {
422
428
  display: grid;
423
429
  grid-template: min-content minmax(240px, 1fr) / minmax(0, 1fr) minmax(0, 1fr);
@@ -81,7 +81,8 @@ export function bindWorkspaceUI(options:{changed:()=>void;defaultTheme:(theme:Wo
81
81
  if(disposed||applying)return;applying=true;
82
82
  try{
83
83
  // Chrome shares the center width. It is not charged against the actual stage minimum.
84
- const chrome=[...stack.children].filter(node=>node!==stage&&!((node as HTMLElement).hidden)).reduce((sum,node)=>sum+(node as HTMLElement).getBoundingClientRect().height,0);
84
+ // Authored JSON can fill the same slot as the rig while Direction metadata stays above it.
85
+ const chrome=[...stack.children].filter(node=>node!==stage&&node.id!=='direction-authored-body'&&!((node as HTMLElement).hidden)).reduce((sum,node)=>sum+(node as HTMLElement).getBoundingClientRect().height,0);
85
86
  available={width:Math.max(0,layout.clientWidth),height:Math.max(0,layout.clientHeight-chrome)};effective=allocateWorkspaceLayout(available,desired,columns);
86
87
  const mode=(panel:WorkspacePanel)=>effective[panel==='leftWidth'?'leftMode':panel==='rightWidth'?'rightMode':'inspectorMode'];
87
88
  for(const panel of present)dock(panel,mode(panel)==='drawer');