From 04a870a58928622236be22b055f1928f2e84d6c8 Mon Sep 17 00:00:00 2001 From: Nigel Breslaw Date: Fri, 15 Nov 2024 19:56:58 +0200 Subject: [PATCH] Bring more old docs content into the new system More language guide and move some items into an FAQ --- docs/astro.config.mjs | 41 ++++++++- .../getting-started/run-in-slintpad.webp | Bin 0 -> 22376 bytes .../{misc/supported_platforms.md => faq.mdx} | 24 ++--- .../content/docs/getting-started/intro.mdx | 21 +++-- docs/src/content/docs/guide/comments.md | 10 --- docs/src/content/docs/guide/conditions.md | 18 ---- .../development}/debugging_techniques.md | 0 .../localization.md} | 22 ++--- docs/src/content/docs/guide/identifiers.md | 9 -- .../docs/guide/{ => language}/basics.mdx | 6 +- .../docs/guide/{ => language}/components.md | 0 .../docs/guide/{ => language}/fonts.md | 0 .../guide/{ => language}/legacy_syntax.md | 0 .../docs/guide/{ => language}/syntax.mdx | 85 ++++++++---------- .../docs/guide/{ => language}/types.mdx | 0 docs/src/utils/utils.ts | 32 +++---- editors/vscode/src/wasm_preview.ts | 2 +- 17 files changed, 132 insertions(+), 138 deletions(-) create mode 100644 docs/src/assets/getting-started/run-in-slintpad.webp rename docs/src/content/docs/{misc/supported_platforms.md => faq.mdx} (90%) delete mode 100644 docs/src/content/docs/guide/comments.md delete mode 100644 docs/src/content/docs/guide/conditions.md rename docs/src/content/docs/{misc => guide/development}/debugging_techniques.md (100%) rename docs/src/content/docs/guide/{translations.md => development/localization.md} (98%) delete mode 100644 docs/src/content/docs/guide/identifiers.md rename docs/src/content/docs/guide/{ => language}/basics.mdx (92%) rename docs/src/content/docs/guide/{ => language}/components.md (100%) rename docs/src/content/docs/guide/{ => language}/fonts.md (100%) rename docs/src/content/docs/guide/{ => language}/legacy_syntax.md (100%) rename docs/src/content/docs/guide/{ => language}/syntax.mdx (60%) rename docs/src/content/docs/guide/{ => language}/types.mdx (100%) diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index ce4d4ae0575..71ece6f2fb1 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -54,7 +54,7 @@ export default defineConfig({ slug: "index", }, { - label: "Vscode Quick Start", + label: "Getting Started", slug: "getting-started/intro", }, { @@ -62,9 +62,38 @@ export default defineConfig({ collapsed: true, items: [ { label: "Introduction", slug: "guide/intro" }, - { label: "Basics", slug: "guide/basics" }, - { label: "Syntax", slug: "guide/syntax" }, - { label: "Old stuff", slug: "guide/old" }, + { + label: "Slint Language", + items: [ + { + label: "Basics", + slug: "guide/language/basics", + }, + { + label: "Syntax", + slug: "guide/language/syntax", + }, + { + label: "Types", + slug: "guide/language/types", + }, + { + label: "Font Handling", + slug: "guide/language/fonts", + }, + { + label: "Legacy Syntax", + slug: "guide/language/legacy_syntax", + }, + ], + }, + { + label: "App Development", + items: [ + "guide/development/debugging_techniques", + "guide/development/localization", + ], + }, ], }, { @@ -173,6 +202,10 @@ export default defineConfig({ { label: "Conclusion", slug: "tutorial/conclusion" }, ], }, + { + label: "FAQ", + slug: "faq", + }, { label: "Native API", collapsed: true, diff --git a/docs/src/assets/getting-started/run-in-slintpad.webp b/docs/src/assets/getting-started/run-in-slintpad.webp new file mode 100644 index 0000000000000000000000000000000000000000..bee8e0e1f9f83f8117ae1e797570dc6f59f3185c GIT binary patch literal 22376 zcmb^YWk4Lw+69XC%;4_s?(Tu$?(V_eJwVVvfGFlpvP?=2tKtM4wbGHEiv{NWg;ca09wS$fU#T?F-cFs^N z2E{L(oLnrSI2eia&q*7*6XhqJ@kxX>n^7Oz2ZRYw&~!a_y?mv@r|>&iYgRi0RR}r4w~IR7|+&A zP8*7$@?ZuF4@qb(0X!%c_Hfjc|A*JGG?P+my51el2 zDX#^^1W;UJM&=?>_ezuZ-_`hV_y)^#hLIdU9t(;{gpctAL zB-Pqo=1(2|$d@^JK+#`yfOOf~$^X%X)&w%`X{#j%#n4(oHZ9EliXWN_1jDhVzzIQqoWi%^e28%31qQzEB>9z|~XYk1wb$43n$lU-!u$Uc$;z_76`5 z#abTTn*Zv0d%A1=;h}N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ApZ_Z|BKYT}F`AZ7l7 z{9^tUW%k4WpBaDl|BAhU$Jo-olkaT*O82wvr}YOysTg8BY_Vo2jFYXi>p_Jwa3vbc z|8)HdHF34YYvG(|NWxE|(WLvHDC5(}6arNERCM@2N+!{2% ; SPDX-License-Identifier: MIT --> -title: Supported Platforms -description: Supported Platforms +title: FAQ +description: Frequently Asked Questions --- -# Supported Platforms + +## What Are The Supported Platforms Slint runs on many desktop and embedded platforms and micro-controllers. The platform descriptions below cover what has been tested for deployment. For the development environment, we recommend using a recent desktop operating system and compiler version. -Contact [SixtyFPS GmbH](https://slint.dev/contact) if you need to support specific or older versions. -## Desktop Platforms + +### Desktop Platforms Generally, Slint runs on Windows, macOS, and popular Linux distributions. The following tables cover versions that we specifically test. The general objective is to support the operating systems that are supported by their vendors at the time of a Slint version release. -### Windows +#### Windows | Operating System | Architecture | | ---------------- | ------------ | | Windows 10 | x86-64 | | Windows 11 | x86-64 | -### macOS +#### macOS | Operating System | Architecture | | ----------------- | --------------- | @@ -34,13 +35,13 @@ are supported by their vendors at the time of a Slint version release. | macOS 14 Sonoma | x86-64, aarch64 | | macOS 15 Sequoia | x86-64, aarch64 | -### Linux +#### Linux Linux desktop distribution present a diverse landscape, and Slint should run on any of them, provided that they are using Wayland or X-Windows, glibc, and d-bus. If a Linux distribution provides Long Term Support (LTS), Slint should run on the most recent LTS or newer, at the time of a Slint version release. -## Embedded Platforms +### Embedded Platforms Slint runs on a variety of embedded platforms. Generally speaking, Slint requires a modern Linux userspace with working OpenGL ES 2.0 (or newer) or Vulkan drivers. We've had success running Slint on @@ -49,8 +50,11 @@ with working OpenGL ES 2.0 (or newer) or Vulkan drivers. We've had success runni - BuildRoot based distributions. - [TorizonCore](https://www.torizon.io/torizoncore-os). -### Microcontrollers +#### Microcontrollers Slint's platform abstraction allows for integration into any Rust or C++ based Microcontroller development environment. Developers need to implement functionality to feed input events such as touch or keyboard, as well as displaying the pixels rendered by Slint into a frame- or linebuffer. + +## What about other platforms? +Contact [SixtyFPS GmbH](https://slint.dev/contact) if you need to support specific or older versions. diff --git a/docs/src/content/docs/getting-started/intro.mdx b/docs/src/content/docs/getting-started/intro.mdx index 41493a80aa8..3e11e9c6992 100644 --- a/docs/src/content/docs/getting-started/intro.mdx +++ b/docs/src/content/docs/getting-started/intro.mdx @@ -1,14 +1,23 @@ --- // cSpell: ignore CACHEDIR -title: VsCode Quick Start +title: Getting Started description: Get going with Slint. --- import { Steps, LinkCard, Tabs, TabItem, FileTree } from '@astrojs/starlight/components'; +## Understanding the documentation + +:::note[Note] +Slint provides a web based live-editing tool called [Slintpad](https://slintpad.com). It's +possible to open the larger snippets in this tool by clicking the `play` button in the top right +corner of the snippets. +![Screenshot showing link to Slintpad](../../../assets/getting-started/run-in-slintpad.webp) +::: + If you are new to Slint and want to quickly get started and learning the basics we recommend -using Visual Studio Code. VSCode is popular, free and thanks to our official Slint extension +using Visual Studio Code (VS Code). VS Code is popular, free and thanks to the Slint extension it is also the easiest to get started with. :::tip[Tip] @@ -16,13 +25,13 @@ We support many other tools and editors see [here](https://slint.dev/get-started ::: -## Setting up VSCode +## Setting up VS Code -1. Install VSCode. +1. Install VS Code. Download it [here](https://code.visualstudio.com). 2. Install the Slint extension. @@ -37,7 +46,7 @@ This is done via the command palette (Ctrl+Shift+P). -1. **Install VSCode.** +1. **Install VS Code.** Download it [here](https://code.visualstudio.com). 2. **Install the Slint extension.** @@ -56,7 +65,7 @@ This is done via the command palette (CMD+Shift+P). -1. **Install VSCode.** +1. **Install VS Code.** Download it [here](https://code.visualstudio.com). 2. **Install the Slint extension.** diff --git a/docs/src/content/docs/guide/comments.md b/docs/src/content/docs/guide/comments.md deleted file mode 100644 index 9e1c45cc87d..00000000000 --- a/docs/src/content/docs/guide/comments.md +++ /dev/null @@ -1,10 +0,0 @@ ---- - -title: Comments -description: Comments ---- - -C-style comments are supported: - -- line comments: `//` means everything to the end of the line is commented. -- block comments: `/* .. */`. Note that the blocks comments can be nested, so `/* this is a /* single */ comment */` diff --git a/docs/src/content/docs/guide/conditions.md b/docs/src/content/docs/guide/conditions.md deleted file mode 100644 index 4ddc8915e1e..00000000000 --- a/docs/src/content/docs/guide/conditions.md +++ /dev/null @@ -1,18 +0,0 @@ ---- - -title: Conditional Elements -description: Conditional Elements ---- - -The `if` construct instantiates an element only if a given condition is true. -The syntax is `if condition : id := Element { ... }` - -```slint -export component Example inherits Window { - preferred-width: 50px; - preferred-height: 50px; - if area.pressed : foo := Rectangle { background: blue; } - if !area.pressed : Rectangle { background: red; } - area := TouchArea {} -} -``` diff --git a/docs/src/content/docs/misc/debugging_techniques.md b/docs/src/content/docs/guide/development/debugging_techniques.md similarity index 100% rename from docs/src/content/docs/misc/debugging_techniques.md rename to docs/src/content/docs/guide/development/debugging_techniques.md diff --git a/docs/src/content/docs/guide/translations.md b/docs/src/content/docs/guide/development/localization.md similarity index 98% rename from docs/src/content/docs/guide/translations.md rename to docs/src/content/docs/guide/development/localization.md index 7b1eade831f..56a1dad22b2 100644 --- a/docs/src/content/docs/guide/translations.md +++ b/docs/src/content/docs/guide/development/localization.md @@ -1,23 +1,21 @@ --- -title: Translations -description: Translations +title: Localization (l10n) +description: Localization --- Slint's translation infrastructure makes your application available in different languages. ## Overview -:::tip Prerequisite - +:::tip[Prerequisite] Install the `slint-tr-extractor` tool to extract translatable strings from `.slint` files: - ```sh cargo install slint-tr-extractor ``` - ::: + Complete the following steps to translate your application: @@ -29,10 +27,8 @@ Complete the following steps to translate your application: At this point, all strings marked for translation are automatically rendered in the target language. -:::{note} - +:::note[Note] Support for translations via gettext is currently not supported on Windows, see [Add support for translations on Windows #3307](https://github.com/slint-ui/slint/issues/3307). - ::: ## Annotating Translatable Strings @@ -108,10 +104,8 @@ find -name \*.slint | xargs slint-tr-extractor -o MY_PROJECT.pot This creates a file called `MY_PROJECT.pot`. Replace "MY_PROJECT" with your actual project name. To learn how the project name affects the lookup of translations, read the sections below. -:::info - +:::tip[Tip] `.pot` files are [Gettext](https://www.gnu.org/software/gettext/) template files. - ::: ## Translate the Strings @@ -230,14 +224,12 @@ Slint looks for `my_application.mo` in the `lang/fr/LC_MESSAGES/` directory. ## Previewing Translations with `slint-viewer` -:::tip Prerequisite - +:::tip[Prerequisite] Use `slint-viewer` to preview translations when previewing `.slint` files: ```sh cargo install slint-viewer ``` - ::: 1. Enable the `gettext` feature when compiling `slint-viewer`. diff --git a/docs/src/content/docs/guide/identifiers.md b/docs/src/content/docs/guide/identifiers.md deleted file mode 100644 index 037153ee02d..00000000000 --- a/docs/src/content/docs/guide/identifiers.md +++ /dev/null @@ -1,9 +0,0 @@ ---- - -title: Identifiers -description: Identifiers ---- - -Identifiers can be composed of letter (`a-zA-Z`), of numbers (`0-9`), or of the underscore (`_`) or the dash (`-`). -They can't start with a number or a dash (but they can start with underscore) -The underscores are normalized to dashes. Which means that these two identifiers are the same: `foo_bar` and `foo-bar`. diff --git a/docs/src/content/docs/guide/basics.mdx b/docs/src/content/docs/guide/language/basics.mdx similarity index 92% rename from docs/src/content/docs/guide/basics.mdx rename to docs/src/content/docs/guide/language/basics.mdx index 23cde2a4b06..6cec0c5d844 100644 --- a/docs/src/content/docs/guide/basics.mdx +++ b/docs/src/content/docs/guide/language/basics.mdx @@ -3,13 +3,13 @@ title: Basics description: The very basics of Slint --- -import CodeSnippetMD from '../../../components/CodeSnippetMD.astro'; +import CodeSnippetMD from '../../../../components/CodeSnippetMD.astro'; import { Aside, LinkCard } from '@astrojs/starlight/components'; diff --git a/docs/src/content/docs/guide/components.md b/docs/src/content/docs/guide/language/components.md similarity index 100% rename from docs/src/content/docs/guide/components.md rename to docs/src/content/docs/guide/language/components.md diff --git a/docs/src/content/docs/guide/fonts.md b/docs/src/content/docs/guide/language/fonts.md similarity index 100% rename from docs/src/content/docs/guide/fonts.md rename to docs/src/content/docs/guide/language/fonts.md diff --git a/docs/src/content/docs/guide/legacy_syntax.md b/docs/src/content/docs/guide/language/legacy_syntax.md similarity index 100% rename from docs/src/content/docs/guide/legacy_syntax.md rename to docs/src/content/docs/guide/language/legacy_syntax.md diff --git a/docs/src/content/docs/guide/syntax.mdx b/docs/src/content/docs/guide/language/syntax.mdx similarity index 60% rename from docs/src/content/docs/guide/syntax.mdx rename to docs/src/content/docs/guide/language/syntax.mdx index de1574fe222..9c580da64b7 100644 --- a/docs/src/content/docs/guide/syntax.mdx +++ b/docs/src/content/docs/guide/language/syntax.mdx @@ -3,7 +3,7 @@ title: Syntax description: Basic syntax --- -import CodeSnippetMD from '../../../components/CodeSnippetMD.astro'; +import CodeSnippetMD from '../../../../components/CodeSnippetMD.astro'; import { LinkCard } from '@astrojs/starlight/components'; ## Comments @@ -15,27 +15,19 @@ to temporarily disable code. Single line comments are denoted by `//` and are terminated by a new line. -```slint title="Single line comments" +```slint // Amazing text! This is a comment -Text { - text: "Hello World"; // This is also a comment - color: blue; -} ``` ### Multi line comments Multi line comments are denoted by `/*` and `*/` and are terminated by a new line. -```slint title="Multi line comments" +```slint /* - This is a multi - line comment + This is a multi line comment. + It can span multiple lines. */ -Text { - text: "Hello World"; - color: blue; -} ``` @@ -46,34 +38,32 @@ so once you know how to declare and use one you know the other. Elements are the that are part of the Slint Language, while components (also know as widgets) are larger items that are built up from multiple elements and properties. -To declare an element you use the `element-name` followed by a set of curly braces `{}` that contain -the properties of the element. Note that elements are not lines of code that must be terminated with a -semicolon `;`. Doing so will result in an error. +If you have come from other languages such as HTML or React you might be used to opening and closing tags as well +as self closing tags. -```slint title="A Slint Text element with properties" "};" -// Note: This is not a valid Slint file, it's just an example of the syntax -Text { - text: "Hello World"; - color: blue; -} +```html + + + + +``` + +Slint simply has a single way to declare an item the `element-name` followed by a set of curly braces `{}` that contain +the properties of the element. +```slint del="Text {};" // valid Text {} -// Also valid -Text { +Text { } // Valid, but considered bad Slint practice Text { - } -// Valid but hard to read when there are no spaces between the name and braces -Text{} // Not valid due to terminating semicolon -Text { -}; +Text {}; ``` :::note[Note] @@ -83,28 +73,13 @@ If you are new to coding then you can make friends with fellow developers by dis code formatting you don't like. It's a type of small talk developers love and appreciate. ::: -If you have come from other languages such as HTML or React you might be used to opening and closing tags as well -as self closing tags. -```html title="HTML" - - - - -``` -Slint only has a single way to declare an item `element-name {}`. There are some additions to this, such -as declaring an element to be a component or a global singleton. Additionally how to declare an Identifier -so other elements can reference it's properties. ## The root element -:::note[Note] -As well as following along with VsCode you can also run the above code in Slint's web -based editor [Slintpad](https://slintpad.com) by clicking the the `Play` Button -on the top right of the code snippet. -::: -```slint title="The root element" playground + +```slint playground component MyApp { Text { text: "Hello World"; @@ -121,5 +96,23 @@ any number of elements. This is explained in more detail later, it's not importa Properties are the values that are assigned to an element. They are set using the `property-name: value;` syntax. +## Identifiers +Identifiers can be composed of letter (`a-zA-Z`), of numbers (`0-9`), or of the underscore (`_`) or the dash (`-`). +They can't start with a number or a dash (but they can start with underscore) +The underscores are normalized to dashes. Which means that these two identifiers are the same: `foo_bar` and `foo-bar`. +## Conditional Elements + +The `if` construct instantiates an element only if a given condition is true. +The syntax is `if condition : id := Element { ... }` + +```slint playground +export component Example inherits Window { + preferred-width: 50px; + preferred-height: 50px; + if area.pressed : foo := Rectangle { background: blue; } + if !area.pressed : Rectangle { background: red; } + area := TouchArea {} +} +``` \ No newline at end of file diff --git a/docs/src/content/docs/guide/types.mdx b/docs/src/content/docs/guide/language/types.mdx similarity index 100% rename from docs/src/content/docs/guide/types.mdx rename to docs/src/content/docs/guide/language/types.mdx diff --git a/docs/src/utils/utils.ts b/docs/src/utils/utils.ts index fa09e795e9e..2d373d01462 100644 --- a/docs/src/utils/utils.ts +++ b/docs/src/utils/utils.ts @@ -72,32 +72,32 @@ export function getTypeInfo(typeName: KnownType): TypeInfo { switch (typeName) { case "angle": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "0deg", }; case "bool": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "false", }; case "brush": return { - href: "/master/docs/slint/guide/types/#colors-and-brushes", + href: "/master/docs/slint/guide/language/types/#colors-and-brushes", defaultValue: "a transparent brush", }; case "color": return { - href: "/master/docs/slint/guide/types/#colors-and-brushes", + href: "/master/docs/slint/guide/language/types/#colors-and-brushes", defaultValue: "a transparent color", }; case "duration": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "0ms", }; case "easing": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "linear", }; case "enum": @@ -107,52 +107,52 @@ export function getTypeInfo(typeName: KnownType): TypeInfo { }; case "float": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "0.0", }; case "image": return { - href: "/master/docs/slint/guide/types/#images", + href: "/master/docs/slint/guide/language/types/#images", defaultValue: "the empty image", }; case "int": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "0", }; case "length": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "0px", }; case "percent": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "0%", }; case "physical-length": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "0phx", }; case "Point": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "(0px, 0px)", }; case "relative-font-size": return { - href: "/master/docs/slint/guide/types/", + href: "/master/docs/slint/guide/language/types/", defaultValue: "0rem", }; case "string": return { - href: "/master/docs/slint/guide/types/#string", + href: "/master/docs/slint/guide/language/types/#string", defaultValue: '""', }; case "struct": return { - href: "/master/docs/slint/guide/types/#structs", + href: "/master/docs/slint/guide/language/types/#structs", defaultValue: "a struct with all default values", }; default: { diff --git a/editors/vscode/src/wasm_preview.ts b/editors/vscode/src/wasm_preview.ts index c1aa6c90cbc..ae42370f93d 100644 --- a/editors/vscode/src/wasm_preview.ts +++ b/editors/vscode/src/wasm_preview.ts @@ -107,7 +107,7 @@ function getPreviewHtml( import * as slint_preview from '${slint_wasm_preview_url}'; await slint_preview.default(); - const vscode = acquireVsCodeApi(); + const vscode = acquireVscodeApi(); let promises = {}; try { slint_preview.run_event_loop();