Skip to content
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

feat: d2 diagrams, process model #2202

Merged
merged 6 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ Not yet created, will be added in the future.

Topics that are around understanding something can be written as a blog post (we welcome submissions to the Tauri blog from anyone). Blog posts are a good option because they help the reader understand that information is accurate at the time of writing (and of course can always be updated later if it becomes stale). Blog posts follow the goals of [explanation in Diátaxis](https://diataxis.fr/explanation), but not all blog posts necessarily fit this specific format.

### Diagrams

We use [Astro D2](https://astro-d2.vercel.app/) to generate diagrams. Because Netlify does not support compiling the diagrams in its end we have to push the prebuilt images manually. This is annoying, but not the end of the world seeing as we've previously been pushing the images manually anyway.

If you make an update to a diagram you'll need to [install D2](https://github.com/terrastruct/d2/blob/master/docs/INSTALL.md) on your system, then when you run either the `build` or `dev` commands you'll need to enable building the diagrams by setting the environment variable `CONTEXT=d2`.

```sh
# Adapt the command as relevant for your system to define the variable
CONTEXT=d2 pnpm dev
```

## Translations (i18n)

Thanks for your interest in helping to translate the documentation! Visit the [translation status page](https://v2.tauri.app/contribute/translate-status) to see which docs are ready for translation, need updated, or need reviewed.
Expand Down
13 changes: 10 additions & 3 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import locales from './locales.json';
import starlightLinksValidator from 'starlight-links-validator';
import starlightBlog from 'starlight-blog';
import serviceWorker from 'astrojs-service-worker';
import astroD2 from 'astro-d2'

const authors = {
nothingismagick: {
Expand Down Expand Up @@ -251,6 +252,12 @@ export default defineConfig({
locales,
lastUpdated: true,
}),
astroD2({
skipGeneration: process.env.CONTEXT !== 'd2',
theme: {
default: '105'
}
}),
serviceWorker({
workbox: {
cleanupOutdatedCaches: true,
Expand Down Expand Up @@ -378,9 +385,9 @@ function i18nRedirect(from, to) {
locale === 'root'
? (routes[from] = to)
: (routes[`/${locale}/${from.replaceAll(/^\/*/g, '')}`] = `/${locale}/${to.replaceAll(
/^\/*/g,
''
)}`)
/^\/*/g,
''
)}`)
);
return routes;
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@astrojs/starlight": "^0.23.0",
"@types/json-schema": "^7.0.15",
"astro": "^4.4.4",
"astro-d2": "^0.2.1",
"astro-feelback": "^0.3.4",
"astrojs-service-worker": "^2.0.0",
"jsdom": "^24.0.0",
Expand Down
14 changes: 14 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

197 changes: 197 additions & 0 deletions public/d2/docs/concept/process-model-0.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 29 additions & 2 deletions src/content/docs/concept/process-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,36 @@ guarantees memory safety while retaining excellent performance.

<figure>

![IPC Diagram](@assets/concept/process-model.svg)
```d2 sketch pad=50
direction: right

<figcaption>Figure 1-1: Simplified representation of the Tauri process model. A single Core process manages one or more WebView processes.</figcaption>
Core: {
shape: diamond
}

"Events & Commands 1": {
WebView1: WebView
}

"Events & Commands 2": {
WebView2: WebView
}

"Events & Commands 3": {
WebView3: WebView
}

Core -> "Events & Commands 1"{style.animated: true}
Core -> "Events & Commands 2"{style.animated: true}
Core -> "Events & Commands 3"{style.animated: true}

"Events & Commands 1" -> WebView1{style.animated: true}
"Events & Commands 2" -> WebView2{style.animated: true}
"Events & Commands 3" -> WebView3{style.animated: true}

```

<figcaption>Simplified representation of the Tauri process model. A single Core process manages one or more WebView processes.</figcaption>
</figure>

## The WebView Process
Expand Down
5 changes: 5 additions & 0 deletions src/styles/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,8 @@ article.card {
body {
overflow-y: scroll;
}

figcaption {
font-size: 0.9rem;
text-align: center;
}
Loading