Skip to content

Commit fdddccb

Browse files
committed
wip
1 parent d0bb55d commit fdddccb

File tree

4 files changed

+58
-16
lines changed

4 files changed

+58
-16
lines changed

composer.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Web/Documentation/content/1.x/1-essentials/02-views.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,15 @@ Optionally, it accepts an `entrypoint` attribute. If it is passed, the component
499499
<x-vite-tags entrypoint="src/main.ts" />
500500
```
501501

502+
### `x-markdown`
503+
504+
The `{html}x-markdown` component can be used to render markdown content, either directly from your view files, or by passing a content variables into it:
505+
506+
```html
507+
<x-markdown># hi</x-markdown>
508+
<x-markdown :content="$text" />
509+
```
510+
502511
## Pre-processing views
503512

504513
In most applications, some views will need access to common data. To avoid having to manually provide this data to views through controller methods, it is possible to use view processors to manipulate views before they are rendered.

src/Web/Documentation/show.view.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class="
3434
</nav>
3535
</div>
3636
<!-- Mobile sidebar button -->
37-
<button onclick="toggleSideBar()" class="fixed lg:hidden bottom-5 right-5 z-[10] border rounded-lg p-3 border-(--ui-border) bg-(--ui-bg-elevated) text-(--ui-text-muted) hover:text-(--ui-text) transition flex items-center justify-center">
38-
<x-icon name="tabler:list" class="size-6" />
39-
</button>
37+
<!-- <button onclick="toggleSideBar()" class="fixed lg:hidden bottom-5 right-5 z-[10] border rounded-lg p-3 border-(--ui-border) bg-(--ui-bg-elevated) text-(--ui-text-muted) hover:text-(--ui-text) transition flex items-center justify-center">-->
38+
<!-- <x-icon name="tabler:list" class="size-6" />-->
39+
<!-- </button>-->
4040
<!-- Mobile sidebar -->
4141
<div data-sidebar class="hidden fixed md:hidden inset-0 overflow-auto z-[9] bg-(--ui-bg) text-(--ui-text) p-8 starting:opacity-0 starting:scale-90 transition opacity-100 scale-100 origin-bottom-right">
4242
<!-- Menu -->

src/Web/Documentation/view-spec.md

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ final class BookView implements View
160160
</div>
161161
```
162162

163-
### `x-template`
163+
### Templates
164164

165165
The built-in `{html}<x-template>` element may be used as a placeholder when you want to use a directive without rendering an actual element in the DOM.
166166

@@ -441,6 +441,29 @@ On some occasions, you might want to dynamically render view components, ie. ren
441441

442442
Besides components that you may create yourself, Tempest provides a default set of useful built-in components to improve your developer experience.
443443

444+
All meta-data about discovered view components can be retrieved via the hidden `meta:view-component` command.
445+
446+
```console
447+
./tempest meta:view-component [view-component]
448+
```
449+
450+
```json
451+
{
452+
"file": "/…/tempest-framework/packages/view/src/Components/x-markdown.view.php",
453+
"name": "x-markdown",
454+
"slots": [],
455+
"variables": [
456+
{
457+
"type": "string|null",
458+
"name": "$content",
459+
"attributeName": "content",
460+
"description": "The markdown content from a variable"
461+
}
462+
]
463+
}
464+
465+
```
466+
444467
### `x-icon`
445468

446469
This component provides the ability to inject any icon from the [Iconify](https://iconify.design/) project in your templates.
@@ -476,6 +499,23 @@ Optionally, it accepts an `entrypoint` attribute. If it is passed, the component
476499
<x-vite-tags entrypoint="src/main.ts" />
477500
```
478501

502+
### `x-template`
503+
504+
See [Templates](#templates).
505+
506+
### `x-slot`
507+
508+
See [Using slots](#using-slots).
509+
510+
### `x-markdown`
511+
512+
A component that will render markdown contents:
513+
514+
```html
515+
<x-markdown># hi</x-markdown>
516+
<x-markdown :content="$text" />
517+
```
518+
479519
## Possible IDE integrations
480520

481521
This section lists a bunch of ideas for IDE features that would be useful for IDE integrations.
@@ -550,12 +590,4 @@ Pressing the same keyboard short twice will toggle between server-side and clien
550590
{{-- this text was selected then commented out via a keyboard shortcut --}} — First press
551591
<!-- this text was selected then commented out via a keyboard shortcut --> — Second press
552592
this text was selected then commented out via a keyboard shortcut — Third press, reverts back to normal
553-
```
554-
555-
## Meta commands
556-
557-
Tempest comes with a hidden console command to gather information about view components:
558-
559-
```console
560-
./tempest meta:view-component [view-component]
561593
```

0 commit comments

Comments
 (0)