-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(storybook): add @fluentui/react-storybook-addon-playground with in-browser TSX playground (#36728) #36744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Dmytro Kirpa (dmytrokirpa)
wants to merge
23
commits into
master
Choose a base branch
from
experimental/storybook-playground
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,795
−46
Draft
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
54d8c5f
feat(storybook): add @fluentui/react-storybook-addon-playground with …
dmytrokirpa fa6a09c
Merge upstream/master into experimental/storybook-playground
dmytrokirpa 66e9370
fix(storybook): address playground review feedback
dmytrokirpa bd38b94
change
dmytrokirpa 2652778
update yarn.lock
dmytrokirpa f8fc7b2
fix(storybook): align playground postcss version
dmytrokirpa ee9303b
address review comments
dmytrokirpa c763102
fix(storybook): defer initial playground CSS compilation
dmytrokirpa fcdb59b
fix(storybook): address playground review feedback
dmytrokirpa 9f7e864
fix(storybook): resolve exports-only typings
Copilot 95b2ba9
test(storybook): clean typings fixture
Copilot cacbb81
Merge branch 'master' into experimental/storybook-playground
dmytrokirpa 5ae34cb
fix: address playground review comments
Copilot a2b9d2d
fix: remove unused playground success state
Copilot 0f5d13a
fix: improve playground runtime diagnostics
Copilot 721f467
fix: harden playground runtime helpers
Copilot 9d4d0d5
test: guard playground sandbox isolation
Copilot 341c985
fix: enforce runtime module allowlist
Copilot a9fa478
chore: clarify sandbox helper internals
Copilot 5f8b9d4
fix: preserve playground path during hash sync
Copilot 29de0c5
test: cover exact module allowlists
Copilot 5c6cdc0
fix: address playground review feedback
Copilot a4efdab
fix: keep playground run callbacks pure
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...luentui-react-storybook-addon-export-to-sandbox-bfb6dbfb-a9e5-47e0-b04d-be8d1f1d4399.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "feat: support per-story full source generation and playground addon buttons", | ||
| "packageName": "@fluentui/react-storybook-addon-export-to-sandbox", | ||
| "email": "dmytrokirpa@microsoft.com" | ||
| } |
6 changes: 6 additions & 0 deletions
6
change/@fluentui-react-storybook-addon-playground-751293a3-5a89-42e3-8d5d-f2e4b6b20f94.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "feat: add initial playground implementation", | ||
| "packageName": "@fluentui/react-storybook-addon-playground", | ||
| "email": "dmytrokirpa@microsoft.com" | ||
| } |
4 changes: 2 additions & 2 deletions
4
change/@fluentui-react-storybook-addon-playground-99650265-91f2-458b-bfdb-cf5dda68c498.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "type": "patch", | ||
| "comment": "feat: add @fluentui/react-storybook-addon-playground package scaffold", | ||
| "type": "minor", | ||
| "comment": "feat: add an in-browser TSX playground for Storybook stories", | ||
| "packageName": "@fluentui/react-storybook-addon-playground", | ||
| "email": "dmytrokirpa@microsoft.com" | ||
| } |
1 change: 1 addition & 0 deletions
1
packages/react-components/react-headless-components-preview/stories/.storybook/css.d.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| declare module '*.css'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...eact-components/react-headless-components-preview/stories/.storybook/playground.setup.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import * as React from 'react'; | ||
| import { polyfillBodyAndObserve } from '@microsoft/focusgroup-polyfill/shadowless'; | ||
| import { Provider } from '@fluentui/react-headless-components-preview/provider'; | ||
| import { definePlaygroundSetup } from '@fluentui/react-storybook-addon-playground/setup'; | ||
|
|
||
| import './tokens.css'; | ||
|
|
||
| polyfillBodyAndObserve(); | ||
|
|
||
| type HeadlessPlaygroundTheme = 'light' | 'dark'; | ||
|
|
||
| const defaultCode = `import * as React from 'react'; | ||
| import { Button } from '@fluentui/react-headless-components-preview/button'; | ||
|
|
||
| export default () => { | ||
| const [count, setCount] = React.useState(0); | ||
|
|
||
| return ( | ||
| <Button | ||
| onClick={() => setCount(count + 1)} | ||
| style={{ | ||
| height: 32, | ||
| padding: '0 14px', | ||
| border: 0, | ||
| borderRadius: 999, | ||
| background: 'var(--accent)', | ||
| color: 'var(--accent-contrast)', | ||
| cursor: 'pointer', | ||
| }} | ||
| > | ||
| Clicked {count} times | ||
| </Button> | ||
| ); | ||
| }; | ||
| `; | ||
|
|
||
| export default definePlaygroundSetup<HeadlessPlaygroundTheme>({ | ||
| title: 'Fluent UI Playground', | ||
| subtitle: 'Headless', | ||
| defaultCode, | ||
| themes: [ | ||
| { id: 'light', label: 'Light', value: 'light', dark: false }, | ||
| { id: 'dark', label: 'Dark', value: 'dark', dark: true }, | ||
| ], | ||
| render: ({ Component, theme }) => ( | ||
| <Provider> | ||
| <div data-theme={theme ?? 'light'} style={{ minHeight: '100%', background: 'var(--bg)', color: 'var(--text)' }}> | ||
| <Component /> | ||
| </div> | ||
| </Provider> | ||
| ), | ||
| }); |
1 change: 1 addition & 0 deletions
1
packages/react-components/react-headless-components-preview/stories/.storybook/preview.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.