Skip to content

Commit d99515e

Browse files
authored
More docs updates (#1426)
* update a sentence * whitespace on readme * improvements * lint * update UTM params * lint * improve sentence * fix docs behavior * prettier * update * updates * copy * move the test status
1 parent eb5e645 commit d99515e

File tree

7 files changed

+90
-23
lines changed

7 files changed

+90
-23
lines changed

README.MD

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
<br>
2+
<br>
23
<p align="center">
34
<picture>
45
<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+
<img width="400" alt="Mitosis logo" src="https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F570f689e59824cb78cf5773350ab4144">
67
</picture>
78
</p>
89

910
<p align="center">
1011
Write components once, compile to every framework
1112
</p>
1213

14+
<br>
15+
1316
<p align="center">
1417
<a href="https://github.com/prettier/prettier"><img alt="code style: prettier" src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg" /></a>
1518
<a href="https://github.com/BuilderIO/mitosis/pulls"><img alt="PRs Welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" /></a>
@@ -52,21 +55,6 @@ Read the full [getting started docs](https://mitosis.builder.io/docs/quickstart/
5255
- [Figma integration](https://mitosis.builder.io/docs/figma/)
5356
- [Mitosis Discord](https://discord.gg/SNusEyNGsx)
5457

55-
## E2E test status
56-
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: |
67-
68-
_NOTE: this matrix is programmatically generated and should not be manually edited._
69-
7058
## Contribute
7159

7260
Interested in contribute? Head over to the [developer](developer/) docs and see how you can get setup & started!

docs/test-status.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## E2E test status
2+
3+
| Target | Single Component | Multiple Components |
4+
| ------- | ------------------ | ------------------- |
5+
| alpine | :white_check_mark: | :white_check_mark: |
6+
| angular | :white_check_mark: | :white_check_mark: |
7+
| qwik | :white_check_mark: | :white_check_mark: |
8+
| react | :white_check_mark: | :white_check_mark: |
9+
| solid | :white_check_mark: | :white_check_mark: |
10+
| svelte | :white_check_mark: | :white_check_mark: |
11+
| vue2 | :white_check_mark: | :white_check_mark: |
12+
| vue3 | :white_check_mark: | :white_check_mark: |
13+
14+
_NOTE: this matrix is programmatically generated and should not be manually edited._

e2e/e2e-app/e2e-output.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ export async function emitTable(allResults: Entry[]) {
5151
await writeFile('./e2e-test-status.md', formattedTable, 'utf8');
5252

5353
// Write it in to the README
54-
const readmeFile = '../../README.MD';
55-
const currentReadme = await readFile(readmeFile, 'utf-8');
54+
const outputFile = '../../docs/test-status.md';
55+
const currentReadme = await readFile(outputFile, 'utf-8');
5656

5757
const before = currentReadme.match(/.*## E2E test status/gms)![0];
5858
const after = currentReadme.match(/## Contribute.*/gms)![0];
@@ -63,7 +63,7 @@ _NOTE: this matrix is programmatically generated and should not be manually edit
6363
6464
${after}`;
6565

66-
await writeFile(readmeFile, newReadme, 'utf-8');
66+
await writeFile(outputFile, newReadme, 'utf-8');
6767
// cut before/after the heading and next heading
6868
// write with this inserted
6969

packages/docs/src/components/search.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ export const Search = component$((props: { class?: ClassList }) => {
2121

2222
// Don't allow server side routing, catch it here and navigate client side.
2323
(window as any).navigation?.addEventListener('navigate', (event: any) => {
24+
// Don't intercept hash changes, whacky behavior ensues (manually scrolling to the top of the page on chrome snaps
25+
// back down to the anchor for some reason which is janky
26+
const isHashChange =
27+
event.destination.url.split('#')[0] === window.location.href.split('#')[0];
28+
if (isHashChange) {
29+
return;
30+
}
2431
if (event.canIntercept) {
2532
const url = new URL(event.destination.url);
2633
event.intercept({

packages/docs/src/routes/docs/figma/index.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ To use this integration:
2525

2626
This method ensures that developers can work within a unified framework while supporting various technology stacks.
2727

28-
Learn more about [Visual Copilot](https://www.builder.io/c/docs/visual-copilot) or [talk to us](https://www.builder.io/m/demo?utm_source=mitosis+docs) for a tailored demo.
28+
Learn more about [Visual Copilot](https://www.builder.io/c/docs/visual-copilot) or [talk to us](https://www.builder.io/m/demo?utm_source=builder-docs-mitosis&utm_campaign=builder-docs&utm_medium=website) for a tailored demo.

packages/docs/src/routes/docs/overview/index.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ By simplifying the development process through having one singular source of tru
2525

2626
### Challenges with web components
2727

28-
While [web components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) are standalone elements designed for reuse across web applications, they present challenges:
28+
While [web components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components) are standalone elements designed for reuse across web applications, they present some [key challenges](https://designsystemcentral.com/why-web-components-arent-the-design-system-silver-bullet-just-yet/152/) for design systems:
2929

3030
- Web components do not natively render on the server side. This can be problematic when using frameworks that rely on server-side rendering for performance and SEO benefits.
3131
- Web components do not seamlessly integrate with your library or framework. For instance, web components do not inherently understand or interact with React's context.
3232
- Web components often come with their own rendering libraries and dependencies, which can lead to performance overhead.
3333

34-
Although web components offer a modular and reusable approach to UI elements, these challenges can limit their viability.
34+
Although web components offer a modular and reusable approach to UI elements, these challenges can limit their viability. However, if supporting web components is a requirement, you can use Mitosis to generate them from a single source of truth. Mitosis supports [Lit](https://lit.dev/), [Stencil](https://stenciljs.com/), and raw web components as outputs.
3535

3636
### Integration with Figma
3737

packages/docs/src/routes/docs/quickstart/index.mdx

+59-1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,64 @@ By following these steps, you'll be well on your way to developing with Mitosis,
7070

7171
See our [CLI documentation](/docs/cli) for more commands you can run for developing and building.
7272

73+
### Verify your components
74+
75+
After generating the component code with Mitosis, the next step is to ensure that your components work as expected. Here's how to verify them using Svelte as the target framework:
76+
77+
1. **Export the components**
78+
79+
Export the `Greet` component from the `library/src/index.ts` file:
80+
81+
```tsx
82+
export { default as Greet } from './greet/greet.lite';
83+
```
84+
85+
2. **Build the library**
86+
87+
From the `library/packages/svelte` folder, build the Svelte components by running the following command:
88+
89+
```bash
90+
npm run build:watch
91+
```
92+
93+
3. **Test in a an application**
94+
95+
We'll use Svelte for this example, but these same steps work for any other output frameworks.
96+
97+
- Navigate to the `test-apps/svelte` folder:
98+
```bash
99+
cd test-apps/svelte
100+
```
101+
- Open the `src/routes/+page.svelte` file and import the component:
102+
103+
```tsx
104+
<script lang="ts">
105+
import { AutoComplete, Todos, Greet } from '@demo-one/library-svelte';
106+
</script>
107+
108+
<h1>Welcome to SvelteKit</h1>
109+
<AutoComplete />
110+
<Todos />
111+
<Greet />
112+
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
113+
114+
```
115+
116+
4. **Start the dev server**
117+
118+
Start the development server for your Svelte app with the following command:
119+
120+
```bash
121+
npm run dev
122+
```
123+
124+
5. **Verify the component**
125+
126+
Open [http://localhost:5173](http://localhost:5173/) in your browser. You should see the functioning Greet component along with the other components.
127+
128+
By following these steps, you'll be well on your way to developing with Mitosis, taking advantage of its capability to write once and deploy to multiple frameworks.
129+
73130
### Next steps
74131

75-
Now, you can build [Mitosis components](/docs/components) and explore our [Figma integration](/docs/figma) to sync your design systems in Figma to code, and then run [`mitosis build`](/docs/cli#mitosis-build) to generate packages for each output framework and publish them to npm.
132+
- Read more on writing [Mitosis components](/docs/components)
133+
- Explore the [Figma integration](/docs/figma) for generating Mitosis components from Figma designs

0 commit comments

Comments
 (0)