動態紀錄說明工作區中發生了什麼事、由誰執行,例如部署、留言與檔案。它以每天一條時間軸呈現,最新的排在最前面,以執行者作為標記,並在文字中說明涉及的項目。切換器可將紀錄篩選為單一種類的事件。
動態紀錄
<section class="sheet container-inline flex flex-col overflow-hidden" data-example="activity-feed" aria-labelledby="activity-title"> <header class="flex flex-wrap items-center justify-between gap-sm p-md"> <div class="flex flex-col gap-3xs"> <h2 class="heading heading-sm" id="activity-title">Activity</h2> <p class="m(0) fg-text-muted" id="activity-count" aria-live="polite">7 events in Atlas Labs since Wednesday</p> </div> <div class="segmented segmented-sm" role="radiogroup" aria-label="Show"> <label class="segmented-item"> <input type="radio" class="segmented-input" name="activity-kind" value="all" checked>All</label> <label class="segmented-item"> <input type="radio" class="segmented-input" name="activity-kind" value="deploy">Deployments</label> <label class="segmented-item"> <input type="radio" class="segmented-input" name="activity-kind" value="comment">Comments</label> <label class="segmented-item"> <input type="radio" class="segmented-input" name="activity-kind" value="file">Files</label> </div> </header> <div class="flex flex-col gap-lg p-md bt(1) bt-solid b-line-hair" data-activity-days> <section class="flex flex-col gap-sm" aria-labelledby="activity-today"> <h3 class="m(0) text-xs font-medium fg-text-muted" id="activity-today">Today</h3> <ol class="timeline"> <li class="timeline-item" data-kind="deploy" aria-current="true"> <span class="timeline-marker"> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/yiching-lin.webp" alt width="256" height="256"> </span> </span> <div class="timeline-body"> <p class="timeline-title">Yi-ching Lin deployed <a class="link" href="#activity-title">atlas.dev</a>to production</p> <div class="flex flex-wrap items-center gap-xs"> <span class="badge badge-success badge-dot">Ready</span> <span class="badge badge-category category-teal">Marketing site</span> <time class="timeline-time" datetime="2026-11-13T09:42">09:42</time> </div> <details class="expand max-w(420)" style="--expand-lines: 2"> <summary class="expand-toggle"> <span class="expand-more">Show the build</span> <span class="expand-less">Hide the build</span> <svg class="icon expand-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" /> </svg> </summary> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term">Commit</dt> <dd class="data-list-value">4f021c8, Add pricing for teams</dd> </div> <div class="data-list-item"> <dt class="data-list-term">Build</dt> <dd class="data-list-value">38 routes in 48 seconds</dd> </div> <div class="data-list-item"> <dt class="data-list-term">Regions</dt> <dd class="data-list-value">14, from Tokyo to São Paulo</dd> </div> <div class="data-list-item"> <dt class="data-list-term">Rollback</dt> <dd class="data-list-value">The 08:12 deployment stays ready</dd> </div> </dl> </details> </div> </li> <li class="timeline-item" data-kind="comment"> <span class="timeline-marker"> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/misaki-sato.webp" alt width="256" height="256"> </span> </span> <div class="timeline-body"> <p class="timeline-title">Misaki Sato commented on <a class="link" href="#activity-title">Pricing page, preview 212</a> </p> <p class="timeline-description max-w(560)">“The yearly toggle reads well now. Can the Enterprise plan say how many seats it starts with?”</p> <div class="flex flex-wrap items-center gap-xs"> <span class="badge badge-category category-teal">Marketing site</span> <time class="timeline-time" datetime="2026-11-13T09:15">09:15</time> </div> </div> </li> <li class="timeline-item" data-kind="file"> <span class="timeline-marker"> <span class="avatar avatar-sm" aria-hidden="true">KN</span> </span> <div class="timeline-body"> <p class="timeline-title">Kenta Nakamura added 2 files to <a class="link" href="#activity-title">Edge functions</a> </p> <div class="flex flex-col items-start gap-xs max-w(420)"> <a class="file file-sm file-interactive" href="#activity-title"> <span class="file-page" aria-hidden="true">pdf</span> <span class="file-body"> <span class="file-name">Cold start profile.pdf</span> <span class="file-meta">1.2 MB</span> </span> </a> <a class="file file-sm file-interactive" href="#activity-title"> <span class="file-page" aria-hidden="true">csv</span> <span class="file-body"> <span class="file-name">Regions by latency.csv</span> <span class="file-meta">84 KB</span> </span> </a> </div> <div class="flex flex-wrap items-center gap-xs"> <span class="badge badge-category category-violet">Edge functions</span> <time class="timeline-time" datetime="2026-11-13T08:30">08:30</time> </div> </div> </li> </ol> </section> <section class="flex flex-col gap-sm" aria-labelledby="activity-yesterday"> <h3 class="m(0) text-xs font-medium fg-text-muted" id="activity-yesterday">Yesterday</h3> <ol class="timeline"> <li class="timeline-item" data-kind="deploy"> <span class="timeline-marker"> <span class="avatar avatar-sm" aria-hidden="true">SK</span> </span> <div class="timeline-body"> <p class="timeline-title">Seo-yeon Kim deployed <a class="link" href="#activity-title">api.atlas.dev</a>to production</p> <div class="flex flex-wrap items-center gap-xs"> <span class="badge badge-success badge-dot">Ready</span> <span class="badge badge-category category-blue">Public API</span> <time class="timeline-time" datetime="2026-11-12T17:40">17:40</time> </div> </div> </li> <li class="timeline-item" data-kind="deploy"> <span class="timeline-marker"> <span class="avatar avatar-sm" aria-hidden="true">SK</span> </span> <div class="timeline-body"> <p class="timeline-title">Seo-yeon Kim’s deployment of <a class="link" href="#activity-title">api.atlas.dev</a>failed</p> <div class="flex flex-wrap items-center gap-xs"> <span class="badge badge-danger badge-dot">Failed</span> <span class="badge badge-category category-blue">Public API</span> <time class="timeline-time" datetime="2026-11-12T17:05">17:05</time> </div> <details class="expand max-w(420)" style="--expand-lines: 2"> <summary class="expand-toggle"> <span class="expand-more">Show the error</span> <span class="expand-less">Hide the error</span> <svg class="icon expand-chevron" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> <path d="M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5" transform="rotate(90 8 8)" /> </svg> </summary> <dl class="data-list"> <div class="data-list-item"> <dt class="data-list-term">Check</dt> <dd class="data-list-value">GET /status, every 10 seconds</dd> </div> <div class="data-list-item"> <dt class="data-list-term">Answered</dt> <dd class="data-list-value">503 three times in a row</dd> </div> <div class="data-list-item"> <dt class="data-list-term">Stopped</dt> <dd class="data-list-value">Before it took any traffic</dd> </div> <div class="data-list-item"> <dt class="data-list-term">Served</dt> <dd class="data-list-value">Tuesday’s deployment, until the fix at 17:40</dd> </div> </dl> </details> </div> </li> </ol> </section> <section class="flex flex-col gap-sm" aria-labelledby="activity-wednesday"> <h3 class="m(0) text-xs font-medium fg-text-muted" id="activity-wednesday">Wednesday, 11 November</h3> <ol class="timeline"> <li class="timeline-item" data-kind="comment"> <span class="timeline-marker"> <span class="avatar avatar-sm"> <img class="avatar-image" src="/demo/people/misaki-sato.webp" alt width="256" height="256"> </span> </span> <div class="timeline-body"> <p class="timeline-title">Misaki Sato commented on <a class="link" href="#activity-title">Cache the image pipeline</a> </p> <p class="timeline-description max-w(560)">“Each preview rebuilds every image. Caching them by hash should cut the build by a third.”</p> <div class="flex flex-wrap items-center gap-xs"> <span class="badge badge-category category-violet">Edge functions</span> <time class="timeline-time" datetime="2026-11-11T10:48">10:48</time> </div> </div> </li> <li class="timeline-item" data-kind="deploy"> <span class="timeline-marker"> <span class="avatar avatar-sm" aria-hidden="true">KN</span> </span> <div class="timeline-body"> <p class="timeline-title">Kenta Nakamura deployed <a class="link" href="#activity-title">fn.atlas.dev</a>to preview</p> <div class="flex flex-wrap items-center gap-xs"> <span class="badge badge-success badge-dot">Ready</span> <span class="badge badge-category category-violet">Edge functions</span> <time class="timeline-time" datetime="2026-11-11T09:05">09:05</time> </div> </div> </li> </ol> </section> </div></section>/** * The activity of a team, filtered by kind on the page. The events are markup the server wrote, so the feed reads * in full without this script; a choice in the switch keeps the events of that kind in their lists, takes out a * day that is left with none, and says how many are shown. Returns the function that stops it and puts every * event back. */export function mount(root) { const count = root.querySelector('#activity-count') const feed = root.querySelector('[data-activity-days]') const days = [...feed.children].map((day) => ({ day, list: day.querySelector('.timeline'), items: [...day.querySelectorAll('.timeline-item')] })) const words = { all: ['event', 'events'], deploy: ['deployment', 'deployments'], comment: ['comment', 'comments'], file: ['file change', 'file changes'] } const controller = new AbortController() const show = (kind) => { let shown = 0 const kept = [] for (const { day, list, items } of days) { const matching = items.filter((item) => kind === 'all' || item.dataset.kind === kind) list.replaceChildren(...matching) if (matching.length) kept.push(day) shown += matching.length } feed.replaceChildren(...kept) count.textContent = `${shown} ${words[kind][shown === 1 ? 0 : 1]} in Atlas Labs since Wednesday` } root.addEventListener('change', (event) => { if (event.target.name === 'activity-kind') show(event.target.value) }, { signal: controller.signal }) return () => { controller.abort() show('all') }}選擇一種事件以縮小紀錄範圍,或開啟某次部署的詳細資料。
區塊提供可直接複製的標記,沿用頁面的文字顏色和字級。預覽在 body 上設定 fg-text-body text-sm。每個區塊都是尺寸容器,無論放在寬大的頁面、側邊欄大小的空間,還是對話框裡,都會依自身寬度重新排列。
#組成
- 一個面板,標頭與各天之間以
bt(1) bt-solid b-line-hair畫出的細線分隔。 - 每一天是一個標題加上一條時間軸。 依序為「今天」、「昨天」,接著是日期,每個都是
<h3>,下方接一個<ol class="timeline">,最新的排在最前面。標頭中的計數說明顯示了多少事件,並與下方各天的事件一致。 - 執行者就是標記。 放在
timeline-marker中的頭像取代圓點,大小與標記相同,為 24px;線條將一個人連到下一個人。姓名寫在句子中,因此相片的alt留空,姓名縮寫則加上aria-hidden。 - 涉及的項目是連結。 標題中的部署、預覽或議題都是指向該項目的連結;檔案則是讀者可以開啟的檔案元件。
- 文字保有閱讀寬度。 引用的留言是
max-w(560),檔案與詳細資料是max-w(420),面板再寬也不會把一句話拉到整個面板;列跟著面板一樣寬,閱讀的寬度則不會。 - 狀態以色調區分,專案以分類標示。 「就緒」和「失敗」是帶有圓點和文字的狀態徽章;事件所屬的專案則以帶有專案名稱的
badge-category呈現,並沿用該專案在其他地方使用的分類。 - 最新的事件是目前事件。 當標記是圓點時,在該列加上
aria-current="true"會讓圓點套用目前事件的強調色。 - 詳細資料預設收合。 部署的建置過程和失敗原因放在展開文字中:先顯示前幾行,再由原生
<details>展開其餘內容,頁內搜尋和鍵盤操作都照常運作。 - 切換器是分段控制項。 它可將紀錄縮小到部署、留言或檔案;沒有剩下任何事件的日期會從清單中移除。
#哪些功能需要腳本
動態紀錄是由伺服器寫出的標記,不需要腳本也能完整閱讀。main.js 只負責縮小範圍:它在清單中保留所選種類的事件,移除沒有剩下任何事件的日期,並更新計數;計數是一個 polite 即時區域。若由伺服器分頁提供動態紀錄,也能以查詢參數回應同一個切換器。
#無障礙
- 面板使用
<section>,並以其標題命名;每一天也是一個以自身標題命名的<section>。 - 每個事件都是一個完整的句子,說明誰對什麼做了什麼,因此即使沒有頭像、徽章或線條也能理解。
- 狀態徽章以文字說明狀態;分類徽章寫出專案名稱,色彩只是重複這個資訊。
- 時間使用
<time datetime>元素,讓讀者取得確切的時間,程式也能讀取。 - 切換器是名為「顯示」的單選按鈕群組;選擇後的計數會被朗讀出來。
#相關內容
- 表面托盤、面板與凹槽構成所有元件共用的材質層次。
- 標題以頁面的高對比文字色呈現標題,搭配上方的前導標籤與下方的引言。
- 分段控制項在同一條軌道上排列數個選項,選取指示會滑到目前的選項。
- 時間軸依發生順序將事件排在一條線上,例如動態消息、歷史紀錄或更新日誌。
- 頭像以相片或姓名縮寫代表個人或團隊,可單獨顯示或重疊排列。
- 連結沿用句子的文字顏色,帶使用者前往其他位置。
- 徽章顯示狀態、類別或數量的小型膠囊標籤;只有在顏色具有意義時才使用色彩。
- 分類色標示資料屬於哪個分類的具名色彩。
- 檔案將單一檔案呈現為帶有名稱的獨立物件,可用於附件、上傳或下載。
- 展開文字長文先顯示開頭幾行,使用者可展開閱讀全文。
- 資料清單用欄位名稱與值呈現單一項目的資料,以細線分隔,例如一次部署、一筆訂單或一份個人資料。