Skip to content

Commit eb5e645

Browse files
steve8708samijaber
andauthored
More docs CSS etc (#1422)
* prefetch header links * smaller text in ribbon * cleanup * does this help prefetching * updates * fix syntax * add staleIfError * fix * preload homepage * f * header * remove useless prefetch * qwik insights * update * fixes * comment * prettier * fix? * footer * mobile footer * remove search for now * search * prettier * better * fuck ya * better * better * update * fix search * better * update * cool * css * docs improvements * updates * updates * rotating code * fuck ya * interactive homepage * fixes * better * fixes * pretty * better perf? * no change if not really change * updates * feedback * css improvement * prettier * test * updoots * docs scrolly * updates * gh action * scrolly goodness * fix * point old docs to new * root readme * cool * README * smaller message * updates * readme * readme * footer improvements * visual copilot doc link * updates based on feedback * updates * multiple searchbars breaks * better animation * prefetch * fixes * fix * updates * fix scroll bug * redirectHome hack * perf optimizations * optimizations * new removeParam for testing * fix h levels in toc * better playground mobile styling * docs tweaks * prettier * z index stuff * fix mobile * add google analytics * overflow hidden * updates * smoother animation * updates * small change * lockfile fix * partytown * smaller text in announcement bar * fix hash links * SEO * css * updates * more og tags * hearts * prettier * minor stuff * simpler * css * updates * refinements * animation improvements * checkpoint * show feedback on mobile too * minor copy * formatting * readme * readme * updates to docs * update doc * Update developer/README.md --------- Co-authored-by: Sami Jaber <[email protected]> Co-authored-by: Sami Jaber <[email protected]>
1 parent 8268c63 commit eb5e645

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1618
-2010
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ body:
4343
- type: input
4444
id: reproduction_fiddle
4545
attributes:
46-
description: A link to a https://mitosis.builder.io fiddle show-casing the bug
46+
description: A link to a https://mitosis.builder.io/playground playground show-casing the bug
4747
label: Reproduction case
4848
validations:
4949
required: true

.github/workflows/crawl-docs-site.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Crawl the docs site with Meilisearch Cloud to update the contents to the latest
2+
3+
on: [push]
4+
5+
jobs:
6+
crawler:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: meilisearch/actions/cloud-crawler@main
10+
with:
11+
token: ${{ secrets.MEILISEARCH_CLOUD_CRAWLER_TOKEN }}

README.MD

+35-186
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<p align="center"><img width="400" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F928fd46bd9d84a3fbc5b31fd5b93a7df"></p>
2-
1+
<br>
32
<p align="center">
4-
Write components once, compile to every framework
3+
<picture>
4+
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F44413839f214431290930e447572b843">
5+
<img width="300" alt="Mitosis logo" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F570f689e59824cb78cf5773350ab4144">
6+
</picture>
57
</p>
68

79
<p align="center">
8-
<p align="center">
9-
Try our <a href="https://mitosis.builder.io/"><b>interactive fiddle</b></a>
10-
</p>
10+
Write components once, compile to every framework
1111
</p>
1212

1313
<p align="center">
@@ -18,191 +18,52 @@
1818
<a href="https://www.npmjs.com/package/@builder.io/mitosis" rel="nofollow"><img src="https://img.shields.io/npm/v/@builder.io/mitosis.svg?sanitize=true"></a>
1919
</p>
2020

21-
_PS: We are actively looking for folks interested in becoming contributors to Mitosis. If interested, look at our list of [good first issues](https://github.com/BuilderIO/mitosis/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or reach out on our [Discord](https://discord.gg/SNusEyNGsx)_
22-
23-
## Table of contents
24-
25-
- [Quick Start](#quick-start)
26-
- [Manual Setup](#manual-setup)
27-
- [Examples](#examples)
28-
- [What is Mitosis](#what-is-mitosis)
29-
- [In-depth Docs](#docs)
30-
- [Why use Mitosis?](#why-use-mitosis)
31-
- [Design Systems Maintainers](#design-systems-maintainers)
32-
- [Teams using multiple web frameworks](#teams-using-multiple-web-frameworks)
33-
- [Teams building web SDKs](#teams-building-web-sdks)
34-
- [Contribute](#contribute)
35-
- [Community](#community)
36-
- [Related Projects](#related-projects)
37-
38-
## Quick Start
39-
40-
To create a new Mitosis project from scratch, run the following `create` command:
41-
42-
```bash
43-
npm create @builder.io/mitosis@latest
44-
```
45-
46-
It will prompt you for a project name, and create a new directory with a basic monorepo project structure that includes:
47-
48-
- npm workspaces
49-
- multiple generated outputs, along with build steps for each
50-
- multiple test servers that import the outputs for convenient debugging/testing
51-
52-
Once completed, make sure to read the `README.md` generated in your new project. It will explain the structure of your project, and provide a walkthrough on how to build/test your components.
53-
54-
## Manual Setup
55-
56-
If you would like to install Mitosis manually, you can do so with the following steps below. These generally follow the same steps as the `create` command.
57-
58-
### Note on Monorepo structure
59-
60-
Given that Mitosis generates code for multiple frameworks, it is highly recommend to treat each output as its own npm package for building/publishing purposes. This means that you will most likely need a monorepo solution (such as npm/pnpm/yarn workspaces, or Nx, or Turborepo). While we provide this out-of-the-box in the `create` command, we will leave it up to the user to implement it however they see fit in the Manual setup guide.
61-
62-
### Installation
63-
64-
First, in a new npm project, install the Mitosis CLI and the Mitosis packages:
65-
66-
```bash
67-
npm install @builder.io/mitosis-cli @builder.io/mitosis
68-
```
69-
70-
### Setup `mitosis.config.js`
71-
72-
Then, create a `mitosis.config.js` file in the root of your project, and add the following configuration:
73-
74-
```js
75-
/** @type {import('@builder.io/mitosis').MitosisConfig} */
76-
module.exports = {
77-
files: 'src/**',
78-
targets: ['svelte', 'react', 'qwik', 'vue'], //define your desired outputs here
79-
};
80-
```
81-
82-
Check [our configuration docs](/docs/configuration.md) for how to setup the Mitosis config file.
83-
84-
### Setup TypeScript
85-
86-
To setup TypeScript, add the following to your `tsconfig.json`:
87-
88-
```jsonc
89-
// tsconfig.json
90-
{
91-
"compilerOptions": {
92-
"jsx": "preserve",
93-
"jsxImportSource": "@builder.io/mitosis"
94-
}
95-
}
96-
```
21+
## Overview
9722

98-
### Create a Component
23+
Mitosis provides a unified development experience across all frameworks, enabling you to build components in a single codebase and compile them to React, Vue, Angular, Svelte, Solid, Alpine, Qwik, and more.
9924

100-
Now, create a `MyComponent.lite.tsx` file in the `src/components` directory:
25+
Using Mitosis, you can:
10126

102-
```tsx
103-
// src/components/MyComponent.lite.tsx
104-
import { useStore } from '@builder.io/mitosis';
27+
- Maintain a consistent design system across multiple frameworks ([example](https://github.com/db-ui/mono))
28+
- Sync your [design systems from Figma to code](/docs/figma) and publish them to npm across frameworks
29+
- Build high quality cross-framework SDKs ([example](https://github.com/BuilderIO/builder/tree/main/packages/sdks#builderio-sdks))
30+
- Avoid the [pitfalls of web components](https://mitosis.builder.io/docs/overview/) by compiling to native framework code
10531

106-
type Props = {
107-
message: string;
108-
};
32+
Additionally, Mitosis [integrates with Figma](https://mitosis.builder.io/docs/figma/) to sync your design systems in Figma to code.
10933

110-
export default function MyBasicComponent(props: Props) {
111-
const state = useStore({
112-
name: 'Foo',
113-
});
114-
115-
return (
116-
<div>
117-
{props.message || 'Hello'} {state.name}! I can run in React, Vue, Solid, Svelte, Qwik
118-
andeverything else!
119-
</div>
120-
);
121-
}
122-
```
34+
_PS: We are actively looking for folks interested in becoming contributors to Mitosis. If interested, look at our list of [good first issues](https://github.com/BuilderIO/mitosis/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or reach out on our [Discord](https://discord.gg/SNusEyNGsx)_
12335

124-
For a deeper look at the Mitosis JSX syntax, check out [our Component docs](/docs/components.md) and overall [Mitosis Documentation](/docs/README.md).
36+
## Quickstart
12537

126-
### Build
38+
To create a new Mitosis project from scratch, run the following `create` command:
12739

12840
```bash
129-
npm exec mitosis build
41+
npm create @builder.io/mitosis@latest
13042
```
13143

132-
🎉 You should now have an `output` directory with your compiled components in all frameworks!
133-
134-
### Recommended: Install ESLint Rules
135-
136-
We recommend you install our [ESLint plugin](./packages/eslint-plugin) to have highly useful rules that guide you as you build your Mitosis components.
137-
138-
### Next up
139-
140-
Our recommended next steps are to:
141-
142-
- add a build step for each generated output (e.g. a Svelte library will need to be build using Sveltekit's [`svelte-package`](https://kit.svelte.dev/docs/packaging) command)
143-
- add a `test-servers/` folder containing web apps that import your outputs, so that you can test them (either manually or programatically).
144-
145-
## Examples
146-
147-
Here are some helpful resources on trying out Mitosis:
148-
149-
- [CKGrafico/papanasi](https://github.com/CKGrafico/papanasi): A framework-agnostic UI library built in Mitosis
150-
- Our [example project](./examples/basic/) is a good starting point for learning how to use Mitosis.
151-
- blog post on creating a Mitosis project: https://blog.logrocket.com/creating-reusable-components-mitosis-builder-io/
152-
153-
## What is Mitosis?
154-
155-
- [this talk](https://portal.gitnation.org/contents/its-time-to-de-fragment-the-web) by Sami Jaber at React Day Berlin is a great intro to Mitosis. It gives a good overview of the impetus behind Mitosis, and a high-level understanding of its different pieces.
156-
157-
- The below video is a brief introduction by Steve Sewell.
158-
[![Mitosis Video](https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2Ffa5c422309ce4fbea9eaa133fa471877)](https://www.youtube.com/watch?v=XQIuv34-K_8 'Mitosis Video')
159-
160-
## Docs
161-
162-
Curious about how Mitosis code works under the hood, and how to use it? Learn more [in our in-depth docs](docs/).
163-
164-
## Why use Mitosis?
165-
166-
Mitosis is an incredibly powerful and flexible tool. So far, we have identified 3 broad categories of engineering teams that stand to benefit greatly from it:
167-
168-
### Design Systems Maintainers
169-
170-
If you are the maintainer of a design system library that started off in one web framework, then you have felt the tremendous amount of maintenance pain and duplication when creating new versions for subsequent frameworks. Look no further than the popular React library [Chakra UI](https://chakra-ui.com/), and how the maintainers have decided to create [Zag.js](https://zagjs.com/overview/introduction#motivation) after feeling the pain of maintaining state-logic code across both their React and Vue libraries. While Zag.js focuses on writing framework-agnostic interactions, Mitosis focuses on writing framework-specific components. (PS: We are working on building examples that combine these two together. TBD!)
171-
172-
### Teams using multiple web frameworks
173-
174-
If you are part of a team/organization that has multiple frontends built in different frameworks, then you know that coordinating your design system across all of them for a cohesive experience and feel is an absolute nightmare. Mitosis is an excellent tool to eliminate this class of problems, as it allows you to define your designs in your components once and deploy them to all of your separate frontends.
175-
176-
### Teams building web SDKs
177-
178-
If your team is building SDKs for a product that integrates directly into a web framework and involves providing components to the end user, then Mitosis is a _perfect_ fit for your team. Our team at Builder.io has this exact use-case: our [new generation of SDKs](https://github.com/BuilderIO/builder/tree/main/packages/sdks/) is built with Mitosis! Our engineers have received glowing praise from our sales team for speed of delivery, and all it took was a switch flip 😉
179-
180-
<div style="display: flex; flex-direction: column; align-items: center;">
181-
<img width="50%" src="imgs/kudos-1.png"/>
182-
<br/>
183-
<img width="50%" src="imgs/kudos-2.png"/>
184-
</div>
185-
186-
## What about XKCD
44+
Once completed, make sure to read the `README.md` generated in your new project. It will explain the structure of your project, and provide a walkthrough on how to build/test your components.
18745

188-
<img alt="XKCD comic about solving too many standards by creating new standards just making yet another standard" src="https://user-images.githubusercontent.com/844291/168342803-5599952e-a400-4918-851d-5af93dc19585.png" width="500">
46+
Read the full [getting started docs](https://mitosis.builder.io/docs/quickstart/) for more.
18947

190-
Yup, we've all seen it. But if this is a concern for you, you may be looking at Mitosis wrong. Rather than just yet-another-component-syntax, Mitosis is a compiler for the frontend, analogous to [LLVM](https://en.wikipedia.org/wiki/LLVM). A toolchain that embraces that there are, and forever will be, many ways of writing components. Mitosis defines a common [intermediate representation](https://en.wikipedia.org/wiki/Intermediate_representation) that allows us to author components once then compile to many frameworks, just like LLVM lets us write code that can compile to any [instruction set architecture](https://en.wikipedia.org/wiki/Instruction_set_architecture). If you look at Mitosis this way, you may more clearly see the value.
48+
## Resources
19149

192-
Also similarly to LLVM, multiple syntaxes can compile to Mitosis. Our out-of-the-box syntax uses JSX, but we have explored others, such as a Vue/Svelte-like syntax. [Builder.io](https://github.com/builderio/builder) emits Mitosis IR, allowing you to turn designs to code for any supported framework. JSX and Builder.io are the currently supported frontends of the compiler, and the frameworks listed below are the backends.
50+
- [Documentation](https://mitosis.builder.io/docs)
51+
- [Playground](https://mitosis.builder.io/playground)
52+
- [Figma integration](https://mitosis.builder.io/docs/figma/)
53+
- [Mitosis Discord](https://discord.gg/SNusEyNGsx)
19354

19455
## E2E test status
19556

196-
| Target | 01 one component | 02 two components |
197-
| ------- | ------------------ | ------------------ |
198-
| alpine | :white_check_mark: | :white_check_mark: |
199-
| angular | :white_check_mark: | :white_check_mark: |
200-
| qwik | :white_check_mark: | :white_check_mark: |
201-
| react | :white_check_mark: | :white_check_mark: |
202-
| solid | :white_check_mark: | :white_check_mark: |
203-
| svelte | :white_check_mark: | :white_check_mark: |
204-
| vue2 | :white_check_mark: | :white_check_mark: |
205-
| vue3 | :white_check_mark: | :white_check_mark: |
57+
| Target | Single Component | Multiple Components |
58+
| ------- | ------------------ | ------------------- |
59+
| alpine | :white_check_mark: | :white_check_mark: |
60+
| angular | :white_check_mark: | :white_check_mark: |
61+
| qwik | :white_check_mark: | :white_check_mark: |
62+
| react | :white_check_mark: | :white_check_mark: |
63+
| solid | :white_check_mark: | :white_check_mark: |
64+
| svelte | :white_check_mark: | :white_check_mark: |
65+
| vue2 | :white_check_mark: | :white_check_mark: |
66+
| vue3 | :white_check_mark: | :white_check_mark: |
20667

20768
_NOTE: this matrix is programmatically generated and should not be manually edited._
20869

@@ -212,18 +73,6 @@ Interested in contribute? Head over to the [developer](developer/) docs and see
21273

21374
Once you're ready, checkout our [issues](https://github.com/BuilderIO/mitosis/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) page and grab your first issue!
21475

215-
## Community
216-
217-
- [Mitosis Discord](https://discord.gg/SNusEyNGsx)
218-
- [@Builderio](https://twitter.com/builderio)
219-
220-
## Related Projects
221-
222-
- [Figma plugin](https://github.com/BuilderIO/figma-html): Convert Figma designs into high quality HTML, React, Vue, Svelte, Angular, Solid, etc code via Mitosis.
223-
- [Builder](https://github.com/BuilderIO): Drag and drop page builder and CMS for React, Vue, Angular, and more.
224-
- [Qwik](https://github.com/BuilderIO/qwik): An open-source framework designed for best possible time to interactive, by focusing on resumability of server-side-rendering of HTML, and fine-grained lazy-loading of code.
225-
- [Partytown](https://github.com/BuilderIO/partytown): Relocate resource intensive third-party scripts off of the main thread and into a web worker. 🎉
226-
22776
<br>
22877
<br>
22978
<p align="center">

developer/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ live under `packages/` and `examples/`:
99

1010
- `core` (`@builder.io/mitosis`): contains the Mitosis engine
1111
- `cli` (`@builder.io/mitosis-cli`): contains the Mitosis CLI, and _depends_ on `core`
12-
- `fiddle`: contains the code for the interactive Mitosis fiddle, which is hosted at mitosis.builder.io
12+
- `site`: contains the Mitosis site hosted at mitosis.builder.io
1313
- `eslint-plugin` (`@builder.io/eslint-plugin-mitosis`): contains the Mitosis eslint rules to enforce valid Mitosis component syntax. Yet to be released.
1414

1515
## Installation
@@ -32,7 +32,7 @@ We need your help! If you found a bug, it's best to [create an issue](https://gi
3232

3333
## Developing for Core & Testing
3434

35-
In `core`, we use vitest snapshots & integeration tests for test coverage. If you are solving a problem that is reproducible by a fiddle in [mitosis.builder.io](https://mitosis.builder.io), we highly recommend the following flow:
35+
In `core`, we use vitest snapshots & integeration tests for test coverage. If you are solving a problem that is reproducible by a fiddle in [mitosis.builder.io/playground](/playground), we highly recommend the following flow:
3636

3737
### Snapshot test
3838

docs/README.md

+1-84
Original file line numberDiff line numberDiff line change
@@ -1,84 +1 @@
1-
# Mitosis Overview
2-
3-
Mitosis is a subset of [JSX](https://github.com/facebook/jsx). It supports generating code for a number of frontend frameworks, including React, Vue, Angular, Svelte, and Solid.
4-
5-
**Table of contents**
6-
7-
- [How Does It Work](#how-does-it-work)
8-
- [Formatting options](#formatting-options)
9-
- [Project Structure](./project-structure.md)
10-
- [Components](./components.md)
11-
- [Context](./context.md)
12-
- [Hooks](./hooks.md)
13-
- [Gotchas](./gotchas.md)
14-
- [Customizability](./customizability.md)
15-
- [Configuration](./configuration.md)
16-
- [CLI](./cli.md)
17-
18-
## How does it work
19-
20-
Mitosis uses a static subset of JSX, inspired by [Solid](https://www.solidjs.com/guide#jsx-compilation). This means we can parse it to a simple JSON structure, then easily build serializers that target various frameworks and implementations.
21-
22-
```tsx
23-
export function MyComponent() {
24-
const state = useStore({
25-
name: 'Steve',
26-
});
27-
28-
return (
29-
<div>
30-
<input value={state.name} onChange={(event) => (state.name = event.target.value)} />
31-
</div>
32-
);
33-
}
34-
```
35-
36-
becomes:
37-
38-
```json
39-
{
40-
"@type": "@builder.io/mitosis/component",
41-
"state": {
42-
"name": "Steve"
43-
},
44-
"nodes": [
45-
{
46-
"@type": "@builder.io/mitosis/node",
47-
"name": "div",
48-
"children": [
49-
{
50-
"@type": "@builder.io/mitosis/node",
51-
"name": "input",
52-
"bindings": {
53-
"value": "state.name",
54-
"onChange": "state.name = event.target.value"
55-
}
56-
}
57-
]
58-
}
59-
]
60-
}
61-
```
62-
63-
Which can be reserialized into many languages and frameworks. For example, to support angular, we just make a serializer that loops over the json and produces:
64-
65-
```ts
66-
@Component({
67-
template: `
68-
<div>
69-
<input [value]="name" (change)="name = $event.target.value" />
70-
</div>
71-
`,
72-
})
73-
class MyComponent {
74-
name = 'Steve';
75-
}
76-
```
77-
78-
Adding framework support is surprisingly easy with the plugin system (docs coming soon).
79-
80-
## Formatting options
81-
82-
Mitosis supports settings for generating code to match your preferred formatting, libraries, etc. These output options will be customizable and extensible with plugins soon.
83-
84-
<img src="https://imgur.com/hWXfNF3.gif "/>
1+
Docs have moved to [mitosis.builder.io](https://mitosis.builder.io/docs)

0 commit comments

Comments
 (0)