diff --git a/PlotLine.Tests/Browser/application-toolbar.cjs b/PlotLine.Tests/Browser/application-toolbar.cjs index da4cc31a..d8744db8 100644 --- a/PlotLine.Tests/Browser/application-toolbar.cjs +++ b/PlotLine.Tests/Browser/application-toolbar.cjs @@ -156,6 +156,33 @@ const assert = require('node:assert/strict'); await page.reload(); assert.equal(await page.locator('html').getAttribute('data-app-theme'), theme); } + await page.goto(base + '/fixture?page=timeline'); + const timelineThemeSurfaces = { + 'modern-light': ['rgb(244, 245, 247)', 'rgb(255, 255, 255)', 'rgb(240, 242, 245)', 'rgb(255, 255, 255)', 'rgb(229, 232, 237)'], + 'modern-dark': ['rgb(29, 31, 35)', 'rgb(37, 40, 45)', 'rgb(45, 48, 54)', 'rgb(50, 54, 61)', 'rgb(58, 63, 72)'], + 'warm-light': ['rgb(246, 241, 232)', 'rgb(255, 253, 248)', 'rgb(244, 235, 221)', 'rgb(255, 253, 249)', 'rgb(238, 227, 213)'], + 'warm-dark': ['rgb(23, 19, 16)', 'rgb(35, 30, 25)', 'rgb(48, 39, 31)', 'rgb(56, 46, 37)', 'rgb(67, 54, 43)'] + }; + for (const [theme, expected] of Object.entries(timelineThemeSurfaces)) { + await page.locator('#accountMenuButton').click(); + await page.locator(`[data-app-theme-choice="${theme}"]`).click(); + await page.waitForFunction(t => document.documentElement.dataset.appTheme === t && !document.querySelector('[data-app-theme-choice]').disabled, theme); + await page.keyboard.press('Escape'); + const actual = await page.evaluate(() => ['.timeline-workspace', '.timeline-shell', '.timeline-chapter-title', '.timeline-scene-card'].map(selector => getComputedStyle(document.querySelector(selector)).backgroundColor)); + assert.deepEqual(actual, expected.slice(0, 4), `${theme} must preserve the canvas, section, nested-panel, and card hierarchy`); + assert.equal(await page.locator('.future-lane-placeholder').evaluate(element => getComputedStyle(element).backgroundColor), expected[2], `${theme} empty lanes must use the nested-panel surface`); + await page.locator('.timeline-scene-card').hover(); + assert.equal(await page.locator('.timeline-scene-card').evaluate(element => getComputedStyle(element).backgroundColor), expected[4], `${theme} must expose a visible scene-card hover state`); + await page.locator('.timeline-scene-card').evaluate(element => element.classList.add('selected')); + assert.equal(await page.locator('.timeline-scene-card').evaluate(element => getComputedStyle(element).backgroundColor), expected[4], `${theme} must expose a visible selected scene-card state`); + await page.locator('.timeline-scene-card').evaluate(element => element.classList.remove('selected')); + await page.screenshot({ path: `/tmp/plotdirector-timeline-${theme}.png`, fullPage: true }); + } + const modernDarkRgb = timelineThemeSurfaces['modern-dark'].slice(0, 4).map(value => value.match(/\d+/g).map(Number)); + assert(modernDarkRgb.every(([red, green, blue]) => Math.max(red, green, blue) - Math.min(red, green, blue) <= 12), 'Modern Dark structural surfaces must remain neutral'); + const warmDarkRgb = timelineThemeSurfaces['warm-dark'].slice(0, 4).map(value => value.match(/\d+/g).map(Number)); + assert(warmDarkRgb.every(([red, , blue]) => red > blue) && warmDarkRgb.some(([red, , blue]) => red - blue >= 15), 'Warm Dark structural surfaces must retain a warm bias'); + await page.goto(base + '/fixture?page=dashboard'); await page.getByRole('tab', { name: 'Project', exact: true }).focus(); await page.keyboard.press('ArrowRight'); assert.equal(await page.getByRole('tab', { name: 'Book', exact: true }).getAttribute('aria-selected'), 'true'); diff --git a/PlotLine.Tests/ToolbarBrowserHost.cs b/PlotLine.Tests/ToolbarBrowserHost.cs index b35d6066..40bc6c59 100644 --- a/PlotLine.Tests/ToolbarBrowserHost.cs +++ b/PlotLine.Tests/ToolbarBrowserHost.cs @@ -52,7 +52,9 @@ internal static class ToolbarBrowserHost model.Books = [model.Book, new Book { BookID = 13, ProjectID = 7, BookTitle = "The Return", BookNumber = 2 }]; } var dashboardPage = context.Request.Query["page"] == "dashboard"; + var timelinePage = context.Request.Query["page"] == "timeline"; if (dashboardPage) model.ActiveSection = "Overview"; + if (timelinePage) model.ActiveSection = "Timeline"; var appearance = await context.RequestServices.GetRequiredService().GetAsync(int.Parse(context.User.FindFirstValue(ClaimTypes.NameIdentifier)!)); var route = new RouteData(); route.Values["controller"] = dashboardPage ? "Projects" : "StoryCalendar"; route.Values["action"] = dashboardPage ? "Details" : "Index"; var action = new ActionContext(context, route, new ActionDescriptor()); @@ -79,6 +81,14 @@ internal static class ToolbarBrowserHost }).ToList() }; var surface = dashboardPage ? "" : await Render("StoryCalendar/_StoryCalendarSurface", calendar); + if (timelinePage) + { + surface = """ +
Filters
View
Jump
Saved views
+
Drag sourcesMara Vale
+
Scene timeline
The Glass Harbour
A Distant ShoreBook one
Characters
Mara Vale
Add characters to scenes to see appearance lanes.
+ """; + } if (dashboardPage) { surface = await Render("Projects/Details", new ProjectDetailViewModel { diff --git a/PlotLine/wwwroot/css/application-shell.css b/PlotLine/wwwroot/css/application-shell.css index e4ee3a29..22246012 100644 --- a/PlotLine/wwwroot/css/application-shell.css +++ b/PlotLine/wwwroot/css/application-shell.css @@ -9,6 +9,8 @@ html[data-app-theme] { --pd-icon-locations: #3e7c50; --pd-icon-relationships: #a34876; --pd-icon-review: #976318; --pd-font-ui: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif; --pd-radius: 5px; --pd-shadow: 0 3px 12px rgb(35 27 15 / 5%); + --pd-canvas: var(--pd-workspace); --pd-section: var(--pd-surface); --pd-nested: var(--pd-surface-2); + --pd-card: var(--pd-elevated); --pd-control: var(--pd-surface); --pd-chip: var(--pd-selected); } html[data-app-theme="modern-light"] { --pd-workspace: #f4f5f7; --pd-surface: #fff; --pd-surface-2: #f0f2f5; --pd-elevated: #fff; @@ -161,6 +163,170 @@ html[data-app-theme] .app-layout { .pd-dashboard .dashboard-book-card .btn { font-size: 12px; } .pd-dashboard .dashboard-attention-card h2, .pd-dashboard .dashboard-activity-card h2 { font: 600 17px var(--pd-font-ui); } .pd-dashboard .dashboard-attention-card h3 { font: 600 13px var(--pd-font-ui); color: var(--pd-text); } + +/* Authenticated feature pages consume the same structural hierarchy as the shell. + This supersedes the legacy two-theme literals without changing page layout. */ +html[data-app-theme] .app-layout :is( + .timeline-control-panel, .timeline-drag-palette, .drag-drop-panel, + .timeline-filter-drawer, .timeline-control-group, .timeline-visibility-panel, + .timeline-jump-panel, .timeline-preset-panel, .timeline-setting-card, + .scene-inspector-panel, .pacing-panel +) { + color: var(--pd-text); + background: var(--pd-section); + border-color: var(--pd-border); + box-shadow: none; +} +html[data-app-theme] .app-layout :is(.timeline-filter-drawer, .timeline-control-group) { + background: var(--pd-nested); + box-shadow: inset 0 1px 0 var(--pd-border-subtle); +} +html[data-app-theme] .app-layout :is( + .timeline-filter-drawer, .timeline-control-group, .timeline-drag-palette +) > summary { + color: var(--pd-accent); + background: transparent; +} +html[data-app-theme] .app-layout :is( + .timeline-filter-drawer, .timeline-control-group, .timeline-drag-palette +)[open] > summary { color: var(--pd-accent-hover); background: var(--pd-hover); } +html[data-app-theme] .app-layout :is( + .timeline-filter-drawer, .timeline-control-group, .timeline-drag-palette +) > summary::after { color: var(--pd-muted); } +html[data-app-theme] .app-layout :is( + .timeline-control-select, .timeline-control-panel .form-label, + .timeline-filter-checks, .timeline-visibility-panel label, + .timeline-preset-panel, .metric-shape-intro, .metric-raw-details summary +) { color: var(--pd-muted); } +html[data-app-theme] .app-layout .timeline-visibility-panel label { + background: var(--pd-control); + border-color: var(--pd-border); +} +html[data-app-theme] .app-layout .timeline-visibility-panel label:has(input:checked) { + color: var(--pd-text); + background: var(--pd-selected); + border-color: var(--pd-focus); +} +html[data-app-theme] .app-layout :is(.timeline-workspace, .timeline-shell) { + color: var(--pd-text); + background: var(--pd-canvas); + border-color: var(--pd-border); + box-shadow: none; +} +html[data-app-theme] .app-layout .timeline-shell { background: var(--pd-section); } +html[data-app-theme] .app-layout :is( + .timeline-section-header, .metric-lane-label, .metric-shape-controls, + .metric-chart-frame, .lane-board-heading, .plot-lane-board-heading, + .pacing-heading, .lane-group-heading, .timeline-chapter-title, .timeline-book-title +) { + color: var(--pd-accent); + background: var(--pd-nested); + border-color: var(--pd-border); + box-shadow: none; +} +html[data-app-theme] .app-layout .timeline-project-title { + color: var(--pd-heading); + background: var(--pd-elevated); + border-color: var(--pd-border); + box-shadow: inset 3px 0 0 var(--pd-accent); +} +html[data-app-theme] .app-layout .timeline-chapter { + color: var(--pd-text); + background: var(--pd-section); + border-color: var(--pd-border); + box-shadow: none; + outline: 0; +} +html[data-app-theme] .app-layout :is(.timeline-scene-card, .timeline-empty-scene) { + color: var(--pd-text); + background: var(--pd-card); + border-color: var(--pd-border); + box-shadow: var(--pd-shadow); +} +html[data-app-theme] .app-layout .timeline-scene-card::after { box-shadow: none; } +html[data-app-theme] .app-layout :is( + .plot-lane-label, .asset-lane-label, .character-lane-label, + .plot-lane-slot, .asset-lane-slot, .character-lane-slot, + .metric-graph-points, .timeline-minimap +) { + color: var(--pd-text); + background: var(--pd-nested); + border-color: var(--pd-border); + box-shadow: none; +} +html[data-app-theme] .app-layout :is(.timeline-placeholder-scene, .timeline-placeholder-cell, .future-lane-placeholder) { + color: var(--pd-muted); + background: var(--pd-nested); + border-color: var(--pd-border); +} +html[data-app-theme] .app-layout .timeline-minimap button { + color: var(--pd-text); + background: var(--pd-control); + border-color: var(--pd-border); +} +html[data-app-theme] .app-layout .timeline-minimap button:is(:hover, :focus-visible) { + background: var(--pd-hover); + border-color: var(--pd-focus); +} +html[data-app-theme] .app-layout .timeline-minimap button.is-active { + color: var(--pd-on-accent); + background: var(--pd-accent); + border-color: var(--pd-accent); +} +html[data-app-theme] .app-layout :is( + .drag-chip, .purpose-chip, .metric-mini-summary, .scene-pov-label, + .location-pill, .preset-chip +) { + color: var(--pd-text) !important; + background: var(--pd-chip) !important; + border-color: var(--pd-border) !important; + box-shadow: none; +} +html[data-app-theme] .app-layout :is(.drag-chip, .preset-chip):hover { + background: var(--pd-hover) !important; + border-color: var(--pd-focus) !important; +} +html[data-app-theme] .app-layout :is( + .timeline-scene-card:hover, .timeline-scene-card.selected, + .timeline-scene-card.focus-match, .timeline-scene-card.keyboard-focus, + .timeline-scene-card.search-hit +) { + background: var(--pd-hover); + border-color: var(--pd-focus); + box-shadow: 0 0 0 2px color-mix(in srgb, var(--pd-focus) 28%, transparent); +} +html[data-app-theme] .app-layout :is( + .timeline-scene-card strong, .timeline-chapter-title strong, + .timeline-book-title strong, .timeline-setting-card strong +) { color: var(--pd-heading); } +html[data-app-theme] .app-layout :is( + .scene-summary, .timeline-chapter-title span, .timeline-book-title span, + .timeline-setting-card small, .character-lane-label small +) { color: var(--pd-muted) !important; } +html[data-app-theme] .app-layout :is(.form-control, .form-select, textarea, input, select) { + color: var(--pd-text); + background-color: var(--pd-control); + border-color: var(--pd-border); +} +html[data-app-theme] .app-layout :is(.form-control, .form-select, textarea, input, select):focus { + border-color: var(--pd-focus); + box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--pd-focus) 24%, transparent); +} +html[data-app-theme] .app-layout :is(.context-header, .project-tabs) { + color: var(--pd-text); + background: var(--pd-section); + border-color: var(--pd-border); + box-shadow: none; +} +html[data-app-theme] .app-layout :is( + .plain-card, .card, .empty-panel, .edit-panel, .list-section, + .story-calendar-toolbar, .story-calendar-layout, .story-calendar-month, + .story-calendar-detail, .story-calendar-day, .story-calendar-detail-scene +) { + color: var(--pd-text); + background-color: var(--pd-section); + border-color: var(--pd-border); +} @media (max-width: 1199px) { .pd-titlebar { gap: 8px; padding-inline: 12px; flex-wrap: wrap; } .pd-shell .app-toolbar { max-width: 40vw; }