diff --git a/Docs/Relationships/Workspace.md b/Docs/Relationships/Workspace.md
index 00cb14da..7f487cd9 100644
--- a/Docs/Relationships/Workspace.md
+++ b/Docs/Relationships/Workspace.md
@@ -18,7 +18,7 @@ PWA context menus discover commands from `data-pd-context` regions and invoke th
Positions, extra/removed nodes, focus, pan, zoom and palette collapse are stored locally by project and selected book, with a 250ms debounce. Browser profiles provide local user separation; settings do not roam between devices. Reset layout is local and never deletes canonical characters or relationships.
-On narrow displays, the four palettes become horizontal scrolling rows above/below the canvas. All palettes can be collapsed. Explicit zoom controls and Ctrl/Cmd-wheel avoid taking over ordinary wheel scrolling. Touch users can pinch and use the relationship dialog without dragging.
+On narrow displays, the correction pass below replaces the four palettes with one searchable character drawer. All desktop palettes can be collapsed. Explicit zoom controls and Ctrl/Cmd-wheel avoid taking over ordinary wheel scrolling. Touch users can pinch and use the relationship dialog without dragging.
The timeline spans project manuscript order, consistent with the existing scene selectors. Initial means project start; End resolves the last scene. Book-specific initial boundaries on existing records are preserved. Changes to an existing relationship at a scene update its canonical event at that scene; additional changes create events on that relationship. Different factual types remain separate relationships. Ambiguous duplicate records produce a conflict for review rather than an arbitrary overwrite. Concurrent creation from separate browser sessions remains subject to the existing stored procedure's concurrency guarantees; no new database uniqueness constraint is claimed.
@@ -27,3 +27,15 @@ Not included: cross-device layout storage, automatic importance suggestions, tim
## Verification
`RelationshipWorkspaceTests` exercises a 75-character, 74-relationship, 300-scene fixture, importance ordering, temporal carry-forward, canonical map/list correspondence, existing Focus Mode, reciprocal edits, same-scene updates and invalid project selections. Browser coverage is in `PlotLine.Tests/Browser/relationship-workspace.cjs`, using the isolated compiled Razor host and mocked HTTP responses for interaction checks. No live manuscript/database writes are required.
+
+## Visual/layout correction pass
+
+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 legend and original selectors are inside Display. 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.
+
+At 800px and below, the four permanent palettes become one drawer: existing character entries move into it and return to their desktop homes on resize. No repeated portrait lists are introduced. Selecting a character dismisses the drawer; Details is independently available. The v1 position/pan/zoom/focus storage and canonical server/save code are unchanged in this pass.
+
+Browser regression coverage additionally checks viewport bounds, complete mobile cast access, Map/List replacement, focus clearing, select/pan controls, maximise/restore and all four principal themes (True Light/Dark use `modern-light`/`modern-dark` theme keys). The normal 75-character/300-scene interactions remain covered. Visual checks use the isolated compiled-Razor fixture; live authenticated author data has not been changed. No schema work or automatic importance inference was added.
diff --git a/PlotLine.Tests/Browser/relationship-workspace.cjs b/PlotLine.Tests/Browser/relationship-workspace.cjs
index 3dee104e..4361b3f9 100644
--- a/PlotLine.Tests/Browser/relationship-workspace.cjs
+++ b/PlotLine.Tests/Browser/relationship-workspace.cjs
@@ -77,7 +77,10 @@ const base = 'http://127.0.0.1:5238';
await page.locator('#rwTimeline').fill('100');
await page.waitForFunction(() => document.getElementById('rwStatus').textContent.includes('relationships.'));
await page.waitForTimeout(250);
+ await page.locator('#rwListView').click();
+ assert(await page.locator('#rwListPanel').isVisible(), 'List replaces the canvas rather than extending the page');
assert.match(await page.locator('.relationship-map-list').innerText(), /Distrustful/, 'timeline and list share state');
+ await page.locator('#rwMapView').click();
await page.locator('#rwConnect').focus(); await page.keyboard.press('Enter');
assert.equal(await page.locator('[name="SceneID"]').inputValue(), '100', 'timeline defaults editor scene');
await page.keyboard.press('Escape');
@@ -85,15 +88,52 @@ const base = 'http://127.0.0.1:5238';
assert.equal(await page.locator('#rwTimeline').inputValue(), '200');
await page.locator('#rwPrevious').click(); await page.waitForTimeout(300);
assert.equal(await page.locator('#rwTimeline').inputValue(), '100');
- await page.evaluate(() => window.PlotDirectorRelationshipWorkspace.cy.zoom(.7));
+ await page.evaluate(() => { window.PlotDirectorRelationshipWorkspace.cy.zoom(.7); window.PlotDirectorRelationshipWorkspace.cy.pan({x:50,y:70}); });
await page.waitForTimeout(350);
await page.reload(); await page.waitForFunction(() => !!window.PlotDirectorRelationshipWorkspace);
assert(Math.abs(await page.evaluate(() => window.PlotDirectorRelationshipWorkspace.cy.zoom()) - .7) < .01, 'layout restores zoom');
- for (const width of [1200, 700, 390]) {
+ assert.deepEqual(await page.evaluate(() => window.PlotDirectorRelationshipWorkspace.cy.pan()), {x:50,y:70}, 'layout restores manual pan');
+ for (const width of [1600, 1200, 700, 390]) {
await page.setViewportSize({ width, height: 1100 });
const dimensions = await page.locator('#rwBoard').evaluate(e => ({ width: e.clientWidth, scroll: e.scrollWidth, canvas: document.getElementById('relationshipMapGraph').clientWidth }));
assert(dimensions.scroll <= dimensions.width + 1 && dimensions.canvas >= 200, 'usable canvas at ' + width);
+ assert(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 2), 'no horizontal page overflow at ' + width);
+ assert(await page.evaluate(() => document.documentElement.scrollHeight <= innerHeight + 2), 'no page scrolling at ' + width);
+ if (width <= 800) {
+ await page.locator('#rwCharacters').click();
+ assert.equal(await page.locator('.rw-left [data-rw-character]').count(), 75, 'mobile drawer keeps the complete cast available');
+ await page.locator('#rwSearch').fill('elan');
+ await page.locator('[data-rw-character="1"]').click();
+ assert(await page.locator('.rw-navigation').isHidden(), 'selection returns touch users to the map');
+ await page.locator('#rwCharacters').click(); await page.locator('#rwSearch').fill(''); await page.locator('#rwCharacters').click();
+ }
}
+ await page.setViewportSize({width:1600,height:1000});
+ for (const theme of ['modern-light','modern-dark','warm-light','warm-dark']) {
+ await page.evaluate(theme => { document.documentElement.dataset.appTheme = theme; document.documentElement.dataset.theme = theme.endsWith('dark') ? 'dark':'light'; }, theme);
+ await page.waitForTimeout(100);
+ const themeState = await page.evaluate(() => {
+ const w = window.PlotDirectorRelationshipWorkspace, style = getComputedStyle(document.documentElement);
+ const swatch = document.createElement('span'); swatch.style.color = style.getPropertyValue('--pd-text'); document.body.append(swatch); const expected = getComputedStyle(swatch).color; swatch.remove();
+ return { node:w.cy.$id('c-1').style('color'), expected, portrait:w.cy.$id('c-1').data('portrait'), canvas:getComputedStyle(document.getElementById('relationshipMapGraph')).backgroundColor };
+ });
+ assert(themeState.portrait.startsWith('data:image/svg+xml'), theme+' initials fallback on graph nodes');
+ assert.equal(themeState.node.replace(/\s/g,''), themeState.expected.replace(/\s/g,''), theme+' graph text follows active theme tokens');
+ assert(themeState.canvas, theme+' themed canvas');
+ await page.screenshot({path:`/srv/repos/relationships-${theme}.png`});
+ }
+ assert(await page.locator('#rwApp').evaluate(e=>e.getBoundingClientRect().width>=innerWidth-12), 'workspace uses essentially the entire application width');
+ const beforeMax = await page.locator('#relationshipMapGraph').boundingBox();
+ await page.locator('#rwMaximise').click();
+ assert.equal(await page.locator('#rwMaximise').getAttribute('aria-pressed'), 'true');
+ const afterMax = await page.locator('#relationshipMapGraph').boundingBox(); assert(afterMax.height>beforeMax.height, 'maximise grows the application canvas');
+ await page.keyboard.press('Escape');
+ assert.equal(await page.locator('#rwMaximise').getAttribute('aria-pressed'), 'false');
+ await page.locator('#rwClearFocus').click();
+ assert.equal(await page.locator('#rwFocusName').innerText(), 'Full cast');
+ await page.locator('#rwPan').click(); assert(await page.evaluate(()=>window.PlotDirectorRelationshipWorkspace.cy.autoungrabify()));
+ await page.locator('#rwSelect').click(); assert(!(await page.evaluate(()=>window.PlotDirectorRelationshipWorkspace.cy.autoungrabify())));
+ assert.equal(await page.locator('.list-section').count(), 0, 'no relationship list below workspace');
// Existing application menu discovery in installed mode, plus keyboard fallback.
const pwa = await browser.newContext({ viewport: { width: 1600, height: 1100 } });
await pwa.addInitScript(() => Object.defineProperty(navigator, 'standalone', { value: true }));
@@ -109,6 +149,10 @@ const base = 'http://127.0.0.1:5238';
assert.match(await app.locator('.pd-context-popup').innerText(), /Edit at timeline point/, 'line actions use application menu');
await app.keyboard.press('Escape');
assert(await page.evaluate(() => window.PlotDirectorRelationshipWorkspace.cy.$id('r-1').hasClass('relationship-category-friendship')), 'existing line category retained');
+ await app.evaluate(() => window.PlotDirectorRelationshipWorkspace.cy.$id('c-18').emit('cxttap'));
+ await app.locator('.pd-context-popup').waitFor();
+ assert.match(await app.locator('.pd-context-popup').innerText(), /Edit character|Add relationship/, 'map context actions remain available when its palette is hidden behind Details');
+ await app.keyboard.press('Escape');
assert.deepEqual(errors, []);
console.log('PASS Relationships workspace: 75 cast, 300 scenes, focus, search, drag/drop, editor, timeline, persistence, responsive layout and PWA menu');
} finally { await browser.close(); }
diff --git a/PlotLine/Help/Articles/RelationshipMap/Overview.md b/PlotLine/Help/Articles/RelationshipMap/Overview.md
index 54149d4e..6380d7e0 100644
--- a/PlotLine/Help/Articles/RelationshipMap/Overview.md
+++ b/PlotLine/Help/Articles/RelationshipMap/Overview.md
@@ -19,23 +19,23 @@ Use it when you want to see family, friendship, romance, conflict, professional
# How To Use It
-The map sits between four independently scrolling character palettes. Characters with importance 8–10 appear at the top, 4–7 at the sides, and lower or unset importance at the bottom. Search ignores case and accents; the importance filter narrows the palettes immediately. **Characters** collapses the palettes to give the canvas more room.
+The map sits between four independently scrolling character palettes. **Major** characters appear at the top, **Supporting** characters at the sides, and **Minor / unset** characters at the bottom. These groups preserve the existing importance thresholds (8+, 4–7 and below 4). Search ignores case and accents; the importance filter narrows the palettes immediately. **Layout → Characters** collapses the palettes to give the canvas more room.
-Click or tap a character to bring them to the centre and activate Focus Mode. With **Show full network** off, the map shows their immediate connections; with it on, unrelated connections are dimmed. **Centre focus** returns to the focused character.
+Click or tap a character to bring them to the centre and activate Focus Mode. With **Show full network** off, the map shows their immediate connections; with it on, unrelated connections are dimmed. The focus chip in the toolbar names the current character; click it or the canvas target control to centre them, or **×** to clear focus.
Drag a palette character onto blank canvas to position them without creating a relationship. The character remains in the palette. Drag onto another character to open the relationship editor. Dragging a map card moves it; the small arrow beside the focused map character starts a relationship instead.
-For keyboard and touch editing, choose **Add relationship**, then select source and target. The arrow beside any palette character also opens the editor with that source. Choose the existing relationship type, state, intensity and optional notes. Mutual status belongs to the initial relationship; scene changes use the existing mutual status. Review **Apply at** before saving.
+For keyboard and touch editing, choose **Add relationship**, then select source and target. The arrow beside any palette character also opens the editor with that source. The editor shows the chosen pair with their avatars; expand **Change characters** to edit either endpoint. Choose the existing relationship type, state, intensity and optional notes. Mutual status belongs to the initial relationship; scene changes use the existing mutual status. Review **Apply at** before saving.
**Initial** edits the starting relationship. A scene selection records a change at that scene. Saving reuses a matching relationship of the same type, and edits an existing event at that scene rather than adding another. Different relationship types may coexist between the same people. The focused character remains centred and zoom is retained after saving.
-The **Relationship Timeline** shows the state after all changes up to the selected scene. Tick marks identify scenes with changes. Use the slider's arrow keys or **Previous change / Next change** to navigate without displaying hundreds of labels. **End** shows the state at the final scene. The current point supplies the editor's default scene.
+The **Relationship Timeline** shows the state after all changes up to the selected scene. Dots identify scenes with changes, and the selected scene is shown beside the timeline heading. **Initial** and **End** jump to the boundaries. Use the slider's arrow keys or **Previous change / Next change** to navigate without displaying hundreds of labels. **End** shows the state at the final scene. The current point supplies the editor's default scene.
-Drag empty canvas to pan. Use **+ / −**, Ctrl/Cmd-wheel, or a two-finger pinch to zoom. **Fit all** fits the visible network; **Auto-arrange** recalculates positions. **Reset layout** restores removed map characters and rearranges locally. **Remove focused from map** hides a node locally and does not delete the character or relationship.
+Drag empty canvas to pan. Use **+ / −**, Ctrl/Cmd-wheel, or a two-finger pinch to zoom. The vertical canvas toolbar contains select, pan, fit, zoom and centre controls. **Auto-arrange** recalculates positions. **Layout → Reset layout** restores removed map characters and rearranges locally. **Layout → Remove focused from map** hides a node locally and does not delete the character or relationship. The maximise control expands the workspace within the application; click it again or press Escape to restore.
-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. **List** jumps to the conventional list, which shows the same relationship state as the map.
+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 the side palettes become horizontal strips, keeping the canvas usable.
+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 the compact relationship legend and the older book/chapter/scene selectors.
# Example
diff --git a/PlotLine/Views/RelationshipMap/Index.cshtml b/PlotLine/Views/RelationshipMap/Index.cshtml
index 47a00c8e..fabaf742 100644
--- a/PlotLine/Views/RelationshipMap/Index.cshtml
+++ b/PlotLine/Views/RelationshipMap/Index.cshtml
@@ -1,29 +1,30 @@
-@using System.Text.Json
@model RelationshipMapViewModel
@{
- ViewData["Title"] = $"Relationship Map - {Model.Project.ProjectName}";
+ ViewData["Title"] = $"Relationships - {Model.Project.ProjectName}";
ViewData["ProjectSection"] = "Relationships";
- var jsonOptions = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
+ ViewData["ShellClass"] = "plotline-shell-wide rw-shell";
}
-
-
-
-
Relationships
-Explore and change relationships through the story.
-