Skip to content

Commit 017aab4

Browse files
committed
docs: add reactivity guide and per-composable reactivity tables
1 parent 6f28763 commit 017aab4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+975
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script setup lang="ts">
2+
defineProps<{
3+
size?: string | number
4+
}>()
5+
</script>
6+
7+
<template>
8+
<AppIcon
9+
class="text-error"
10+
icon="close"
11+
:size="size ?? 16"
12+
/>
13+
</template>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script setup lang="ts">
2+
defineProps<{
3+
size?: string | number
4+
}>()
5+
</script>
6+
7+
<template>
8+
<AppIcon
9+
class="text-success"
10+
icon="success"
11+
:size="size ?? 16"
12+
/>
13+
</template>

apps/docs/src/pages/composables/forms/create-form.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@ import { useForm } from '@vuetify/v0'
5757
const form = useForm()
5858
```
5959

60+
## Reactivity
61+
62+
`createForm` adds **reactive validation state** on top of `createRegistry`. Form-level and field-level state are fully reactive.
63+
64+
| Property/Method | Reactive | Notes |
65+
| - | :-: | - |
66+
| `isValid` | <AppSuccessIcon /> | Computed from all fields |
67+
| `isValidating` | <AppSuccessIcon /> | Computed from all fields |
68+
| `ticket.value` | <AppSuccessIcon /> | ShallowRef, triggers validation on change |
69+
| `ticket.errors` | <AppSuccessIcon /> | ShallowRef array |
70+
| `ticket.isValid` | <AppSuccessIcon /> | ShallowRef (null/true/false) |
71+
| `ticket.isPristine` | <AppSuccessIcon /> | ShallowRef boolean |
72+
| `ticket.isValidating` | <AppSuccessIcon /> | ShallowRef boolean |
73+
| `get(id)` | <AppErrorIcon /> | Returns ticket with reactive refs |
74+
| `values()` | <AppErrorIcon /> | Use `useProxyRegistry()` for reactive collection |
75+
6076
## Architecture
6177

6278
`createForm` extends `createRegistry` with validation capabilities:

apps/docs/src/pages/composables/foundation/create-context.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,16 @@ Click the buttons to add notifications. Click a notification to dismiss it.
9999

100100
:::
101101

102+
## Reactivity
103+
104+
`createContext` is a **factory function** that returns plain functions. It does not introduce reactivity itself—reactivity comes from the values you provide.
105+
106+
| Return | Reactive | Notes |
107+
| - | :-: | - |
108+
| `useContext()` | <AppErrorIcon /> | Function, returns injected value |
109+
| Injected value | <AppSuccessIcon /> | If you provide refs/reactive objects |
110+
111+
> [!TIP] Reactivity is what you provide
112+
> The context system is a transport layer. If you provide `ref()` or `reactive()` values, consumers get reactive access. Plain objects remain plain.
113+
102114
<DocsApi />

apps/docs/src/pages/composables/foundation/create-plugin.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,11 @@ flowchart LR
100100
install --> app.runWithContext
101101
```
102102

103+
## Reactivity
104+
105+
`createPlugin` is a **factory function** that returns a Vue plugin object. It does not introduce reactivity—it's a vehicle for providing contexts at app level.
106+
107+
> [!TIP] Reactivity lives in what you provide
108+
> The plugin is just the delivery mechanism. Reactive state comes from the contexts you provide via `provideContext()`.
109+
103110
<DocsApi />

apps/docs/src/pages/composables/foundation/create-trinity.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,15 @@ flowchart LR
8181
C --> Fallback
8282
```
8383

84+
## Reactivity
85+
86+
`createTrinity` is a **factory function** that returns a tuple of functions and a default context. It does not introduce reactivity—it structures access to contexts you create.
87+
88+
| Return | Reactive | Notes |
89+
| - | :-: | - |
90+
| `defaultContext` | <AppSuccessIcon /> | If the context object contains refs/reactive |
91+
92+
> [!TIP] Trinity is a pattern, not a reactive primitive
93+
> The trinity pattern organizes your context into a consistent tuple. Reactivity depends on what you put in `defaultContext`.
94+
8495
<DocsApi />

apps/docs/src/pages/composables/plugins/use-breakpoints.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,19 @@ flowchart LR
9191
viewport --> breakpoint[name/flags]
9292
```
9393

94+
## Reactivity
95+
96+
All breakpoint properties are reactive and automatically update when the viewport size changes.
97+
98+
| Property | Reactive | Notes |
99+
| - | :-: | - |
100+
| `name` | <AppSuccessIcon /> | Current breakpoint name |
101+
| `width` | <AppSuccessIcon /> | Viewport width in pixels |
102+
| `height` | <AppSuccessIcon /> | Viewport height in pixels |
103+
| `isMobile` | <AppSuccessIcon /> | Below mobile breakpoint threshold |
104+
| `xs` / `sm` / `md` / `lg` / `xl` / `xxl` | <AppSuccessIcon /> | Exact breakpoint matches |
105+
| `smAndUp` / `mdAndUp` / `lgAndUp` / `xlAndUp` / `xxlAndUp` | <AppSuccessIcon /> | At or above breakpoint |
106+
| `smAndDown` / `mdAndDown` / `lgAndDown` / `xlAndDown` / `xxlAndDown` | <AppSuccessIcon /> | At or below breakpoint |
107+
| `breakpoints` | <AppErrorIcon /> | Static config object |
108+
94109
<DocsApi />

apps/docs/src/pages/composables/plugins/use-date.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,3 +410,12 @@ This is intentional to prevent hydration mismatches. For SSR apps needing curren
410410
```
411411

412412
3. **Server timezone:** Set `TZ=UTC` environment variable on your server for consistent baseline
413+
414+
## Reactivity
415+
416+
The date context provides minimal reactivity, with the adapter being a static instance.
417+
418+
| Property | Reactive | Notes |
419+
| - | :-: | - |
420+
| `locale` | <AppSuccessIcon /> | Computed from `useLocale` if available |
421+
| `adapter` | <AppErrorIcon /> | Static adapter instance |

apps/docs/src/pages/composables/plugins/use-features.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,4 +238,14 @@ flowchart TD
238238
createTokens --> useFeatures
239239
```
240240

241+
## Reactivity
242+
243+
Feature flags inherit reactivity from `createGroup`. Selection state is reactive, but lookup methods return static values.
244+
245+
| Property | Reactive | Notes |
246+
| - | :-: | - |
247+
| `selectedIds` | <AppSuccessIcon /> | Set of enabled feature IDs |
248+
| `selectedItems` | <AppSuccessIcon /> | Computed array of enabled features |
249+
| ticket `isSelected` | <AppSuccessIcon /> | Computed from `selectedIds` |
250+
241251
<DocsApi />

apps/docs/src/pages/composables/plugins/use-hydration.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,13 @@ flowchart LR
7373
hydrate --> isHydrated
7474
```
7575

76+
## Reactivity
77+
78+
Hydration state is reactive and updates when the root component mounts.
79+
80+
| Property | Reactive | Notes |
81+
| - | :-: | - |
82+
| `isHydrated` | <AppSuccessIcon /> | True after root component mounts |
83+
| `isSettled` | <AppSuccessIcon /> | True after next tick post-hydration |
84+
7685
<DocsApi />

0 commit comments

Comments
 (0)