diff --git a/slides/datastar/assets/Star-Trek-Lower-Decks.webp b/slides/datastar/assets/Star-Trek-Lower-Decks.webp new file mode 100644 index 0000000..7a2a78c Binary files /dev/null and b/slides/datastar/assets/Star-Trek-Lower-Decks.webp differ diff --git a/slides/datastar/assets/mariner.png b/slides/datastar/assets/mariner.png new file mode 100644 index 0000000..7f578fe Binary files /dev/null and b/slides/datastar/assets/mariner.png differ diff --git a/slides/datastar/slides copy.md b/slides/datastar/slides copy.md new file mode 100644 index 0000000..b250ecd --- /dev/null +++ b/slides/datastar/slides copy.md @@ -0,0 +1,914 @@ +--- +# try also 'default' to start simple +theme: default +# random image from a curated Unsplash collection by Anthony +# like them? see https://unsplash.com/collections/94734566/slidev +background: assets/galaxy.jpg +# some information about your slides (markdown enabled) +title: Datastar +# apply UnoCSS classes to the current slide +class: text-center +# https://sli.dev/features/drawing +drawings: + persist: false +# slide transition: https://sli.dev/guide/animations.html#slide-transitions +transition: slide-left +# enable MDC Syntax: https://sli.dev/features/mdc +mdc: true +--- + +# To The Stars with Datastar + +An interstellar journey + + + + + +--- +background: assets/galaxy.jpg +--- + + +

Drake Formular

+ +
+ +$$ {1|2|3|4|5|6|7|all} +\begin{aligned} +N &= R_* \cdot f_p \cdot n_e \cdot f_l \cdot f_i \cdot f_c \cdot L \\ +R_* &= \text{rate of star formation} \\ +f_p &= \text{fraction of stars with planets} \\ +n_e &= \text{number of habitable planets per star} \\ +f_l &= \text{fraction where life develops} \\ +f_i &= \text{fraction where intelligent life evolves} \\ +f_c &= \text{fraction that develops detectable technology} \\ +L &= \text{length of time civilizations are detectable} +\end{aligned} +$$ + +
+ +--- +class: text-center +--- + +

The "Drake" Formular of Webtechnologies

+ +
+ +$$ {1|all} +\begin{aligned} +N_w &= D_b \cdot L_b \cdot F_b \cdot P_t \cdot F_f \cdot S_m \cdot C_{ss} \cdot C_l \cdot H_p \\ +\\ +N_w &= \text{Total Possible Tech Stacks} \\ +D_b &= \text{databases (PostgreSQL, MongoDB, MySQL...)} \\ +L_b &= \text{backend languages (Javascript, Python, Go...)} \\ +F_b &= \text{backend frameworks (Express, Django, FastAPI...)} \\ +P_t &= \text{transport protocols (REST, GraphQL, gRPC...)} \\ +F_f &= \text{frontend frameworks (React, Vue, Svelte...)} \\ +S_m &= \text{state management (Redux, Zustand, Pinia...)} \\ +C_{ss} &= \text{CSS frameworks (Tailwind, UnoCSS, Bootstrap...)} \\ +C_l &= \text{component libraries (shadcn, MUI, Ant Design...)} \\ +H_p &= \text{hosting platforms (Vercel, AWS, VPS...)} \\ +\end{aligned} +$$ + +
+--- +class: default +--- + +

The Space of Webtechnologies

+ +
+ +$$ +\begin{aligned} +N_w &= ( D_b , L_b , F_b , P_t , F_f , S_m , C_{ss} , C_l , H_p ) \\ +\\ +\end{aligned} +$$ + +- Every website or web application is one star in this space. +- There are many combinations that work well. While others no so much. +- We all plot our path in this space. And have our current home there. +- There are clusters in this space, i.e. the React-Cluster, oder Angular or Vue. +- My current home is in the L-O-B with Go and Vue vicinity. +- There is an old Cluster called Hypermedia. Where all Webapps once lived. +- Hypermedia has developed a new bulge called HTMX. +- Next to it is a new tiny blob, called Datastar. + + + +
+ +--- +class: text-center +--- + +# My name is +# Thomas Hedeler + +# A holistic developer + +--- +class: default +transition: fade-out +--- + +# How did I find Datastar? What is my motivation? + +### Finding my combination of web technologies for a minimal viable web application. + +
+ +- Part 1: The Database: SQLite +- Part 2: The No-ORM ORM - A very simple Data Abstraction Layer. +- Part 3: Developing a Web Server Application in Go. +- Part 4: Datastar - a lightweight framework for real-time collaborative web apps. +- Part 5: Modern CSS. +- Part 6: Web components. +- Part 7: Simple Deployments with a VPS, Nginx, Certbot and a single binary file. + +--- +class: default +transition: fade-out +--- + +# Part 1: SQLite: +### It is fast, feature complete* and rock solid. +
+ +## It is not SQ-Lite, it is SQL-ite + + + +Since everybody knows SQLite, today just a few highlights: + +- It has JSON and JSONB as built-in data types. +- It has 29 new functions to extract from JSON or to create JSON objects. +- It's CTEs make SQL Turing complete. +- The SQLite CLI can be used to execute "SQL-scripts". See demo. + +
+ +
* from my pov and for my needs and purposes
+--- +class: default +transition: fade-out +--- + +# Part 2: A very simple Data Abstraction Layer: + +
+ +Features: +- Simplified Database Lifecycle Management. +- Generic Data Handling. +- High-Level CRUD Operations. +- Fluent Transaction API. +- Abstraction and Safety. +- Utility Functions. + +
+--- +class: default +transition: fade-out +--- + +# Part 3: Developing a Web Server Application in Go. + +
+ +Why Go? + +- Go is a compiled language that generates native machine code. +- Go's core strength is its built-in, lightweight concurrency model using goroutines and channels. +- Go has a small, well-defined specification and a deliberately simple syntax. +- The standard library is comprehensive, especially for web development. +- Go compiles into a single, static binary with no external dependencies. +- Go is simple, just 25 reserved words in the language. +- Can embed the database engine (modernc/sqlite) +- Can serve static code from embeded folders and files. +- Can embed other resources, like sql files or template files. +- Has a built-in templating engine. +--- +layout: quote +transition: fade-out +--- + +# Part 4: Datastar + +
+ +Quote Gillian Delany:  + +> The problem is Datastar is actually a backend agnostic backend framework with a 10 Kb shim. There has never been anything like it in practice. So it is hard to explain. + + + +--- +class: default +--- + +# Term-Soup: +
+ +ADR, core+plugins, Signals, Ideomorph, Core-Engine, Plug-ins, SSE, +You have to control the backend, Templating, HTMX, Hypermedia, Hateoas, +Locality of behaviour, +Declarative vs. Imperative, DS conforms strictly to the web's specs. + +--- +class: default +--- + +# HTTP - Protocol +# + +
POST https://api.example.com/api/users/search?page=2&limit=10 HTTP/1.1
+
+
Host: api.example.com
+
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
+
Accept: application/json
+
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
+
Cookie: sessionId=abc123; theme=dark
+
Content-Length: 89
+
+ +
+
+
{
+
body: data for the search request
+
}
+
+ + +--- +class: default +--- + +# Reducing the Network to a Remote Procedure Call + +```js +{ + const { data, error } = await to(fetch("https://api.example.com/api/board")); + if (error) { + // handle error + return; + } + // handle data +} +{ + const { data, error } = await to(fetch("https://api.example.com/api/users/12")); + if (error) { + // handle error + return; + } + // handle data +} + +// the function that "unwraps" the promise: +export function to(promise: Promise) { + return promise + .then((response) => response.json()) + .then((data) => ({ data, error: null })) + .catch((error) => ({ data: null, error })); +} + +``` + +--- +class: default +--- + +# Learn Some Templating System: +
+ +| Concept | Example | Meaning | +| ----------------- | ---------------------------------------- | -------------------------- | +| **Interpolation** | `{{ name }}` | Insert value of `name` | +| **Loop** | `{% for item in items %}...{% endfor %}` | Repeat block for each item | +| **Condition** | `{% if logged_in %}Welcome{% endif %}` | Conditional rendering | +| **Include** | `{% include 'header.html' %}` | Reuse a subtemplate | +| **Escaping** | `{{{ raw_html }}}` or `{{& raw_html}}` | Control HTML escaping | + + +--- +class: default +--- + +# Templating and Hypermedia: +
+ +| | Templating | Hypermedia as the Engine of Application State | +| --------- | ------------------------ | ------------------------------------------ | +| Input | Data | Data + available transitions | +| Output | Document (HTML) | Document representing a state with actions | +| Function | Bind data to structure | Bind state transitions to structure | +| Goal | Present information | Drive navigation and state evolution | +| Mechanism | Placeholder substitution | Link/form embedding | +| Example | `{{.Title}}` → “Article” | `Edit` | + + +--- +transition: slide-up +level: 2 +--- + +# Navigation + +Hover on the bottom-left corner to see the navigation's controls panel, [learn more](https://sli.dev/guide/ui#navigation-bar) + +## Keyboard Shortcuts + +| | | +| --------------------------------------------------- | --------------------------- | +| right / space | next animation or slide | +| left / shiftspace | previous animation or slide | +| up | previous slide | +| down | next slide | + + + +

Here!

+ +--- +layout: two-cols +layoutClass: gap-16 +--- + +# Table of contents + +You can use the `Toc` component to generate a table of contents for your slides: + +```html + +``` + +The title will be inferred from your slide content, or you can override it with `title` and `level` in your frontmatter. + +::right:: + + + +--- +layout: image-right +image: https://cover.sli.dev +--- + +# Code + +Use code snippets and get the highlighting directly, and even types hover! + +```ts [filename-example.ts] {all|4|6|6-7|9|all} twoslash +// TwoSlash enables TypeScript hover information +// and errors in markdown code blocks +// More at https://shiki.style/packages/twoslash +import { computed, ref } from 'vue' + +const count = ref(0) +const doubled = computed(() => count.value * 2) + +doubled.value = 2 +``` + + + + +<<< @/snippets/external.ts#snippet + + + +[Learn more](https://sli.dev/features/line-highlighting) + + + + + + +--- +level: 2 +--- + +# Shiki Magic Move + +Powered by [shiki-magic-move](https://shiki-magic-move.netlify.app/), Slidev supports animations across multiple code snippets. + +Add multiple code blocks and wrap them with ````md magic-move (four backticks) to enable the magic move. For example: + +````md magic-move {lines: true} +```ts {*|2|*} +// step 1 +const author = reactive({ + name: 'John Doe', + books: [ + 'Vue 2 - Advanced Guide', + 'Vue 3 - Basic Guide', + 'Vue 4 - The Mystery' + ] +}) +``` + +```ts {*|1-2|3-4|3-4,8} +// step 2 +export default { + data() { + return { + author: { + name: 'John Doe', + books: [ + 'Vue 2 - Advanced Guide', + 'Vue 3 - Basic Guide', + 'Vue 4 - The Mystery' + ] + } + } + } +} +``` + +```ts +// step 3 +export default { + data: () => ({ + author: { + name: 'John Doe', + books: [ + 'Vue 2 - Advanced Guide', + 'Vue 3 - Basic Guide', + 'Vue 4 - The Mystery' + ] + } + }) +} +``` + +Non-code blocks are ignored. + +```vue + + +``` +```` + +--- + +# Components + +
+
+ +You can use Vue components directly inside your slides. + +We have provided a few built-in components like `` and `` that you can use directly. And adding your custom components is also super easy. + +```html + +``` + + + + +Check out [the guides](https://sli.dev/builtin/components.html) for more. + +
+
+ +```html + +``` + + + +
+
+ + + +--- +class: px-20 +--- + +# Themes + +Slidev comes with powerful theming support. Themes can provide styles, layouts, components, or even configurations for tools. Switching between themes by just **one edit** in your frontmatter: + +
+ +```yaml +--- +theme: default +--- +``` + +```yaml +--- +theme: seriph +--- +``` + + + + + +
+ +Read more about [How to use a theme](https://sli.dev/guide/theme-addon#use-theme) and +check out the [Awesome Themes Gallery](https://sli.dev/resources/theme-gallery). + +--- + +# Clicks Animations + +You can add `v-click` to elements to add a click animation. + +
+ +This shows up when you click the slide: + +```html +
This shows up when you click the slide.
+``` + +
+ +
+ + + +The v-mark directive +also allows you to add +inline marks +, powered by [Rough Notation](https://roughnotation.com/): + +```html +inline markers +``` + + + +
+ +[Learn more](https://sli.dev/guide/animations#click-animation) + +
+--- + +# HTTP - Protocol +# + +
POST https://api.example.com/api/users/search?page=2&limit=10 HTTP/1.1
+
+
Host: api.example.com
+
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
+
Accept: application/json
+
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
+
Cookie: sessionId=abc123; theme=dark
+
Content-Length: 89
+
+ +
+
+
{
+
body: data for the search request
+
}
+
+ + +--- + +# Reducing the Network to a Remote Procedure Call + +```js +{ + const { data, error } = await to(fetch("https://api.example.com/api/users/11")); + if (error) { + // handle error + return; + } + // handle data +} + + +// the function that "unwraps" the promise: +export function to(promise: Promise) { + return promise + .then((response) => response.json()) + .then((data) => ({ data, error: null })) + .catch((error) => ({ data: null, error })); +} + +``` + +--- + +# LaTeX + +LaTeX is supported out-of-box. Powered by [KaTeX](https://katex.org/). + +
+ +Inline $\sqrt{3x-1}+(1+x)^2$ + +Block +$$ {1|3|all} +\begin{aligned} +\nabla \cdot \vec{E} &= \frac{\rho}{\varepsilon_0} \\ +\nabla \cdot \vec{B} &= 0 \\ +\nabla \times \vec{E} &= -\frac{\partial\vec{B}}{\partial t} \\ +\nabla \times \vec{B} &= \mu_0\vec{J} + \mu_0\varepsilon_0\frac{\partial\vec{E}}{\partial t} +\end{aligned} +$$ +--- + + + +$$ {1|2|3|4|5|6|7|all} +\begin{aligned} +N &= R_* \cdot f_p \cdot n_e \cdot f_l \cdot f_i \cdot f_c \cdot L \\ +R_* &= \text{rate of star formation} \\ +f_p &= \text{fraction of stars with planets} \\ +n_e &= \text{number of habitable planets per star} \\ +f_l &= \text{fraction where life develops} \\ +f_i &= \text{fraction where intelligent life evolves} \\ +f_c &= \text{fraction that develops detectable technology} \\ +L &= \text{length of time civilizations are detectable} +\end{aligned} +$$ + +

Drake Formular

+ +--- + +

Drake Formular

+ +
+ +$$ {1|2|3|4|5|6|7|all} +\begin{aligned} +N &= R_* \cdot f_p \cdot n_e \cdot f_l \cdot f_i \cdot f_c \cdot L \\ +R_* &= \text{rate of star formation} \\ +f_p &= \text{fraction of stars with planets} \\ +n_e &= \text{number of habitable planets per star} \\ +f_l &= \text{fraction where life develops} \\ +f_i &= \text{fraction where intelligent life evolves} \\ +f_c &= \text{fraction that develops detectable technology} \\ +L &= \text{length of time civilizations are detectable} +\end{aligned} +$$ + +
+--- +class: text-center +--- +## The "Drake" Formular of Webtechnologies + +$$ {1|all|1} +\begin{aligned} +N_w &= D_b \cdot L_b \cdot F_b \cdot P_t \cdot F_f \cdot S_m \cdot C_{ss} \cdot C_l \cdot H_p \\ +\\ +N_w &= \text{Total Possible Tech Stacks} \\ +D_b &= \text{databases (PostgreSQL, MongoDB, MySQL...)} \\ +L_b &= \text{backend languages (Javascript, Python, Go...)} \\ +F_b &= \text{backend frameworks (Express, Django, FastAPI...)} \\ +P_t &= \text{transport protocols (REST, GraphQL, gRPC...)} \\ +F_f &= \text{frontend frameworks (React, Vue, Svelte...)} \\ +S_m &= \text{state management (Redux, Zustand, Pinia...)} \\ +C_{ss} &= \text{CSS frameworks (Tailwind, UnoCSS, Bootstrap...)} \\ +C_l &= \text{component libraries (shadcn, MUI, Ant Design...)} \\ +H_p &= \text{hosting platforms (Vercel, AWS, VPS...)} \\ +\end{aligned} +$$ + + +--- + +# Diagrams + +You can create diagrams / graphs from textual descriptions, directly in your Markdown. + +
+ +```mermaid {scale: 0.5, alt: 'A simple sequence diagram'} +sequenceDiagram + Alice->John: Hello John, how are you? + Note over Alice,John: A typical interaction +``` + +```mermaid {theme: 'neutral', scale: 0.8} +graph TD +B[Text] --> C{Decision} +C -->|One| D[Result 1] +C -->|Two| E[Result 2] +``` + +```mermaid +mindmap + root((mindmap)) + Origins + Long history + ::icon(fa fa-book) + Popularisation + British popular psychology author Tony Buzan + Research + On effectiveness
and features + On Automatic creation + Uses + Creative techniques + Strategic planning + Argument mapping + Tools + Pen and paper + Mermaid +``` + +```plantuml {scale: 0.7} +@startuml + +package "Some Group" { + HTTP - [First Component] + [Another Component] +} + +node "Other Groups" { + FTP - [Second Component] + [First Component] --> FTP +} + +cloud { + [Example 1] +} + +database "MySql" { + folder "This is my folder" { + [Folder 3] + } + frame "Foo" { + [Frame 4] + } +} + +[Another Component] --> [Example 1] +[Example 1] --> [Folder 3] +[Folder 3] --> [Frame 4] + +@enduml +``` + +
+ +Learn more: [Mermaid Diagrams](https://sli.dev/features/mermaid) and [PlantUML Diagrams](https://sli.dev/features/plantuml) +--- +class: text-center +--- + +# The Journey + + + +In the beginning, there was chaos... + + + + + +But then a hero emerged! + + + + + +And everything changed. + + + +--- +foo: bar +dragPos: + square: 691,32,167,_,-16 +--- + +# Draggable Elements + +Double-click on the draggable elements to edit their positions. + +
+ +###### Directive Usage + +```md + +``` + +
+ +###### Component Usage + +```md + +
+ Use the `v-drag` component to have a draggable container! + +``` + + +
+ Double-click me! +
+
+ + + +###### Draggable Arrow + +```md + +``` + + + +--- +src: ./pages/imported-slides.md +hide: false +--- + +--- + +# Monaco Editor + +Slidev provides built-in Monaco Editor support. + +Add `{monaco}` to the code block to turn it into an editor: + +```ts {monaco} +import { ref } from 'vue' +import { emptyArray } from './external' + +const arr = ref(emptyArray(10)) +``` + +Use `{monaco-run}` to create an editor that can execute the code directly in the slide: + +```ts {monaco-run} +import { version } from 'vue' +import { emptyArray, sayHello } from './external' + +sayHello() +console.log(`vue ${version}`) +console.log(emptyArray(10).reduce(fib => [...fib, fib.at(-1)! + fib.at(-2)!], [1, 1])) +``` + +--- +layout: center +class: text-center +--- + +# Learn More + +[Documentation](https://sli.dev) · [GitHub](https://github.com/slidevjs/slidev) · [Showcases](https://sli.dev/resources/showcases) + + diff --git a/slides/datastar/slides.md b/slides/datastar/slides.md index 76027fe..c98b31b 100644 --- a/slides/datastar/slides.md +++ b/slides/datastar/slides.md @@ -226,6 +226,172 @@ Declarative vs. Imperative, DS conforms strictly to the web's specs. class: default --- +# Reducing the Network to a Remote Procedure Call + +```js +{ + const { data, error } = await to(fetch("https://api.example.com/api/board")); + if (error) { + // handle error + return; + } + // handle data +} +{ + const { data, error } = await to(fetch("https://api.example.com/api/users/12")); + if (error) { + // handle error + return; + } + // handle data +} + +// the function that "unwraps" the promise: +export function to(promise: Promise) { + return promise + .then((response) => response.json()) + .then((data) => ({ data, error: null })) + .catch((error) => ({ data: null, error })); +} + +``` +--- +class: default +--- + +# HTTP - Protocol +# + +
POST https://api.example.com/api/users/search?page=2&limit=10 HTTP/1.1
+
+
Host: api.example.com
+
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
+
Accept: application/json
+
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
+
Cookie: sessionId=abc123; theme=dark
+
Content-Length: 89
+
+ +
+
+
{
+
body: data for the search request
+
}
+
+ +--- +class: default +--- +# SSE - Server-Sent Events +# + +
GET https://api.example.com/api/events/stream HTTP/1.1
+
+
Host: api.example.com
+
Accept: text/event-stream
+
Cache-Control: no-cache
+
Connection: keep-alive
+
+ +
+
Response:
+
+
HTTP/1.1 200 OK
+
Content-Type: text/event-stream
+
Cache-Control: no-cache
+
Connection: keep-alive
+
+ +
+
+
event: message
+
data: {"user": "Alice", "action": "joined"}
+
+
event: update
+
data: {"count": 42}
+
+
data: Multi-line
+
data: message example
+
+
+ + +--- +layout: two-cols +layoutClass: gap-16 +--- +# HTTP Communication +# +```mermaid { scale: 0.6} +sequenceDiagram + participant Browser + participant Backend + + Note over Browser,Backend: Traditional HTTP (Polling) + Browser->>Backend: GET /api/data + Backend-->>Browser: Response with data + Note over Browser: Wait... + Browser->>Backend: GET /api/data + Backend-->>Browser: Response with data + Note over Browser: Wait... + Browser->>Backend: GET /api/data + Backend-->>Browser: Response with data +``` +::right:: +# SSE Communication +# +```mermaid { scale: 0.6} +sequenceDiagram + participant Browser + participant Backend + + Note over Browser,Backend: Server-Sent Events (SSE) + Browser->>Backend: GET /api/events (Accept: text/event-stream) + Backend-->>Browser: 200 OK (Connection open) + Note over Backend,Browser: Connection stays open + Backend-->>Browser: event: updatedata: {...} + Backend-->>Browser: event: updatedata: {...} + Backend-->>Browser: event: updatedata: {...} + Note over Browser,Backend: Real-time updates without new requests +``` +--- +class: default +--- + +# Reducing the Network to a Remote Procedure Call + +```js +{ + const { data, error } = await to(fetch("https://api.example.com/api/board")); + if (error) { + // handle error + return; + } + // handle data +} +{ + const { data, error } = await to(fetch("https://api.example.com/api/users/12")); + if (error) { + // handle error + return; + } + // handle data +} + +// the function that "unwraps" the promise: +export function to(promise: Promise) { + return promise + .then((response) => response.json()) + .then((data) => ({ data, error: null })) + .catch((error) => ({ data: null, error })); +} + +``` + +--- +class: default +--- + # Learn Some Templating System:
@@ -256,600 +422,9 @@ class: default --- +layout: image +image: assets/mariner.png transition: slide-up level: 2 --- - -# Navigation - -Hover on the bottom-left corner to see the navigation's controls panel, [learn more](https://sli.dev/guide/ui#navigation-bar) - -## Keyboard Shortcuts - -| | | -| --------------------------------------------------- | --------------------------- | -| right / space | next animation or slide | -| left / shiftspace | previous animation or slide | -| up | previous slide | -| down | next slide | - - - -

Here!

- ---- -layout: two-cols -layoutClass: gap-16 ---- - -# Table of contents - -You can use the `Toc` component to generate a table of contents for your slides: - -```html - -``` - -The title will be inferred from your slide content, or you can override it with `title` and `level` in your frontmatter. - -::right:: - - - ---- -layout: image-right -image: https://cover.sli.dev ---- - -# Code - -Use code snippets and get the highlighting directly, and even types hover! - -```ts [filename-example.ts] {all|4|6|6-7|9|all} twoslash -// TwoSlash enables TypeScript hover information -// and errors in markdown code blocks -// More at https://shiki.style/packages/twoslash -import { computed, ref } from 'vue' - -const count = ref(0) -const doubled = computed(() => count.value * 2) - -doubled.value = 2 -``` - - - - -<<< @/snippets/external.ts#snippet - - - -[Learn more](https://sli.dev/features/line-highlighting) - - - - - - ---- -level: 2 ---- - -# Shiki Magic Move - -Powered by [shiki-magic-move](https://shiki-magic-move.netlify.app/), Slidev supports animations across multiple code snippets. - -Add multiple code blocks and wrap them with ````md magic-move (four backticks) to enable the magic move. For example: - -````md magic-move {lines: true} -```ts {*|2|*} -// step 1 -const author = reactive({ - name: 'John Doe', - books: [ - 'Vue 2 - Advanced Guide', - 'Vue 3 - Basic Guide', - 'Vue 4 - The Mystery' - ] -}) -``` - -```ts {*|1-2|3-4|3-4,8} -// step 2 -export default { - data() { - return { - author: { - name: 'John Doe', - books: [ - 'Vue 2 - Advanced Guide', - 'Vue 3 - Basic Guide', - 'Vue 4 - The Mystery' - ] - } - } - } -} -``` - -```ts -// step 3 -export default { - data: () => ({ - author: { - name: 'John Doe', - books: [ - 'Vue 2 - Advanced Guide', - 'Vue 3 - Basic Guide', - 'Vue 4 - The Mystery' - ] - } - }) -} -``` - -Non-code blocks are ignored. - -```vue - - -``` -```` - ---- - -# Components - -
-
- -You can use Vue components directly inside your slides. - -We have provided a few built-in components like `` and `` that you can use directly. And adding your custom components is also super easy. - -```html - -``` - - - - -Check out [the guides](https://sli.dev/builtin/components.html) for more. - -
-
- -```html - -``` - - - -
-
- - - ---- -class: px-20 ---- - -# Themes - -Slidev comes with powerful theming support. Themes can provide styles, layouts, components, or even configurations for tools. Switching between themes by just **one edit** in your frontmatter: - -
- -```yaml ---- -theme: default ---- -``` - -```yaml ---- -theme: seriph ---- -``` - - - - - -
- -Read more about [How to use a theme](https://sli.dev/guide/theme-addon#use-theme) and -check out the [Awesome Themes Gallery](https://sli.dev/resources/theme-gallery). - ---- - -# Clicks Animations - -You can add `v-click` to elements to add a click animation. - -
- -This shows up when you click the slide: - -```html -
This shows up when you click the slide.
-``` - -
- -
- - - -The v-mark directive -also allows you to add -inline marks -, powered by [Rough Notation](https://roughnotation.com/): - -```html -inline markers -``` - - - -
- -[Learn more](https://sli.dev/guide/animations#click-animation) - -
---- - -# HTTP - Protocol -# - -
POST https://api.example.com/api/users/search?page=2&limit=10 HTTP/1.1
-
-
Host: api.example.com
-
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
-
Accept: application/json
-
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
-
Cookie: sessionId=abc123; theme=dark
-
Content-Length: 89
-
- -
-
-
{
-
body: data for the search request
-
}
-
- - ---- - -# Reducing the Network to a Remote Procedure Call - -```js -{ - const { data, error } = await to(fetch("https://api.example.com/api/users/11")); - if (error) { - // handle error - return; - } - // handle data -} - - -// the function that "unwraps" the promise: -export function to(promise: Promise) { - return promise - .then((response) => response.json()) - .then((data) => ({ data, error: null })) - .catch((error) => ({ data: null, error })); -} - -``` - ---- - -# LaTeX - -LaTeX is supported out-of-box. Powered by [KaTeX](https://katex.org/). - -
- -Inline $\sqrt{3x-1}+(1+x)^2$ - -Block -$$ {1|3|all} -\begin{aligned} -\nabla \cdot \vec{E} &= \frac{\rho}{\varepsilon_0} \\ -\nabla \cdot \vec{B} &= 0 \\ -\nabla \times \vec{E} &= -\frac{\partial\vec{B}}{\partial t} \\ -\nabla \times \vec{B} &= \mu_0\vec{J} + \mu_0\varepsilon_0\frac{\partial\vec{E}}{\partial t} -\end{aligned} -$$ ---- - - - -$$ {1|2|3|4|5|6|7|all} -\begin{aligned} -N &= R_* \cdot f_p \cdot n_e \cdot f_l \cdot f_i \cdot f_c \cdot L \\ -R_* &= \text{rate of star formation} \\ -f_p &= \text{fraction of stars with planets} \\ -n_e &= \text{number of habitable planets per star} \\ -f_l &= \text{fraction where life develops} \\ -f_i &= \text{fraction where intelligent life evolves} \\ -f_c &= \text{fraction that develops detectable technology} \\ -L &= \text{length of time civilizations are detectable} -\end{aligned} -$$ - -

Drake Formular

- ---- - -

Drake Formular

- -
- -$$ {1|2|3|4|5|6|7|all} -\begin{aligned} -N &= R_* \cdot f_p \cdot n_e \cdot f_l \cdot f_i \cdot f_c \cdot L \\ -R_* &= \text{rate of star formation} \\ -f_p &= \text{fraction of stars with planets} \\ -n_e &= \text{number of habitable planets per star} \\ -f_l &= \text{fraction where life develops} \\ -f_i &= \text{fraction where intelligent life evolves} \\ -f_c &= \text{fraction that develops detectable technology} \\ -L &= \text{length of time civilizations are detectable} -\end{aligned} -$$ - -
---- -class: text-center ---- -## The "Drake" Formular of Webtechnologies - -$$ {1|all|1} -\begin{aligned} -N_w &= D_b \cdot L_b \cdot F_b \cdot P_t \cdot F_f \cdot S_m \cdot C_{ss} \cdot C_l \cdot H_p \\ -\\ -N_w &= \text{Total Possible Tech Stacks} \\ -D_b &= \text{databases (PostgreSQL, MongoDB, MySQL...)} \\ -L_b &= \text{backend languages (Javascript, Python, Go...)} \\ -F_b &= \text{backend frameworks (Express, Django, FastAPI...)} \\ -P_t &= \text{transport protocols (REST, GraphQL, gRPC...)} \\ -F_f &= \text{frontend frameworks (React, Vue, Svelte...)} \\ -S_m &= \text{state management (Redux, Zustand, Pinia...)} \\ -C_{ss} &= \text{CSS frameworks (Tailwind, UnoCSS, Bootstrap...)} \\ -C_l &= \text{component libraries (shadcn, MUI, Ant Design...)} \\ -H_p &= \text{hosting platforms (Vercel, AWS, VPS...)} \\ -\end{aligned} -$$ - - ---- - -# Diagrams - -You can create diagrams / graphs from textual descriptions, directly in your Markdown. - -
- -```mermaid {scale: 0.5, alt: 'A simple sequence diagram'} -sequenceDiagram - Alice->John: Hello John, how are you? - Note over Alice,John: A typical interaction -``` - -```mermaid {theme: 'neutral', scale: 0.8} -graph TD -B[Text] --> C{Decision} -C -->|One| D[Result 1] -C -->|Two| E[Result 2] -``` - -```mermaid -mindmap - root((mindmap)) - Origins - Long history - ::icon(fa fa-book) - Popularisation - British popular psychology author Tony Buzan - Research - On effectiveness
and features - On Automatic creation - Uses - Creative techniques - Strategic planning - Argument mapping - Tools - Pen and paper - Mermaid -``` - -```plantuml {scale: 0.7} -@startuml - -package "Some Group" { - HTTP - [First Component] - [Another Component] -} - -node "Other Groups" { - FTP - [Second Component] - [First Component] --> FTP -} - -cloud { - [Example 1] -} - -database "MySql" { - folder "This is my folder" { - [Folder 3] - } - frame "Foo" { - [Frame 4] - } -} - -[Another Component] --> [Example 1] -[Example 1] --> [Folder 3] -[Folder 3] --> [Frame 4] - -@enduml -``` - -
- -Learn more: [Mermaid Diagrams](https://sli.dev/features/mermaid) and [PlantUML Diagrams](https://sli.dev/features/plantuml) ---- -class: text-center ---- - -# The Journey - - - -In the beginning, there was chaos... - - - - - -But then a hero emerged! - - - - - -And everything changed. - - - ---- -foo: bar -dragPos: - square: 691,32,167,_,-16 ---- - -# Draggable Elements - -Double-click on the draggable elements to edit their positions. - -
- -###### Directive Usage - -```md - -``` - -
- -###### Component Usage - -```md - -
- Use the `v-drag` component to have a draggable container! - -``` - - -
- Double-click me! -
-
- - - -###### Draggable Arrow - -```md - -``` - - - ---- -src: ./pages/imported-slides.md -hide: false ---- - ---- - -# Monaco Editor - -Slidev provides built-in Monaco Editor support. - -Add `{monaco}` to the code block to turn it into an editor: - -```ts {monaco} -import { ref } from 'vue' -import { emptyArray } from './external' - -const arr = ref(emptyArray(10)) -``` - -Use `{monaco-run}` to create an editor that can execute the code directly in the slide: - -```ts {monaco-run} -import { version } from 'vue' -import { emptyArray, sayHello } from './external' - -sayHello() -console.log(`vue ${version}`) -console.log(emptyArray(10).reduce(fib => [...fib, fib.at(-1)! + fib.at(-2)!], [1, 1])) -``` - ---- -layout: center -class: text-center ---- - -# Learn More - -[Documentation](https://sli.dev) · [GitHub](https://github.com/slidevjs/slidev) · [Showcases](https://sli.dev/resources/showcases) - - +# to be continued ... \ No newline at end of file