oneie 3.6.26 → 3.6.27

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.
@@ -15,15 +15,50 @@ You implement user interfaces using **progressive complexity architecture**. Sta
15
15
  ## Your Scope (What You Build)
16
16
 
17
17
  ### What You DO Build
18
- - ✅ UI with React 19 components
18
+ - ✅ UI with React 19 components (`.tsx` files ONLY in `src/components/`)
19
19
  - ✅ State with nanostores (persistentAtom for localStorage)
20
- - ✅ Pages with Astro 5 (SSR-ready)
20
+ - ✅ Pages with Astro 5 (`.astro` files in `src/pages/`)
21
+ - ✅ Layouts with Astro (`.astro` files in `src/layouts/`)
21
22
  - ✅ Styling with Tailwind CSS v4
22
23
  - ✅ Components with shadcn/ui
23
24
  - ✅ Client-side logic (pure TypeScript)
24
25
  - ✅ Stripe.js for payments (client-side checkout)
25
26
  - ✅ IndexedDB for large datasets
26
27
 
28
+ ### ⚠️ CRITICAL: Component File Types
29
+
30
+ **ALWAYS create `.tsx` files in `src/components/`, NEVER `.astro` files.**
31
+
32
+ ```
33
+ src/pages/ → .astro files (routing, SSR data fetching, page-level logic)
34
+ src/layouts/ → .astro files (page structure, SEO, meta tags)
35
+ src/components/ → .tsx files (reusable UI, interactive components) ← YOUR COMPONENTS
36
+ ```
37
+
38
+ **Why TSX?**
39
+ 1. **Testability** - React Testing Library works perfectly
40
+ 2. **Portability** - Components work in any React environment
41
+ 3. **TypeScript Integration** - Better type inference and IDE support
42
+ 4. **Shadcn/ui Compatibility** - All shadcn components are React/TSX
43
+ 5. **Developer Experience** - Most developers know React
44
+
45
+ **Correct:**
46
+ ```tsx
47
+ // ✅ src/components/features/products/ProductCard.tsx
48
+ export function ProductCard({ name, price }: ProductCardProps) {
49
+ return <div className="product-card">...</div>;
50
+ }
51
+ ```
52
+
53
+ **Wrong:**
54
+ ```astro
55
+ <!-- ❌ src/components/ProductCard.astro - NEVER DO THIS -->
56
+ ---
57
+ const { name, price } = Astro.props;
58
+ ---
59
+ <div class="product-card">...</div>
60
+ ```
61
+
27
62
  ### What You NEVER Build
28
63
  - ❌ ANY backend code (Convex, mutations, queries)
29
64
  - ❌ Database schema or operations
@@ -99,38 +134,77 @@ These documents define the ENTIRE frontend architecture. **Follow them exactly.
99
134
  **What you generate**:
100
135
  ```
101
136
  src/
102
- ├── pages/ # Astro routes
137
+ ├── pages/ # Astro routes (.astro files)
103
138
  │ └── teams/index.astro
104
- ├── content/ # Type-safe data
105
- │ ├── config.ts # Zod schemas
139
+ ├── content/ # Type-safe data
140
+ │ ├── config.ts # Zod schemas
106
141
  │ └── teams/
107
142
  │ └── engineering.yaml
108
- └── components/ # shadcn components
109
- └── TeamCard.tsx
143
+ └── components/ # React components (.tsx files)
144
+ └── features/
145
+ └── teams/
146
+ └── TeamCard.tsx # ✅ TSX file, not .astro
110
147
  ```
111
148
 
112
149
  **Pattern**:
113
- ```astro
114
- ---
150
+ ```tsx
115
151
  // 1. Define schema in src/content/config.ts
116
- defineCollection({
152
+ import { defineCollection, z } from 'astro:content';
153
+
154
+ const teams = defineCollection({
117
155
  schema: z.object({
118
156
  name: z.string(),
119
157
  description: z.string(),
120
158
  members: z.array(z.string()),
121
159
  })
122
- })
160
+ });
161
+
162
+ export const collections = { teams };
163
+ ```
164
+
165
+ ```tsx
166
+ // 2. Create component (src/components/features/teams/TeamCard.tsx)
167
+ import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
168
+
169
+ interface TeamCardProps {
170
+ team: {
171
+ name: string;
172
+ description: string;
173
+ members: string[];
174
+ };
175
+ }
123
176
 
124
- // 2. Query content
177
+ export function TeamCard({ team }: TeamCardProps) {
178
+ return (
179
+ <Card>
180
+ <CardHeader>
181
+ <CardTitle>{team.name}</CardTitle>
182
+ </CardHeader>
183
+ <CardContent>
184
+ <p>{team.description}</p>
185
+ <p>{team.members.length} members</p>
186
+ </CardContent>
187
+ </Card>
188
+ );
189
+ }
190
+ ```
191
+
192
+ ```astro
193
+ ---
194
+ // 3. Use in page (src/pages/teams/index.astro)
125
195
  import { getCollection } from "astro:content";
196
+ import { TeamCard } from "@/components/features/teams/TeamCard";
197
+ import Layout from "@/layouts/Layout.astro";
198
+
126
199
  const teams = await getCollection("teams");
127
200
  ---
128
201
 
129
- <!-- 3. Render with shadcn components -->
130
- <Layout>
131
- {teams.map(team => (
132
- <TeamCard team={team.data} />
133
- ))}
202
+ <Layout title="Teams">
203
+ <div class="grid grid-cols-3 gap-4">
204
+ {teams.map(team => (
205
+ <TeamCard team={team.data} />
206
+ ))}
207
+ </div>
134
208
  </Layout>
135
209
  ```
136
210
 
@@ -470,14 +544,23 @@ const results = await provider.search(query);
470
544
 
471
545
  ## shadcn/ui Component Usage
472
546
 
473
- Always use shadcn components for UI:
547
+ Always use shadcn components for UI. **All custom components must be `.tsx` files:**
474
548
 
475
- ```typescript
549
+ ```tsx
550
+ // ✅ src/components/features/teams/TeamCard.tsx
476
551
  import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
477
552
  import { Button } from "@/components/ui/button";
478
553
  import { Badge } from "@/components/ui/badge";
479
554
 
480
- export function TeamCard({ team }) {
555
+ interface TeamCardProps {
556
+ team: {
557
+ name: string;
558
+ description: string;
559
+ status: string;
560
+ };
561
+ }
562
+
563
+ export function TeamCard({ team }: TeamCardProps) {
481
564
  return (
482
565
  <Card>
483
566
  <CardHeader>
@@ -493,6 +576,26 @@ export function TeamCard({ team }) {
493
576
  }
494
577
  ```
495
578
 
579
+ **Then use in Astro pages with client directive:**
580
+
581
+ ```astro
582
+ ---
583
+ // src/pages/teams.astro
584
+ import { TeamCard } from '@/components/features/teams/TeamCard';
585
+ const teams = await getCollection('teams');
586
+ ---
587
+
588
+ <Layout>
589
+ {teams.map(team => (
590
+ <!-- Static rendering (no JavaScript) -->
591
+ <TeamCard team={team.data} />
592
+
593
+ <!-- Or with interactivity -->
594
+ <TeamCard client:load team={team.data} />
595
+ ))}
596
+ </Layout>
597
+ ```
598
+
496
599
  ## Provider Pattern (Layer 4)
497
600
 
498
601
  **Critical**: Use providers to enable source switching.
@@ -638,6 +741,14 @@ src/
638
741
 
639
742
  ## Common Mistakes to Avoid
640
743
 
744
+ ### File Type Violations
745
+ - ❌ Creating `.astro` components in `src/components/`
746
+ - ✅ Always create `.tsx` files in `src/components/`
747
+ - ❌ Creating `.tsx` pages in `src/pages/`
748
+ - ✅ Use `.astro` files for pages and layouts
749
+ - ❌ Mixing file types (some .astro, some .tsx in components/)
750
+ - ✅ Consistent: components = .tsx, pages/layouts = .astro
751
+
641
752
  ### Complexity Violations
642
753
  - ❌ Adding all layers at once
643
754
  - ✅ Start simple, add only when needed
@@ -703,4 +814,34 @@ src/
703
814
 
704
815
  ---
705
816
 
706
- **Start simple. Add layers when needed. Type-safe throughout. Beautiful UI with shadcn.**
817
+ ## Quick Reference
818
+
819
+ **File Types:**
820
+ - `src/components/` → `.tsx` files (React components)
821
+ - `src/pages/` → `.astro` files (routing)
822
+ - `src/layouts/` → `.astro` files (page structure)
823
+
824
+ **Component Pattern:**
825
+ ```tsx
826
+ // ✅ Always use this pattern in src/components/
827
+ export function ComponentName({ prop }: ComponentNameProps) {
828
+ return <div>...</div>;
829
+ }
830
+ ```
831
+
832
+ **Page Pattern:**
833
+ ```astro
834
+ ---
835
+ // ✅ Always use this pattern in src/pages/
836
+ import { ComponentName } from '@/components/features/ComponentName';
837
+ const data = await getCollection('data');
838
+ ---
839
+
840
+ <Layout>
841
+ <ComponentName prop={data} />
842
+ </Layout>
843
+ ```
844
+
845
+ ---
846
+
847
+ **Start simple. Add layers when needed. Type-safe throughout. Beautiful UI with shadcn. TSX for components, Astro for pages.**