From 742fd952110506fa39374d785f07fde9b961a60d Mon Sep 17 00:00:00 2001 From: STUDENTOP Date: Fri, 18 Sep 2026 23:16:40 +0800 Subject: [PATCH] feat(h5): give the dock five independently tweened slots Crossing the 1023/1024 rail breakpoint used to snap the dock: the grid tracks switch discretely, so the five actions jumped together and landed off their own slots. Each action now owns an absolute slot expressed in percentages of the dock box, so left/top/width/height all interpolate and every action travels its own trajectory into the rail. - Drop grid-template-columns/rows from the dock transition list. Combined with transition-behavior: allow-discrete they wedge Chrome's layout: the main thread stopped answering CDP for 30s+ at the breakpoint. - Size the bar box and the rail width with absolute lengths. A bar-side percentage kept growing while the rail-side fraction shrank, inflating the box mid-flight until the publish/active chips overlapped. - Keep transform free for press feedback and move the publish float to top. - Enlarge the publish label; let the desktop dock and type scale with clamp(). - h5-visual: replace racy rAF sampling with deterministic pause/seek sampling of the running transitions, assert every action interpolates and that the box never grows past the two settled layouts. - h5-visual: the guest detail assertion demanded an API-fixture ISBN, but the local-first catalogue renders the seeded record with no listing request. Assert the seeded record shows and that no login gate appears. Verified: miniProgram lint + 54 tests, web lint + 50 tests, H5 build and performance budget, h5-visual 74/74 with 0 diagnostics, WeApp build. --- .../scripts/h5-interaction-regressions.mjs | 6 +- miniProgram/scripts/h5-visual.mjs | 103 +++++++++++++- miniProgram/src/h5.css | 40 ++++-- miniProgram/test/style-alignment.test.ts | 29 ++++ web/app/globals.css | 134 +++++++++++++++--- web/app/lib/golden-ui.test.ts | 25 ++++ 6 files changed, 300 insertions(+), 37 deletions(-) diff --git a/miniProgram/scripts/h5-interaction-regressions.mjs b/miniProgram/scripts/h5-interaction-regressions.mjs index a30be95..bd888ae 100644 --- a/miniProgram/scripts/h5-interaction-regressions.mjs +++ b/miniProgram/scripts/h5-interaction-regressions.mjs @@ -2,17 +2,20 @@ import fs from 'node:fs/promises' import path from 'node:path' export async function checkBackNavigation(client, preview, artifactDir) { + const trace = (label) => { if (process.env.BITERSTORE_H5_TRACE === '1') console.error(`[h5-back] ${label}`) } const evaluate = async (expression) => (await client.send('Runtime.evaluate', { expression, returnByValue: true, awaitPromise: true })).result.value const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) await client.send('Emulation.setDeviceMetricsOverride', { width: 390, height: 900, deviceScaleFactor: 1, mobile: true }) const loaded = client.once('Page.loadEventFired') await client.send('Page.navigate', { url: `${preview}/home` }) - await loaded + await Promise.race([loaded, pause(5000)]) + trace('home-loaded') await pause(1000) await evaluate(`window.__backTestStage = document.querySelector('.app-stage'); true`) await evaluate(`window.__backEvents = []; window.addEventListener('popstate', e => window.__backEvents.push({state:e.state, same:window.__backTestStage === document.querySelector('.app-stage')}), true); true`) const rounds = [] for (let index = 0; index < 10; index += 1) { + trace(`round:${index}:start`) const before = await evaluate(`(() => { const area = document.querySelector('.content-scroll'); area.style.scrollBehavior = 'auto'; area.scrollTop = Math.min(160, area.scrollHeight - area.clientHeight); return area.scrollTop })()`) await evaluate(`document.querySelector('.book-tile')?.click()`) await pause(400) @@ -23,6 +26,7 @@ export async function checkBackNavigation(client, preview, artifactDir) { const after = await evaluate(`(() => { const area = document.querySelector('.content-scroll'); return { home: !!document.querySelector('.home-page'), sameApp: window.__backTestStage === document.querySelector('.app-stage'), appCount: document.querySelectorAll('.app-stage').length, scroll: area?.scrollTop, scrollbar: area && getComputedStyle(area).scrollbarWidth, animatedCards: [...document.querySelectorAll('.listing-card')].some(node => getComputedStyle(node).animationName !== 'none') } })()`) if (!after.home || !after.sameApp || after.appCount !== 1 || Math.abs(after.scroll - before) > 1 || after.scrollbar !== 'none' || after.animatedCards) throw new Error(`Back regression ${index}: ${JSON.stringify({ before, forward, after, events:await evaluate('window.__backEvents') })}`) rounds.push({ before, ...after }) + trace(`round:${index}:done`) } await fs.writeFile(path.join(artifactDir, 'back-navigation.json'), JSON.stringify(rounds, null, 2)) const screenshot = await client.send('Page.captureScreenshot', { format: 'png' }) diff --git a/miniProgram/scripts/h5-visual.mjs b/miniProgram/scripts/h5-visual.mjs index bb80fec..20ff4dd 100644 --- a/miniProgram/scripts/h5-visual.mjs +++ b/miniProgram/scripts/h5-visual.mjs @@ -14,6 +14,7 @@ const browserCandidates = [ 'C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe' ] const chrome = process.env.CHROME_PATH || browserCandidates.find(existsSync) +const cdpPort = Number(process.env.BITERSTORE_CDP_PORT || 9347) const artifactDir = process.env.BITERSTORE_H5_ARTIFACT_DIR || path.join(root, 'qa-artifacts', 'h5-actual') const distDir = path.join(root, 'dist') const profileDir = path.join(root, 'qa-artifacts', `chrome-cdp-profile-${process.pid}`) @@ -46,6 +47,7 @@ const allTargets = [ ['publish-600', 600, 900, '/publish'], ['publish-768', 768, 1024, '/publish'], ['publish-1440', 1440, 900, '/publish'], + ['publish-2048', 2048, 1100, '/publish'], ['messages-320', 320, 700, '/messages'], ['messages-390', 390, 900, '/messages'], ['messages-600', 600, 900, '/messages'], @@ -179,6 +181,8 @@ const authenticatedFixture = `(() => { })();` const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms)) +const waitForLoad = (event, timeout = 5000) => Promise.race([event, delay(timeout)]) +const trace = (label) => { if (process.env.BITERSTORE_H5_TRACE === '1') console.error(`[h5-visual] ${label}`) } async function waitForEndpoint(url) { for (let attempt = 0; attempt < 30; attempt += 1) { try { const response = await fetch(url); if (response.ok) return response } catch { /* Chrome is starting */ } @@ -269,13 +273,14 @@ if (!process.env.BITERSTORE_H5_URL) { previewServer.listen(Number(previewUrl.port || 80), previewUrl.hostname, resolve) }) } -const browser = spawn(chrome, ['--headless=new', '--no-first-run', '--no-sandbox', '--disable-gpu', '--disable-gpu-sandbox', '--use-angle=swiftshader', '--remote-allow-origins=*', '--remote-debugging-port=9333', `--user-data-dir=${profileDir}`, 'about:blank'], { windowsHide: true, stdio: 'ignore' }) +const browser = spawn(chrome, ['--headless=new', '--no-first-run', '--no-default-browser-check', '--disable-extensions', '--disable-sync', '--disable-component-update', '--no-sandbox', '--disable-gpu', '--disable-gpu-sandbox', '--use-angle=swiftshader', '--remote-allow-origins=*', `--remote-debugging-port=${cdpPort}`, `--user-data-dir=${profileDir}`, 'about:blank'], { windowsHide: true, stdio: 'ignore' }) let client const diagnostics = [] const pages = [] +let dockMotion try { - await waitForEndpoint('http://127.0.0.1:9333/json/version') - const tabResponse = await fetch(`http://127.0.0.1:9333/json/new?${encodeURIComponent(`${preview}/`)}`, { method: 'PUT' }) + await waitForEndpoint(`http://127.0.0.1:${cdpPort}/json/version`) + const tabResponse = await fetch(`http://127.0.0.1:${cdpPort}/json/new?${encodeURIComponent(`${preview}/`)}`, { method: 'PUT' }) const tab = await tabResponse.json() client = new CdpClient(tab.webSocketDebuggerUrl, (message) => { if (message.method === 'Runtime.exceptionThrown') diagnostics.push({ type: 'exception', text: message.params.exceptionDetails?.text || 'Runtime exception' }) @@ -286,10 +291,11 @@ try { await client.send('Storage.clearDataForOrigin', { origin: preview, storageTypes: 'all' }) await client.send('Page.addScriptToEvaluateOnNewDocument', { source: authenticatedFixture }) for (const [name, width, height, route, requestedScale = 1] of targets) { + trace(`target:${name}:start`) await client.send('Emulation.setDeviceMetricsOverride', { width, height, deviceScaleFactor: requestedScale, mobile: width < 700 }) const loaded = client.once('Page.loadEventFired') await client.send('Page.navigate', { url: `${preview}${route}` }) - await loaded + await waitForLoad(loaded) await delay(750) await client.send('Runtime.evaluate', { expression: `window.scrollTo(0, 0); document.querySelectorAll('.taro_router, .taro_page, .content-scroll').forEach((element) => { element.scrollTop = 0 })` }) await delay(100) @@ -310,7 +316,16 @@ try { } if (name === 'feedback-390' && (!pageState.result.value.text.includes('提交 Bug') || !pageState.result.value.text.includes('提交建议') || !pageState.result.value.text.includes('反馈内容'))) diagnostics.push({ type: 'feedback-form-incomplete', text: name }) if (expectedPageClass[name] && !pageState.result.value.shell?.className.includes(expectedPageClass[name])) diagnostics.push({ type: 'unexpected-page', text: `${name}: expected ${expectedPageClass[name]}, got ${pageState.result.value.shell?.className || 'no shell'}` }) - if (name === 'detail-guest-390' && !pageState.result.value.text.includes('ISBN 9787040396638')) diagnostics.push({ type: 'missing-guest-listing-detail', text: name }) + // The catalogue is local-first: a locally seeded id is served from the seed + // with no listing request, so the guest detail page renders the seeded + // record rather than any API fixture. Assert the record really rendered and + // that no login gate was shown instead. + if (name === 'detail-guest-390') { + const guestText = pageState.result.value.text + const showsRecord = guestText.includes('ISBN 978-7-5608-9493-7') && guestText.includes('高等数学(第七版)上册') + const showsGate = guestText.includes('登录梨苑儿') || guestText.includes('统一身份认证密码') + if (!showsRecord || showsGate) diagnostics.push({ type: 'missing-guest-listing-detail', text: name + ':' + showsRecord + ':' + showsGate }) + } const layout = pageState.result.value.layout if (layout?.documentScroll?.scrollWidth > width + 1) diagnostics.push({ type: 'horizontal-overflow', text: `${name}: document ${layout.documentScroll.scrollWidth}px > viewport ${width}px` }) if (layout?.stageCoversViewport === false || !layout?.stageBackground || layout.stageBackground === 'none') diagnostics.push({ type: 'background-not-covered', text: `${name}: ${JSON.stringify({ stageRect: layout?.stageRect, viewport: layout?.viewport, background: layout?.stageBackground })}` }) @@ -331,12 +346,88 @@ try { if (name === 'messages-390' && !pageState.result.value.text.includes('新消息 · 你好,这本书还在吗?')) diagnostics.push({ type: 'missing-unread-preview', text: name }) if (name === 'not-found-390' && !pageState.result.value.text.includes('好像翻错书页了')) diagnostics.push({ type: 'missing-not-found-state', text: name }) if (name === 'messages-390' && [...(pageState.result.value.metrics['.thread-list h3 span'] ? [pageState.result.value.metrics['.thread-list h3 span']] : [])].some((metric) => metric.height > 28)) diagnostics.push({ type: 'wrapped-campus-label', text: `${name}: ${JSON.stringify(pageState.result.value.metrics['.thread-list h3 span'])}` }) + if (name.startsWith('publish-')) { + const publishLabel = await client.send('Runtime.evaluate', { expression: `(() => { const label = document.querySelector('.bottom-nav .nav-item.publish > span'); if (!label) return null; const style = getComputedStyle(label); return { fontSize: Number.parseFloat(style.fontSize), fontWeight: style.fontWeight }; })()`, returnByValue: true }) + const minimumSize = width >= 1024 ? 17.5 : 11 + if (!publishLabel.result.value || publishLabel.result.value.fontSize < minimumSize) diagnostics.push({ type: 'publish-label-too-small', text: `${name}: ${JSON.stringify(publishLabel.result.value)}` }) + } const result = await client.send('Page.captureScreenshot', { format: 'png', fromSurface: true }) await fs.writeFile(path.join(artifactDir, `${name}.png`), Buffer.from(result.data, 'base64')) + trace(`target:${name}:done`) + } + const dockStateExpression = "(() => { const nav = document.querySelector('.bottom-nav'); const label = document.querySelector('.bottom-nav .nav-item.publish > span'); const items = nav ? [...nav.querySelectorAll('.nav-item')] : []; const rect = (node) => { const box = node.getBoundingClientRect(); return { left: box.left, top: box.top, width: box.width, height: box.height, bottom: box.bottom } }; return { ok: Boolean(nav && label && items.length === 5), nav: nav ? rect(nav) : null, items: items.map(rect), labelSize: label ? Number.parseFloat(getComputedStyle(label).fontSize) : 0, transitionProperty: nav ? getComputedStyle(nav).transitionProperty : '', transitionDuration: nav ? getComputedStyle(nav).transitionDuration : '', itemTransitionProperty: items.length ? getComputedStyle(items[0]).transitionProperty : '', itemTransitionDuration: items.length ? getComputedStyle(items[0]).transitionDuration : '' } })()" + const evaluateInPage = async (expression) => (await client.send('Runtime.evaluate', { expression, returnByValue: true })).result.value + const readDockState = async () => evaluateInPage(dockStateExpression) + // Freeze the responsive morph instead of racing the compositor: pausing every + // running transition lets the same 380ms animation be sampled at exact, + // repeatable offsets. rAF sampling cannot promise that a mid-frame survives. + const freezeDockExpression = "(() => { const animations = [...document.getAnimations()]; for (const animation of animations) { animation.pause(); animation.currentTime = 0 } window.__dockAnimations = animations; const transitions = animations.filter((animation) => animation.transitionProperty); return { total: animations.length, transitions: transitions.length, properties: [...new Set(transitions.map((animation) => animation.transitionProperty))] } })()" + const seekDockExpression = (time) => "(() => { for (const animation of (window.__dockAnimations || [])) animation.currentTime = " + time + "; return true })()" + const resumeDockExpression = "(() => { for (const animation of (window.__dockAnimations || [])) animation.play(); window.__dockAnimations = []; return true })()" + await client.send('Emulation.setDeviceMetricsOverride', { width: 1023, height: 900, deviceScaleFactor: 1, mobile: false }) + trace('dock:navigate') + const dockLoaded = client.once('Page.loadEventFired') + await client.send('Page.navigate', { url: `${preview}/profile` }) + await waitForLoad(dockLoaded) + await delay(750) + trace('dock:from') + const from = await readDockState() + await client.send('Emulation.setDeviceMetricsOverride', { width: 1024, height: 900, deviceScaleFactor: 1, mobile: false }) + const frozen = await evaluateInPage(freezeDockExpression) + const moments = [] + for (const time of [40, 80, 120, 160, 200, 240, 280, 320]) { + await evaluateInPage(seekDockExpression(time)) + moments.push({ time, state: await readDockState() }) + } + await evaluateInPage(resumeDockExpression) + await delay(500) + const to = await readDockState() + trace('dock:to') + const axes = ['left', 'top', 'width', 'height'] + const spread = (values) => Math.max(...values) - Math.min(...values) + const sampled = moments.filter((moment) => moment.state?.ok) + const barIsOneRow = from?.ok && spread(from.items.map((item) => item.top)) <= 12 + const barColumnsEven = from?.ok && from.items.every((item, index) => index === 0 || Math.abs((item.left - from.items[index - 1].left) - from.items[0].width) <= 2) + const railIsOneColumn = to?.ok && spread(to.items.map((item) => item.left)) <= 2 + const railRowsEven = to?.ok && to.items.every((item, index) => index === 0 || Math.abs((item.top - to.items[index - 1].top) - to.items[0].height) <= 2) + const railSlotsAreNarrow = to?.ok && to.items.every((item) => item.width <= to.nav.width - 12) + const frozenGeometry = Boolean(frozen && axes.every((axis) => frozen.properties.includes(axis))) + const tweenFaults = from?.ok && to?.ok && sampled.length === moments.length ? from.items.flatMap((item, index) => axes.flatMap((axis) => { + if (Math.abs(to.items[index][axis] - item[axis]) < 24) return [] + const moves = sampled.some((moment) => Math.abs(moment.state.items[index][axis] - item[axis]) > 4 && Math.abs(moment.state.items[index][axis] - to.items[index][axis]) > 4) + return moves ? [] : [{ item: index, axis, from: +item[axis].toFixed(1), to: +to.items[index][axis].toFixed(1), samples: sampled.map((moment) => +moment.state.items[index][axis].toFixed(1)) }] + })) : [{ item: -1, axis: 'missing-moment', from: 0, to: 0, samples: [] }] + // No action may grow past the two settled layouts mid-flight: a bar box sized + // in percentages would double in size halfway and overlap its neighbours. + const boxStaysWithinLayout = from?.ok && to?.ok && sampled.every((moment) => moment.state.items.every((entry, index) => entry.width <= Math.max(from.items[index].width, to.items[index].width) + 2 && entry.height <= Math.max(from.items[index].height, to.items[index].height) + 2)) + // Somewhere in the morph the five actions must sit on five distinct slots at + // once - ordered vertically and no longer sharing one row position. + const independentTrajectories = sampled.some((moment) => moment.state.items.every((item, index) => index === 0 || item.top - moment.state.items[index - 1].top >= 8) && spread(moment.state.items.map((item) => item.left)) > 8) + const midpoint = sampled[Math.floor(sampled.length / 2)]?.state + dockMotion = { + from: from && { nav: from.nav, items: from.items }, + midpoint: midpoint && { nav: midpoint.nav, items: midpoint.items }, + to: to && { nav: to.nav, items: to.items }, + frozen: frozen && { transitions: frozen.transitions, properties: frozen.properties } + } + const dockChecks = { + frozenTransitions: frozen?.transitions, frozenProperties: frozen?.properties, frozenGeometry, + barIsOneRow, barColumnsEven, railIsOneColumn, railRowsEven, railSlotsAreNarrow, boxStaysWithinLayout, independentTrajectories, + sampledMoments: sampled.length, tweenFaults, labelSize: to?.labelSize + } + if (!from?.ok || !to?.ok || !frozen || !frozenGeometry || frozen.transitions < 20 + || !barIsOneRow || !barColumnsEven || !railIsOneColumn || !railRowsEven || !railSlotsAreNarrow + || !boxStaysWithinLayout || !independentTrajectories || sampled.length !== moments.length || tweenFaults.length + || to.labelSize < 17.5 + || !String(from.transitionDuration).includes('0.38s') || !String(from.itemTransitionDuration).includes('0.38s') + || !String(from.transitionProperty).includes('width') || !String(from.itemTransitionProperty).includes('left') || !String(from.itemTransitionProperty).includes('top')) { + diagnostics.push({ type: 'responsive-dock-motion', text: JSON.stringify(dockChecks) }) } + trace('back:start') await checkBackNavigation(client, preview, artifactDir) + trace('back:done') if (process.env.BITERSTORE_CHECK_ADMIN === '1') await checkAdminReview(client, artifactDir) - console.log(JSON.stringify({ ok: diagnostics.length === 0, artifactDir, viewports: targets.map(([, width, height, , scale = 1]) => `${width}x${height}@${scale}x`), pages, diagnostics })) + console.log(JSON.stringify({ ok: diagnostics.length === 0, artifactDir, viewports: targets.map(([, width, height, , scale = 1]) => `${width}x${height}@${scale}x`), pages, dockMotion, diagnostics })) if (diagnostics.length) process.exitCode = 1 } finally { client?.close() diff --git a/miniProgram/src/h5.css b/miniProgram/src/h5.css index 66a616a..11bc3db 100644 --- a/miniProgram/src/h5.css +++ b/miniProgram/src/h5.css @@ -52,7 +52,7 @@ button, a { -webkit-tap-highlight-color: transparent; } .top-actions { gap: 2px; } .icon-button { width: 38px; } .content-scroll { padding-left: 10px; padding-right: 10px; } - .bottom-nav { left: 6px; right: 6px; padding-inline: 3px; } + .bottom-nav { left: 6px; right: auto; width: calc(100% - 12px); padding-inline: 3px; } .nav-item { font-size: 10.5px; } .nav-item svg { width: 20px; height: 20px; } .notification-grid { grid-template-columns: 1fr; } @@ -74,7 +74,7 @@ button, a { -webkit-tap-highlight-color: transparent; } .phone-shell { width: 100%; height: 100%; min-height: 100%; border-radius: clamp(24px, 5vw, 28px); } .topbar { padding-inline: clamp(22px, 5vw, 28px); } .content-scroll { height: calc(100% - 76px); padding-inline: clamp(18px, 5vw, 28px); } - .bottom-nav { left: clamp(14px, 4vw, 22px); right: clamp(14px, 4vw, 22px); } + .bottom-nav { left: clamp(14px, 4vw, 22px); right: auto; width: calc(100% - clamp(28px, 8vw, 44px)); } .hero-copy { width: 60%; } .hero-tobby { width: clamp(180px, 42vw, 225px); height: clamp(180px, 42vw, 225px); } .book-row { grid-auto-columns: minmax(155px, 40%); } @@ -134,7 +134,7 @@ button, a { -webkit-tap-highlight-color: transparent; } @media (max-height: 700px) { .topbar { height: 68px; padding-top: max(9px, env(safe-area-inset-top)); padding-bottom: 7px; } .content-scroll { height: calc(100% - 68px); padding-top: 8px; } - .bottom-nav { bottom: max(5px, env(safe-area-inset-bottom)); height: 64px; } + .bottom-nav { top: calc(100% - 64px - max(5px, env(safe-area-inset-bottom))); bottom: auto; height: 64px; } .nav-item { gap: 3px; } .welcome-page { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: 18px; } .welcome-copy { margin-top: 16px; } @@ -148,7 +148,7 @@ button, a { -webkit-tap-highlight-color: transparent; } @media (min-width: 1024px) and (max-height: 700px) { .topbar { height: 76px; } .content-scroll { height: calc(100% - 76px); padding-top: 10px; } - .bottom-nav { top: 88px; bottom: 16px; height: auto; min-height: 0; grid-template-rows: repeat(5, minmax(0, 1fr)); overflow: hidden; } + .bottom-nav { top: 88px; bottom: auto; height: calc(100% - 104px); min-height: 0; grid-template-rows: repeat(5, minmax(0, 1fr)); overflow: hidden; } .nav-item { min-height: 0; } } @@ -156,16 +156,40 @@ button, a { -webkit-tap-highlight-color: transparent; } @media (orientation: landscape) and (min-width: 700px) and (max-width: 1023px) and (max-height: 500px) { .content-scroll { padding-left: 120px; padding-right: 24px; padding-bottom: 24px; } - .bottom-nav { left: 18px; right: auto; top: 82px; bottom: 12px; width: 82px; height: auto; grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(46px, 1fr)); align-items: stretch; padding: 7px; border-radius: 21px; } + .bottom-nav { left: 18px; right: auto; top: 82px; bottom: auto; width: 82px; height: calc(100% - 94px); grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(46px, 1fr)); align-items: stretch; padding: 7px; border-radius: 21px; } .nav-item { min-height: 46px; justify-content: center; gap: 2px; border-radius: 14px !important; font-size: 10.5px; } .nav-item svg { width: 19px; height: 19px; } .nav-item.active:not(.publish) { background: #e8ecdc; } - .nav-item.active:not(.publish)::before { display: none; } + .nav-item.active:not(.publish)::before { opacity: 0; transform: scale(.72); } .nav-item.publish { transform: none; color: white; background: var(--sage); } - .nav-item.publish::before, .nav-item.publish::after { display: none; } - .nav-item.publish > span { font-size: 10.5px; transform: none; } + .nav-item.publish::before, .nav-item.publish::after { opacity: 0; transform: scale(.72); } + .nav-item.publish::after { animation: none; } + .nav-item.publish > span { font-size: 12.5px; transform: none; } .hero-card { min-height: 176px; } .hero-copy { padding-top: 20px; padding-bottom: 18px; } .hero-copy h1 { font-size: 29px; } .hero-tobby { width: 180px; height: 180px; bottom: -24px; } } + +/* H5 is loaded after the Golden Reference stylesheet. Keep the independent + * Dock slots and desktop scale authoritative over the compatibility media + * rules above. */ +.bottom-nav { padding: 0; } + +@media (min-width: 1024px) { + .content-scroll { padding-left: clamp(164px, 11vw, 260px); } + .bottom-nav { --dock-rail-width: clamp(118px, 8.4vw, 210px); width: var(--dock-rail-width); } + .nav-item { gap: clamp(7px, .6vw, 12px); font-size: clamp(15px, 1vw, 24px); } + .nav-item svg { width: clamp(26px, 1.55vw, 40px); height: clamp(26px, 1.55vw, 40px); } + .nav-item.publish > svg { width: clamp(29px, 1.8vw, 46px); height: clamp(29px, 1.8vw, 46px); } + .nav-item.publish > span { font-size: clamp(18px, 1.15vw, 28px); } + .page-topbar h1 { font-size: clamp(25px, 1.8vw, 40px); } + .upload-heading { font-size: clamp(17px, 1.25vw, 28px); } + .upload-instruction { font-size: clamp(12px, .9vw, 20px); } + .required-image-button svg, .add-image svg { width: clamp(28px, 1.8vw, 44px); height: clamp(28px, 1.8vw, 44px); } + .required-image-button strong, .add-image strong { font-size: clamp(14px, 1vw, 23px); } + .required-image-button span, .add-image span { font-size: clamp(10px, .78vw, 17px); } + .stepper span { width: clamp(30px, 2.2vw, 46px); height: clamp(30px, 2.2vw, 46px); font-size: clamp(12px, .82vw, 18px); } + .stepper p { font-size: clamp(11px, .8vw, 17px); } + .stepper i { top: clamp(15px, 1.1vw, 23px); } +} diff --git a/miniProgram/test/style-alignment.test.ts b/miniProgram/test/style-alignment.test.ts index dd78267..8f4acc7 100644 --- a/miniProgram/test/style-alignment.test.ts +++ b/miniProgram/test/style-alignment.test.ts @@ -163,6 +163,35 @@ describe('Golden Reference style alignment', () => { expect(visual).toContain("file = path.join(distDir, 'index.html')") expect(visual).toContain("type: 'horizontal-overflow'") expect(visual).toContain("type: 'fixed-compact-canvas'") + expect(visual).toContain("type: 'responsive-dock-motion'") + }) + + it('H5 Dock 放大发布标签并沿用较宽桌面轨道', () => { + const goldenCss = read('../web/app/globals.css') + const h5Css = read('src/h5.css') + expect(goldenCss).toContain('--motion-fluid: 380ms cubic-bezier(.22, 1, .36, 1)') + expect(goldenCss).toContain('transition-duration: var(--motion-fluid-duration)') + expect(goldenCss).toContain('.nav-item.publish > span { font-size: 15px; line-height: 1.15; transform: none; }') + expect(goldenCss).toContain('.nav-item.publish > span { font-size: clamp(18px, 1.15vw, 28px); }') + expect(h5Css).toContain('.bottom-nav { --dock-rail-width: clamp(118px, 8.4vw, 210px); width: var(--dock-rail-width); }') + expect(h5Css).toContain('height: calc(100% - 104px)') + }) + + it('H5 Dock 的五个动作各自补间到独立槽位,且不补间网格轨道', () => { + const goldenCss = read('../web/app/globals.css') + expect(goldenCss).toContain('transition-property: left, top, width, height, padding, border-radius, border-color, background-color, box-shadow;') + expect(goldenCss).toContain('.nav-item { transition: left var(--motion-fluid), top var(--motion-fluid), width var(--motion-fluid), height var(--motion-fluid),') + expect(goldenCss).toContain('left: calc(var(--dock-slot) * 20%);') + expect(goldenCss).toContain('height: 54px;') + expect(goldenCss).toContain('.bottom-nav .nav-item:nth-child(5) { --dock-slot: 4; }') + expect(goldenCss).toContain('.bottom-nav .nav-item:nth-child(5) { top: calc(80% - 6px); }') + expect(goldenCss).toContain('width: calc(var(--dock-rail-width) - 20px);') + expect(goldenCss).toContain('--dock-rail-width: clamp(118px, 8.4vw, 210px); width: var(--dock-rail-width);') + expect(goldenCss).toContain('.bottom-nav .nav-item.publish { top: -1px; }') + expect(goldenCss).toContain('.nav-item.publish:active { transform: scale(.96); }') + expect(goldenCss).not.toContain('transition-behavior: allow-discrete') + expect(goldenCss).not.toContain('.nav-item.publish { transform: translateY(-9px); }') + expect(goldenCss).not.toMatch(/transition-property:[^;]*grid-template/) }) it('injects the ignored local AppID and stable base-library version into every WeApp build', () => { diff --git a/web/app/globals.css b/web/app/globals.css index 75df851..e739a14 100644 --- a/web/app/globals.css +++ b/web/app/globals.css @@ -15,6 +15,9 @@ --gold: #c8ae72; --aqua: #78d8c6; --shadow: 0 14px 34px rgba(76, 73, 54, .11); + --motion-quick: 180ms cubic-bezier(.2, .72, .24, 1); + --motion-fluid-duration: 380ms; + --motion-fluid: 380ms cubic-bezier(.22, 1, .36, 1); } * { box-sizing: border-box; } @@ -138,10 +141,9 @@ button, a { -webkit-tap-highlight-color: transparent; } .rank-item small { margin-top: 3px; color: var(--muted); font-size: 9px; } .rank-item b { color: var(--price); font: 700 13px Georgia, serif; } -.bottom-nav { position: absolute; z-index: 10; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom)); height: 72px; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 8px 7px 7px; border: 1px solid rgba(213,199,167,.84); border-radius: 25px; background: rgba(255,253,248,.94); box-shadow: 0 12px 32px rgba(64,67,53,.18); backdrop-filter: blur(16px); } +.bottom-nav { position: absolute; z-index: 10; left: 12px; right: auto; top: calc(100% - 72px - max(10px, env(safe-area-inset-bottom))); bottom: auto; width: calc(100% - 24px); height: 72px; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 8px 7px 7px; border: 1px solid rgba(213,199,167,.84); border-radius: 25px; background: rgba(255,253,248,.94); box-shadow: 0 12px 32px rgba(64,67,53,.18); backdrop-filter: blur(16px); } .nav-item { min-height: 51px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; color: #707268; font-size: 10px; position: relative; } .nav-item.active { color: var(--olive); font-weight: 700; } -.nav-item.publish { transform: translateY(-9px); } .nav-item.publish::before { content: ''; position: absolute; z-index: -1; width: 54px; height: 54px; bottom: -1px; border: 5px solid var(--paper); border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 1px var(--border), 0 7px 16px rgba(79,89,64,.23); } .nav-item.publish { color: white; } .nav-icon { width: 20px; height: 20px; position: relative; display: block; } @@ -726,6 +728,22 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .profile-reminder button svg { width: 13px; } @media (prefers-reduced-motion: no-preference) { + .app-stage, .route-view, .phone-shell, .topbar, .content-scroll, .bottom-nav { + transition-duration: var(--motion-fluid-duration); + transition-timing-function: cubic-bezier(.22, 1, .36, 1); + } + .app-stage { transition-property: padding; } + .route-view { transition-property: width, max-width, height; } + .phone-shell { transition-property: width, height, min-height, border-radius, border-color, box-shadow; } + .topbar { transition-property: height, padding; } + .content-scroll { transition-property: height, padding, width, max-width; } + .bottom-nav { + /* Grid templates are intentionally NOT transitioned: pairing them with + * allow-discrete wedges Chrome's layout (measured: >30s of unresponsive + * main thread at the 1023 -> 1024 rail breakpoint) and the Dock slots are + * absolutely positioned, so track animation buys nothing. */ + transition-property: left, top, width, height, padding, border-radius, border-color, background-color, box-shadow; + } .route-view.route-forward { animation: route-in .26s cubic-bezier(.2,.72,.24,1) both; } .toast { animation: toast-pop .28s cubic-bezier(.18,.89,.32,1.22) both; } .sheet-layer { animation: fade-in .18s ease-out both; } @@ -740,12 +758,15 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .route-view:not(.route-back) .publish-page .upload-card, .route-view:not(.route-back) .publish-page .ai-card, .route-view:not(.route-back) .publish-page .form-card, .route-view:not(.route-back) .publish-page .publish-preview { animation: card-rise .28s ease-out both; } .nav-item.publish::after { animation: sparkle 2.4s ease-in-out infinite; } .search-tobby-hint img { animation: hint-float 3.6s ease-in-out infinite; } - button:not(.nav-item), .listing-card, .thread-list > button, .profile-menu > button, .book-tile { transition: transform .18s cubic-bezier(.2,.72,.24,1), border-color .18s ease, background-color .18s ease, box-shadow .18s ease; } + button:not(.nav-item), .listing-card, .thread-list > button, .profile-menu > button, .book-tile { transition: transform var(--motion-quick), color var(--motion-quick), opacity var(--motion-quick), border-color var(--motion-quick), background-color var(--motion-quick), box-shadow var(--motion-quick); } button:not(.nav-item):active, .profile-menu > button:active, .thread-list > button:active { transform: scale(.975); } - .nav-item { transition: color .2s ease, transform .2s cubic-bezier(.2,.72,.24,1); } + .nav-item { transition: left var(--motion-fluid), top var(--motion-fluid), width var(--motion-fluid), height var(--motion-fluid), color var(--motion-quick), background-color var(--motion-fluid), border-radius var(--motion-fluid), gap var(--motion-fluid), transform var(--motion-quick); } + .nav-item > svg, .nav-item > span { transition: width var(--motion-fluid), height var(--motion-fluid), font-size var(--motion-fluid), letter-spacing var(--motion-fluid), transform var(--motion-fluid), opacity var(--motion-quick); } + .nav-item::before, .nav-item::after { transition: width var(--motion-fluid), height var(--motion-fluid), inset var(--motion-fluid), opacity var(--motion-quick), transform var(--motion-fluid), border-radius var(--motion-fluid), box-shadow var(--motion-fluid); } .nav-item:active { transform: translateY(1px) scale(.96); } - .nav-item.publish:active { transform: translateY(-8px) scale(.96); } + .nav-item.publish:active { transform: scale(.96); } .form-field input, .form-field select, .form-field textarea, .chat-composer input { transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease; } + .stepper > div, .stepper span, .stepper i, .tag-picker button, .chip, .required-image-button, .add-image, .ai-card, .upload-card, .form-card, .publish-preview { transition: color var(--motion-quick), opacity var(--motion-quick), transform var(--motion-quick), border-color var(--motion-quick), background-color var(--motion-quick), box-shadow var(--motion-quick); } } @keyframes route-in { from { opacity: 0; transform: translateY(7px) scale(.995); } to { opacity: 1; transform: none; } } @@ -822,8 +843,9 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .rank-price small { margin-top: 5px; color: #8b8c80; font-size: 8px; } .rank-item > svg { width: 14px; color: #9b9a8e; } -.nav-item.publish { justify-content: center; gap: 1px; padding-top: 3px; } -.nav-item.publish > span { font-size: 9px; line-height: 1; transform: translateY(-2px); } +.nav-item.publish { justify-content: center; gap: 3px; padding-top: 2px; } +.nav-item.publish > svg { width: 22px; height: 22px; } +.nav-item.publish > span { font-size: 11.5px; line-height: 1.1; font-weight: 800; letter-spacing: .04em; transform: translateY(-1px); } .notification-grid > button { padding-right: 24px; } .notification-grid > button small { display: block; margin-top: 6px; color: var(--sage); font-size: 9px; font-weight: 700; } @@ -946,7 +968,7 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .route-view > .login-page { width: min(100%, 430px); margin-inline: auto; } .topbar { height: 82px; padding: 17px 30px 11px; } .content-scroll { height: calc(100% - 82px); padding: 12px 30px 116px; } - .bottom-nav { left: 26px; right: 26px; } + .bottom-nav { left: 26px; right: auto; top: calc(100% - 98px); width: calc(100% - 52px); } .hero-card { min-height: 250px; } .hero-copy { width: 58%; padding: 32px 0 28px 34px; } @@ -1006,14 +1028,16 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .topbar .brand { font-size: 28px; } .content-scroll { height: calc(100% - 88px); padding: 18px 38px 38px 164px; overscroll-behavior: auto; } - .bottom-nav { left: 26px; right: auto; top: 106px; bottom: 24px; width: 110px; height: auto; grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(66px, 1fr)); align-items: stretch; padding: 12px 9px; border-radius: 24px; } + .bottom-nav { left: 26px; right: auto; top: 106px; bottom: auto; width: 110px; height: calc(100% - 130px); grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(66px, 1fr)); align-items: stretch; padding: 12px 9px; border-radius: 24px; } .nav-item { min-height: 64px; justify-content: center; gap: 7px; border-radius: 17px !important; font-size: 13px; } .nav-item svg { width: 22px; height: 22px; } .nav-item.active:not(.publish) { background: #e8ecdc; } - .nav-item.active:not(.publish)::before { display: none; } + .nav-item.active:not(.publish)::before { opacity: 0; transform: scale(.72); } .nav-item.publish { transform: none; color: white; background: var(--sage); } - .nav-item.publish::before, .nav-item.publish::after { display: none; } - .nav-item.publish > span { font-size: 13px; transform: none; } + .nav-item.publish::before, .nav-item.publish::after { opacity: 0; transform: scale(.72); } + .nav-item.publish::after { animation: none; } + .nav-item.publish > svg { width: 25px; height: 25px; } + .nav-item.publish > span { font-size: 15px; line-height: 1.15; transform: none; } .nav-item.publish:active { transform: scale(.97); } .home-page .content-scroll { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); grid-auto-rows: min-content; gap: 14px 22px; } @@ -1083,7 +1107,7 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .route-view { height: calc(100dvh - 16px); } .topbar { height: 64px; padding: 10px 24px 8px; } .content-scroll { height: calc(100% - 64px); padding: 8px 24px 78px; } - .bottom-nav { left: 24px; right: 24px; bottom: 8px; height: 60px; padding-block: 4px; } + .bottom-nav { left: 24px; right: auto; top: calc(100% - 68px); bottom: auto; width: calc(100% - 48px); height: 60px; padding-block: 4px; } .nav-item { min-height: 48px; gap: 2px; } .detail-page .content-scroll { gap: 10px 16px; } .detail-gallery { min-height: 260px; } @@ -1096,7 +1120,7 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .route-view { height: calc(100dvh - 24px); } .topbar { height: 72px; padding: 12px 28px 9px; } .content-scroll { height: calc(100% - 72px); padding: 10px 28px 24px 138px; } - .bottom-nav { left: 18px; top: 84px; bottom: 14px; width: 96px; grid-template-rows: repeat(5, minmax(48px, 1fr)); padding: 7px; } + .bottom-nav { left: 18px; top: 84px; bottom: auto; width: 96px; height: calc(100% - 98px); grid-template-rows: repeat(5, minmax(48px, 1fr)); padding: 7px; } .nav-item { min-height: 48px; gap: 3px; } .detail-page .content-scroll { gap: 10px 18px; } .detail-gallery { min-height: clamp(340px, calc(100dvh - 180px), 460px); } @@ -1113,7 +1137,7 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .top-actions { gap: 2px; } .icon-button { width: 38px; } .content-scroll { padding-left: 10px; padding-right: 10px; } - .bottom-nav { left: 6px; right: 6px; padding-inline: 3px; } + .bottom-nav { left: 6px; right: auto; width: calc(100% - 12px); padding-inline: 3px; } .nav-item { font-size: 10.5px; } .nav-item svg { width: 20px; height: 20px; } .notification-grid { grid-template-columns: 1fr; } @@ -1135,7 +1159,7 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .phone-shell { width: 100%; height: 100%; min-height: 100%; border-radius: clamp(24px, 5vw, 28px); } .topbar { padding-inline: clamp(22px, 5vw, 28px); } .content-scroll { height: calc(100% - 76px); padding-inline: clamp(18px, 5vw, 28px); } - .bottom-nav { left: clamp(14px, 4vw, 22px); right: clamp(14px, 4vw, 22px); } + .bottom-nav { left: clamp(14px, 4vw, 22px); right: auto; width: calc(100% - clamp(28px, 8vw, 44px)); } .hero-copy { width: 60%; } .hero-tobby { width: clamp(180px, 42vw, 225px); height: clamp(180px, 42vw, 225px); } .book-row { grid-auto-columns: minmax(155px, 40%); } @@ -1196,7 +1220,7 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; @media (max-height: 700px) { .topbar { height: 68px; padding-top: max(9px, env(safe-area-inset-top)); padding-bottom: 7px; } .content-scroll { height: calc(100% - 68px); padding-top: 8px; } - .bottom-nav { bottom: max(5px, env(safe-area-inset-bottom)); height: 64px; } + .bottom-nav { top: calc(100% - 64px - max(5px, env(safe-area-inset-bottom))); bottom: auto; height: 64px; } .nav-item { gap: 3px; } .welcome-page { padding-top: max(18px, env(safe-area-inset-top)); padding-bottom: 18px; } .welcome-copy { margin-top: 16px; } @@ -1210,20 +1234,21 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; @media (min-width: 1024px) and (max-height: 700px) { .topbar { height: 76px; } .content-scroll { height: calc(100% - 76px); padding-top: 10px; } - .bottom-nav { top: 88px; bottom: 16px; height: auto; min-height: 0; grid-template-rows: repeat(5, minmax(0, 1fr)); overflow: hidden; } + .bottom-nav { top: 88px; bottom: auto; height: calc(100% - 104px); min-height: 0; grid-template-rows: repeat(5, minmax(0, 1fr)); overflow: hidden; } .nav-item { min-height: 0; } } @media (orientation: landscape) and (min-width: 700px) and (max-width: 1023px) and (max-height: 500px) { .content-scroll { padding-left: 120px; padding-right: 24px; padding-bottom: 24px; } - .bottom-nav { left: 18px; right: auto; top: 82px; bottom: 12px; width: 82px; height: auto; grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(46px, 1fr)); align-items: stretch; padding: 7px; border-radius: 21px; } + .bottom-nav { left: 18px; right: auto; top: 82px; bottom: auto; --dock-rail-width: 82px; width: var(--dock-rail-width); height: calc(100% - 94px); grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(46px, 1fr)); align-items: stretch; padding: 7px; border-radius: 21px; } .nav-item { min-height: 46px; justify-content: center; gap: 2px; border-radius: 14px !important; font-size: 10.5px; } .nav-item svg { width: 19px; height: 19px; } .nav-item.active:not(.publish) { background: #e8ecdc; } - .nav-item.active:not(.publish)::before { display: none; } + .nav-item.active:not(.publish)::before { opacity: 0; transform: scale(.72); } .nav-item.publish { transform: none; color: white; background: var(--sage); } - .nav-item.publish::before, .nav-item.publish::after { display: none; } - .nav-item.publish > span { font-size: 10.5px; transform: none; } + .nav-item.publish::before, .nav-item.publish::after { opacity: 0; transform: scale(.72); } + .nav-item.publish::after { animation: none; } + .nav-item.publish > span { font-size: 12.5px; transform: none; } .hero-card { min-height: 176px; } .hero-copy { padding-top: 20px; padding-bottom: 18px; } .hero-copy h1 { font-size: 29px; } @@ -1240,3 +1265,68 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; .report-progress-card .report-number { display: block; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; } .report-progress-card time, .report-time { display: block; margin-top: 5px; font-size: 11px; color: var(--muted); } .notification-feed p, .notification-feed .feed-copy { white-space: pre-wrap; overflow-wrap: anywhere; } + +/* Give every Dock action its own independently interpolated slot. Slot + * geometry is expressed in percentages of the Dock box, so when the window + * crosses the bar/rail breakpoint each of the five actions travels its own + * trajectory instead of snapping as a single grid row. transform is left free + * for the press feedback declared with the other motion rules. */ +.bottom-nav { padding: 0; } +.bottom-nav .nav-item { + position: absolute; + left: calc(var(--dock-slot) * 20%); + top: 8px; + bottom: auto; + width: 20%; + /* A length, not calc(100% - 16px): a bar-side percentage keeps growing with + * the container while the rail-side fraction shrinks, so the box inflates + * mid-flight and the chips overlap. A length interpolates monotonically. */ + height: 54px; + min-height: 0; +} +.bottom-nav .nav-item:nth-child(1) { --dock-slot: 0; } +.bottom-nav .nav-item:nth-child(2) { --dock-slot: 1; } +.bottom-nav .nav-item:nth-child(3) { --dock-slot: 2; } +.bottom-nav .nav-item:nth-child(4) { --dock-slot: 3; } +.bottom-nav .nav-item:nth-child(5) { --dock-slot: 4; } +/* The publish action floats above the bar; rail mode resets it to its slot. */ +.bottom-nav .nav-item.publish { top: -1px; } + +@media (max-width: 1023px) and (max-height: 700px) { + .bottom-nav .nav-item { top: 4px; } + .bottom-nav .nav-item.publish { top: -5px; } +} + +@media (min-width: 1024px), + (orientation: landscape) and (min-width: 700px) and (max-width: 1023px) and (max-height: 500px) { + .bottom-nav .nav-item { + left: 9px; + /* Length, not calc(100% - 18px): see the bar-height note above. */ + width: calc(var(--dock-rail-width) - 20px); + height: calc(20% - 4px); + min-height: 0; + } + .bottom-nav .nav-item:nth-child(1) { top: 10px; } + .bottom-nav .nav-item:nth-child(2) { top: calc(20% + 6px); } + .bottom-nav .nav-item:nth-child(3) { top: calc(40% + 2px); } + .bottom-nav .nav-item:nth-child(4) { top: calc(60% - 2px); } + .bottom-nav .nav-item:nth-child(5) { top: calc(80% - 6px); } +} + +@media (min-width: 1024px) { + .content-scroll { padding-left: clamp(164px, 11vw, 260px); } + .bottom-nav { --dock-rail-width: clamp(118px, 8.4vw, 210px); width: var(--dock-rail-width); } + .nav-item { gap: clamp(7px, .6vw, 12px); font-size: clamp(15px, 1vw, 24px); } + .nav-item svg { width: clamp(26px, 1.55vw, 40px); height: clamp(26px, 1.55vw, 40px); } + .nav-item.publish > svg { width: clamp(29px, 1.8vw, 46px); height: clamp(29px, 1.8vw, 46px); } + .nav-item.publish > span { font-size: clamp(18px, 1.15vw, 28px); } + .page-topbar h1 { font-size: clamp(25px, 1.8vw, 40px); } + .upload-heading { font-size: clamp(17px, 1.25vw, 28px); } + .upload-instruction { font-size: clamp(12px, .9vw, 20px); } + .required-image-button svg, .add-image svg { width: clamp(28px, 1.8vw, 44px); height: clamp(28px, 1.8vw, 44px); } + .required-image-button strong, .add-image strong { font-size: clamp(14px, 1vw, 23px); } + .required-image-button span, .add-image span { font-size: clamp(10px, .78vw, 17px); } + .stepper span { width: clamp(30px, 2.2vw, 46px); height: clamp(30px, 2.2vw, 46px); font-size: clamp(12px, .82vw, 18px); } + .stepper p { font-size: clamp(11px, .8vw, 17px); } + .stepper i { top: clamp(15px, 1.1vw, 23px); } +} diff --git a/web/app/lib/golden-ui.test.ts b/web/app/lib/golden-ui.test.ts index 71e0100..e697f41 100644 --- a/web/app/lib/golden-ui.test.ts +++ b/web/app/lib/golden-ui.test.ts @@ -178,4 +178,29 @@ describe('authenticated Golden H5', () => { expect(styles).toContain('width: min(calc(100vw - 48px), 1600px)') expect(styles).toContain('.profile-page .content-scroll { grid-template-columns: repeat(3, minmax(0, 1fr)); }') }) + + it('keeps the publish dock label readable and eases responsive chrome changes', () => { + expect(styles).toContain('--motion-fluid: 380ms cubic-bezier(.22, 1, .36, 1)') + expect(styles).toContain('transition-duration: var(--motion-fluid-duration)') + expect(styles).toContain('.nav-item.publish > span { font-size: 15px; line-height: 1.15; transform: none; }') + expect(styles).toContain('.nav-item.publish > span { font-size: clamp(18px, 1.15vw, 28px); }') + expect(styles).toContain('top: calc(100% - 98px); width: calc(100% - 52px)') + expect(styles).toContain('@media (prefers-reduced-motion: reduce)') + }) + + it('gives every dock action its own interpolated slot and never tweens grid tracks', () => { + expect(styles).toContain('transition-property: left, top, width, height, padding, border-radius, border-color, background-color, box-shadow;') + expect(styles).toContain('.nav-item { transition: left var(--motion-fluid), top var(--motion-fluid), width var(--motion-fluid), height var(--motion-fluid),') + expect(styles).toContain('left: calc(var(--dock-slot) * 20%);') + expect(styles).toContain('height: 54px;') + expect(styles).toContain('.bottom-nav .nav-item:nth-child(5) { --dock-slot: 4; }') + expect(styles).toContain('.bottom-nav .nav-item:nth-child(5) { top: calc(80% - 6px); }') + expect(styles).toContain('width: calc(var(--dock-rail-width) - 20px);') + expect(styles).toContain('--dock-rail-width: clamp(118px, 8.4vw, 210px); width: var(--dock-rail-width);') + expect(styles).toContain('.bottom-nav .nav-item.publish { top: -1px; }') + expect(styles).toContain('.nav-item.publish:active { transform: scale(.96); }') + expect(styles).not.toContain('transition-behavior: allow-discrete') + expect(styles).not.toContain('.nav-item.publish { transform: translateY(-9px); }') + expect(styles).not.toMatch(/transition-property:[^;]*grid-template/) + }) });