diff --git a/PlotLine.Tests/Browser/character-attributes.cjs b/PlotLine.Tests/Browser/character-attributes.cjs index 44133ebc..7a57d738 100644 --- a/PlotLine.Tests/Browser/character-attributes.cjs +++ b/PlotLine.Tests/Browser/character-attributes.cjs @@ -7,7 +7,8 @@ const {chromium}=require('playwright');const os=require('node:os'),path=require( if(installed){await persistent.pages()[0].goto('http://127.0.0.1:5238/fixture?page=calendar-test');await cdp.send('PWA.install',{manifestId,installUrlOrBundleUrl:'http://127.0.0.1:5238/fixture?page=calendar-test'});await cdp.send('PWA.changeAppUserSettings',{manifestId,displayMode:'standalone'});} async function newPage(){if(!installed)return browser.newPage({viewport:{width:1440,height:1000}});const opened=persistent.waitForEvent('page');await cdp.send('PWA.launch',{manifestId,url:'http://127.0.0.1:5238/fixture?page=calendar-test'});const page=await opened;await page.waitForLoadState();assert(await page.evaluate(()=>matchMedia('(display-mode: standalone)').matches));return page;} const results=[];try{ - for(const count of [10,100,500]){ + const widthCheck=process.argv.includes('--width-check'),before=process.argv.includes('--before'); + for(const count of widthCheck?[100]:[10,100,500]){ const page=await newPage(),errors=[];console.log('ACCEPTANCE',installed?'installed':'browser',count);page.on('pageerror',e=>errors.push(e.message)); const groups=await (await page.request.get('http://127.0.0.1:5238/character-attribute-definitions-fixture')).json(); @@ -17,6 +18,21 @@ const {chromium}=require('playwright');const os=require('node:os'),path=require( await page.route('**/CharacterAttributes/Undo',async route=>{const token=route.request().postDataJSON().token,state=undo.get(token);assert(state);if(state.versions.some(([id,version])=>records.find(r=>r.id===id).version!==version))return route.fulfill({status:409,json:{message:'Characters changed in another window.'}});const changed=state.previous.map(old=>{const r=records.find(r=>r.id===old.id);r.values=old.values;r.version=`v${clock++}`;return r;});await route.fulfill({json:{saved:true,characters:changed}});}); const start=Date.now();await page.goto(`http://127.0.0.1:5238/character-attributes-fixture?count=${count}`);await page.locator('[data-attribute="importance"]').first().waitFor();const load=Date.now()-start; const card=id=>page.locator(`.character-card[data-drag-id="${id}"]`),value=(a,v)=>page.locator(`[data-attribute="${a}"][data-value="${v}"]`); + if(widthCheck){ + const measurements=[],directory='/tmp/pd-character-width';fs.mkdirSync(directory,{recursive:true}); + for(const width of [1280,1920,2560,3840]){ + await page.setViewportSize({width,height:1080});await page.evaluate(()=>window.scrollTo({top:0,behavior:'instant'})); + const measure=await page.evaluate(()=>{const rect=s=>document.querySelector(s).getBoundingClientRect();const workspace=rect('[data-character-attributes]'),parent=rect('.plotline-help-main'),sidebar=rect('[data-attribute-sidebar]'),grid=rect('.character-card-grid'),toolbar=rect('.character-attribute-toolbar');return {viewport:innerWidth,parentWidth:parent.width,workspaceWidth:workspace.width,left:workspace.left-parent.left,right:parent.right-workspace.right,sidebarWidth:sidebar.width,gridWidth:grid.width,columns:getComputedStyle(document.querySelector('.character-card-grid')).gridTemplateColumns.split(' ').length,toolbarWidth:toolbar.width,overflow:document.documentElement.scrollWidth>innerWidth};}); + assert(!measure.overflow);assert(Math.abs(measure.sidebarWidth-256)<1);assert(Math.abs(measure.toolbarWidth-measure.workspaceWidth)<1); + if(!before){assert(Math.abs(measure.left-16)<1);assert(Math.abs(measure.right-16)<1);assert(Math.abs(measure.workspaceWidth-(measure.parentWidth-32))<1);} + await page.screenshot({path:`${directory}/${before?'before':'after'}-${installed?'pwa':'browser'}-${width}.png`}); + await page.locator('[data-attributes-toggle]').click();const collapsed=await page.locator('.character-card-grid').evaluate(n=>n.getBoundingClientRect().width);assert(collapsed>measure.gridWidth+250);assert(await page.locator('[data-attribute-sidebar]').isHidden());await page.locator('[data-attributes-toggle]').click(); + await page.evaluate(()=>window.scrollTo({top:1200,behavior:'instant'}));const sticky=await page.locator('[data-attribute-sidebar]').boundingBox();assert(sticky.y>=0&&sticky.y+sticky.height<=1081);await page.evaluate(()=>window.scrollTo({top:0,behavior:'instant'}));measure.collapsedGridWidth=collapsed;measurements.push(measure); + } + if(!before){assert(measurements[3].columns>measurements[1].columns);assert(measurements[3].gridWidth>measurements[1].gridWidth+1500);} + await page.goto('http://127.0.0.1:5238/relationship-evolution-fixture');assert.equal(await page.locator('.pd-record-canvas').count(),1);assert.equal(await page.locator('.pd-workspace-full-width').count(),0,'other pages do not opt in');assert(await page.locator('.pd-record-canvas').evaluate(n=>n.getBoundingClientRect().widthns.slice(0,9).map(n=>n.getBoundingClientRect().height));assert(new Set(heights.map(Math.round)).size>1); await value('importance','10').locator('button').first().dragTo(card(1));await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="1"] [data-attribute-indicators]').textContent===''&&document.querySelector('.character-card[data-drag-id="1"] [title="Story importance: Major"]'));assert.equal(records[0].values.importance,'10'); await card(2).locator('[data-character-drag]').dragTo(value('importance','6'));await page.waitForFunction(()=>document.querySelector('.character-card[data-drag-id="2"] [title="Story importance: Supporting"]'));assert.equal(records[1].values.importance,'6'); diff --git a/PlotLine/Views/Characters/Index.cshtml b/PlotLine/Views/Characters/Index.cshtml index 47e9c9a0..091bf216 100644 --- a/PlotLine/Views/Characters/Index.cshtml +++ b/PlotLine/Views/Characters/Index.cshtml @@ -1,6 +1,7 @@ @model CharacterListViewModel @{ ViewData["DesktopLayout"] = "management"; + ViewData["ShellClass"] = "pd-workspace-full-width"; ViewData["Title"] = "Characters"; ViewData["ProjectSection"] = "Characters"; } diff --git a/PlotLine/wwwroot/css/character-attributes.css b/PlotLine/wwwroot/css/character-attributes.css index 6bd99449..7723258e 100644 --- a/PlotLine/wwwroot/css/character-attributes.css +++ b/PlotLine/wwwroot/css/character-attributes.css @@ -19,3 +19,10 @@ .character-attribute-controls{white-space:nowrap}.character-attribute-controls [data-character-drag]{cursor:grab;font-size:1rem;line-height:1}.character-attribute-controls input{vertical-align:middle} .text-data-5{color:var(--pd-data-5,var(--pd-icon-characters))!important} + +/* Continue the existing column sizing beyond the shared grid's five-column ceiling. */ +@container character-list (min-width: 1200px) { + .pd-workspace-full-width .character-card-grid { + grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); + } +} diff --git a/PlotLine/wwwroot/css/record-workspace.css b/PlotLine/wwwroot/css/record-workspace.css index c5f81bcc..1e95d89d 100644 --- a/PlotLine/wwwroot/css/record-workspace.css +++ b/PlotLine/wwwroot/css/record-workspace.css @@ -54,3 +54,10 @@ html[data-standalone="true"] .pd-record-canvas { overflow-wrap: anywhere; } /* Responsive tables scroll as a unit; record-form wrapping must not split each cell into letters. */ .pd-record-canvas .table-responsive { overflow-wrap: normal; } + +/* Explicit page opt-in, in browser and installed PWA; other record widths stay scoped. */ +.app-layout .plotline-shell.pd-workspace-full-width { + width: 100%; + max-width: none; + padding-inline: 1rem; +}