You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|@object-ui/data-*| The Adapters | Connectors for REST, ObjectQL, GraphQL. | Isolate ALL fetch logic. |
31
32
4. The JSON Protocol Specification (The "DNA")
@@ -58,16 +59,31 @@ interface UIComponent {
58
59
children?: UIComponent[];
59
60
}
60
61
61
-
5. Coding Standards (The 5 Commandments)
62
+
5. Coding Standards (The 7 Commandments)
63
+
📜 Rule #0: Strict Adherence to @objectstack/spec
64
+
* Context: We are the implementation of a standard protocol.
65
+
* Instruction: All component schemas, JSON structures, and data types MUST strictly follow definitions in `@objectstack/spec`.
66
+
* Constraint: Do not invent new schema properties. If the spec says `columns`, do not use `fields`.
67
+
* Validation: Check `@objectstack/spec` definitions before writing any `interface` or `type`.
68
+
62
69
🌍 Rule #1: Protocol Agnostic (The Universal Adapter)
63
70
* Context: The user might fetch data from a legacy SOAP API or a local JSON file.
64
71
* Instruction: Never hardcode objectql.find(). Use the DataSource Interface.
65
72
* Pattern: Inject dataSource via the root <SchemaRendererProviderdataSource={...} />.
66
-
🎨 Rule #2: "Shadcn Native" Aesthetics
73
+
74
+
📚 Rule #2: Documentation Driven Development
75
+
* Context: Code without docs is dead code.
76
+
* Instruction: For EVERY feature implemented or refactored, you MUST update the corresponding documentation:
77
+
1. Package `README.md`
78
+
2.`content/docs/guide/*.md`
79
+
* Definition of Done: The task is not complete until the documentation reflects the new code/architecture.
80
+
81
+
🎨 Rule #3: "Shadcn Native" Aesthetics
67
82
* Identity: We are essentially "Serializable Shadcn".
68
83
* Instruction: When implementing a component (e.g., Card), strictly follow Shadcn's DOM structure (CardHeader, CardTitle, CardContent).
69
84
* Constraint: ALWAYS expose className in the schema props. Allow users to inject bg-red-500 via JSON to override default styles.
70
-
⚡ Rule #3: The Action System (Interactivity)
85
+
86
+
⚡ Rule #4: The Action System (Interactivity)
71
87
* Concept: A static UI is useless. The JSON must define behavior.
72
88
* Pattern: Actions are defined as data, not functions.
73
89
* Example JSON:
@@ -80,13 +96,16 @@ interface UIComponent {
80
96
}
81
97
82
98
* Implementation: The @object-ui/core package acts as an Event Bus to dispatch these actions.
83
-
🧩 Rule #4: Layout as Components
99
+
100
+
🧩 Rule #5: Layout as Components
84
101
* Concept: Layouts are just components that render children.
85
102
* Instruction: Treat Grid, Stack, Container as first-class citizens.
86
103
* Responsiveness: Layout schemas must support responsive props (e.g., cols: { sm: 1, md: 2, lg: 4 }).
87
-
🔒 Rule #5: Type Safety over Magic
104
+
105
+
🔒 Rule #6: Type Safety over Magic
88
106
* No any: Use strict Generics.
89
107
* Registry: Use a central ComponentRegistry to map strings ("type": "button") to React components. Do not use eval() or dynamic imports to load components at runtime for security.
108
+
90
109
6. Implementation Patterns
91
110
Pattern A: The Component Registry (Extensibility)
92
111
How do we let users add their own "Map" component?
0 commit comments