MCPcopy Index your code
hub / github.com/Devessier/xstatebyexample

github.com/Devessier/xstatebyexample @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
52 symbols 116 edges 41 files 1 documented · 2%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

XState by Example

Welcome to the repository of XState by Example, a collection of state machines to help people think in state machines.

Development

To start the website locally, run the following:

npm install
npm run dev

Generate Markdown files from demo source files

I want to display the content of machine.ts and Demo.tsx files for each machine. Though it's easy to get the raw content of any file – thanks to Vite – but it's harder to render them as proper code blocks. I use [Expressive Code to generate amazing code blocks, but it can't easily render an arbitrary string as a code block.

As a consequence, I had to generate the Markdown blocks with an automatic tool.

To run it:

npm run generate:code-markdown

For now, the files should be committed. There is no automatic system to build them or check them on a CI.

Extension points exported contracts — how you extend this code

Props (Interface)
(no doc)
src/examples/notification/Demo.tsx
Props (Interface)
(no doc)
src/examples/user-activity/Demo.tsx
Props (Interface)
(no doc)
src/examples/video-player/Demo.tsx
UserData (Interface)
(no doc)
src/examples/authentication/machine.ts
Props (Interface)
(no doc)
src/examples/authentication/Demo.tsx

Core symbols most depended-on inside this repo

wait
called by 4
src/lib/wait.ts
formatTime
called by 2
src/examples/video-player/Demo.tsx
timestamp
called by 1
src/examples/user-activity/machine.ts
useTimestamp
called by 1
src/examples/user-activity/Demo.tsx
formatServerError
called by 1
src/examples/authentication/Demo.tsx
generateId
called by 1
src/examples/notification-center/machine.ts
Tabs
called by 0
src/components/Tabs.tsx
WebsiteIcon
called by 0
src/components/TheMastHead.tsx

Shape

Function 42
Interface 10

Languages

TypeScript100%

Modules by API surface

src/examples/video-player/Demo.tsx8 symbols
src/examples/authentication/Demo.tsx6 symbols
src/examples/notification-center/Demo.tsx4 symbols
src/examples/user-activity/Demo.tsx3 symbols
src/examples/user-activity/machine.ts2 symbols
src/examples/throttling/Demo.tsx2 symbols
src/examples/search-as-you-type/Demo.tsx2 symbols
src/examples/notification/Demo.tsx2 symbols
src/examples/debouncing/Demo.tsx2 symbols
src/components/TheMastHead.tsx2 symbols
src/components/AppExampleSandbox.tsx2 symbols
src/pages/favicon.ico.ts1 symbols

For agents

$ claude mcp add xstatebyexample \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact