2023-06-22 13:46:57 -07:00
|
|
|
/**
|
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import clsx from 'clsx';
|
|
|
|
import Link from '@docusaurus/Link';
|
|
|
|
import Layout from '@theme/Layout';
|
|
|
|
|
|
|
|
import styles from './index.module.css';
|
|
|
|
|
2023-12-12 09:06:58 -08:00
|
|
|
import YogaLogo from '../../static/img/logo.svg';
|
|
|
|
import Playground from '../components/Playground';
|
|
|
|
|
2023-11-03 05:23:56 -07:00
|
|
|
function HeroSection() {
|
2023-06-22 13:46:57 -07:00
|
|
|
return (
|
2023-11-03 05:23:56 -07:00
|
|
|
<header className={clsx('hero', styles.heroBanner)}>
|
|
|
|
<div className={clsx('row', 'container', styles.heroRow)}>
|
|
|
|
<div className="col col--6">
|
2023-12-12 09:06:58 -08:00
|
|
|
<h1 className="hero__title">Yoga</h1>
|
2023-11-03 05:23:56 -07:00
|
|
|
<p className="hero__subtitle">
|
2023-12-12 09:06:58 -08:00
|
|
|
A portable layout engine targeting web standards
|
2023-11-03 05:23:56 -07:00
|
|
|
</p>
|
|
|
|
|
|
|
|
<Link className="button button--primary button--lg" to="/docs/intro">
|
|
|
|
Learn more
|
2023-06-22 13:46:57 -07:00
|
|
|
</Link>
|
|
|
|
</div>
|
2023-12-12 09:06:58 -08:00
|
|
|
<div className="col col--2">
|
|
|
|
<YogaLogo className={styles.heroLogo} />
|
2023-11-03 05:23:56 -07:00
|
|
|
</div>
|
2023-06-22 13:46:57 -07:00
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-12-12 09:06:58 -08:00
|
|
|
const playgroundCode = `
|
|
|
|
<Layout config={{useWebDefaults: false}}>
|
2023-12-18 09:38:00 -08:00
|
|
|
<Node style={{width: 250, height: 475, padding: 10}}>
|
|
|
|
<Node style={{flex: 1, rowGap: 10}}>
|
|
|
|
<Node style={{height: 60}} />
|
|
|
|
<Node style={{flex: 1, marginInline: 10}} />
|
|
|
|
<Node style={{flex: 2, marginInline: 10}} />
|
2023-12-12 09:06:58 -08:00
|
|
|
<Node
|
|
|
|
style={{
|
|
|
|
position: "absolute",
|
|
|
|
width: "100%",
|
|
|
|
bottom: 0,
|
|
|
|
height: 64,
|
|
|
|
flexDirection: "row",
|
|
|
|
alignItems: "center",
|
|
|
|
justifyContent: "space-around",
|
|
|
|
}}
|
|
|
|
>
|
2023-12-18 09:38:00 -08:00
|
|
|
<Node style={{height: 40, width: 40}} />
|
|
|
|
<Node style={{height: 40, width: 40}} />
|
|
|
|
<Node style={{height: 40, width: 40}} />
|
|
|
|
<Node style={{height: 40, width: 40}} />
|
2023-12-12 09:06:58 -08:00
|
|
|
</Node>
|
|
|
|
</Node>
|
|
|
|
</Node>
|
|
|
|
</Layout>
|
|
|
|
`.trim();
|
Consolidate JavaScript Flavors (#1433)
Summary:
Fixes https://github.com/facebook/yoga/issues/1417
This dramatically simplifies the matrix of Node vs web, ASM vs WASM, sync vs async compilation, or CommonJS vs ES Modules. We have one variant, using wasm, with ESModule top-level await to do async compilation. Web/node share the same binary, and we base64 encode the WASM into a wrapper JS file for compatibility with Node and bundlers.
This has some downsides, like requiring an environment with top level await, but also has upsides, like a consistent, sync looking API compatible with older Yoga, and mitigating TypeScript issues with package exports and typings resolution.
As part of this work I also removed `ts-node` from the toolchain (at the cost of a couple of config files needing to be vanilla JS).
Pull Request resolved: https://github.com/facebook/yoga/pull/1433
Test Plan:
1. `yarn test`
2. `yarn lint`
3. `yarn tsc`
4. `yarn benchmark`
5. `yarn build` website-next
6. `yarn lint` website-next
7. Locally test website-next
8. Examine package artifact created by GitHub
9. All Automation passes
Reviewed By: yungsters
Differential Revision: D50453324
Pulled By: NickGerleman
fbshipit-source-id: fe1192acc69e57fa69a1ff056dd7b5844d2198d5
2023-10-31 20:41:38 -07:00
|
|
|
|
2023-11-03 05:23:56 -07:00
|
|
|
function PlaygroundSection() {
|
|
|
|
return (
|
|
|
|
<main className={styles.playgroundSection}>
|
2023-12-12 09:06:58 -08:00
|
|
|
<Playground height="600px" code={playgroundCode} autoFocus={true} />
|
2023-11-03 05:23:56 -07:00
|
|
|
</main>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-06-22 13:46:57 -07:00
|
|
|
export default function Home(): JSX.Element {
|
|
|
|
return (
|
2023-12-12 09:06:58 -08:00
|
|
|
<Layout>
|
2023-11-03 05:23:56 -07:00
|
|
|
<HeroSection />
|
|
|
|
<PlaygroundSection />
|
2023-06-22 13:46:57 -07:00
|
|
|
</Layout>
|
|
|
|
);
|
|
|
|
}
|