Consolidate Supporting palette and dedicate right rail to Details
This commit is contained in:
parent
b5a2df25de
commit
6b4079a280
@ -8,7 +8,7 @@ The previous `RelationshipMap/Index` page offered GET selectors for book, chapte
|
||||
|
||||
Existing graph category colours, labels, intensity widths, hover text, selected-line styling and history rendering are retained in `_GraphScripts`. Focus Mode still displays the chosen character's immediate network or dims the unrelated full network. Client navigation now applies that same rule without a page reload. Map and list update from the same server response. Timeline reads the existing state resolver rather than computing a second relationship state in JavaScript. The resolver also excludes archived records and relationships before their recorded starting scene/book.
|
||||
|
||||
Characters have numeric `CharacterImportance`; existing graph thresholds are 8+ and 4+. Palettes use those thresholds, splitting supporting characters between the sides. Names and avatar/portrait paths come from the existing character records. Only real importance data is offered as a filter. Each character has one palette entry with a lazy portrait. The timeline uses a native range input and change markers instead of hundreds of labels.
|
||||
Characters have numeric `CharacterImportance`; existing graph thresholds are 8+ and 4+. Palettes use those thresholds: Major at the top, every Supporting character on the left and Minor at the bottom. The right rail is Details only. Names and avatar/portrait paths come from the existing character records. Find character searches all three palettes; the redundant importance filter controls are removed. Each character has one palette entry with a lazy portrait. The timeline uses a native range input and change markers instead of hundreds of labels.
|
||||
|
||||
Character analysis exposes a generated `Summary` and run/completion metadata (`CharacterEnrichmentCharacterStatus`), and structured enrichment results. Summary length is measurable but is a generated output with no calibrated relationship to importance. A separate suggestion feature should combine scene presence and POV evidence with analysis coverage, evaluate ranking across several books, and require author acceptance. This pass deliberately does not infer or change author importance.
|
||||
|
||||
@ -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 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 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 is dedicated to contextual detail, with no Supporting/Details tabs. 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.
|
||||
|
||||
@ -69,3 +69,9 @@ Maximise retains its existing PWA ribbon placement and behaviour; the browser co
|
||||
### Focus action spacing
|
||||
|
||||
The initial stability styling reserved unequal 150px/65px slots, leaving an uneven group and clipping the long Clear caption. Expanded PWA Focus actions now use equal compact widths with the normal ribbon gap. The label is explicitly Clear focus. Its ribbon binding stays visible but disabled while its canonical source is hidden (no character focused), avoiding an empty reserved slot or a width change. The web control retains its existing hiding behaviour. Regression checks cover balanced geometry, the complete Clear label, enabling/disabling and unchanged workspace bounds at 1440/1700/1920px.
|
||||
|
||||
## Simplified character palettes
|
||||
|
||||
The existing 8+/4–7/below-4 classifications and Model.Cast order are unchanged. Supporting entries are no longer split by alternating index: the complete existing collection renders on the left. Major and Minor entries keep their top and bottom homes. The left keeps Find character and a Supporting count, with the dropdown and three importance filter buttons removed. Search still matches every cast entry using the existing accent/case normalization, and palette-local scrolling brings a focused result into view without scrolling the outer workspace.
|
||||
|
||||
The right is Details only, with the existing character/relationship content and colour key. Clear focus resets the contextual content instead of switching to a Supporting list. Collapsing character palettes retains Details. The mobile drawer continues to move all existing character entries into one list, then restore their desktop homes on resize; no duplicate portraits or records are introduced. Tests cover complete Supporting population/order, absence of the removed controls/tab, search/focus across all classes, Supporting drag/drop, Details, mobile and existing map/ribbon stability.
|
||||
|
||||
@ -25,10 +25,14 @@ const base = 'http://127.0.0.1:5238';
|
||||
assert.equal(await page.locator('[data-rw-character]').count(), 75);
|
||||
await page.locator('[data-map-fit]').click();
|
||||
assert(await page.evaluate(() => { const cy = window.PlotDirectorRelationshipWorkspace.cy, box = cy.nodes(':visible').renderedBoundingBox(); return box.w <= cy.width()+1 && box.h <= cy.height()+1; }), 'Fit all contains the large cast');
|
||||
for (const [side, min, max] of [['top',8,10],['left',4,7],['right',4,7],['bottom',0,3]]) {
|
||||
for (const [side, min, max] of [['top',8,10],['left',4,7],['bottom',0,3]]) {
|
||||
const values = await page.locator(`.rw-${side} [data-rw-character]`).evaluateAll(nodes => nodes.map(n => Number(n.dataset.importance)));
|
||||
assert(values.length && values.every(n => n >= min && n <= max), side + ' importance population');
|
||||
}
|
||||
const supportingIds = await page.locator('.rw-left [data-rw-character]').evaluateAll(nodes=>nodes.map(n=>Number(n.dataset.rwCharacter)));
|
||||
assert.deepEqual(supportingIds,state.cast.filter(c=>c.characterImportance>=4&&c.characterImportance<8).map(c=>c.characterID),'complete Supporting collection in existing order');
|
||||
assert.equal(await page.locator('.rw-rail [data-rw-entry], #rwPaletteTab, #rwDetailTab, #rwImportance, [data-rw-group]').count(),0,'Details-only right rail and no redundant importance controls');
|
||||
assert(await page.locator('#rwDetailPanel').isVisible(),'contextual Details permanently available on desktop');
|
||||
const filteringMs = await page.evaluate(() => { const start = performance.now(); const search = document.getElementById('rwSearch'); for (let i=0;i<100;i++) { search.value = i%2 ? 'cast' : 'elan'; search.dispatchEvent(new Event('input')); } return performance.now()-start; });
|
||||
assert(filteringMs < 1500, '100 large-cast filter updates remain responsive');
|
||||
console.log(`75-character filtering: ${filteringMs.toFixed(1)}ms for 100 updates`);
|
||||
@ -41,20 +45,37 @@ const base = 'http://127.0.0.1:5238';
|
||||
});
|
||||
assert(centred, 'click focuses and centres');
|
||||
await page.locator('#rwSearch').fill('');
|
||||
await page.locator('#rwImportance').selectOption('major');
|
||||
assert.equal(await page.locator('[data-rw-entry]:not([hidden]) [data-rw-character][data-importance="3"]').count(), 0);
|
||||
await page.locator('#rwImportance').selectOption('');
|
||||
for (const [id,name] of [[10,'Cast 10'],[7,'Cast 07'],[3,'Cast 03']]) {
|
||||
await page.locator('#rwSearch').fill(name);
|
||||
assert.equal(await page.locator('[data-rw-entry]:not([hidden])').count(),1,'whole-cast search '+name);
|
||||
await page.locator(`[data-rw-character="${id}"]`).click();
|
||||
assert(await page.evaluate(id=>{const cy=window.PlotDirectorRelationshipWorkspace.cy,n=cy.$id(`c-${id}`),p=n.renderedPosition();return n.hasClass('is-focus')&&Math.abs(p.x-cy.width()/2)<2&&Math.abs(p.y-cy.height()/2)<2},id),'search focuses and centres '+name);
|
||||
assert.match(await page.locator('[data-map-detail-title]').innerText(),new RegExp(name),'Details tracks search selection');
|
||||
}
|
||||
await page.locator('#rwSearch').fill('elan');await page.locator('[data-rw-character="1"]').click();await page.locator('#rwSearch').fill('');
|
||||
// Exercise actual HTML drag events with a DataTransfer and rendered Cytoscape hit-testing.
|
||||
async function drag(id, target, mapHandle = false) {
|
||||
await page.evaluate(({id,target,mapHandle}) => {
|
||||
const button = mapHandle ? document.querySelector('[aria-label="Drag to another character, or click to add a relationship"]') : document.querySelector(`[data-rw-character="${id}"]`), graph = document.getElementById('relationshipMapGraph');
|
||||
const cy = window.PlotDirectorRelationshipWorkspace.cy;
|
||||
const p = target ? cy.$id(`c-${target}`).renderedPosition() : { x: 24, y: 24 };
|
||||
let p = target ? cy.$id(`c-${target}`).renderedPosition() : null;
|
||||
if (!p) {
|
||||
const boxes=cy.nodes(':visible').map(n=>n.renderedBoundingBox());
|
||||
for(let y=24;y<graph.clientHeight-15&&!p;y+=24) for(let x=64;x<graph.clientWidth-15&&!p;x+=24)
|
||||
if(!boxes.some(b=>x>=b.x1-4&&x<=b.x2+4&&y>=b.y1-4&&y<=b.y2+4))p={x,y};
|
||||
if(!p)throw new Error('Fixture has no empty drop location');
|
||||
}
|
||||
const box = graph.getBoundingClientRect(), dataTransfer = new DataTransfer();
|
||||
button.dispatchEvent(new DragEvent('dragstart', { bubbles: true, dataTransfer }));
|
||||
for (const type of ['dragover','drop']) graph.dispatchEvent(new DragEvent(type, { bubbles: true, cancelable: true, dataTransfer, clientX: box.left+p.x, clientY: box.top+p.y }));
|
||||
}, {id,target,mapHandle});
|
||||
}
|
||||
await drag(7, null);
|
||||
assert.equal(await page.locator('#rwDialog').evaluate(e=>e.open),false,'Supporting blank drop does not create a relationship');
|
||||
assert(await page.evaluate(()=>window.PlotDirectorRelationshipWorkspace.cy.$id('c-7').visible()));
|
||||
await drag(7,1);await page.locator('#rwDialog[open]').waitFor();
|
||||
assert.equal(await page.locator('[name="SourceID"]').inputValue(),'7','Supporting drag onto another character opens editor');
|
||||
await page.keyboard.press('Escape');
|
||||
await drag(75, null);
|
||||
assert.equal(await page.locator('#rwDialog').evaluate(e => e.open), false, 'blank drop does not create relationship');
|
||||
assert(await page.evaluate(() => window.PlotDirectorRelationshipWorkspace.cy.$id('c-75').visible()));
|
||||
@ -151,7 +172,7 @@ const base = 'http://127.0.0.1:5238';
|
||||
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');
|
||||
assert.match(await app.locator('.pd-context-popup').innerText(), /Edit character|Add relationship/, 'map context actions remain available after focusing');
|
||||
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');
|
||||
|
||||
@ -58,7 +58,7 @@ const base='http://127.0.0.1:5238';
|
||||
await (await command('Add relationship')).click();assert(await app.locator('#rwDialog').evaluate(e=>e.open));await app.keyboard.press('Escape');
|
||||
await app.evaluate(()=>{window.__layouts=0;window.PlotDirectorRelationshipWorkspace.cy.on('layoutstop',()=>window.__layouts++);});
|
||||
await (await command('Auto-arrange')).click();assert(await app.evaluate(()=>window.__layouts>0),'original auto-arrange handler');
|
||||
await (await command('Characters')).click();assert(await app.locator('#rwBoard').evaluate(e=>e.classList.contains('palettes-hidden')));await (await command('Characters')).click();
|
||||
await (await command('Characters')).click();assert(await app.locator('#rwBoard').evaluate(e=>e.classList.contains('palettes-hidden')));assert(await app.locator('#rwDetailPanel').isVisible(),'Details remains when palettes collapse');await (await command('Characters')).click();
|
||||
const maximise=await command('Maximise workspace');
|
||||
assert.equal(await maximise.locator('xpath=ancestor::details[@data-compact="true"]').count(),0,'Maximise is directly on ribbon, not in a dropdown');
|
||||
assert.equal(await display.getByRole('button',{name:'Maximise workspace',exact:true}).count(),0);
|
||||
|
||||
@ -21,7 +21,9 @@ Use it when you want to see family, friendship, romance, conflict, professional
|
||||
|
||||
In the installed PWA, workspace commands appear in the existing ribbon: **View**, **Focus**, **Relationship**, **Arrange**, **Layout** and **Display**. The Focus command shows the current character and offers Clear focus. Layout and Display retain their existing options; narrower windows use the ribbon’s standard overflow menus. The browser version keeps its workspace toolbar. Both presentations control the same map, list, focus and maximise state.
|
||||
|
||||
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.
|
||||
The map has three independently scrolling character palettes: **Major** across the top, **all Supporting** characters down the left, and **Minor / unset** across the bottom. These use the existing importance classifications; this layout does not change stored importance. The right panel is dedicated to contextual Details.
|
||||
|
||||
**Find character** searches the whole cast across all three palettes, ignoring case and accents. There is no importance filter to switch first. Select a matching character in their palette to focus and centre them on the map; their palette entry is also brought into view. **Layout → Characters** collapses the character palettes while keeping Details available.
|
||||
|
||||
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.
|
||||
|
||||
@ -35,7 +37,7 @@ The **Relationship Timeline** shows the state after all changes up to the select
|
||||
|
||||
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. In the PWA it sits directly on the ribbon and temporarily hides the title and category-tab rows to give the canvas more height, while keeping the command row and Restore button available.
|
||||
|
||||
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.
|
||||
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 always contains 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** 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.
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
@model RelationshipMapViewModel
|
||||
<aside class="relationship-map-details" data-pd-context="relationship" id="rwDetailPanel" hidden>
|
||||
<aside class="relationship-map-details" data-pd-context="relationship" id="rwDetailPanel">
|
||||
<div id="relationshipMapEmptyDetail" class="muted">Choose a character or relationship.</div>
|
||||
<div id="relationshipMapDetail" class="d-none">
|
||||
<div class="relationship-map-detail-heading">
|
||||
|
||||
@ -1,26 +1,18 @@
|
||||
@model RelationshipMapViewModel
|
||||
<div class="rw-board" id="rwBoard">
|
||||
@foreach (var side in new[] { "top", "left", "right", "bottom" })
|
||||
@foreach (var side in new[] { "top", "left", "bottom" })
|
||||
{
|
||||
var supporting = Model.Cast.Where(x => x.CharacterImportance >= 4 && x.CharacterImportance < 8).ToList();
|
||||
var cast = side == "top" ? Model.Cast.Where(x => x.CharacterImportance >= 8)
|
||||
: side == "bottom" ? Model.Cast.Where(x => (x.CharacterImportance ?? 0) < 4)
|
||||
: supporting.Where((x, i) => i % 2 == (side == "left" ? 0 : 1));
|
||||
: supporting;
|
||||
@if (side == "left")
|
||||
{
|
||||
@:<aside class="rw-navigation" aria-label="Character search and groups">
|
||||
<h2>Characters <span>(@Model.Cast.Count)</span></h2>
|
||||
<label class="visually-hidden" for="rwSearch">Find character</label>
|
||||
<input id="rwSearch" type="search" class="form-control form-control-sm" placeholder="Find character…" autocomplete="off" />
|
||||
<label class="visually-hidden" for="rwImportance">Importance</label>
|
||||
<select id="rwImportance" class="form-select form-select-sm"><option value="">All importance</option><option value="major">Major</option><option value="supporting">Supporting</option><option value="minor">Minor / unset</option></select>
|
||||
<div class="rw-groups" role="group" aria-label="Character importance groups"><button type="button" data-rw-group="major">Major</button><button type="button" data-rw-group="supporting">Supporting</button><button type="button" data-rw-group="minor">Minor</button></div>
|
||||
<h3>Supporting characters</h3>
|
||||
}
|
||||
@if (side == "right")
|
||||
{
|
||||
@:<aside class="rw-rail" aria-label="Characters and relationship detail">
|
||||
<div class="rw-rail-tabs" role="group" aria-label="Side panel"><button type="button" id="rwPaletteTab" aria-pressed="true">Supporting</button><button type="button" id="rwDetailTab" aria-pressed="false">Details</button></div>
|
||||
<h3>Supporting (@supporting.Count)</h3>
|
||||
}
|
||||
<div class="rw-strip rw-@side" role="region" aria-label="@side character palette" tabindex="0">
|
||||
@if (side == "top" || side == "bottom") { <h2>@(side == "top" ? "Major" : "Minor") <span>(@cast.Count())</span></h2> }
|
||||
@ -40,20 +32,23 @@
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@if (side == "right") { <partial name="_Details" model="Model" /><section class="rw-colour-key" aria-label="Relationship colour key"><h3>Relationship key</h3><div class="relationship-map-legend-grid">
|
||||
@foreach (var category in Model.Categories)
|
||||
{
|
||||
<span class="relationship-map-legend-item @category.CssClass">
|
||||
<span class="relationship-map-legend-line" aria-hidden="true"></span>
|
||||
<span>@category.CategoryName</span>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
</section> }
|
||||
@if (side == "left" || side == "right") { @:</aside>
|
||||
@if (side == "left") { @:</aside>
|
||||
}
|
||||
}
|
||||
<aside class="rw-rail" aria-label="Contextual details">
|
||||
<h2 class="rw-detail-heading">Details</h2>
|
||||
<partial name="_Details" model="Model" />
|
||||
<section class="rw-colour-key" aria-label="Relationship colour key"><h3>Relationship key</h3>
|
||||
<div class="relationship-map-legend-grid">
|
||||
@foreach (var category in Model.Categories)
|
||||
{
|
||||
<span class="relationship-map-legend-item @category.CssClass">
|
||||
<span class="relationship-map-legend-line" aria-hidden="true"></span><span>@category.CategoryName</span>
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
</aside>
|
||||
<div class="rw-centre" data-pd-context="relationship canvas">
|
||||
<div class="relationship-map-toolbar" aria-label="Canvas controls">
|
||||
<button class="btn btn-outline-secondary btn-sm" type="button" id="rwSelect" aria-label="Select and move characters" title="Select and move characters" aria-pressed="true">↖</button>
|
||||
|
||||
@ -31,14 +31,11 @@ body.app-layout.rw-page .plotline-shell, .plotline-shell.rw-shell { max-width: n
|
||||
.rw-navigation, .rw-rail, .rw-strip, .rw-timeline, .rw-list-panel { border: 1px solid var(--pd-border); border-radius: 5px; background: var(--pd-section); min-width: 0; min-height: 0; }
|
||||
.rw-navigation { grid-column: 1; grid-row: 1/5; display: flex; flex-direction: column; gap: 7px; padding: 8px 6px; }
|
||||
.rw-rail { grid-column: 3; grid-row: 1/5; display: flex; flex-direction: column; overflow: hidden; }
|
||||
.rw-groups { display: flex; gap: 2px; }
|
||||
.rw-groups button { flex: 1; font-size: 10px; min-height: 28px; background: var(--pd-nested); color: var(--pd-text); border: 1px solid var(--pd-border); border-radius: 3px; padding: 2px; }
|
||||
.rw-rail-tabs { display: flex; padding: 4px; gap: 4px; border-bottom: 1px solid var(--pd-border); }
|
||||
.rw-rail-tabs button { flex: 1; border: 1px solid transparent; border-radius: 3px; padding: 6px; background: transparent; color: var(--pd-text); }
|
||||
.rw-detail-heading { padding: 8px 10px; border-bottom: 1px solid var(--pd-border); }
|
||||
.rw-strip { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--pd-border) transparent; display: flex; gap: 4px; padding: 4px; }
|
||||
.rw-top { grid-column: 2; grid-row: 1; }
|
||||
.rw-bottom { grid-column: 2; grid-row: 4; }
|
||||
.rw-left, .rw-right { flex-direction: column; border: 0; flex: 1; }
|
||||
.rw-left { flex-direction: column; border: 0; flex: 1; }
|
||||
.rw-top h2, .rw-bottom h2 { position: sticky; left: -4px; z-index: 1; background: var(--pd-section); display: flex; align-items: center; gap: 4px; padding: 6px; min-width: 65px; font-size: 12px; }
|
||||
.rw-strip h2 span { font-size: 10px; color: var(--pd-muted); }
|
||||
.rw-entry { flex-shrink: 0; display: flex; align-items: center; min-width: 0; position: relative; }
|
||||
@ -88,8 +85,9 @@ body.app-layout.rw-page .plotline-shell, .plotline-shell.rw-shell { max-width: n
|
||||
#rwApp .relationship-map-list-item strong { flex: 1; }
|
||||
#rwApp .relationship-map-list-item.is-selected { border-color: var(--pd-focus); background: var(--pd-selected); }
|
||||
#rwApp .status-pill { font-size: 10px; }
|
||||
.rw-board.palettes-hidden { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) 88px; }
|
||||
.rw-board.palettes-hidden > .rw-strip, .rw-board.palettes-hidden > .rw-navigation, .rw-board.palettes-hidden > .rw-rail { display: none; }
|
||||
.rw-board.palettes-hidden { grid-template-columns: minmax(0,1fr) clamp(190px,16vw,230px); grid-template-rows: minmax(0,1fr) 88px; }
|
||||
.rw-board.palettes-hidden > .rw-strip, .rw-board.palettes-hidden > .rw-navigation { display: none; }
|
||||
.rw-board.palettes-hidden .rw-rail { grid-column: 2; grid-row: 1/3; }
|
||||
.rw-board.palettes-hidden .rw-centre { grid-column: 1; grid-row: 1; }.rw-board.palettes-hidden .rw-timeline { grid-column: 1; grid-row: 2; }
|
||||
.rw-app.rw-maximised { position: fixed; inset: 4px; height: auto !important; z-index: 1040; }
|
||||
#rwDialog { font: 12px/1.4 var(--pd-font-ui); color: var(--pd-text); background: var(--pd-elevated); border: 1px solid var(--pd-border); border-radius: 7px; width: min(480px,96vw); max-height: 90dvh; padding: 16px; }
|
||||
@ -118,8 +116,7 @@ body.app-layout.rw-page .plotline-shell, .plotline-shell.rw-shell { max-width: n
|
||||
.rw-board.mobile-detail .rw-rail { display: flex; }
|
||||
.rw-centre { grid-column: 1; grid-row: 1; } .rw-timeline { grid-column: 1; grid-row: 2; padding: 5px; }
|
||||
.rw-timeline-heading label { font-size: 11px; } .rw-timeline-heading { gap: 3px; } #rwPoint { max-width: 45%; }
|
||||
.rw-groups button { min-height: 32px; }
|
||||
.rw-board.mobile-characters .rw-top, .rw-board.mobile-characters .rw-bottom, .rw-board.mobile-characters .rw-right { display: none; }
|
||||
.rw-board.mobile-characters .rw-top, .rw-board.mobile-characters .rw-bottom { display: none; }
|
||||
.rw-toolbar-actions #rwPalettes { display: inline-block; }
|
||||
}
|
||||
|
||||
@ -168,3 +165,8 @@ body.rw-page [data-pwa-context-controls] .pd-context-group[aria-label="Focus"] d
|
||||
body.rw-page [data-pwa-context-controls] .pd-context-group[aria-label="Focus"] .pd-context-command > span {
|
||||
display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
@media(max-width:800px) {
|
||||
.rw-board.palettes-hidden { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) 92px; }
|
||||
.rw-board.palettes-hidden .rw-rail { grid-column: 1; grid-row: 1/3; }
|
||||
}
|
||||
|
||||
@ -107,22 +107,27 @@
|
||||
focus = Number(id); extraNodes.add(focus); ensureNode(focus);
|
||||
if (cy.zoom() < .6) cy.zoom(.8);
|
||||
applyFocus(true);
|
||||
if (window.innerWidth > 800) showRail('detail');
|
||||
const entry = document.querySelector(`[data-rw-entry="${focus}"]`);
|
||||
const palette = entry?.closest('.rw-strip');
|
||||
if (palette?.clientWidth && palette.clientHeight) {
|
||||
const item = entry.getBoundingClientRect(), view = palette.getBoundingClientRect();
|
||||
if (item.left < view.left) palette.scrollLeft -= view.left - item.left;
|
||||
else if (item.right > view.right) palette.scrollLeft += item.right - view.right;
|
||||
if (item.top < view.top) palette.scrollTop -= view.top - item.top;
|
||||
else if (item.bottom > view.bottom) palette.scrollTop += item.bottom - view.bottom;
|
||||
}
|
||||
if (window.innerWidth > 800) showDetail();
|
||||
else { board.classList.remove('mobile-characters'); document.getElementById('rwCharacters').setAttribute('aria-expanded', 'false'); }
|
||||
remember();
|
||||
}
|
||||
function normalise(value) { return value.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLocaleLowerCase().replace(/[^\p{L}\p{N}]+/gu, ' ').trim(); }
|
||||
function filter() {
|
||||
const query = normalise(document.getElementById('rwSearch').value).split(' ').filter(Boolean);
|
||||
const importance = document.getElementById('rwImportance').value;
|
||||
document.querySelectorAll('[data-rw-character]').forEach(button => {
|
||||
const n = Number(button.dataset.importance);
|
||||
const group = n >= 8 ? 'major' : n >= 4 ? 'supporting' : 'minor';
|
||||
button.closest('[data-rw-entry]').hidden = (importance && group !== importance) || !query.every(word => normalise(button.textContent).includes(word));
|
||||
button.closest('[data-rw-entry]').hidden = !query.every(word => normalise(button.textContent).includes(word));
|
||||
});
|
||||
}
|
||||
document.getElementById('rwSearch').addEventListener('input', filter);
|
||||
document.getElementById('rwImportance').addEventListener('change', filter);
|
||||
document.querySelectorAll('[data-rw-character]').forEach(button => button.addEventListener('click', () => focusCharacter(button.dataset.rwCharacter)));
|
||||
function openEditor(from, to) {
|
||||
if (loading || !stateLoaded) { status.textContent = 'Wait for the timeline to finish loading.'; return; }
|
||||
@ -264,7 +269,7 @@
|
||||
function openContext(element, original) {
|
||||
if (!window.PlotDirectorPwa?.standalone || original?.ctrlKey || !element) return;
|
||||
if (!element.getClientRects().length || element.closest('[hidden]')) {
|
||||
showRail('detail'); element = document.getElementById('rwDetailPanel');
|
||||
showDetail(); element = document.getElementById('rwDetailPanel');
|
||||
}
|
||||
element.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, cancelable: true,
|
||||
clientX: original?.clientX || 100, clientY: original?.clientY || 100 }));
|
||||
@ -336,7 +341,7 @@
|
||||
visible.forEach((n,i) => { if (!restored?.positions?.[n.id()] && n.position().x === 0 && n.position().y === 0) n.position({ x: 200 + i % 6 * 190, y: 150 + Math.floor(i/6)*100 }); });
|
||||
status.textContent = `${point.textContent}: ${model.relationships.length} relationships.`;
|
||||
if (focus) renderCharacterDetail();
|
||||
else showRail('palette');
|
||||
else clearDetail();
|
||||
} catch (error) { if (error.name !== 'AbortError') { stateLoaded = false; status.textContent = error.message; } }
|
||||
finally { if (active === request) loading = false; }
|
||||
}
|
||||
@ -377,11 +382,11 @@
|
||||
person.append(portrait,label); pair.append(person);
|
||||
});
|
||||
}
|
||||
function showRail(mode) {
|
||||
document.querySelector('.rw-right').hidden = mode !== 'palette';
|
||||
document.getElementById('rwDetailPanel').hidden = mode !== 'detail';
|
||||
document.getElementById('rwPaletteTab').setAttribute('aria-pressed', String(mode === 'palette'));
|
||||
document.getElementById('rwDetailTab').setAttribute('aria-pressed', String(mode === 'detail'));
|
||||
function showDetail() { document.getElementById('rwDetailPanel').hidden = false; }
|
||||
function clearDetail() {
|
||||
document.getElementById('relationshipMapEmptyDetail').classList.remove('d-none');
|
||||
document.getElementById('relationshipMapDetail').classList.add('d-none');
|
||||
workspace.selectedRelationship = null; activeRelationship = null;
|
||||
}
|
||||
function renderCharacterDetail() {
|
||||
const character = castById.get(focus); if (!character) return;
|
||||
@ -418,7 +423,7 @@
|
||||
document.getElementById('rwEditLine').hidden = false;
|
||||
document.getElementById('rwEditCharacter').hidden = true;
|
||||
document.getElementById('rwFocusRelationships').hidden = true;
|
||||
showRail('detail');
|
||||
showDetail();
|
||||
}
|
||||
function toggleCharacters() {
|
||||
setView('map');
|
||||
@ -450,34 +455,27 @@
|
||||
graphWidth = width; graphHeight = height; positionHandle();
|
||||
};
|
||||
const homes = new Map([...document.querySelectorAll('[data-rw-entry]')].map(e => [e,e.parentElement]));
|
||||
const supportingTitle = document.querySelector('.rw-navigation h3').textContent;
|
||||
const adaptPalettes = () => {
|
||||
const mobile = window.innerWidth <= 800;
|
||||
const left = document.querySelector('.rw-left');
|
||||
homes.forEach((home, entry) => (mobile ? left : home).append(entry));
|
||||
document.querySelector('.rw-navigation h3').textContent = mobile ? 'All characters' : 'Supporting characters';
|
||||
document.querySelector('.rw-navigation h3').textContent = mobile ? `All characters (${cast.length})` : supportingTitle;
|
||||
if (!mobile) { board.classList.remove('mobile-characters','mobile-detail'); }
|
||||
resizeGraph();
|
||||
};
|
||||
const breakpoint = matchMedia('(max-width:800px)'); breakpoint.addEventListener('change', adaptPalettes); adaptPalettes();
|
||||
document.getElementById('rwCharacters').addEventListener('click', toggleCharacters);
|
||||
document.getElementById('rwPaletteTab').addEventListener('click', () => showRail('palette'));
|
||||
document.getElementById('rwDetailTab').addEventListener('click', () => { if (focus) renderCharacterDetail(); showRail('detail'); });
|
||||
document.getElementById('rwInfo').addEventListener('click', () => {
|
||||
if (focus) renderCharacterDetail(); showRail('detail');
|
||||
if (focus) renderCharacterDetail(); showDetail();
|
||||
const active = board.classList.toggle('mobile-detail'); board.classList.remove('mobile-characters');
|
||||
document.getElementById('rwInfo').setAttribute('aria-expanded', String(active));
|
||||
});
|
||||
document.getElementById('rwClearFocus').addEventListener('click', () => { focus = null; applyFocus(); showRail('palette'); remember(); });
|
||||
document.getElementById('rwClearFocus').addEventListener('click', () => { focus = null; applyFocus(); clearDetail(); remember(); });
|
||||
document.getElementById('rwFocusName').addEventListener('click', () => applyFocus(true));
|
||||
document.getElementById('rwDetailConnect').addEventListener('click', () => openEditor(null, focus));
|
||||
document.getElementById('rwSelect').addEventListener('click', () => setPanMode(false));
|
||||
document.getElementById('rwPan').addEventListener('click', () => setPanMode(true));
|
||||
document.querySelectorAll('[data-rw-group]').forEach(button => button.addEventListener('click', () => {
|
||||
const input = document.getElementById('rwImportance'); input.value = input.value === button.dataset.rwGroup ? '' : button.dataset.rwGroup;
|
||||
input.dispatchEvent(new Event('change'));
|
||||
const target = input.value === 'major' ? '.rw-top' : input.value === 'minor' ? '.rw-bottom' : '.rw-left';
|
||||
document.querySelector(target)?.scrollTo(0,0);
|
||||
}));
|
||||
document.querySelector('.relationship-map-list').addEventListener('click', event => { if (event.target.closest('button')) showRelationshipDetail(); });
|
||||
decorateNodes();
|
||||
cy.on('add', 'node', () => decorateNodes());
|
||||
@ -500,5 +498,5 @@
|
||||
if (restored?.collapsed) { board.classList.add('palettes-hidden'); document.getElementById('rwPalettes').setAttribute('aria-expanded', 'false'); cy.resize(); }
|
||||
|
||||
applyFocus(!!workspace.focusCharacterId);
|
||||
if (focus && window.innerWidth > 800) showRail('detail');
|
||||
if (focus && window.innerWidth > 800) showDetail();
|
||||
})();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user