@cloudwerk/ui 0.7.1 → 0.7.2
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/README.md +80 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @cloudwerk/ui
|
|
2
|
+
|
|
3
|
+
UI rendering abstraction for Cloudwerk. Supports Hono JSX (default) and React.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @cloudwerk/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For React support:
|
|
12
|
+
```bash
|
|
13
|
+
npm install @cloudwerk/ui react react-dom
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Key Exports
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import {
|
|
20
|
+
// Rendering
|
|
21
|
+
render, // Render JSX to Response
|
|
22
|
+
html, // Create HTML Response from string
|
|
23
|
+
hydrate, // Client-side hydration
|
|
24
|
+
|
|
25
|
+
// Renderer management
|
|
26
|
+
setActiveRenderer,
|
|
27
|
+
initReactRenderer,
|
|
28
|
+
|
|
29
|
+
// Hydration utilities
|
|
30
|
+
wrapForHydration,
|
|
31
|
+
generateHydrationScript
|
|
32
|
+
} from '@cloudwerk/ui'
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Basic Usage
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Render a JSX component
|
|
39
|
+
import { render } from '@cloudwerk/ui'
|
|
40
|
+
|
|
41
|
+
export function GET() {
|
|
42
|
+
return render(<HomePage />)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// With options
|
|
46
|
+
return render(<NotFoundPage />, { status: 404 })
|
|
47
|
+
|
|
48
|
+
// Raw HTML response
|
|
49
|
+
import { html } from '@cloudwerk/ui'
|
|
50
|
+
|
|
51
|
+
return html('<!DOCTYPE html><html><body>Hello</body></html>')
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## React Renderer
|
|
55
|
+
|
|
56
|
+
To use React instead of Hono JSX:
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { initReactRenderer, setActiveRenderer } from '@cloudwerk/ui'
|
|
60
|
+
|
|
61
|
+
// Register and activate React renderer
|
|
62
|
+
initReactRenderer()
|
|
63
|
+
setActiveRenderer('react')
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Client Entry Point
|
|
67
|
+
|
|
68
|
+
For client-side hydration, import from the client subpath:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import { hydrate } from '@cloudwerk/ui/client'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Documentation
|
|
75
|
+
|
|
76
|
+
For full documentation, visit: https://github.com/squirrelsoft-dev/cloudwerk
|
|
77
|
+
|
|
78
|
+
## Part of Cloudwerk
|
|
79
|
+
|
|
80
|
+
This package is part of the [Cloudwerk](https://github.com/squirrelsoft-dev/cloudwerk) monorepo.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudwerk/ui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "UI rendering abstraction for Cloudwerk",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@cloudwerk/core": "0.7.
|
|
26
|
-
"@cloudwerk/utils": "0.6.
|
|
25
|
+
"@cloudwerk/core": "0.7.2",
|
|
26
|
+
"@cloudwerk/utils": "0.6.1"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"hono": "^4.0.0",
|