Restore stacked Display selectors in browser and PWA
This commit is contained in:
parent
7591edacaf
commit
fed3224f0d
@ -32,7 +32,7 @@ Not included: cross-device layout storage, automatic importance suggestions, tim
|
||||
|
||||
The page is now a single bounded application surface beneath the existing ribbon in browser and PWA mode. A page-scoped shell class removes content-width limits and gutters. Height follows the actual ribbon and viewport via ResizeObserver; internal palettes, history and List scroll without extending the document. The application maximise mode has an explicit restore button and Escape fallback, with no browser fullscreen API.
|
||||
|
||||
The toolbar contains Map/List, a named focus chip with clear action, Auto-arrange, Layout and Display. The colour key is pinned beneath the right rail. Display exposes network visibility, Story point and maximise/restore; the original selectors are in the Story point dialog. The map's fit, zoom, centre and select/pan controls form a floating vertical toolbar. The right rail shares its space between Supporting characters and contextual detail. Character detail is built from the same canonical response and includes existing avatar, importance, relationship count and selectable connections/history. List is a separate workspace view; no standalone list remains beneath the map.
|
||||
The toolbar contains Map/List, a named focus chip with clear action, Auto-arrange, Layout and Display. The colour key is pinned beneath the right rail. Display contains the original story-point selectors, network visibility and update action directly in a stacked panel; the PWA ribbon also includes maximise/restore. The map's fit, zoom, centre and select/pan controls form a floating vertical toolbar. The right rail shares its space between Supporting characters and contextual detail. Character detail is built from the same canonical response and includes existing avatar, importance, relationship count and selectable connections/history. List is a separate workspace view; no standalone list remains beneath the map.
|
||||
|
||||
The timeline retains its existing state resolver, range keyboard navigation and scene defaults. Presentation adds explicit Initial/End buttons, change dots, progress and selected-scene output. Relationship dialogs retain their form and save path, with avatar pairs and subordinate endpoint selectors. Graph nodes retain Cytoscape and category line colours, adding existing portrait paths or generated initials. Node, label, focus, palette and timeline surfaces use the application's semantic theme tokens and update when the active theme changes.
|
||||
|
||||
@ -50,4 +50,4 @@ Only in standalone mode, accounted contributions suppress the entire secondary t
|
||||
|
||||
Workspace commands explicitly select distinct icons from the existing SVG icon catalogue, including new diagram/navigation glyphs where no suitable icon existed. Layout and Display summaries declare their own icons rather than inheriting the first child command's icon. The shared form renderer also honours an explicitly declared field icon.
|
||||
|
||||
Display now contains one network-visibility checkbox and two commands: Story point and maximise/restore. The previous GET selectors and update action remain available in a compact Story point dialog. Its network checkbox remains associated with that original GET form, so submitting the selectors preserves network visibility. The colour key is outside the ribbon and fixed beneath the right palette/detail rail. Both browser and PWA Display panels have no scroll container; focused browser tests assert distinct command glyphs and non-scrolling desktop/mobile menus.
|
||||
Display contains the original Book, Chapter, Scene and Character focus selectors directly, with simple stacked labels, network visibility and Update Map. The PWA uses an opt-in `data-pwa-fields="stacked"` presentation of the same source form: native select lists remain dropdowns even with hundreds of scenes, avoiding nested popup pickers. Browser presentation matches the earlier stacked panel. The intermediate Story point dialog has been removed. The colour key remains fixed below the right rail; neither Display presentation uses a scroll container. Browser tests verify selector visibility, binding to source fields, actual GET submission of book/chapter/scene, and non-scrolling desktop/mobile panels.
|
||||
|
||||
@ -17,7 +17,9 @@ const base='http://127.0.0.1:5238';
|
||||
const shell=app.locator('[data-pwa-context-controls]');
|
||||
async function command(name){
|
||||
const target=shell.getByRole('button',{name,exact:true,includeHidden:true});assert.equal(await target.count(),1,'single ribbon command '+name);
|
||||
await target.evaluate(e=>{for(let n=e.parentElement;n;n=n.parentElement)if(n.tagName==='DETAILS')n.open=true;});
|
||||
const menu=target.locator('xpath=ancestor::details[@data-compact="true"]').last();
|
||||
if(await menu.count() && !(await menu.evaluate(e=>e.open))) await menu.locator(':scope > summary').click();
|
||||
await target.waitFor({state:'visible'});
|
||||
return target;
|
||||
}
|
||||
for(const name of ['Map','List','Full cast','Details','Add relationship','Auto-arrange','Remove focused from map','Reset layout','Characters','Maximise workspace']) await command(name);
|
||||
@ -25,14 +27,24 @@ const base='http://127.0.0.1:5238';
|
||||
assert(await shell.locator('[data-help-open]').count(),'Help uses ribbon help');
|
||||
assert.equal(await shell.locator('.relationship-map-legend-grid').count(),0,'legend removed from ribbon');
|
||||
assert(await app.locator('.rw-rail .rw-colour-key').isVisible(),'colour key at bottom of right panel');
|
||||
await (await command('Story point…')).click(); assert(await app.locator('#rwStoryDialog').evaluate(e=>e.open));
|
||||
assert(await app.locator('#rwStoryDialog select').count()>=4,'story selectors remain available in compact dialog'); await app.locator('#rwCloseStory').click();
|
||||
await command('Maximise workspace');
|
||||
const display=shell.locator('.pd-context-group[aria-label="Display"] > details > .pd-context-menu-content');
|
||||
for (const label of ['Book','Chapter','Scene','Character focus']) assert(await display.getByLabel(label,{exact:true}).isVisible(), 'direct stacked selector '+label);
|
||||
assert.equal(await display.locator('.pd-context-selector').count(),0,'ordinary select lists, no nested picker menus');
|
||||
await display.getByLabel('Book',{exact:true}).selectOption('12');
|
||||
await display.getByLabel('Chapter',{exact:true}).selectOption('21');
|
||||
await display.getByLabel('Scene',{exact:true}).selectOption('100');
|
||||
assert.equal(await app.locator('#bookId').inputValue(),'12','book binding');
|
||||
assert.equal(await app.locator('#chapterId').inputValue(),'21','chapter binding');
|
||||
assert.equal(await app.locator('#sceneId').inputValue(),'100','scene binding');
|
||||
await web.locator('.rw-display > summary').click();
|
||||
for (const id of ['bookId','chapterId','sceneId']) assert(await web.locator('#'+id).isVisible(),'browser dropdown '+id);
|
||||
assert(await web.locator('.rw-display > .rw-menu-panel').evaluate(e=>e.scrollHeight<=e.clientHeight+1),'browser Display does not scroll');
|
||||
const iconPaths=await shell.locator('button.pd-context-command').evaluateAll(nodes=>nodes.map(n=>n.querySelector('svg path')?.getAttribute('d')));
|
||||
assert(iconPaths.every(Boolean),'every command has a relevant icon'); assert.equal(new Set(iconPaths).size,iconPaths.length,'command icons are distinct');
|
||||
await command('Maximise workspace');
|
||||
const display=shell.locator('.pd-context-group[aria-label="Display"] > details > .pd-context-menu-content');
|
||||
assert(await display.evaluate(e=>e.scrollHeight<=e.clientHeight+1 && e.scrollWidth<=e.clientWidth+1),'Display has no scrolling');
|
||||
assert(await (await command('Story point…')).isVisible()); assert(await (await command('Maximise workspace')).isVisible());
|
||||
assert(await (await command('Update Map')).isVisible()); assert(await (await command('Maximise workspace')).isVisible());
|
||||
const geometry=await app.locator('#rwApp').evaluate(e=>({top:e.getBoundingClientRect().top,board:document.getElementById('rwBoard').getBoundingClientRect().top,rows:getComputedStyle(e).gridTemplateRows.split(' ').length}));
|
||||
assert.equal(geometry.rows,1,'no reserved toolbar grid row');assert(Math.abs(geometry.board-geometry.top)<2,'palettes start immediately, recovered space used');
|
||||
await (await command('List')).click();assert(await app.locator('#rwListPanel').isVisible());assert.equal(await (await command('List')).getAttribute('aria-pressed'),'true');
|
||||
@ -54,6 +66,11 @@ const base='http://127.0.0.1:5238';
|
||||
assert(await app.locator('.rw-toolbar').isHidden());
|
||||
await command('Maximise workspace');
|
||||
assert(await display.evaluate(e=>e.scrollHeight<=e.clientHeight+1 && e.scrollWidth<=e.clientWidth+1),'mobile Display has no scrolling');
|
||||
await app.route('**/RelationshipMap?**', route=>route.fulfill({contentType:'text/html',body:'Submitted fixture'}));
|
||||
const submitted=app.waitForRequest(request=>new URL(request.url()).pathname==='/RelationshipMap');
|
||||
await (await command('Update Map')).click();
|
||||
const query=new URL((await submitted).url()).searchParams;
|
||||
assert.equal(query.get('projectId'),'7');assert.equal(query.get('bookId'),'12');assert.equal(query.get('chapterId'),'21');assert.equal(query.get('sceneId'),'100');
|
||||
await app.goto(base+'/fixture');assert.equal(await app.locator('[data-pwa-context-controls]').getByRole('button',{name:'Add relationship',exact:true}).count(),0,'navigation clears relationship contributions');
|
||||
assert.deepEqual(errors,[]);console.log('PASS Relationships ribbon: browser fallback, PWA controls/state/menus, recovered height, mobile overflow and navigation cleanup');
|
||||
} finally {await browser.close();}
|
||||
|
||||
@ -37,7 +37,7 @@ Drag empty canvas to pan. Use **+ / −**, Ctrl/Cmd-wheel, or a two-finger pinch
|
||||
|
||||
Installed PWA users can right-click palette characters, map characters, connections or canvas to access the existing application command menu. The same actions are available through buttons, with no right-click required. Select a connection to inspect its history or edit it at the timeline point. **Map / List** switches between workspace views of the same relationship state. The right rail switches between Supporting characters and contextual Details. Focusing a character shows their relationship count, connections, editing actions and history; selecting a connection shows its current state, notes and history.
|
||||
|
||||
Positions, focus, zoom, pan and palette collapse are remembered in this browser for the project/book. They do not sync to other devices. On smaller screens, **Characters** opens a searchable drawer containing the whole cast, and **Details** opens the contextual panel. Selecting a character closes the drawer and returns to the map. The canvas and timeline remain the primary surface. **Display** contains Show full network, **Story point…**, and maximise/restore. Story point opens the existing book/chapter/scene and focus selectors in a separate dialog. The relationship colour key stays at the bottom of the right panel.
|
||||
Positions, focus, zoom, pan and palette collapse are remembered in this browser for the project/book. They do not sync to other devices. On smaller screens, **Characters** opens a searchable drawer containing the whole cast, and **Details** opens the contextual panel. Selecting a character closes the drawer and returns to the map. The canvas and timeline remain the primary surface. **Display** opens a panel with Book, Chapter, Scene and Character focus select lists stacked under simple labels, followed by Show full network and **Update Map**. These controls are directly available in both browser and PWA mode; choose the story point and select Update Map. The relationship colour key stays at the bottom of the right panel.
|
||||
|
||||
# Example
|
||||
|
||||
|
||||
@ -24,18 +24,7 @@
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" id="rwPalettes" data-ribbon-icon="characters" aria-expanded="true">Characters</button>
|
||||
</div></details>
|
||||
<details class="rw-menu rw-display" data-pwa-context="Display" data-pwa-menu-icon="display" data-pwa-scope="Display" data-pwa-compact="true"><summary class="btn btn-outline-secondary btn-sm">Display</summary><div class="rw-menu-panel">
|
||||
<form id="rwNetworkForm"> <label class="form-check relationship-map-check">
|
||||
<input class="form-check-input" type="checkbox" name="showFullNetwork" form="rwStoryForm" data-ribbon-icon="relationships" value="true" checked="@Model.ShowFullNetwork" />
|
||||
<span class="form-check-label">Show full network</span>
|
||||
</label>
|
||||
</form>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" id="rwStoryPoint" data-ribbon-icon="point">Story point…</button>
|
||||
</div></details>
|
||||
<button type="button" data-pwa-context="Display" data-pwa-compact="true" id="rwMaximise" data-ribbon-icon="maximise" class="btn btn-outline-secondary btn-sm" aria-label="Maximise workspace" aria-pressed="false" title="Maximise workspace">⛶</button>
|
||||
</div>
|
||||
</header>
|
||||
<dialog id="rwStoryDialog" aria-labelledby="rwStoryTitle"><h2 id="rwStoryTitle">Story point and focus</h2>
|
||||
<form id="rwStoryForm" class="relationship-map-controls" method="get" asp-action="Index">
|
||||
<form id="rwStoryForm" class="relationship-map-controls" data-pwa-fields="stacked" method="get" asp-action="Index">
|
||||
<input type="hidden" name="projectId" value="@Model.Project.ProjectID" />
|
||||
<div>
|
||||
<label class="form-label" for="bookId">Book</label>
|
||||
@ -61,10 +50,19 @@
|
||||
<option value="">Full cast</option>
|
||||
</select>
|
||||
</div>
|
||||
<button class="btn btn-primary btn-sm" type="submit">Update Map</button>
|
||||
<label class="form-check relationship-map-check">
|
||||
<input class="form-check-input" type="checkbox" name="showFullNetwork" data-ribbon-icon="relationships" value="true" checked="@Model.ShowFullNetwork" />
|
||||
<span class="form-check-label">Show full network</span>
|
||||
</label>
|
||||
<button class="btn btn-primary btn-sm" type="submit" data-ribbon-icon="refresh">Update Map</button>
|
||||
<a class="btn btn-outline-secondary btn-sm" asp-action="Index" asp-route-projectId="@Model.Project.ProjectID">Project Start</a>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm" id="rwCloseStory">Close</button>
|
||||
</form></dialog>
|
||||
|
||||
</form>
|
||||
</div></details>
|
||||
<button type="button" data-pwa-context="Display" data-pwa-compact="true" id="rwMaximise" data-ribbon-icon="maximise" class="btn btn-outline-secondary btn-sm" aria-label="Maximise workspace" aria-pressed="false" title="Maximise workspace">⛶</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<partial name="_Workspace" model="Model" />
|
||||
<div id="rwListPanel" class="rw-list-panel" hidden aria-label="Relationship list">
|
||||
<h2>Relationships at the current story point</h2>
|
||||
|
||||
@ -147,6 +147,9 @@ body.rw-page [data-pwa-context-controls] .pd-context-group[aria-label="Display"]
|
||||
body.rw-page [data-pwa-context-controls] .pd-context-group[aria-label="Display"] .pd-context-form { display: block; }
|
||||
body.rw-page [data-pwa-context-controls] .pd-context-group[aria-label="Display"] .pd-context-field { flex-direction: row; justify-content: flex-start; max-width: none; padding: 7px; gap: 8px; }
|
||||
body.rw-page [data-pwa-context-controls] .pd-context-group[aria-label="Display"] input[type="checkbox"] { width: 16px; min-width: 16px; height: 16px; margin-left: auto; }
|
||||
#rwStoryDialog { width: min(440px,95vw); max-height: 90dvh; overflow: auto; background: var(--pd-elevated); color: var(--pd-text); border: 1px solid var(--pd-border); border-radius: 6px; padding: 15px; }
|
||||
#rwStoryDialog::backdrop { background: rgb(0 0 0 / 45%); }
|
||||
#rwStoryDialog h2 { font-size: 17px; margin-bottom: 12px; }
|
||||
/* Plain stacked selectors, matching the browser Display panel. */
|
||||
body.rw-page [data-pwa-context-controls] .pd-context-form[data-pwa-fields="stacked"] { display: grid; gap: 6px; }
|
||||
body.rw-page [data-pwa-context-controls] .pd-context-form[data-pwa-fields="stacked"] .pd-context-field { display: flex; flex-direction: column; align-items: stretch; padding: 0; gap: 3px; min-width: 0; max-width: none; }
|
||||
body.rw-page [data-pwa-context-controls] .pd-context-form[data-pwa-fields="stacked"] .pd-context-select { width: 100%; max-width: none; height: 28px; }
|
||||
body.rw-page [data-pwa-context-controls] .pd-context-form[data-pwa-fields="stacked"] .pd-context-field:has(input[type="checkbox"]) { flex-direction: row; align-items: center; padding: 4px 0; }
|
||||
body.rw-page [data-pwa-context-controls] .pd-context-form[data-pwa-fields="stacked"] .pd-context-submit { flex-direction: row; justify-content: flex-start; gap: 8px; min-height: 32px; }
|
||||
|
||||
@ -253,14 +253,17 @@
|
||||
// Explicitly fail open for complex editors/multiple/file/range fields: the workspace owns them.
|
||||
if (fields.some(field => field.matches('textarea, select[multiple], input[type="file"], input[type="range"]'))) throw new Error('Unsupported contextual form');
|
||||
const proxy = make('form', 'pd-context-form');
|
||||
const stacked = form.dataset.pwaFields === 'stacked';
|
||||
if (stacked) proxy.dataset.pwaFields = 'stacked';
|
||||
const submit = form.querySelector('button[type="submit"], button:not([type]), input[type="submit"]');
|
||||
const isSearch = fields.length === 1 && fields[0].matches('input') && (fields[0].type === 'search' || /^(q|query|search|searchTerm)$/i.test(fields[0].name) || form.hasAttribute('data-pwa-search'));
|
||||
if (isSearch) proxy.classList.add('pd-context-search');
|
||||
for (const source of fields) {
|
||||
const label = source.dataset.pwaLabel || source.getAttribute('aria-label') || source.labels?.[0]?.textContent.trim() || source.placeholder || source.name;
|
||||
const wrapper = make(isSearch ? 'div' : 'label', 'pd-context-field');
|
||||
if (isSearch) wrapper.append(make('span', '', label)); else decorate(wrapper, label, source.dataset.ribbonIcon || (source.matches('select') ? /project/i.test(source.name) ? 'projects' : /book/i.test(source.name) ? 'bible' : 'point' : 'search'));
|
||||
if (isSearch || stacked) wrapper.append(make('span', '', label)); else decorate(wrapper, label, source.dataset.ribbonIcon || (source.matches('select') ? /project/i.test(source.name) ? 'projects' : /book/i.test(source.name) ? 'bible' : 'point' : 'search'));
|
||||
const target = make(source.tagName.toLowerCase(), source.matches('select') ? 'pd-context-select' : 'pd-context-input');
|
||||
if (stacked) target.setAttribute('aria-label', label);
|
||||
if (source.matches('select')) [...source.options].forEach(option => { const copy = new Option(option.text, option.value, false, option.selected); copy.disabled = option.disabled; target.add(copy); });
|
||||
else { target.type = source.type === 'checkbox' ? 'checkbox' : source.type === 'search' ? 'search' : 'text'; target.placeholder = source.placeholder; }
|
||||
target.dataset.pwaBinding = bindingKey(source);
|
||||
@ -272,7 +275,7 @@
|
||||
if (original.type === 'checkbox') original.checked = target.checked;
|
||||
original.dispatchEvent(new Event(name, { bubbles: true }));
|
||||
});
|
||||
if (source.matches('select') && source.options.length > 12) {
|
||||
if (source.matches('select') && source.options.length > 12 && !stacked) {
|
||||
const picker = make('details', 'pd-context-menu pd-context-selector'); picker.dataset.compact = 'true'; wireMenu(picker);
|
||||
const summary = make('summary');
|
||||
summary.dataset.pwaBinding = `picker-${bindingKey(source)}`;
|
||||
@ -301,7 +304,7 @@
|
||||
proxy.append(wrapper);
|
||||
}
|
||||
if (submit && !isSearch) {
|
||||
const button = make('button', 'pd-ribbon-command pd-context-submit'); decorate(button, caption(submit), fields.some(field => field.matches('select')) ? 'timeline' : 'search'); button.type = 'submit'; proxy.append(button);
|
||||
const button = make('button', 'pd-ribbon-command pd-context-submit'); decorate(button, caption(submit), submit.dataset.ribbonIcon || (fields.some(field => field.matches('select')) ? 'timeline' : 'search')); button.type = 'submit'; proxy.append(button);
|
||||
button.disabled = submit.matches(':disabled');
|
||||
}
|
||||
proxy.addEventListener('submit', event => {
|
||||
|
||||
@ -8,9 +8,6 @@
|
||||
if (!app.classList.contains('rw-maximised')) app.style.height = `${Math.max(260, window.innerHeight - app.getBoundingClientRect().top - 5)}px`;
|
||||
resizeGraph();
|
||||
};
|
||||
document.getElementById('rwStoryPoint').addEventListener('click', () => document.getElementById('rwStoryDialog').showModal());
|
||||
document.getElementById('rwCloseStory').addEventListener('click', () => document.getElementById('rwStoryDialog').close());
|
||||
document.getElementById('rwNetworkForm').addEventListener('submit', event => event.preventDefault());
|
||||
sizeWorkspace();
|
||||
window.addEventListener('resize', sizeWorkspace);
|
||||
const chromeObserver = new ResizeObserver(sizeWorkspace);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user