From 5404273e9e396bb81eb959b566a1469111e7e232 Mon Sep 17 00:00:00 2001 From: brendt Date: Thu, 4 Jun 2026 10:00:18 +0200 Subject: [PATCH 1/3] wip --- docs/1-essentials/02-views.md | 67 ++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/docs/1-essentials/02-views.md b/docs/1-essentials/02-views.md index 036c505fa..2e0fdd2ef 100644 --- a/docs/1-essentials/02-views.md +++ b/docs/1-essentials/02-views.md @@ -215,9 +215,9 @@ Since `:isset` is a shorthand for `:if="isset()"`, it can be combined with `:els

Title

``` -#### `:foreach` and `:{:hl-keyword:forelse:}` +#### `{:hl-property::foreach:}` and `:{:hl-property:forelse:}` -The `:foreach` directive may be used to render the associated element multiple times based on the result of its expression. Combined with `:{:hl-keyword:forelse:}`, an empty state can be displayed when the data is empty. +The `{:hl-property::foreach:}` directive may be used to render the associated element multiple times based on the result of its expression. Combined with `:{:hl-property:forelse:}`, an empty state can be displayed when the data is empty. ```html
  • @@ -249,26 +249,35 @@ The example above will only render the child `div` elements: ### Tag override with the `as` prop The `as` attribute allows you to transform the rendered tag of one element into another. This takes place on an instance of `GenericElement`, so for example this code: + ```html My Link ``` + Would render + ```html ``` + The power behind this is when you use an `Expression` to determine the element. Say for example, you wish to have a `` component which renders as an `` when the `$href` attribute is provided. In your view, use the component like so: + ```html Click to go to an awesome website This is just a button ``` + In your `` component, define: + ```html ``` -Your page will render two links, as follows + +Your page will render two links, as follows: + ```html Click to go to an awesome website @@ -348,16 +357,21 @@ In previous releases (3.8.0 and prior), Tempest would attempt to *merge* these v ::: Assume you have a `button`, like so, with a default set of classes present: + ```html x-button.view.php ``` + Now, in your page, you may utilise the element: + ```html index.view.php ``` + As these attributes automatically apply, your button will be converted to this: + ```html ``` + When you use this version of ``: + - `{html}id` will now default to `mybtn_(sequence generated by uniqid)`, - `{html}style` will not appear automatically, as it was not supplied, - `{html}class` will have a default, you can of course instead concatenate these strings, or use a CVA utility for smart class merging, or anything you want. For example, pass one or more classes: + ```html ``` + And you'll get + ```html ``` @@ -403,19 +425,25 @@ You cannot mix `ApplyAttribute` with automatic fallthrough attributes. Opting to #### Excluding specific fallthrough attributes To exclude specific attributes from falling through, configure your `button` view component like this: + ```html x-button.view.php ``` + :::info The `removeKeys` method returns all key=>value pairs, except for those specified. You can also use the `filter` method if you need to use a closure to filter. ::: + Now, when utilising it in your page: + ```html index.view.php ``` + Will result in: + ```html ``` + :::info The `removeKeysExcept` method returns only the specified key=>value pairs. You can also use the `filter` method if you need to use a closure to filter. ::: + Now, when utilising it in your page: + ```html index.view.php ``` + Tempest will apply only the specified attributes: + ```html ``` + Now, when utilising it in your page: + ```html index.view.php ``` + Tempest will spread the supplied attributes, and as we also used the `AsAttribute` to convert it to a `{html}a` when `$href` is populated, you will get a hyperlink: + ```html Tempest, the framework that gets out of your way ``` @@ -586,10 +626,12 @@ To override this behaviour and manually control in which view component your slo #### Extendable view component example using `define` Let us assume you have an `x-container` view component, which is a `
    ` with formatting to act as a flex container for responsive sizing. You use this component repeatedly across your project, and it's effectively a macro to open and close the `
    `; it doesn't have any slots or do anything special itself otherwise, with only a default `` to render whatever it is given. + ```html x-container.view.php
    ``` Now, assume we have an `x-header` in which we wish to use the `x-container`. Our `x-header` wishes to place slots `left` and `right` inside it; `x-header` owns these slots and wishes to expose these slots at the callsite in case they need custom content. Using the `define` keyword tells Tempest to treat these slots as *defined* by `x-header` instead of as a *slot to fill* inside `x-container`. Using `name` here instead of `define` would mean that Tempest falls back to the AST, and treats them as if they are slots of ``. + ```html x-header.view.php
    @@ -607,17 +649,21 @@ Now, assume we have an `x-header` in which we wish to use the `x-container`. Our
    ``` + At the callsite, you still use the `name` attribute to define which slot you're placing content into: + ```html callsite.view.php Some content I want to insert ``` + This example would replace the default content `` instead with the literal string `Some content I want to insert` - or whatever you provide. #### Populating a child's name slot using `define` You can also push content into a child's named slot, not just the default slot, by creating a `define`d slot as follows: + ```html x-outer.view.php
    @@ -627,12 +673,15 @@ You can also push content into a child's named slot, not just the default slot,
    ``` + Again, the `define` keyword registers a `left` slot against the view component `` irrespective of it's position in the AST, and means that at the callsite: + ```html outercallsite.view.php My override ``` + And so, this places the literal string `My override` into ``'s `left` slot. ### Dynamic view components @@ -757,7 +806,9 @@ This component provides the ability to inject any icon from the [Iconify](https: ```html ``` + will render + ```html ``` + will render + ```html ``` + will render + ```html ``` + will render + ```html ``` + will render + ```html Date: Thu, 4 Jun 2026 10:18:03 +0200 Subject: [PATCH 2/3] wip --- docs/1-essentials/05-discovery.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/1-essentials/05-discovery.md b/docs/1-essentials/05-discovery.md index b5fc728d6..31cf9dec2 100644 --- a/docs/1-essentials/05-discovery.md +++ b/docs/1-essentials/05-discovery.md @@ -32,7 +32,9 @@ Discovery comes with performance considerations. In production, it is always cac To ensure that the discovery cache is up-to-date, add the `discovery:generate` command before any other Tempest command in your deployment pipeline. -```console ">_ ./tempest discovery:generate --no-interaction" +```console +./tempest discovery:generate --no-interaction + Clearing discovery cache ..................................... 2025-12-30 15:51:46 Clearing discovery cache ..................................... DONE Generating discovery cache using the `full` strategy ......... 2025-12-30 15:51:46 From 09f29f5616616d1f40f1d1fa850aec1b4181ae23 Mon Sep 17 00:00:00 2001 From: brendt Date: Thu, 4 Jun 2026 10:41:37 +0200 Subject: [PATCH 3/3] wip --- docs/2-features/13-static-pages.md | 4 ++-- docs/3-packages/01-highlight.md | 2 +- docs/3-packages/03-responsive-image.md | 2 +- docs/3-packages/04-markdown.md | 2 +- docs/5-extra-topics/04-contributing.md | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/2-features/13-static-pages.md b/docs/2-features/13-static-pages.md index aaaf92e33..4ae985fc3 100644 --- a/docs/2-features/13-static-pages.md +++ b/docs/2-features/13-static-pages.md @@ -113,7 +113,7 @@ The only thing left to do is to generate the static pages: ## Crawling for dead links -Optionally, you can instruct the static generate to crawl your pages to scan for dead links. This is done by passing the `--crawl` option to the `static:generate` command: +Optionally, you can instruct the static generate to crawl your pages to scan for dead links. This is done by passing the `--crawl` option to the `{txt}static:generate` command: ```console ./tempest static:generate --crawl @@ -127,6 +127,6 @@ By default, the crawler will only check for internal dead links. If you want to ## Production -Static pages are generated in the `/public` directory, as `index.html` files. Most web servers will automatically serve these static pages for you without any additional setup. +Static pages are generated in the `{txt}/public` directory, as `index.html` files. Most web servers will automatically serve these static pages for you without any additional setup. Note that static pages are meant to be generated as part of your deployment script. That means the `{txt}./tempest static:generate` command should be in your deployment pipeline. diff --git a/docs/3-packages/01-highlight.md b/docs/3-packages/01-highlight.md index 647bc2334..3222494ad 100644 --- a/docs/3-packages/01-highlight.md +++ b/docs/3-packages/01-highlight.md @@ -7,7 +7,7 @@ description: "Tempest's highlighter is a package for server-side, high-performan Require `tempest/highlight` with composer: -``` +```console composer require tempest/highlight ``` diff --git a/docs/3-packages/03-responsive-image.md b/docs/3-packages/03-responsive-image.md index b43a5a4cb..6ab8cca6e 100644 --- a/docs/3-packages/03-responsive-image.md +++ b/docs/3-packages/03-responsive-image.md @@ -6,7 +6,7 @@ description: "A standalone package to render responsive images" ## Quickstart -``` +```console composer require tempest/responsive-image ``` diff --git a/docs/3-packages/04-markdown.md b/docs/3-packages/04-markdown.md index cd432e728..25838e9f4 100644 --- a/docs/3-packages/04-markdown.md +++ b/docs/3-packages/04-markdown.md @@ -7,7 +7,7 @@ description: "Fast and extensible Markdown in PHP" ## Quickstart -```sh +```console composer require tempest/markdown ``` diff --git a/docs/5-extra-topics/04-contributing.md b/docs/5-extra-topics/04-contributing.md index 0a15a9468..53753932d 100644 --- a/docs/5-extra-topics/04-contributing.md +++ b/docs/5-extra-topics/04-contributing.md @@ -326,7 +326,7 @@ Even though we release on a non-fixed schedule, we do assign deadlines to the `n ### Colors -#1b1429 -#29abe2 -#00e7ff -#0071bc \ No newline at end of file +- #1b1429 +- #29abe2 +- #00e7ff +- #0071bc \ No newline at end of file