- Loading...
+
+
)}
>
@@ -233,72 +294,173 @@ export default function Playground() {
);
}
+const MOBILE = '@media (max-width: 768px)';
+
// Style definitions for the Playground component
const styles = stylex.create({
root: {
minHeight: '100vh',
backgroundColor: 'var(--bg1)',
},
- header: {
- height: 40,
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'flex-end',
- paddingInline: 4,
+ headerContainer: {
backgroundColor: 'var(--playground-container-bg)',
borderBottomWidth: 1,
borderBottomStyle: 'solid',
borderBottomColor: 'rgba(255, 255, 255, 0.1)',
boxShadow: '0 1px 4px rgba(0, 0, 0, 0.1)',
- zIndex: 20,
},
- reloadButton: {
+ headerContent: {
+ alignItems: 'center',
display: 'flex',
+ height: 40,
+ justifyContent: 'space-between',
+ paddingInline: 16,
+ position: 'relative',
+ },
+ desktopHeader: {
+ display: {
+ default: 'block',
+ [MOBILE]: 'none',
+ },
+ },
+ headerNote: {
+ color: 'var(--fg2)',
+ fontSize: '0.9rem',
+ fontStyle: 'italic',
+ },
+ mobileNav: {
+ alignItems: 'center',
+ display: {
+ default: 'none',
+ [MOBILE]: 'flex',
+ },
+ flexGrow: 1,
+ gap: 8,
+ height: '100%',
+ width: '100%',
+ },
+ tabButton: {
alignItems: 'center',
- justifyContent: 'center',
backgroundColor: {
default: 'transparent',
':hover': 'var(--ifm-color-primary-light)',
},
+ borderColor: 'transparent',
+ borderRadius: 4,
+ borderStyle: 'none',
+ borderWidth: 0,
color: 'var(--fg1)',
- width: 32,
- height: 32,
+ cursor: 'pointer',
+ display: 'flex',
+ flexBasis: 0,
+ flexGrow: 1,
+ fontSize: '0.9rem',
+ height: 'calc(100% - 12px)',
+ justifyContent: 'center',
+ paddingBottom: 0,
+ paddingLeft: 16,
+ paddingRight: 16,
+ paddingTop: 0,
+ transitionDuration: '200ms',
+ transitionProperty: 'background-color',
+ },
+ tabButtonActive: {
+ color: 'white',
+ backgroundColor: {
+ default: 'var(--ifm-color-primary)',
+ ':hover': 'var(--ifm-color-primary)',
+ },
+ },
+ reloadButton: {
+ alignItems: 'center',
+ backgroundColor: {
+ default: 'transparent',
+ ':hover': 'var(--ifm-color-primary-light)',
+ },
borderRadius: 4,
borderStyle: 'none',
+ color: 'var(--fg1)',
cursor: 'pointer',
- zIndex: 20,
+ display: 'flex',
+ height: 32,
+ justifyContent: 'center',
padding: 4,
- transitionProperty: 'background-color, transform',
- transitionDuration: '200ms, 150ms',
transform: {
default: null,
':hover': 'scale(1.05)',
},
+ transitionDuration: '200ms, 150ms',
+ transitionProperty: 'background-color, transform',
+ width: 32,
+ zIndex: 20,
},
container: {
- display: 'flex',
alignItems: 'center',
- justifyContent: 'center',
+ borderBottomColor: 'var(--cyan)',
+ borderBottomStyle: 'solid',
+ borderBottomWidth: 2,
+ display: 'flex',
height: stylex.firstThatWorks(
'calc(100dvh - 100px)',
'calc(100vh - 100px)',
),
- borderBottomWidth: 2,
- borderBottomStyle: 'solid',
- borderBottomColor: 'var(--cyan)',
+ justifyContent: 'center',
+ position: 'relative',
},
- textarea: {
+ panel: {
+ alignItems: 'stretch',
+ borderStyle: 'none',
+ borderWidth: 0,
display: 'flex',
flexDirection: 'column',
- alignItems: 'stretch',
- justifyContent: 'stretch',
- width: '50%',
height: '100%',
- borderWidth: 0,
- borderStyle: 'none',
+ justifyContent: 'stretch',
+ left: 0,
+ opacity: {
+ default: 1,
+ [MOBILE]: 0,
+ },
+ pointerEvents: {
+ default: 'auto',
+ [MOBILE]: 'none',
+ },
+ position: {
+ default: 'relative',
+ [MOBILE]: 'absolute',
+ },
+ top: 0,
+ transitionDuration: '200ms',
+ transitionProperty: 'opacity',
+ width: {
+ default: '50%',
+ [MOBILE]: '100%',
+ },
+ },
+ panelActive: {
+ opacity: 1,
+ pointerEvents: 'auto',
+ zIndex: 1,
},
centered: {
alignItems: 'center',
justifyContent: 'center',
},
+ desktopReloadContainer: {
+ display: {
+ default: 'block',
+ [MOBILE]: 'none',
+ },
+ },
+ mobileReloadContainer: {
+ display: {
+ default: 'none',
+ [MOBILE]: 'inline-flex',
+ },
+ marginLeft: 8,
+ },
+ mobileReloadButton: {
+ color: 'white',
+ height: 24,
+ width: 24,
+ },
});
diff --git a/apps/docs/components/playground-utils/files.js b/apps/docs/components/playground-utils/files.js
index 5570b215..1d735b60 100644
--- a/apps/docs/components/playground-utils/files.js
+++ b/apps/docs/components/playground-utils/files.js
@@ -142,13 +142,13 @@ export default defineConfig({
"preview": "vite preview"
},
"dependencies": {
- "@stylexjs/stylex": "^0.10.0-beta.2",
+ "@stylexjs/stylex": "^0.10.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@babel/preset-react": "^7.25.9",
- "@stylexjs/postcss-plugin": "^0.10.0-beta.2",
+ "@stylexjs/postcss-plugin": "^0.10.0",
"@vitejs/plugin-react": "^4.3.4",
"postcss": "^8.4.49",
"vite": "^6.0.1"
@@ -179,8 +179,7 @@ createRoot(root).render(
},
'App.jsx': {
file: {
- contents: `
-import { useState } from 'react';
+ contents: `import { useState } from 'react';
import reactLogo from './assets/react.svg';
import viteLogo from '/vite.svg';
import * as stylex from '@stylexjs/stylex';
diff --git a/apps/docs/src/pages/playground.js b/apps/docs/src/pages/playground.js
index 67579ce9..490b8675 100644
--- a/apps/docs/src/pages/playground.js
+++ b/apps/docs/src/pages/playground.js
@@ -8,6 +8,7 @@
*/
import * as React from 'react';
+import * as stylex from '@stylexjs/stylex';
import BrowserOnly from '@docusaurus/BrowserOnly';
import Layout from '@theme/Layout';
@@ -16,10 +17,70 @@ export default function PlaygroundPage() {
{() => {
+ const isSafari = /^((?!chrome|android).)*safari/i.test(
+ navigator.userAgent,
+ );
+
+ if (isSafari) {
+ return (
+
+
+ Safari Not Supported
+
+
+ Safari is not supported at this time. Please try our{' '}
+
+ StackBlitz playground
+ {' '}
+ instead.
+
+
+ );
+ }
+
const Playground = require('../../components/Playground').default;
+
return ;
}}
);
}
+
+const styles = stylex.create({
+ unsupportedMessage: {
+ display: 'flex',
+ flexDirection: 'column',
+ alignItems: 'center',
+ justifyContent: 'center',
+ padding: 32,
+ marginBlock: 64,
+ marginInline: 'auto',
+ maxWidth: 600,
+ textAlign: 'center',
+ backgroundColor: 'var(--ifm-background-surface-color)',
+ borderRadius: 8,
+ boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)',
+ },
+ messageTitle: {
+ fontSize: '1.25rem',
+ marginBottom: 16,
+ color: 'var(--ifm-color-emphasis-700)',
+ },
+ messageText: {
+ fontSize: '1rem',
+ lineHeight: 1.5,
+ color: 'var(--ifm-font-color-base)',
+ margin: 0,
+ },
+ link: {
+ color: 'var(--ifm-color-primary)',
+ textDecoration: {
+ default: 'none',
+ ':hover': 'underline',
+ },
+ },
+});