oneie 3.6.6 → 3.6.11
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 +182 -25
- 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/mcp-toggle.md +93 -0
- package/.claude/commands/onboard.md +179 -0
- package/.claude/commands/one.md +236 -516
- package/.claude/commands/plan.md +394 -80
- package/.claude/commands/release.md +41 -19
- package/.claude/commands/server.md +335 -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/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/.claude/hooks/__pycache__/todo.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,441 @@
|
|
|
1
|
+
# React Hooks Demo Guide
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The ONE Platform includes a comprehensive demo showcasing all **43 production-ready React hooks** organized across **8 dimensions** of the 6-dimension ontology.
|
|
6
|
+
|
|
7
|
+
## What's Included
|
|
8
|
+
|
|
9
|
+
### 1. Demo Page (`/demo/hooks`)
|
|
10
|
+
|
|
11
|
+
An interactive, beautifully designed page showcasing all 43 hooks with:
|
|
12
|
+
|
|
13
|
+
- **Hero Section** - Eye-catching introduction with key metrics
|
|
14
|
+
- **Navigation** - Quick links to each dimension
|
|
15
|
+
- **Hook Cards** - Complete documentation for each hook including:
|
|
16
|
+
- Function signature
|
|
17
|
+
- Parameters explanation
|
|
18
|
+
- Return type
|
|
19
|
+
- Usage example
|
|
20
|
+
- Real-world example code
|
|
21
|
+
- **Common Patterns** - Loading states, error handling, real-time data
|
|
22
|
+
- **Integration Guide** - Using hooks in Astro and React
|
|
23
|
+
- **Complete Working Example** - Full course enrollment component
|
|
24
|
+
- **Statistics** - Key metrics about the hooks
|
|
25
|
+
- **Next Steps** - Links to documentation
|
|
26
|
+
|
|
27
|
+
### 2. Interactive Component (`/src/components/demo/HooksDemo.tsx`)
|
|
28
|
+
|
|
29
|
+
A React component that provides live, runnable examples of:
|
|
30
|
+
|
|
31
|
+
- `useProvider()` - Check backend status
|
|
32
|
+
- `useGroups()` - List groups
|
|
33
|
+
- `useSearch()` - Search entities
|
|
34
|
+
- `useEvents()` - Get recent events
|
|
35
|
+
- `useLabels()` - Get available labels
|
|
36
|
+
|
|
37
|
+
Features:
|
|
38
|
+
- Real-time demo execution
|
|
39
|
+
- Mock data when backend unavailable
|
|
40
|
+
- Results display in JSON format
|
|
41
|
+
- Loading and error states
|
|
42
|
+
- Pro tips section
|
|
43
|
+
|
|
44
|
+
### 3. Comprehensive Guide (`/demo/hooks-guide`)
|
|
45
|
+
|
|
46
|
+
Complete documentation covering:
|
|
47
|
+
|
|
48
|
+
- Quick start guide
|
|
49
|
+
- All 8 hook dimensions in detail
|
|
50
|
+
- Parameter and return type explanations
|
|
51
|
+
- Code examples for every hook
|
|
52
|
+
- Common patterns and best practices
|
|
53
|
+
- Type definitions
|
|
54
|
+
- FAQ section
|
|
55
|
+
|
|
56
|
+
## Hook Dimensions
|
|
57
|
+
|
|
58
|
+
### 1. Provider (4 hooks)
|
|
59
|
+
|
|
60
|
+
Backend abstraction and configuration.
|
|
61
|
+
|
|
62
|
+
- `useProvider()` - Access DataProvider instance
|
|
63
|
+
- `useIsProviderAvailable()` - Check if backend is online
|
|
64
|
+
- `useProviderCapability()` - Check specific capabilities
|
|
65
|
+
- `useProviderName()` - Get provider name
|
|
66
|
+
|
|
67
|
+
### 2. Groups (4 hooks)
|
|
68
|
+
|
|
69
|
+
Multi-tenant isolation and hierarchical containers.
|
|
70
|
+
|
|
71
|
+
- `useGroup()` - CRUD operations on groups
|
|
72
|
+
- `useGroups()` - List groups with filtering
|
|
73
|
+
- `useCurrentGroup()` - Get active group
|
|
74
|
+
- `useChildGroups()` - Get child groups
|
|
75
|
+
|
|
76
|
+
### 3. People (5 hooks)
|
|
77
|
+
|
|
78
|
+
Authorization, roles, and user management.
|
|
79
|
+
|
|
80
|
+
- `usePerson()` - Get/update single person
|
|
81
|
+
- `useCurrentUser()` - Get authenticated user
|
|
82
|
+
- `useHasRole()` - Check user role
|
|
83
|
+
- `useCanAccess()` - Check resource access
|
|
84
|
+
- `useGroupMembers()` - Get group members
|
|
85
|
+
|
|
86
|
+
### 4. Things (7 hooks)
|
|
87
|
+
|
|
88
|
+
Entities, objects, and content management.
|
|
89
|
+
|
|
90
|
+
- `useThing()` - CRUD operations
|
|
91
|
+
- `useThings()` - List with filtering
|
|
92
|
+
- `useThingDetail()` - Get single thing
|
|
93
|
+
- `useThingsByType()` - Get things by type
|
|
94
|
+
- `useThingSearch()` - Search things
|
|
95
|
+
- `usePublishedThings()` - Get published
|
|
96
|
+
- `useMyThings()` - Get user's things
|
|
97
|
+
|
|
98
|
+
### 5. Connections (9 hooks)
|
|
99
|
+
|
|
100
|
+
Relationships between entities.
|
|
101
|
+
|
|
102
|
+
- `useConnection()` - Create/delete connections
|
|
103
|
+
- `useConnections()` - List connections
|
|
104
|
+
- `useRelatedEntities()` - Get related entities
|
|
105
|
+
- `useIsConnected()` - Check if connected
|
|
106
|
+
- `useOwnedEntities()` - Get owned entities
|
|
107
|
+
- `useFollowers()` - Get followers
|
|
108
|
+
- `useFollowing()` - Get following list
|
|
109
|
+
- `useEnrollments()` - Get course enrollments
|
|
110
|
+
- `useUserEnrollments()` - Get user's enrollments
|
|
111
|
+
|
|
112
|
+
### 6. Events (9 hooks)
|
|
113
|
+
|
|
114
|
+
Activity logging and audit trails.
|
|
115
|
+
|
|
116
|
+
- `useEvent()` - Record events
|
|
117
|
+
- `useEvents()` - List events
|
|
118
|
+
- `useActivityFeed()` - User activity feed
|
|
119
|
+
- `useAuditTrail()` - Entity audit trail
|
|
120
|
+
- `useUserHistory()` - User event history
|
|
121
|
+
- `useEventsByType()` - Get events by type
|
|
122
|
+
- `useEventCount()` - Count events
|
|
123
|
+
- `useTimeline()` - Chronological timeline
|
|
124
|
+
- `useEventStream()` - Real-time event stream
|
|
125
|
+
|
|
126
|
+
### 7. Search & Knowledge (9 hooks)
|
|
127
|
+
|
|
128
|
+
Semantic search, labels, and RAG.
|
|
129
|
+
|
|
130
|
+
- `useSearch()` - Search all entities
|
|
131
|
+
- `useSearchByType()` - Search by type
|
|
132
|
+
- `useLabels()` - Get all labels
|
|
133
|
+
- `useLabelsByCategory()` - Get labels by category
|
|
134
|
+
- `useEntityLabels()` - Get entity labels
|
|
135
|
+
- `useEntitiesByLabel()` - Get entities with label
|
|
136
|
+
- `useSimilarEntities()` - Get similar entities
|
|
137
|
+
- `useFacetedSearch()` - Faceted search
|
|
138
|
+
- `useTrendingEntities()` - Get trending items
|
|
139
|
+
|
|
140
|
+
### 8. Recommendations (1 hook)
|
|
141
|
+
|
|
142
|
+
AI-powered personalization.
|
|
143
|
+
|
|
144
|
+
- `useRecommendations()` - Get AI recommendations
|
|
145
|
+
|
|
146
|
+
## Using the Demo
|
|
147
|
+
|
|
148
|
+
### View the Interactive Page
|
|
149
|
+
|
|
150
|
+
Visit `/demo/hooks` to see the complete, interactive demo page.
|
|
151
|
+
|
|
152
|
+
Features:
|
|
153
|
+
- Responsive design (mobile, tablet, desktop)
|
|
154
|
+
- Syntax highlighting for code examples
|
|
155
|
+
- Dark/light mode support
|
|
156
|
+
- Copy-to-clipboard code blocks
|
|
157
|
+
- Smooth scrolling navigation
|
|
158
|
+
- SEO optimized
|
|
159
|
+
|
|
160
|
+
### Use the Interactive Component
|
|
161
|
+
|
|
162
|
+
Import and use the `HooksDemo` component in any page:
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { HooksDemo } from '@/components/demo/HooksDemo';
|
|
166
|
+
|
|
167
|
+
export default function MyPage() {
|
|
168
|
+
return (
|
|
169
|
+
<div>
|
|
170
|
+
<h1>Test the Hooks</h1>
|
|
171
|
+
<HooksDemo client:load />
|
|
172
|
+
</div>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Read the Guide
|
|
178
|
+
|
|
179
|
+
Visit `/demo/hooks-guide` for the complete written guide with:
|
|
180
|
+
|
|
181
|
+
- Detailed API documentation
|
|
182
|
+
- Parameter explanations
|
|
183
|
+
- Return type specifications
|
|
184
|
+
- Code examples for every scenario
|
|
185
|
+
- Best practices
|
|
186
|
+
- FAQ
|
|
187
|
+
|
|
188
|
+
## Key Features
|
|
189
|
+
|
|
190
|
+
### 100% Type Safe
|
|
191
|
+
|
|
192
|
+
All hooks are fully typed with TypeScript:
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
const { things, loading, error } = useThings({
|
|
196
|
+
type: 'course',
|
|
197
|
+
status: 'published'
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// types are inferred correctly:
|
|
201
|
+
// things: Thing[]
|
|
202
|
+
// loading: boolean
|
|
203
|
+
// error: unknown
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Backend Agnostic
|
|
207
|
+
|
|
208
|
+
Works with any backend provider:
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
// Automatically uses configured provider
|
|
212
|
+
// Convex, WordPress, Notion, Stripe, etc.
|
|
213
|
+
const { groups } = useGroups();
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Fallback Support
|
|
217
|
+
|
|
218
|
+
Graceful degradation when backend unavailable:
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
const isOnline = useIsProviderAvailable();
|
|
222
|
+
|
|
223
|
+
if (!isOnline) {
|
|
224
|
+
return <OfflineMode />;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return <OnlineMode />;
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Real-time Capable
|
|
231
|
+
|
|
232
|
+
Subscribe to live updates:
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
const { events, subscribe } = useEventStream();
|
|
236
|
+
|
|
237
|
+
useEffect(() => {
|
|
238
|
+
subscribe();
|
|
239
|
+
}, [subscribe]);
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Error Handling
|
|
243
|
+
|
|
244
|
+
Built-in error states:
|
|
245
|
+
|
|
246
|
+
```typescript
|
|
247
|
+
const { things, error } = useThings();
|
|
248
|
+
|
|
249
|
+
if (error) {
|
|
250
|
+
return <div>Error: {error.message}</div>;
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Integration Patterns
|
|
255
|
+
|
|
256
|
+
### In Astro Pages
|
|
257
|
+
|
|
258
|
+
```astro
|
|
259
|
+
---
|
|
260
|
+
// Fetch server-side data
|
|
261
|
+
import { getProvider } from '@/lib/ontology/factory';
|
|
262
|
+
const provider = await getProvider();
|
|
263
|
+
const groups = await provider.groups.list();
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
<Layout>
|
|
267
|
+
<h1>Groups</h1>
|
|
268
|
+
|
|
269
|
+
{/* Static content */}
|
|
270
|
+
<div class="grid gap-4">
|
|
271
|
+
{groups?.map(g => (
|
|
272
|
+
<GroupCard group={g} />
|
|
273
|
+
))}
|
|
274
|
+
</div>
|
|
275
|
+
|
|
276
|
+
{/* Interactive island */}
|
|
277
|
+
<GroupCreator client:load />
|
|
278
|
+
</Layout>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### In React Components
|
|
282
|
+
|
|
283
|
+
```tsx
|
|
284
|
+
import { useGroups } from '@/hooks/ontology';
|
|
285
|
+
|
|
286
|
+
export function GroupList() {
|
|
287
|
+
const { groups, loading, error } = useGroups();
|
|
288
|
+
|
|
289
|
+
if (loading) return <Skeleton />;
|
|
290
|
+
if (error) return <Error />;
|
|
291
|
+
|
|
292
|
+
return (
|
|
293
|
+
<div>
|
|
294
|
+
{groups?.map(g => (
|
|
295
|
+
<GroupCard key={g._id} group={g} />
|
|
296
|
+
))}
|
|
297
|
+
</div>
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Performance Considerations
|
|
303
|
+
|
|
304
|
+
### Lazy Loading
|
|
305
|
+
|
|
306
|
+
The demo page uses Astro's islands architecture for optimal performance:
|
|
307
|
+
|
|
308
|
+
- Static HTML by default
|
|
309
|
+
- React components load only when needed
|
|
310
|
+
- Syntax highlighting runs at build time
|
|
311
|
+
- Minimal JavaScript bundle
|
|
312
|
+
|
|
313
|
+
### Caching
|
|
314
|
+
|
|
315
|
+
Hooks automatically cache results:
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
// First call fetches
|
|
319
|
+
const { things: courses } = useThings();
|
|
320
|
+
|
|
321
|
+
// Subsequent calls use cache
|
|
322
|
+
const { things: courses2 } = useThings();
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## Testing
|
|
326
|
+
|
|
327
|
+
The demo page is fully responsive and tested across:
|
|
328
|
+
|
|
329
|
+
- Desktop (1920x1080+)
|
|
330
|
+
- Tablet (768px - 1023px)
|
|
331
|
+
- Mobile (320px - 767px)
|
|
332
|
+
- Dark mode
|
|
333
|
+
- Light mode
|
|
334
|
+
- All browsers (Chrome, Firefox, Safari, Edge)
|
|
335
|
+
|
|
336
|
+
## Lighthouse Scores
|
|
337
|
+
|
|
338
|
+
Expected performance metrics:
|
|
339
|
+
|
|
340
|
+
- **Performance**: 90+
|
|
341
|
+
- **Accessibility**: 95+
|
|
342
|
+
- **Best Practices**: 95+
|
|
343
|
+
- **SEO**: 100
|
|
344
|
+
|
|
345
|
+
## Browser Support
|
|
346
|
+
|
|
347
|
+
- Chrome 90+
|
|
348
|
+
- Firefox 88+
|
|
349
|
+
- Safari 14+
|
|
350
|
+
- Edge 90+
|
|
351
|
+
|
|
352
|
+
## Accessibility
|
|
353
|
+
|
|
354
|
+
The demo includes:
|
|
355
|
+
|
|
356
|
+
- Semantic HTML
|
|
357
|
+
- ARIA labels
|
|
358
|
+
- Keyboard navigation
|
|
359
|
+
- Screen reader support
|
|
360
|
+
- Color contrast compliance
|
|
361
|
+
- Mobile touch targets
|
|
362
|
+
|
|
363
|
+
## Code Quality
|
|
364
|
+
|
|
365
|
+
All code follows:
|
|
366
|
+
|
|
367
|
+
- TypeScript strict mode
|
|
368
|
+
- ESLint rules
|
|
369
|
+
- Prettier formatting
|
|
370
|
+
- shadcn/ui best practices
|
|
371
|
+
- React 19 standards
|
|
372
|
+
- Astro conventions
|
|
373
|
+
|
|
374
|
+
## Next Steps
|
|
375
|
+
|
|
376
|
+
1. **View the Demo** - Visit `/demo/hooks`
|
|
377
|
+
2. **Read the Guide** - Check `/demo/hooks-guide`
|
|
378
|
+
3. **Explore Examples** - Click through the interactive demos
|
|
379
|
+
4. **Try it Out** - Copy examples to your components
|
|
380
|
+
5. **Learn More** - Read `/CLAUDE.md` for architecture details
|
|
381
|
+
|
|
382
|
+
## Files Included
|
|
383
|
+
|
|
384
|
+
```
|
|
385
|
+
web/src/
|
|
386
|
+
├── pages/
|
|
387
|
+
│ └── demo/
|
|
388
|
+
│ ├── hooks.astro # Main demo page
|
|
389
|
+
│ └── hooks-guide.md # Complete guide
|
|
390
|
+
├── components/
|
|
391
|
+
│ └── demo/
|
|
392
|
+
│ └── HooksDemo.tsx # Interactive component
|
|
393
|
+
└── hooks/
|
|
394
|
+
├── ontology/
|
|
395
|
+
│ ├── useProvider.ts # 4 provider hooks
|
|
396
|
+
│ ├── useGroup.ts # 4 group hooks
|
|
397
|
+
│ ├── usePerson.ts # 5 people hooks
|
|
398
|
+
│ ├── useThing.ts # 7 thing hooks
|
|
399
|
+
│ ├── useConnection.ts # 9 connection hooks
|
|
400
|
+
│ ├── useEvent.ts # 9 event hooks
|
|
401
|
+
│ ├── useSearch.ts # 10 search/knowledge hooks
|
|
402
|
+
│ └── index.ts # Barrel export (all 43 hooks)
|
|
403
|
+
└── index.ts # All hooks export
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
## FAQ
|
|
407
|
+
|
|
408
|
+
**Q: Where do I access the demo?**
|
|
409
|
+
A: Visit `/demo/hooks` in your browser.
|
|
410
|
+
|
|
411
|
+
**Q: Can I use these in production?**
|
|
412
|
+
A: Yes! These are production-ready, type-safe hooks.
|
|
413
|
+
|
|
414
|
+
**Q: What if my backend isn't available?**
|
|
415
|
+
A: Use `useIsProviderAvailable()` to check. The hooks degrade gracefully.
|
|
416
|
+
|
|
417
|
+
**Q: Do I need to install anything?**
|
|
418
|
+
A: No, all hooks are built-in.
|
|
419
|
+
|
|
420
|
+
**Q: Can I customize the demo?**
|
|
421
|
+
A: Yes, the demo files are in `/web/src/`. Feel free to modify.
|
|
422
|
+
|
|
423
|
+
**Q: How do I contribute improvements?**
|
|
424
|
+
A: Submit issues and PRs to the GitHub repository.
|
|
425
|
+
|
|
426
|
+
## Support
|
|
427
|
+
|
|
428
|
+
- GitHub Issues: Report bugs and feature requests
|
|
429
|
+
- Documentation: Read `/CLAUDE.md` and `/one/knowledge/`
|
|
430
|
+
- Community: Join the Discord server
|
|
431
|
+
- Email: support@one.ie
|
|
432
|
+
|
|
433
|
+
## License
|
|
434
|
+
|
|
435
|
+
All demo code is provided under the same license as the ONE Platform.
|
|
436
|
+
|
|
437
|
+
---
|
|
438
|
+
|
|
439
|
+
**Built with Astro 5, React 19, shadcn/ui, and the 6-dimension ontology.**
|
|
440
|
+
|
|
441
|
+
Last updated: October 25, 2024
|