Skip to content

feat: add chat app example#7518

Draft
janechu wants to merge 5 commits into
releases/fast-element-v3from
users/janechu/create-chat-app-example
Draft

feat: add chat app example#7518
janechu wants to merge 5 commits into
releases/fast-element-v3from
users/janechu/create-chat-app-example

Conversation

@janechu
Copy link
Copy Markdown
Collaborator

@janechu janechu commented May 14, 2026

Pull Request

📖 Description

  • add a new examples/chat-app workspace that mirrors the todo-app example shape while using declarative FAST templates
  • pre-render the example shell with @microsoft/fast-build from entry.html, state.json, and templates.html
  • demonstrate iframe + document.write() streaming for canned assistant replies, including new chat-message, chat-card, and chat-suggestion custom elements
  • document the example in README.md and DESIGN.md

👩‍💻 Reviewer Notes

  • The easiest smoke test is to run the example, send Hi, and watch the assistant reply stream in chunk-by-chunk.
  • index.html is generated from the declarative sources by build-markup.mjs; if the shell changes, regenerate it with npm run build -w @microsoft/fast-chat-app-example.

📑 Test Plan

  • npm run build
  • npm run build -w @microsoft/fast-chat-app-example
  • npm run test -w @microsoft/fast-chat-app-example
  • manual smoke test of the built example with Playwright against a local static server (Hi → streamed reply + How are you? suggestion)
  • npm run test currently hits unrelated existing Playwright failures in packages/fast-element/src/components/hydration.pw.spec.ts (Firefox) and packages/fast-element/src/platform.pw.spec.ts (WebKit)

✅ Checklist

General

  • I have included a change request file using $ npm run change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

janechu and others added 5 commits May 14, 2026 14:25
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These editor-only TypeScript LSP plugins were inherited from the
todo-app template but are not required for chat-app to build or run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Makes the iframe + document.write streaming visibly progressive
during manual smoke tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Merge every component's <style> block into public/styles.css.
- Scope each component's rules with :host(<tag>) so the same file can be
  loaded into multiple shadow roots without cross-component bleed.
- Link the file from <head> in entry.html (render-blocking, so it loads
  before the rest of the HTML is processed) and from inside every
  declarative shadow DOM template in templates.html.
- Update DESIGN.md to describe the new structure.

The browser fetches the file once; each shadow root applies the cached
stylesheet. Built output (www/index.html) shrinks ~70% (17.6 -> 5.5 kB)
and the CSS is now cacheable across page loads.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant