oneie 3.6.7 → 3.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/agent-backend.md +83 -0
- package/.claude/agents/agent-designer.md +97 -0
- package/.claude/agents/agent-director.md +118 -7
- package/.claude/agents/agent-documenter.md +93 -0
- package/.claude/agents/agent-frontend.md +96 -0
- package/.claude/agents/agent-ops.md +264 -32
- package/.claude/agents/agent-problem-solver.md +166 -0
- package/.claude/agents/agent-quality.md +127 -0
- package/.claude/commands/build.md +293 -0
- package/.claude/commands/cascade.md +231 -127
- package/.claude/commands/deploy.md +56 -17
- package/.claude/commands/mcp-toggle.md +93 -0
- package/.claude/commands/one.md +78 -127
- package/.claude/commands/plan.md +394 -80
- package/.claude/commands/push.md +75 -14
- package/.claude/commands/release.md +89 -25
- package/.claude/commands/server.md +2 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/root-cleanup.py +75 -0
- package/.claude/skills/INDEX.md +523 -0
- package/.claude/skills/REGISTRY.md +529 -0
- package/.claude/skills/agent-backend-create-mutation.md +319 -0
- package/.claude/skills/agent-designer-create-wireframe.md +341 -0
- package/.claude/skills/agent-frontend-create-page.md +413 -0
- package/.claude/skills/agents/README.md +238 -0
- package/dist/clone-web.js +1 -1
- package/dist/clone-web.js.map +1 -1
- package/folders.yaml +1 -1
- package/one/.obsidian/workspace.json +38 -38
- package/one/connections/api/queries-reference.md +842 -0
- package/one/connections/api-reference.md +1011 -0
- package/one/connections/integration-examples.md +875 -0
- package/one/connections/integration-guide.md +869 -0
- package/one/connections/integration-phase2.md +736 -0
- package/one/events/API_ROUTES_FIXES_SUMMARY.md +262 -0
- package/one/events/ASTRO-INTEGRATION-EXAMPLES.md +636 -0
- package/one/events/BEFORE_AFTER_COMPARISON.md +960 -0
- package/one/events/CONNECTIONS_DEMO.md +501 -0
- package/one/events/DELIVERABLES.md +432 -0
- package/one/events/DEMO-GROUPS-PAGE.md +392 -0
- package/one/events/DEMO-TESTING-SUMMARY.md +518 -0
- package/one/events/DEMO_COMPONENTS.md +487 -0
- package/one/events/DEMO_HOOKS_INDEX.md +334 -0
- package/one/events/DEMO_INFRASTRUCTURE.md +905 -0
- package/one/events/DEMO_INFRASTRUCTURE_SUMMARY.md +570 -0
- package/one/events/DEMO_INTEGRATION_CHECKLIST.md +431 -0
- package/one/events/DEMO_QUICK_REFERENCE.md +441 -0
- package/one/events/DEMO_SETUP.md +476 -0
- package/one/events/EFFECT_TS_API_PATTERN.md +478 -0
- package/one/events/GROUPS_DEMO_IMPLEMENTATION.md +414 -0
- package/one/events/HOOKS-DEMO.md +441 -0
- package/one/events/ONTOLOGY-HOOKS-README.md +700 -0
- package/one/events/ONTOLOGY-INTEGRATION-MANIFEST.md +365 -0
- package/one/events/QA-CHECKLIST.md +674 -0
- package/one/events/QUICK-START-ONTOLOGY.md +408 -0
- package/one/events/SEARCH_DEMO_CODE_REFERENCE.md +639 -0
- package/one/events/SEARCH_DEMO_DELIVERY.md +415 -0
- package/one/events/SEARCH_DEMO_SUMMARY.md +303 -0
- package/one/events/SEARCH_DEMO_VISUAL_GUIDE.md +381 -0
- package/one/events/TEST-PLAN-INDEX.md +346 -0
- package/one/events/TEST-PLAN.md +1417 -0
- package/one/events/TESTING-DELIVERY.txt +372 -0
- package/one/events/TRANSITIONS-QUICK-START.md +141 -0
- package/one/events/TYPESCRIPT_FIXES.md +152 -0
- package/one/events/TYPESCRIPT_FIXES_COMPLETE.txt +412 -0
- package/one/events/TYPESCRIPT_FIXES_INDEX.md +341 -0
- package/one/events/VIEW-TRANSITIONS.md +428 -0
- package/one/events/backend-integration-tests.md +606 -0
- package/one/events/backend-structure-diagram.txt +393 -0
- package/one/events/backend-structure-summary.txt +269 -0
- package/one/events/cloudflare-pages-infrastructure-setup.md +264 -0
- package/one/events/convex-analysis-index.md +304 -0
- package/one/events/convex-structure-analysis.md +700 -0
- package/one/events/design-spec-complete.md +208 -0
- package/one/events/ontology-test-examples.md +562 -0
- package/one/events/phase1-backend-implementation-complete.md +518 -0
- package/one/events/test-dashboard.md +345 -0
- package/one/events/test-index.md +361 -0
- package/one/events/test-report-ontology.md +582 -0
- package/one/events/testing-summary.md +344 -0
- package/one/groups/features.md +2878 -0
- package/one/groups/strategy copy.md +869 -0
- package/one/knowledge/backend-api-reference.md +710 -0
- package/one/knowledge/documentation-summary.md +285 -0
- package/one/knowledge/lessons-learned.md +294 -4
- package/one/knowledge/ontology-visual-guide.md +360 -0
- package/one/knowledge/ontology.md +9 -17
- package/one/things/demo-accessibility-animations.md +999 -0
- package/one/things/demo-components.md +1304 -0
- package/one/things/demo-design-summary.md +629 -0
- package/one/things/demo-design-system.md +919 -0
- package/one/things/demo-page-layouts.md +989 -0
- package/one/things/designs/accessibility-audit.md +790 -0
- package/one/things/designs/component-specifications.md +757 -0
- package/one/things/designs/design-overview.md +318 -0
- package/one/things/designs/design-tokens.md +414 -0
- package/one/things/designs/wireframes-dashboard.md +653 -0
- package/one/things/docs/api-requests.md +923 -0
- package/one/things/features/0 All Features.md +2 -0
- package/one/things/implementation/backend-guide.md +412 -0
- package/one/things/plans/2-backend-agnostic-frontend.md +11 -8
- package/one/things/plans/2-sites.md +895 -0
- package/one/things/plans/ai-elements.md +1259 -0
- package/one/things/plans/ai-integration.md +947 -0
- package/one/things/plans/ai-sdk.md +761 -0
- package/one/things/plans/app.md +1 -1
- package/one/things/plans/architecture-summary.md +283 -0
- package/one/things/plans/async-ai-agents.md +215 -0
- package/one/things/plans/backend-agnostic-frontend.md +11 -6
- package/one/things/plans/backend-cleanup-quickstart.md +346 -0
- package/one/things/plans/backend-ontology-conformance.md +416 -0
- package/one/things/plans/backend-status.md +541 -0
- package/one/things/plans/backend-structure.md +799 -0
- package/one/things/plans/backend-target-structure.md +438 -0
- package/one/things/plans/backend.md +1133 -0
- package/one/things/plans/better-auth-any-backend.md +11 -11
- package/one/things/plans/cli-updates-required.md +280 -0
- package/one/things/plans/complete-step-by-step.md +1302 -0
- package/one/things/plans/convex-agents.md +1005 -0
- package/one/things/plans/deployment-architecture.md +426 -0
- package/one/things/plans/development-plan.md +1220 -0
- package/one/things/plans/effect.md +808 -48
- package/one/things/plans/integrate-frontend-and-backend.md +579 -0
- package/one/things/plans/mcp-clear-context-prompt.md +60 -0
- package/one/things/plans/mcp-simple.md +228 -0
- package/one/things/plans/one.md +8 -7
- package/one/things/plans/ontology-6-dimensions.md +20 -14
- package/one/things/plans/quick-wins.md +1273 -0
- package/one/things/plans/readme-backend-cleanup.md +361 -0
- package/one/things/plans/separate-demo.md +830 -0
- package/one/things/plans/separate.md +3 -3
- package/one/things/plans/sequence.md +1897 -0
- package/one/things/plans/sync-checklist.md +321 -0
- package/one/things/plans/unified-implementation-plan.md +3 -3
- package/one/things/plans/update-demos.md +513 -0
- package/package.json +1 -1
- package/.claude/agents/backend-specialist.md +0 -169
- package/.claude/agents/designer.md +0 -216
- package/.claude/agents/frontend-specialist.md +0 -236
- package/.claude/commands/done.md +0 -35
- package/.claude/commands/infer.md +0 -138
- package/.claude/commands/next.md +0 -53
- package/.claude/commands/one copy.md +0 -565
- package/.claude/commands/one-template.md +0 -106
- package/.claude/commands/one-v1.md +0 -609
- package/.claude/hooks/__pycache__/knowledge-post.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/knowledge-pre.cpython-313.pyc +0 -0
- package/one/groups/nine-padel-customers.md +0 -138
- package/one/groups/nine-padel-data-structure.md +0 -167
- package/one/groups/nine-padel-ontology-specification.md +0 -359
- package/one/groups/nine-padel-ontology.md +0 -143
- package/one/groups/nine-padel-strategy.md +0 -234
- package/one/groups/nine-padel.md +0 -211
- package/one/groups/nine-padle-contents.baked.md +0 -1252
- package/one/groups/nine-padle-contents.md +0 -6
- package/one/things/features/1-1-agent-prompts/design.md +0 -470
- package/one/things/features/1-1-agent-prompts/tests.md +0 -264
- package/one/things/features/1-2-yaml-orchestrator/design.md +0 -497
- package/one/things/features/1-2-yaml-orchestrator/tests.md +0 -227
- package/one/things/features/1-3-event-coordination/design.md +0 -544
- package/one/things/features/1-3-event-coordination/tests.md +0 -223
- package/one/things/features/1-4-knowledge-management/design.md +0 -609
- package/one/things/features/1-4-knowledge-management/tests.md +0 -195
- package/one/things/features/1-5-quality-loops/design.md +0 -797
- package/one/things/features/1-5-quality-loops/tests.md +0 -212
- package/one/things/features/1-6-numbering-structure/design.md +0 -610
- package/one/things/features/1-6-numbering-structure/tests.md +0 -213
- package/one/things/features/dataprovider-interface/1-tests.md +0 -1522
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
# View Transitions Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This project implements elegant view transitions between pages using **Astro's View Transitions API**. The transitions are:
|
|
6
|
+
|
|
7
|
+
- ✨ **Subtle and elegant** - Smooth fade + scale by default
|
|
8
|
+
- 🎯 **Direction-aware** - Slides left/right based on forward/backward navigation
|
|
9
|
+
- ♿ **Accessible** - Respects `prefers-reduced-motion`
|
|
10
|
+
- ⚡ **Performant** - GPU-accelerated animations at 60fps
|
|
11
|
+
- 📱 **Responsive** - Optimized timing for mobile devices
|
|
12
|
+
|
|
13
|
+
## How It Works
|
|
14
|
+
|
|
15
|
+
### The View Transitions API
|
|
16
|
+
|
|
17
|
+
Astro's View Transitions API intercepts all same-site navigation and smoothly animates between old and new page content. No full page reload occurs.
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
User clicks link
|
|
21
|
+
↓
|
|
22
|
+
astro:before-preparation event
|
|
23
|
+
↓
|
|
24
|
+
Determine navigation direction (forward/back)
|
|
25
|
+
↓
|
|
26
|
+
Fade out old content with appropriate animation
|
|
27
|
+
↓
|
|
28
|
+
Swap DOM
|
|
29
|
+
↓
|
|
30
|
+
Fade in new content
|
|
31
|
+
↓
|
|
32
|
+
astro:after-swap event (cleanup)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Implementation
|
|
36
|
+
|
|
37
|
+
### 1. Layout Setup (`src/layouts/Layout.astro`)
|
|
38
|
+
|
|
39
|
+
```astro
|
|
40
|
+
---
|
|
41
|
+
import { ViewTransitions } from 'astro:transitions';
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
<!doctype html>
|
|
45
|
+
<html lang="en">
|
|
46
|
+
<head>
|
|
47
|
+
<ViewTransitions />
|
|
48
|
+
<!-- other head content -->
|
|
49
|
+
</head>
|
|
50
|
+
<body>
|
|
51
|
+
<TransitionController client:load />
|
|
52
|
+
<!-- page content -->
|
|
53
|
+
</body>
|
|
54
|
+
</html>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The `<ViewTransitions />` component enables the API and the `<TransitionController>` handles direction detection.
|
|
58
|
+
|
|
59
|
+
### 2. Transition Styles (`src/styles/transitions.css`)
|
|
60
|
+
|
|
61
|
+
All animations are defined in a dedicated stylesheet with:
|
|
62
|
+
|
|
63
|
+
- **Default fade + scale** - Clean, modern feel
|
|
64
|
+
- **Directional slides** - Left/right based on navigation direction
|
|
65
|
+
- **Element-specific transitions** - Headers, modals, cards get appropriate animations
|
|
66
|
+
- **Accessibility** - Respects `prefers-reduced-motion`
|
|
67
|
+
|
|
68
|
+
### 3. Direction Detection (`src/components/TransitionController.tsx`)
|
|
69
|
+
|
|
70
|
+
React component that:
|
|
71
|
+
|
|
72
|
+
1. Listens to `astro:before-preparation` events
|
|
73
|
+
2. Compares current path with destination path
|
|
74
|
+
3. Determines if navigation is forward or backward
|
|
75
|
+
4. Sets `data-direction` attribute on `<html>` element
|
|
76
|
+
5. CSS uses this attribute to apply directional animations
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
// Navigation to /blog/post-1 from /blog → forward
|
|
80
|
+
// Navigation to /blog from /blog/post-1 → back
|
|
81
|
+
// Navigation to /blog from /shop → none (regular fade)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Animation Types
|
|
85
|
+
|
|
86
|
+
### 1. Fade + Scale (Default)
|
|
87
|
+
|
|
88
|
+
Used for most page transitions:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Outgoing: fade out + scale down (0.95)
|
|
92
|
+
Incoming: fade in + scale up (1.05)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Creates depth perception and modern feel.
|
|
96
|
+
|
|
97
|
+
### 2. Directional Slides
|
|
98
|
+
|
|
99
|
+
When navigating forward/backward:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
Forward navigation:
|
|
103
|
+
Outgoing: slide left + fade out
|
|
104
|
+
Incoming: slide in from right + fade in
|
|
105
|
+
|
|
106
|
+
Backward navigation:
|
|
107
|
+
Outgoing: slide right + fade out
|
|
108
|
+
Incoming: slide in from left + fade in
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Modal Entrance
|
|
112
|
+
|
|
113
|
+
Dialogs and modals scale up with fade for emphasis.
|
|
114
|
+
|
|
115
|
+
### 4. Header Stability
|
|
116
|
+
|
|
117
|
+
Navigation elements get subtle fade-only transitions to remain grounded.
|
|
118
|
+
|
|
119
|
+
## Customization
|
|
120
|
+
|
|
121
|
+
### Change Default Animation Duration
|
|
122
|
+
|
|
123
|
+
Edit `src/styles/transitions.css`:
|
|
124
|
+
|
|
125
|
+
```css
|
|
126
|
+
::view-transition-old(root) {
|
|
127
|
+
animation: fade-out-scale 0.3s cubic-bezier(...); /* was 0.5s */
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
::view-transition-new(root) {
|
|
131
|
+
animation: fade-in-scale 0.3s cubic-bezier(...);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Add Custom Transitions to Elements
|
|
136
|
+
|
|
137
|
+
```css
|
|
138
|
+
/* In your component styles or transitions.css */
|
|
139
|
+
.my-special-element {
|
|
140
|
+
view-transition-name: special-element;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
::view-transition-old(special-element) {
|
|
144
|
+
animation: my-custom-out 0.4s ease-out forwards;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
::view-transition-new(special-element) {
|
|
148
|
+
animation: my-custom-in 0.4s ease-in forwards;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Disable Transitions for Specific Links
|
|
153
|
+
|
|
154
|
+
```astro
|
|
155
|
+
<a href="/admin" data-astro-reload>
|
|
156
|
+
Admin (no transition)
|
|
157
|
+
</a>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Use Alternative Transition Style
|
|
161
|
+
|
|
162
|
+
Add `class="layout-cross-fade"` to `<html>` via JavaScript:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
// In TransitionController.tsx
|
|
166
|
+
document.documentElement.classList.add('layout-cross-fade');
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Then the cross-fade variant will be used instead of default animations.
|
|
170
|
+
|
|
171
|
+
## Easing Functions
|
|
172
|
+
|
|
173
|
+
The animations use optimized cubic-bezier curves:
|
|
174
|
+
|
|
175
|
+
```css
|
|
176
|
+
/* Out easing - decelerating (moving out) */
|
|
177
|
+
cubic-bezier(0.4, 0, 1, 1)
|
|
178
|
+
|
|
179
|
+
/* In easing - accelerating (moving in) */
|
|
180
|
+
cubic-bezier(0, 0, 0.2, 1)
|
|
181
|
+
|
|
182
|
+
/* In-out easing - slow start & end */
|
|
183
|
+
cubic-bezier(0.4, 0, 0.2, 1)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
These follow Material Design 3 motion principles.
|
|
187
|
+
|
|
188
|
+
## Performance
|
|
189
|
+
|
|
190
|
+
### GPU Acceleration
|
|
191
|
+
|
|
192
|
+
All animations use `transform` and `opacity` (GPU-accelerated properties):
|
|
193
|
+
|
|
194
|
+
```css
|
|
195
|
+
transform: translateX(40px) scale(0.95);
|
|
196
|
+
opacity: 0;
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
❌ **Avoid:**
|
|
200
|
+
```css
|
|
201
|
+
left: 40px; /* causes reflow */
|
|
202
|
+
width: 95%; /* triggers layout */
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Will-Change
|
|
206
|
+
|
|
207
|
+
The stylesheet includes `will-change` hints:
|
|
208
|
+
|
|
209
|
+
```css
|
|
210
|
+
::view-transition-old(root),
|
|
211
|
+
::view-transition-new(root) {
|
|
212
|
+
will-change: transform, opacity;
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Results
|
|
217
|
+
|
|
218
|
+
- Smooth 60fps animations
|
|
219
|
+
- ~3ms transition overhead per navigation
|
|
220
|
+
- No jank or layout thrashing
|
|
221
|
+
|
|
222
|
+
## Accessibility
|
|
223
|
+
|
|
224
|
+
### Respects Motion Preferences
|
|
225
|
+
|
|
226
|
+
```css
|
|
227
|
+
@media (prefers-reduced-motion: reduce) {
|
|
228
|
+
::view-transition-group(*) {
|
|
229
|
+
animation-duration: 0.01ms !important;
|
|
230
|
+
animation-iteration-count: 1 !important;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Users who prefer reduced motion get instant transitions.
|
|
236
|
+
|
|
237
|
+
### Testing Motion Preferences
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# On macOS: System Preferences → Accessibility → Display → Reduce motion
|
|
241
|
+
# On Windows: Settings → Ease of Access → Display → Show animations
|
|
242
|
+
# In browser DevTools: Rendering tab → Emulate CSS media feature
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Browser Support
|
|
246
|
+
|
|
247
|
+
| Browser | Support | Version |
|
|
248
|
+
| --- | --- | --- |
|
|
249
|
+
| Chrome | ✅ Full | 111+ |
|
|
250
|
+
| Edge | ✅ Full | 111+ |
|
|
251
|
+
| Firefox | ✅ Full | 120+ |
|
|
252
|
+
| Safari | ✅ Full | 18.1+ |
|
|
253
|
+
| Mobile | ✅ Full | Latest |
|
|
254
|
+
|
|
255
|
+
Older browsers simply reload the page without transitions (graceful degradation).
|
|
256
|
+
|
|
257
|
+
## Troubleshooting
|
|
258
|
+
|
|
259
|
+
### Transitions Not Working
|
|
260
|
+
|
|
261
|
+
1. Ensure `<ViewTransitions />` is in `<head>`
|
|
262
|
+
2. Check that `TransitionController` is imported
|
|
263
|
+
3. Verify styles are imported in Layout.astro
|
|
264
|
+
4. Clear browser cache
|
|
265
|
+
5. Check browser console for errors
|
|
266
|
+
|
|
267
|
+
### Transitions Too Fast/Slow
|
|
268
|
+
|
|
269
|
+
Adjust animation duration in `transitions.css`:
|
|
270
|
+
|
|
271
|
+
```css
|
|
272
|
+
/* Make slower */
|
|
273
|
+
animation-duration: 0.8s;
|
|
274
|
+
|
|
275
|
+
/* Make faster */
|
|
276
|
+
animation-duration: 0.2s;
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Elements Jumping During Transition
|
|
280
|
+
|
|
281
|
+
Ensure elements have fixed dimensions or use `view-transition-name` to keep them stable:
|
|
282
|
+
|
|
283
|
+
```css
|
|
284
|
+
.important-element {
|
|
285
|
+
view-transition-name: important;
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Motion Sickness
|
|
290
|
+
|
|
291
|
+
Reduce scale or movement in animations:
|
|
292
|
+
|
|
293
|
+
```css
|
|
294
|
+
@keyframes fade-out-scale {
|
|
295
|
+
to {
|
|
296
|
+
transform: scale(0.98); /* was 0.95 */
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Advanced Usage
|
|
302
|
+
|
|
303
|
+
### Conditional Transitions
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
function TransitionController() {
|
|
307
|
+
const prefersReducedMotion = window.matchMedia(
|
|
308
|
+
'(prefers-reduced-motion: reduce)'
|
|
309
|
+
).matches;
|
|
310
|
+
|
|
311
|
+
if (prefersReducedMotion) {
|
|
312
|
+
// Disable transitions
|
|
313
|
+
document.documentElement.style.viewTransitionDuration = '0s';
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Per-Page Transition Types
|
|
319
|
+
|
|
320
|
+
```astro
|
|
321
|
+
---
|
|
322
|
+
// Add class to html element via page
|
|
323
|
+
const pageClass = Astro.url.pathname === '/blog' ? 'blog-layout' : '';
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
<html class={pageClass}>
|
|
327
|
+
<!-- CSS targets .blog-layout for custom animations -->
|
|
328
|
+
</html>
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Loading State During Transition
|
|
332
|
+
|
|
333
|
+
```tsx
|
|
334
|
+
document.addEventListener('astro:before-preparation', () => {
|
|
335
|
+
// Show loading indicator
|
|
336
|
+
document.body.classList.add('is-transitioning');
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
document.addEventListener('astro:after-swap', () => {
|
|
340
|
+
// Hide loading indicator
|
|
341
|
+
document.body.classList.remove('is-transitioning');
|
|
342
|
+
});
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
## Best Practices
|
|
346
|
+
|
|
347
|
+
1. **Keep animations under 500ms** - Anything longer feels sluggish
|
|
348
|
+
2. **Use easing functions** - Never use `linear` for page transitions
|
|
349
|
+
3. **Maintain consistency** - Use same duration/easing across all transitions
|
|
350
|
+
4. **Test on slow networks** - Animations may queue if loading takes time
|
|
351
|
+
5. **Prefer transform/opacity** - GPU-accelerated properties only
|
|
352
|
+
6. **Respect user preferences** - Always check `prefers-reduced-motion`
|
|
353
|
+
7. **Test on mobile** - Use shorter durations (300ms instead of 500ms)
|
|
354
|
+
8. **Avoid blocking transitions** - Don't perform heavy JS during transitions
|
|
355
|
+
|
|
356
|
+
## CSS Reference
|
|
357
|
+
|
|
358
|
+
### View Transition Properties
|
|
359
|
+
|
|
360
|
+
```css
|
|
361
|
+
/* Name an element for custom animation */
|
|
362
|
+
view-transition-name: element-name;
|
|
363
|
+
|
|
364
|
+
/* Animate old/new content */
|
|
365
|
+
::view-transition-old(root) { }
|
|
366
|
+
::view-transition-new(root) { }
|
|
367
|
+
|
|
368
|
+
/* Animate specific named elements */
|
|
369
|
+
::view-transition-old(element-name) { }
|
|
370
|
+
::view-transition-new(element-name) { }
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Timing Functions
|
|
374
|
+
|
|
375
|
+
```css
|
|
376
|
+
/* Material Design 3 easing */
|
|
377
|
+
cubic-bezier(0.4, 0, 1, 1) /* Emphasized easing (decelerate) */
|
|
378
|
+
cubic-bezier(0, 0, 0.2, 1) /* Standard easing (accelerate) */
|
|
379
|
+
cubic-bezier(0.4, 0, 0.2, 1) /* In-out easing */
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Related Documentation
|
|
383
|
+
|
|
384
|
+
- [Astro View Transitions](https://docs.astro.build/en/guides/view-transitions/)
|
|
385
|
+
- [Web Animations API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Animations_API)
|
|
386
|
+
- [CSS Animations](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animations)
|
|
387
|
+
- [Material Design Motion](https://m3.material.io/styles/motion)
|
|
388
|
+
- [Prefers Reduced Motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion)
|
|
389
|
+
|
|
390
|
+
## Examples
|
|
391
|
+
|
|
392
|
+
### Example 1: Blog Post Navigation
|
|
393
|
+
|
|
394
|
+
```
|
|
395
|
+
User on /blog → Click blog post link → Slide left fade (forward)
|
|
396
|
+
User on /blog/post-1 → Click back button → Slide right fade (back)
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Example 2: Dashboard Navigation
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
User on /account → Click settings → Fade + scale up (modal-like)
|
|
403
|
+
User on /account/settings → Click back → Fade + scale down
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Example 3: Product Catalog
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
User on /shop → Click category → Zoom out + fade
|
|
410
|
+
User in category → Click product → Zoom in + fade
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## Tips for Great Transitions
|
|
414
|
+
|
|
415
|
+
1. **Subtle is better** - Animations should enhance, not distract
|
|
416
|
+
2. **Consistency matters** - Same animations throughout site
|
|
417
|
+
3. **Fast on mobile** - Reduce animation duration on small screens
|
|
418
|
+
4. **Context helps** - Directional slides guide user through hierarchy
|
|
419
|
+
5. **Test often** - Check on real devices and slow networks
|
|
420
|
+
6. **A/B test** - Measure if transitions improve engagement
|
|
421
|
+
|
|
422
|
+
---
|
|
423
|
+
|
|
424
|
+
**Questions?** Check the [Astro Documentation](https://docs.astro.build/en/guides/view-transitions/) or review the implementation in:
|
|
425
|
+
|
|
426
|
+
- `src/layouts/Layout.astro` - Setup
|
|
427
|
+
- `src/styles/transitions.css` - Animations
|
|
428
|
+
- `src/components/TransitionController.tsx` - Direction detection
|