diff --git a/PlotLine.Tests/Browser/narrative-focus-popup.cjs b/PlotLine.Tests/Browser/narrative-focus-popup.cjs index a06ea1c5..03994fac 100644 --- a/PlotLine.Tests/Browser/narrative-focus-popup.cjs +++ b/PlotLine.Tests/Browser/narrative-focus-popup.cjs @@ -22,7 +22,10 @@ const base=process.env.PD_NARRATIVE_TEST_URL||'http://127.0.0.1:5238'; const set=t=>p.evaluate(t=>window.PlotDirectorNarrativeFocus.set(t),t); await set({chapterID:21,sceneID:31}); const styles=await p.evaluate(()=>['appProjectMenu','appBookMenu','appNarrativeFocusMenu'].map(id=>{const n=document.getElementById(id),s=getComputedStyle(n),a=getComputedStyle(n,'::after');return [s.fontSize,s.padding,s.gap,s.color,s.borderRadius,a.borderTop,a.borderRight,a.borderLeft,a.marginLeft];})); - assert.deepEqual(styles[2],styles[1]);assert.deepEqual(styles[2].filter((_,i)=>i!==1),styles[0].filter((_,i)=>i!==1)); + assert.deepEqual(styles[1],styles[0]);assert.deepEqual(styles[2].filter((_,i)=>i!==1),styles[0].filter((_,i)=>i!==1)); + assert(await p.evaluate(()=>{const a=getComputedStyle(document.getElementById('appProjectMenu')),b=getComputedStyle(document.getElementById('appBookMenu'));return a.borderRight===b.borderRight&&a.marginRight===b.marginRight&&a.paddingRight===b.paddingRight;}),'matching Project/Book separators'); + await p.locator('[data-focus-label]').evaluate(n=>n.textContent='Current Focus: Short'); + assert(await toggle.evaluate(n=>{const label=n.querySelector('[data-focus-label]'),b=n.getBoundingClientRect(),l=label.getBoundingClientRect();return b.right-l.right<30;}),'chevron follows short label without unused width'); await open();await p.locator('[data-focus-search]').fill('Departure');await expectOpen();assert.equal(await p.locator('[data-focus-position] option').count(),2); let release;const gate=new Promise(r=>release=r);await p.route('**/NarrativeFocus/Set',async r=>{await gate;await r.continue();}); await p.locator('[data-focus-position]').selectOption('22/32');await expectOpen();assert.match(await p.locator('[data-narrative-status]').textContent(),/Updating/);release();await closed();await p.unroute('**/NarrativeFocus/Set');assert.match(await toggle.textContent(),/Departure/); @@ -38,7 +41,7 @@ const base=process.env.PD_NARRATIVE_TEST_URL||'http://127.0.0.1:5238'; for(const width of [1666,950,650])for(const theme of ['modern-light','modern-dark']){ await p.setViewportSize({width,height:1050});await p.evaluate(t=>window.PlotDirectorApplyApplicationTheme?.(t),theme); const before=await toggle.boundingBox();await p.locator('[data-focus-label]').evaluate(n=>n.textContent='Current Focus: Chapter with a very long title '.repeat(12)); - const after=await toggle.boundingBox();assert.equal(after.height,before.height);assert.equal(after.width,before.width); + const after=await toggle.boundingBox();assert.equal(after.height,before.height);assert(after.width<=Math.max(before.width,448)); assert(await p.locator('[data-focus-label]').evaluate(n=>n.scrollWidth>n.clientWidth&&getComputedStyle(n).textOverflow==='ellipsis')); await open();const box=await popup.boundingBox();assert(box.x>=0&&box.x+box.width<=width+1,'popup fits viewport'); await p.screenshot({path:`/tmp/pd-focus-popup-${installed?'pwa':'browser'}-${width}-${theme}.png`});await p.keyboard.press('Escape');await closed(); diff --git a/PlotLine/wwwroot/css/application-navigation.css b/PlotLine/wwwroot/css/application-navigation.css index 4c680237..70b323e2 100644 --- a/PlotLine/wwwroot/css/application-navigation.css +++ b/PlotLine/wwwroot/css/application-navigation.css @@ -52,7 +52,8 @@ .app-layout .app-navigation { margin-bottom: 0; padding-block: 2px; } .app-layout .app-navigation .navbar-brand { font-size: .95rem; padding-right: .75rem; border-right: 1px solid var(--bs-border-color); } .app-layout .app-navigation .nav-link { border-radius: 2px; padding-block: .3rem; font-size: .8125rem; } -.app-layout #appProjectMenu { margin-right: .6rem; padding-right: .75rem; border-right: 1px solid var(--bs-border-color); font-weight: 600; } +.app-layout :is(#appProjectMenu, #appBookMenu) { margin-right: .6rem; padding-right: .75rem; border-right: 1px solid var(--bs-border-color); } +.app-layout #appProjectMenu { font-weight: 600; } .app-toolbar { display: flex; align-items: center; gap: .25rem; min-height: 40px; padding: 3px 12px; margin-bottom: .5rem; border-bottom: 1px solid var(--bs-border-color); background: var(--bs-tertiary-bg); color: var(--plotline-text); } .app-toolbar-commands { display: flex; align-items: center; gap: 2px; overflow-x: auto; min-width: 0; flex: 1; } .app-toolbar-command { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; padding: 5px 8px; color: inherit; text-decoration: none; font-size: .8125rem; line-height: 20px; border: 1px solid transparent; border-radius: 2px; white-space: nowrap; } diff --git a/PlotLine/wwwroot/css/scene-explorer.css b/PlotLine/wwwroot/css/scene-explorer.css index 3412416d..3dc688ae 100644 --- a/PlotLine/wwwroot/css/scene-explorer.css +++ b/PlotLine/wwwroot/css/scene-explorer.css @@ -3,9 +3,9 @@ .pd-scene-explorer button{border:1px solid var(--pd-border);border-radius:4px;padding:.35rem .6rem;background:var(--pd-surface);color:var(--pd-text)} .pd-scene-explorer input[type=range]{flex:1 1 12rem;min-width:0} .pd-scene-explorer small{flex-basis:100%;color:var(--pd-muted)} -.pd-narrative-focus{position:relative;width:clamp(10rem,26vw,28rem);min-width:10rem;max-width:28rem;font-size:.82rem;margin-inline:.4rem;} -.pd-narrative-focus>.dropdown-toggle{width:100%;min-width:0;} -.pd-shell .pd-narrative-focus .app-context-label{flex:1;min-width:0;max-width:none;text-align:start;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} +.pd-narrative-focus{position:relative;min-width:0;max-width:28rem;font-size:.82rem;} +.pd-narrative-focus>.dropdown-toggle{max-width:100%;min-width:0;} +.pd-shell .pd-narrative-focus .app-context-label{min-width:0;max-width:none;text-align:start;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} .pd-narrative-focus>.dropdown-toggle::after{flex-shrink:0;} .pd-focus-picker{width:min(32rem,88vw);padding:1rem;} .pd-focus-picker label{display:block;margin-block:.5rem;}