@meonode/ui 0.1.2 → 0.1.4
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 +235 -227
- package/dist/html.node.d.ts +58 -44
- package/dist/html.node.d.ts.map +1 -1
- package/dist/html.node.js +51 -37
- package/package.json +2 -3
- package/docs/basic-usage.md +0 -63
- package/docs/conditional-component-with-hook.md +0 -68
package/README.md
CHANGED
|
@@ -3,284 +3,292 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@meonode/ui)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
theming, and compose children *before* they are rendered by React. This provides greater control and flexibility,
|
|
9
|
-
especially for dynamic UIs and design systems.
|
|
6
|
+
**Build React UIs with Type-Safe Fluency**
|
|
7
|
+
A structured approach to component composition with built-in theming, prop separation, and dynamic children handling.
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
```ts
|
|
10
|
+
// Quick Start Example
|
|
11
|
+
import { Component, Div, H1, Button } from '@meonode/ui';
|
|
12
|
+
|
|
13
|
+
const BlueButton = Component((props) =>
|
|
14
|
+
Button({
|
|
15
|
+
padding: '12px 24px',
|
|
16
|
+
borderRadius: '8px',
|
|
17
|
+
backgroundColor: 'dodgerblue',
|
|
18
|
+
color: 'white',
|
|
19
|
+
...props
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const App = Component(() =>
|
|
24
|
+
Div({
|
|
25
|
+
padding: '40px',
|
|
26
|
+
children: [
|
|
27
|
+
H1('Welcome to Meonode', { fontSize: '2rem' }),
|
|
28
|
+
BlueButton({
|
|
29
|
+
onClick: () => alert('Hello World!'),
|
|
30
|
+
children: 'Get Started'
|
|
31
|
+
})
|
|
32
|
+
]
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
```
|
|
12
36
|
|
|
13
|
-
##
|
|
37
|
+
## Why @meonode/ui?
|
|
14
38
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* **Flexible Children Management:** Supports various child types, including primitives, other `@meonode/ui` nodes,
|
|
21
|
-
standard React elements, and functions for dynamic rendering (function-as-child pattern).
|
|
22
|
-
* **Type-Safe:** Written entirely in TypeScript, providing excellent autocompletion and compile-time safety.
|
|
23
|
-
* **Seamless Integration:** Works with existing React components and fits naturally into any React workflow.
|
|
24
|
-
* **`Component` HOC:** A higher-order component to easily wrap functions that return `@meonode/ui` instances, making
|
|
25
|
-
them standard React components.
|
|
26
|
-
* **Pre-built HTML Element Components:** Offers a suite of convenience functions (e.g., `Div`, `Span`, `H1`, `Button`) that wrap `Node()` for common HTML tags, streamlining development.
|
|
39
|
+
- 🎯 **Type-Safe Design** - Full TypeScript support with autocomplete for styles and themes
|
|
40
|
+
- 🎨 **CSS-in-JS Without Runtime** - Write styles directly in props with theme references
|
|
41
|
+
- 🧩 **Component-First Architecture** - Compose UIs from structured nodes instead of JSX
|
|
42
|
+
- 🌐 **Theme Propagation** - Contextual theming that works with any component structure
|
|
43
|
+
- ⚡ **Zero Dependencies** - Lightweight core (under 15kb gzipped)
|
|
27
44
|
|
|
28
45
|
## Installation
|
|
29
46
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
yarn add react @meonode/ui
|
|
47
|
+
```bash
|
|
48
|
+
npm install @meonode/ui react
|
|
49
|
+
# or
|
|
50
|
+
yarn add @meonode/ui react
|
|
35
51
|
```
|
|
36
52
|
|
|
37
|
-
To use the built-in integration with Material UI, install the following:
|
|
38
|
-
|
|
39
|
-
```shell
|
|
40
|
-
yarn add react @mui/material @meonode/ui @meonode/mui
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
53
|
## Core Concepts
|
|
46
54
|
|
|
47
|
-
###
|
|
48
|
-
|
|
49
|
-
The primary factory function to create `@meonode/ui` instances (internally `BaseNode`).
|
|
50
|
-
|
|
51
|
-
* `element`: The React element type (e.g., `'div'`, `MyReactComponent`, another `Node` instance).
|
|
52
|
-
* `props`: An object containing properties for the element, including standard HTML attributes, event handlers, `children`, `theme`, and direct CSS style properties.
|
|
53
|
-
|
|
54
|
-
### `BaseNode`
|
|
55
|
-
|
|
56
|
-
The internal representation of a React element within `@meonode/ui`. It holds the element type, processed props (with styles and DOM attributes separated), and processed children. You typically don't interact with `BaseNode` directly but through the `Node` factory. Each `BaseNode` instance has a `render()` method to convert it into a renderable React element.
|
|
57
|
-
|
|
58
|
-
### `Component(componentFunction)`
|
|
59
|
-
|
|
60
|
-
A Higher-Order Component (HOC) that wraps a function. This function receives props and should return either a `@meonode/ui` instance (created via `Node()`) or a standard `ReactNode`. The `Component` HOC ensures that if a `@meonode/ui` instance is returned, its `render()` method is called, making it renderable by React.
|
|
61
|
-
|
|
62
|
-
### Theming
|
|
63
|
-
|
|
64
|
-
Pass a `theme` object via the `theme` prop to any `Node`. This theme becomes available to that `Node` and its descendants. Style properties can then reference theme values using a dot-path string:
|
|
65
|
-
|
|
66
|
-
---
|
|
55
|
+
### 1. Component Creation
|
|
67
56
|
|
|
68
|
-
|
|
57
|
+
Create elements using the `Node` factory or pre-built components:
|
|
69
58
|
|
|
70
|
-
|
|
59
|
+
```tsx
|
|
60
|
+
import { Node, Div, H1 } from '@meonode/ui';
|
|
71
61
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Themes allow for centralized styling and easy reuse of design tokens.
|
|
80
|
-
|
|
81
|
-
### 4. Handling Children
|
|
82
|
-
|
|
83
|
-
`@meonode/ui` offers flexible ways to define children:
|
|
84
|
-
|
|
85
|
-
**Note on Function Children and Themes:** When a function child returns a `BaseNode` instance (e.g., `() => Node(...)`), `@meonode/ui` ensures that the parent's theme is propagated to this returned `BaseNode` if it doesn't already have its own theme. This allows `BaseNode`s created within the function to resolve theme-based styles like `color: 'theme.colors.highlight'`.
|
|
86
|
-
|
|
87
|
-
### 5. Creating Reusable Components with `Component` HOC
|
|
88
|
-
|
|
89
|
-
The `Component` HOC simplifies creating standard React components from functions that return `@meonode/ui` nodes.
|
|
90
|
-
|
|
91
|
-
### 6. Using with Existing React Components
|
|
92
|
-
|
|
93
|
-
You can easily incorporate existing React components into your `@meonode/ui` structures.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
### 7. Using Pre-built HTML Components
|
|
62
|
+
// Using Node factory
|
|
63
|
+
const Card = Node('div', {
|
|
64
|
+
padding: '20px',
|
|
65
|
+
borderRadius: '8px',
|
|
66
|
+
boxShadow: '0 2px 12px rgba(0,0,0,0.1)'
|
|
67
|
+
});
|
|
97
68
|
|
|
98
|
-
|
|
69
|
+
// Using pre-built components
|
|
70
|
+
const Header = () =>
|
|
71
|
+
Div({
|
|
72
|
+
padding: '20px',
|
|
73
|
+
backgroundColor: 'navy',
|
|
74
|
+
children: H1('App Header', { color: 'white' })
|
|
75
|
+
});
|
|
76
|
+
```
|
|
99
77
|
|
|
100
|
-
|
|
78
|
+
### 2. Theming System
|
|
101
79
|
|
|
102
|
-
|
|
103
|
-
import { Component, Div, H1, P, Button } from '@meonode/ui';
|
|
80
|
+
Define and consume themes with dot-notation:
|
|
104
81
|
|
|
105
|
-
|
|
106
|
-
const
|
|
82
|
+
```tsx
|
|
83
|
+
const theme = {
|
|
107
84
|
colors: {
|
|
108
|
-
primary: '
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
85
|
+
primary: '#2196F3',
|
|
86
|
+
text: {
|
|
87
|
+
primary: '#1A237E',
|
|
88
|
+
secondary: '#455A64'
|
|
89
|
+
}
|
|
113
90
|
},
|
|
114
91
|
spacing: {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
large: '24px',
|
|
118
|
-
},
|
|
119
|
-
typography: {
|
|
120
|
-
h1Size: '2.5rem',
|
|
121
|
-
pSize: '1rem',
|
|
122
|
-
},
|
|
123
|
-
borders: {
|
|
124
|
-
radius: '4px',
|
|
125
|
-
thin: '1px solid #cccccc',
|
|
92
|
+
md: '16px',
|
|
93
|
+
lg: '24px'
|
|
126
94
|
}
|
|
127
95
|
};
|
|
128
96
|
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
theme
|
|
132
|
-
padding: 'theme.spacing.
|
|
133
|
-
backgroundColor: 'theme.colors.
|
|
134
|
-
borderRadius: 'theme.borders.radius',
|
|
135
|
-
boxShadow: '0 4px 8px rgba(0,0,0,0.1)',
|
|
136
|
-
maxWidth: '400px',
|
|
137
|
-
margin: 'theme.spacing.medium auto', // Center the card
|
|
138
|
-
border: 'theme.borders.thin',
|
|
97
|
+
const ThemedCard = Component(() =>
|
|
98
|
+
Div({
|
|
99
|
+
theme,
|
|
100
|
+
padding: 'theme.spacing.lg',
|
|
101
|
+
backgroundColor: 'theme.colors.primary',
|
|
139
102
|
children: [
|
|
140
|
-
H1({
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}),
|
|
146
|
-
P({
|
|
147
|
-
fontSize: 'theme.typography.pSize',
|
|
148
|
-
color: 'theme.colors.text',
|
|
149
|
-
lineHeight: '1.6',
|
|
150
|
-
marginBottom: 'theme.spacing.large',
|
|
151
|
-
children: 'This card is built using pre-built HTML components from @meonode/ui, styled with a custom theme.',
|
|
152
|
-
}),
|
|
153
|
-
Button({
|
|
154
|
-
backgroundColor: 'theme.colors.primary',
|
|
155
|
-
color: 'theme.colors.textOnPrimary',
|
|
156
|
-
padding: 'theme.spacing.small theme.spacing.medium',
|
|
157
|
-
border: 'none',
|
|
158
|
-
borderRadius: 'theme.borders.radius',
|
|
159
|
-
fontSize: 'theme.typography.pSize',
|
|
160
|
-
cursor: 'pointer',
|
|
161
|
-
children: 'Learn More',
|
|
162
|
-
onClick: () => alert('Button clicked!'),
|
|
163
|
-
// Example of hover style (though direct CSS-in-JS hover is more complex without a helper)
|
|
164
|
-
// For simple cases, you might rely on global CSS or a more advanced styling solution.
|
|
165
|
-
// This is a placeholder to show where you might think about interactions.
|
|
166
|
-
// Real hover effects would typically be handled by CSS classes or a more robust styling library.
|
|
167
|
-
}),
|
|
168
|
-
],
|
|
169
|
-
});
|
|
170
|
-
});
|
|
103
|
+
H1('Themed Title', { color: 'theme.colors.text.primary' }),
|
|
104
|
+
P('Content...', { color: 'theme.colors.text.secondary' })
|
|
105
|
+
]
|
|
106
|
+
})
|
|
107
|
+
);
|
|
171
108
|
```
|
|
172
109
|
|
|
173
|
-
|
|
174
|
-
```ts
|
|
175
|
-
import React from 'react';
|
|
176
|
-
import ReactDOM from 'react-dom/client';
|
|
177
|
-
|
|
178
|
-
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
179
|
-
root.render(MyStyledCard());
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
---
|
|
183
|
-
|
|
184
|
-
## Usage Implementation
|
|
185
|
-
|
|
186
|
-
The example implementation can be seen in the docs folder:
|
|
187
|
-
1. [Basic Usage](./docs/basic-usage.md)
|
|
188
|
-
2. [Conditional Component With Hook](./docs/conditional-component-with-hook.md)
|
|
110
|
+
### 3. Prop Handling
|
|
189
111
|
|
|
190
|
-
|
|
112
|
+
Automatic separation of CSS props from DOM attributes:
|
|
191
113
|
|
|
192
|
-
|
|
114
|
+
```ts
|
|
115
|
+
const ProfileCard = Component(({ user }) =>
|
|
116
|
+
Div({
|
|
117
|
+
// CSS Props
|
|
118
|
+
padding: '20px',
|
|
119
|
+
borderRadius: '8px',
|
|
120
|
+
// DOM Props
|
|
121
|
+
ariaRole: 'article',
|
|
122
|
+
tabIndex: 0,
|
|
123
|
+
// Children
|
|
124
|
+
children: `Welcome ${user.name}!`
|
|
125
|
+
})
|
|
126
|
+
);
|
|
127
|
+
```
|
|
193
128
|
|
|
194
|
-
|
|
129
|
+
## Key Features
|
|
195
130
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
131
|
+
| Feature | Description |
|
|
132
|
+
|------------------------|-----------------------------------------------------------------------------|
|
|
133
|
+
| **Smart Prop Merge** | CSS properties are automatically merged with style object |
|
|
134
|
+
| **Theme Resolution** | `theme.` references resolve through component hierarchy |
|
|
135
|
+
| **Type Safety** | Autocomplete for CSS properties and theme paths |
|
|
136
|
+
| **HOC Support** | Wrap existing components with `Component()` for seamless integration |
|
|
137
|
+
| **Dynamic Children** | Function-as-child pattern with automatic theme propagation |
|
|
200
138
|
|
|
201
|
-
|
|
139
|
+
## Advanced Usage
|
|
202
140
|
|
|
203
|
-
|
|
204
|
-
* `component`: A function that accepts props and returns a `BaseNodeInstance` or any `ReactNode`.
|
|
205
|
-
* Returns: A standard React functional component.
|
|
141
|
+
### Component Composition
|
|
206
142
|
|
|
207
|
-
|
|
143
|
+
```ts
|
|
144
|
+
const Dashboard = Component(() =>
|
|
145
|
+
Div({
|
|
146
|
+
display: 'grid',
|
|
147
|
+
gridTemplateColumns: '1fr 3fr',
|
|
148
|
+
gap: '20px',
|
|
149
|
+
children: [
|
|
150
|
+
Sidebar({
|
|
151
|
+
width: '240px',
|
|
152
|
+
items: navItems
|
|
153
|
+
}),
|
|
154
|
+
MainContent({
|
|
155
|
+
padding: '40px',
|
|
156
|
+
children: AnalyticsChart({ dataset })
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
})
|
|
160
|
+
);
|
|
161
|
+
```
|
|
208
162
|
|
|
209
|
-
|
|
210
|
-
* Converts the internal `BaseNode` representation into a standard, renderable React Node tree using `React.createElement`.
|
|
163
|
+
### With Conditional Children That Contains Hook
|
|
211
164
|
|
|
212
|
-
|
|
165
|
+
also add this
|
|
213
166
|
|
|
214
|
-
|
|
167
|
+
```ts
|
|
215
168
|
|
|
216
|
-
|
|
217
|
-
|
|
169
|
+
// Wraps a hook-capable component into a BaseNode-compatible Client Component
|
|
170
|
+
import { Component, Column, Row, Div, P } from '@meonode/ui'
|
|
171
|
+
import { useState, useEffect } from 'react'
|
|
172
|
+
|
|
173
|
+
// Shared theme object passed into components. This may be written in a different file and imported.
|
|
174
|
+
const theme = {
|
|
175
|
+
background: { primary: 'lightgreen', secondary: 'lightyellow' },
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Exported component rendered via <Component /> (client wrapper)
|
|
179
|
+
export default Component(() => {
|
|
180
|
+
// React hook for conditional UI
|
|
181
|
+
const [showDetails, setShowDetails] = useState(false)
|
|
182
|
+
|
|
183
|
+
// Declarative layout using Column as root container
|
|
184
|
+
return Column({
|
|
185
|
+
theme,
|
|
186
|
+
padding: 20,
|
|
187
|
+
gap: 15,
|
|
188
|
+
children: [
|
|
189
|
+
// Header row with a toggle button
|
|
190
|
+
Row({
|
|
191
|
+
gap: 10,
|
|
192
|
+
children: [
|
|
193
|
+
Div({
|
|
194
|
+
onClick: () => setShowDetails(prev => !prev),
|
|
195
|
+
cursor: 'pointer',
|
|
196
|
+
userSelect: 'none',
|
|
197
|
+
padding: '10px 20px',
|
|
198
|
+
backgroundColor: 'theme.background.primary', // Node engine will handle this
|
|
199
|
+
borderRadius: 5,
|
|
200
|
+
fontWeight: 'bold',
|
|
201
|
+
children: showDetails ? 'Hide Details' : 'Show Details',
|
|
202
|
+
}),
|
|
203
|
+
],
|
|
204
|
+
}),
|
|
218
205
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
206
|
+
// Conditionally render DetailComponent via function wrapper
|
|
207
|
+
// Ensures it's treated as a renderable function (deferred React class or element that is NOT called directly)
|
|
208
|
+
// Node engine will handle this like magic
|
|
209
|
+
showDetails && (() => DetailComponent({ info: 'Here are some details!' })), // Works like `Component(() => DetailComponent({ info: 'Here some details!' }))`,
|
|
210
|
+
showDetails && DetailComponent({ info: 'Here are some details!' }).render() // Works
|
|
211
|
+
],
|
|
212
|
+
})
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
// A stateful detail section using useEffect and styled Div
|
|
216
|
+
const DetailComponent = ({ info }: { info: string }) => {
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
console.log('DetailComponent mounted')
|
|
219
|
+
return () => {
|
|
220
|
+
console.log('DetailComponent unmounted')
|
|
221
|
+
}
|
|
222
|
+
}, [])
|
|
225
223
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
224
|
+
return Div({
|
|
225
|
+
padding: 15,
|
|
226
|
+
border: '1px solid green',
|
|
227
|
+
borderRadius: 6,
|
|
228
|
+
backgroundColor: 'theme.background.secondary', // Node engine will handle this
|
|
229
|
+
children: P(info),
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
232
|
|
|
233
|
-
|
|
234
|
-
- The `render()` method on a `BaseNode` instance recursively traverses its structure
|
|
235
|
-
- Calls `render()` on any child `BaseNode`s
|
|
236
|
-
- Ultimately uses `React.createElement` to construct the final tree of React elements
|
|
237
|
-
- The `nodeTheme` prop is removed before passing props to `createElement`
|
|
233
|
+
```
|
|
238
234
|
|
|
239
|
-
|
|
235
|
+
### Material UI Integration
|
|
240
236
|
|
|
241
|
-
|
|
237
|
+
```bash
|
|
238
|
+
yarn add @meonode/mui @mui/material
|
|
239
|
+
```
|
|
242
240
|
|
|
243
|
-
|
|
241
|
+
```ts
|
|
242
|
+
import { MuiButton, MuiTextField } from '@meonode/mui';
|
|
244
243
|
|
|
245
|
-
|
|
244
|
+
const MuiLoginForm = Component(() =>
|
|
245
|
+
Div({
|
|
246
|
+
maxWidth: '400px',
|
|
247
|
+
margin: '0 auto',
|
|
248
|
+
children: [
|
|
249
|
+
MuiTextField({
|
|
250
|
+
label: 'Email',
|
|
251
|
+
fullWidth: true,
|
|
252
|
+
margin: 'normal'
|
|
253
|
+
}),
|
|
254
|
+
MuiTextField({
|
|
255
|
+
label: 'Password',
|
|
256
|
+
type: 'password',
|
|
257
|
+
fullWidth: true,
|
|
258
|
+
margin: 'normal'
|
|
259
|
+
}),
|
|
260
|
+
MuiButton({
|
|
261
|
+
variant: 'contained',
|
|
262
|
+
color: 'primary',
|
|
263
|
+
children: 'Sign In'
|
|
264
|
+
})
|
|
265
|
+
]
|
|
266
|
+
})
|
|
267
|
+
);
|
|
268
|
+
```
|
|
246
269
|
|
|
247
|
-
|
|
270
|
+
## API Reference
|
|
248
271
|
|
|
249
|
-
|
|
272
|
+
### Core Functions
|
|
250
273
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
* Great alternative to JSX when you prefer a more functional programming approach
|
|
274
|
+
| Function | Parameters | Description |
|
|
275
|
+
|----------------|-----------------------------------------|-------------------------------------------------|
|
|
276
|
+
| `Node` | `element: string \| Component`, `props` | Creates a new UI node |
|
|
277
|
+
| `Component` | `(props) => Node \| ReactNode` | Converts node trees to React components |
|
|
256
278
|
|
|
257
|
-
---
|
|
258
279
|
|
|
259
280
|
## Contributing
|
|
260
281
|
|
|
261
|
-
|
|
282
|
+
We welcome contributions! Please follow these steps:
|
|
283
|
+
1. Fork the repository
|
|
284
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
285
|
+
3. Commit your changes
|
|
286
|
+
4. Push to the branch
|
|
287
|
+
5. Open a Pull Request
|
|
262
288
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
## [License](https://github.com/l7aromeo/meonode-ui/blob/main/LICENSE)
|
|
266
|
-
|
|
267
|
-
The MIT License (MIT)
|
|
268
|
-
Copyright (c) 2025 Ukasyah Rahmatullah Zada
|
|
289
|
+
Contact me on [Discord](https://discordapp.com/users/704803255561224264) for discussions.
|
|
269
290
|
|
|
270
|
-
|
|
271
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
272
|
-
in the Software without restriction, including without limitation the rights
|
|
273
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
274
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
275
|
-
furnished to do so, subject to the following conditions:
|
|
276
|
-
|
|
277
|
-
The above copyright notice and this permission notice shall be included in all
|
|
278
|
-
copies or substantial portions of the Software.
|
|
291
|
+
---
|
|
279
292
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
283
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
284
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
285
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
286
|
-
SOFTWARE.
|
|
293
|
+
**MIT Licensed** | Copyright © 2024 Ukasyah Rahmatullah Zada
|
|
294
|
+
*Empowering developers to build better UIs*
|
package/dist/html.node.d.ts
CHANGED
|
@@ -17,30 +17,6 @@ export declare const Body: (props?: NodeProps<"body">) => import("./node.type.js
|
|
|
17
17
|
* @returns A div element node.
|
|
18
18
|
*/
|
|
19
19
|
export declare const Div: (props?: NodeProps<"div">) => import("./node.type.js").BaseNodeInstance<"div">;
|
|
20
|
-
/**
|
|
21
|
-
* Represents a span element.
|
|
22
|
-
* @param props Optional properties for the span element.
|
|
23
|
-
* @returns A span element node.
|
|
24
|
-
*/
|
|
25
|
-
export declare const Span: (props?: NodeProps<"span">) => import("./node.type.js").BaseNodeInstance<"span">;
|
|
26
|
-
/**
|
|
27
|
-
* Represents a paragraph element.
|
|
28
|
-
* @param props Optional properties for the paragraph element.
|
|
29
|
-
* @returns A paragraph element node.
|
|
30
|
-
*/
|
|
31
|
-
export declare const P: (props?: NodeProps<"p">) => import("./node.type.js").BaseNodeInstance<"p">;
|
|
32
|
-
/**
|
|
33
|
-
* Represents a preformatted text element.
|
|
34
|
-
* @param props Optional properties for the pre element.
|
|
35
|
-
* @returns A pre element node.
|
|
36
|
-
*/
|
|
37
|
-
export declare const Pre: (props?: NodeProps<"pre">) => import("./node.type.js").BaseNodeInstance<"pre">;
|
|
38
|
-
/**
|
|
39
|
-
* Represents a code element for displaying code snippets.
|
|
40
|
-
* @param props Optional properties for the code element.
|
|
41
|
-
* @returns A code element node.
|
|
42
|
-
*/
|
|
43
|
-
export declare const Code: (props?: NodeProps<"code">) => import("./node.type.js").BaseNodeInstance<"code">;
|
|
44
20
|
/**
|
|
45
21
|
* Represents a column layout using flexbox.
|
|
46
22
|
* @param props Optional properties for the column layout.
|
|
@@ -96,65 +72,103 @@ export declare const Sticky: (props?: NodeProps<"div">) => import("./node.type.j
|
|
|
96
72
|
*/
|
|
97
73
|
export declare const Static: (props?: NodeProps<"div">) => import("./node.type.js").BaseNodeInstance<"div">;
|
|
98
74
|
/**
|
|
99
|
-
*
|
|
75
|
+
* Creates an h1 heading element node.
|
|
76
|
+
* @param children Optional text or number content for the heading.
|
|
100
77
|
* @param props Optional properties for the h1 element.
|
|
101
78
|
* @returns An h1 element node.
|
|
102
79
|
*/
|
|
103
|
-
export declare const H1: (props?: NodeProps<"h1">) => import("./node.type.js").BaseNodeInstance<"h1">;
|
|
80
|
+
export declare const H1: (children?: string | number, props?: Omit<NodeProps<"h1">, "children">) => import("./node.type.js").BaseNodeInstance<"h1">;
|
|
104
81
|
/**
|
|
105
|
-
*
|
|
82
|
+
* Creates an h2 heading element node.
|
|
83
|
+
* @param children Optional text or number content for the heading.
|
|
106
84
|
* @param props Optional properties for the h2 element.
|
|
107
85
|
* @returns An h2 element node.
|
|
108
86
|
*/
|
|
109
|
-
export declare const H2: (props?: NodeProps<"h2">) => import("./node.type.js").BaseNodeInstance<"h2">;
|
|
87
|
+
export declare const H2: (children?: string | number, props?: Omit<NodeProps<"h2">, "children">) => import("./node.type.js").BaseNodeInstance<"h2">;
|
|
110
88
|
/**
|
|
111
|
-
*
|
|
89
|
+
* Creates an h3 heading element node.
|
|
90
|
+
* @param children Optional text or number content for the heading.
|
|
112
91
|
* @param props Optional properties for the h3 element.
|
|
113
92
|
* @returns An h3 element node.
|
|
114
93
|
*/
|
|
115
|
-
export declare const H3: (props?: NodeProps<"h3">) => import("./node.type.js").BaseNodeInstance<"h3">;
|
|
94
|
+
export declare const H3: (children?: string | number, props?: Omit<NodeProps<"h3">, "children">) => import("./node.type.js").BaseNodeInstance<"h3">;
|
|
116
95
|
/**
|
|
117
|
-
*
|
|
96
|
+
* Creates an h4 heading element node.
|
|
97
|
+
* @param children Optional text or number content for the heading.
|
|
118
98
|
* @param props Optional properties for the h4 element.
|
|
119
99
|
* @returns An h4 element node.
|
|
120
100
|
*/
|
|
121
|
-
export declare const H4: (props?: NodeProps<"h4">) => import("./node.type.js").BaseNodeInstance<"h4">;
|
|
101
|
+
export declare const H4: (children?: string | number, props?: Omit<NodeProps<"h4">, "children">) => import("./node.type.js").BaseNodeInstance<"h4">;
|
|
122
102
|
/**
|
|
123
|
-
*
|
|
103
|
+
* Creates an h5 heading element node.
|
|
104
|
+
* @param children Optional text or number content for the heading.
|
|
124
105
|
* @param props Optional properties for the h5 element.
|
|
125
106
|
* @returns An h5 element node.
|
|
126
107
|
*/
|
|
127
|
-
export declare const H5: (props?: NodeProps<"h5">) => import("./node.type.js").BaseNodeInstance<"h5">;
|
|
108
|
+
export declare const H5: (children?: string | number, props?: Omit<NodeProps<"h5">, "children">) => import("./node.type.js").BaseNodeInstance<"h5">;
|
|
128
109
|
/**
|
|
129
|
-
*
|
|
110
|
+
* Creates an h6 heading element node.
|
|
111
|
+
* @param children Optional text or number content for the heading.
|
|
130
112
|
* @param props Optional properties for the h6 element.
|
|
131
113
|
* @returns An h6 element node.
|
|
132
114
|
*/
|
|
133
|
-
export declare const H6: (props?: NodeProps<"h6">) => import("./node.type.js").BaseNodeInstance<"h6">;
|
|
115
|
+
export declare const H6: (children?: string | number, props?: Omit<NodeProps<"h6">, "children">) => import("./node.type.js").BaseNodeInstance<"h6">;
|
|
134
116
|
/**
|
|
135
|
-
*
|
|
117
|
+
* Creates a strong element node for important text.
|
|
118
|
+
* @param children Optional text or number content to emphasize.
|
|
136
119
|
* @param props Optional properties for the strong element.
|
|
137
120
|
* @returns A strong element node.
|
|
138
121
|
*/
|
|
139
|
-
export declare const Strong: (props?: NodeProps<"strong">) => import("./node.type.js").BaseNodeInstance<"strong">;
|
|
122
|
+
export declare const Strong: (children?: string | number, props?: Omit<NodeProps<"strong">, "children">) => import("./node.type.js").BaseNodeInstance<"strong">;
|
|
140
123
|
/**
|
|
141
|
-
*
|
|
124
|
+
* Creates an em element node for emphasized text.
|
|
125
|
+
* @param children Optional text or number content to emphasize.
|
|
142
126
|
* @param props Optional properties for the em element.
|
|
143
127
|
* @returns An em element node.
|
|
144
128
|
*/
|
|
145
|
-
export declare const Em: (props?: NodeProps<"em">) => import("./node.type.js").BaseNodeInstance<"em">;
|
|
129
|
+
export declare const Em: (children?: string | number, props?: Omit<NodeProps<"em">, "children">) => import("./node.type.js").BaseNodeInstance<"em">;
|
|
146
130
|
/**
|
|
147
|
-
*
|
|
131
|
+
* Creates a small element node for side-comments and small print.
|
|
132
|
+
* @param children Optional text or number content to display smaller.
|
|
148
133
|
* @param props Optional properties for the small element.
|
|
149
134
|
* @returns A small element node.
|
|
150
135
|
*/
|
|
151
|
-
export declare const Small: (props?: NodeProps<"small">) => import("./node.type.js").BaseNodeInstance<"small">;
|
|
136
|
+
export declare const Small: (children?: string | number, props?: Omit<NodeProps<"small">, "children">) => import("./node.type.js").BaseNodeInstance<"small">;
|
|
152
137
|
/**
|
|
153
|
-
*
|
|
138
|
+
* Creates a mark element node for highlighted text.
|
|
139
|
+
* @param children Optional text or number content to highlight.
|
|
154
140
|
* @param props Optional properties for the mark element.
|
|
155
141
|
* @returns A mark element node.
|
|
156
142
|
*/
|
|
157
|
-
export declare const Mark: (props?: NodeProps<"mark">) => import("./node.type.js").BaseNodeInstance<"mark">;
|
|
143
|
+
export declare const Mark: (children?: string | number, props?: Omit<NodeProps<"mark">, "children">) => import("./node.type.js").BaseNodeInstance<"mark">;
|
|
144
|
+
/**
|
|
145
|
+
* Creates a span element node.
|
|
146
|
+
* @param children Optional text or number content for the span.
|
|
147
|
+
* @param props Optional properties for the span element.
|
|
148
|
+
* @returns A span element node.
|
|
149
|
+
*/
|
|
150
|
+
export declare const Span: (children?: string | number, props?: Omit<NodeProps<"span">, "children">) => import("./node.type.js").BaseNodeInstance<"span">;
|
|
151
|
+
/**
|
|
152
|
+
* Creates a paragraph element node.
|
|
153
|
+
* @param children Optional text or number content for the paragraph.
|
|
154
|
+
* @param props Optional properties for the p element.
|
|
155
|
+
* @returns A paragraph element node.
|
|
156
|
+
*/
|
|
157
|
+
export declare const P: (children?: string | number, props?: Omit<NodeProps<"p">, "children">) => import("./node.type.js").BaseNodeInstance<"p">;
|
|
158
|
+
/**
|
|
159
|
+
* Creates a preformatted text element node.
|
|
160
|
+
* @param children Optional text or number content for the pre element.
|
|
161
|
+
* @param props Optional properties for the pre element.
|
|
162
|
+
* @returns A pre element node.
|
|
163
|
+
*/
|
|
164
|
+
export declare const Pre: (children?: string | number, props?: Omit<NodeProps<"pre">, "children">) => import("./node.type.js").BaseNodeInstance<"pre">;
|
|
165
|
+
/**
|
|
166
|
+
* Creates a code element node for displaying code snippets.
|
|
167
|
+
* @param children Optional text or number content for the code.
|
|
168
|
+
* @param props Optional properties for the code element.
|
|
169
|
+
* @returns A code element node.
|
|
170
|
+
*/
|
|
171
|
+
export declare const Code: (children?: string | number, props?: Omit<NodeProps<"code">, "children">) => import("./node.type.js").BaseNodeInstance<"code">;
|
|
158
172
|
/**
|
|
159
173
|
* Represents an ordered list.
|
|
160
174
|
* @param props Optional properties for the ol element.
|
package/dist/html.node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html.node.d.ts","sourceRoot":"","sources":["../src/html.node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAKlD;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,QAAQ,SAAS,CAAC,MAA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I,QAAQ,SAAS,CAAC,MAAM,CAAC,yDAAwB,CAAA;AAEtE;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,QAAQ,SAAS,CAAC,OAAO,CAAC,0DAAyB,CAAA;AAEzE;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,QAAQ,SAAS,CAAC,QAAQ,CAAC,2DAA0B,CAAA;AAE5E;;;;GAIG;AACH,eAAO,MAAM,KAAK,GAAI,QAAQ,SAAS,CAAC,OAAO,CAAC,0DAAyB,CAAA;AAEzE;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,QAAQ,SAAS,CAAC,MAAM,CAAC,yDAAwB,CAAA"}
|
package/dist/html.node.js
CHANGED
|
@@ -11,23 +11,7 @@
|
|
|
11
11
|
* Represents a div element.
|
|
12
12
|
* @param props Optional properties for the div element.
|
|
13
13
|
* @returns A div element node.
|
|
14
|
-
*/export var Div=function Div(a){return Node("div",a)}
|
|
15
|
-
* Represents a span element.
|
|
16
|
-
* @param props Optional properties for the span element.
|
|
17
|
-
* @returns A span element node.
|
|
18
|
-
*/export var Span=function Span(a){return Node("span",a)};/**
|
|
19
|
-
* Represents a paragraph element.
|
|
20
|
-
* @param props Optional properties for the paragraph element.
|
|
21
|
-
* @returns A paragraph element node.
|
|
22
|
-
*/export var P=function P(a){return Node("p",a)};/**
|
|
23
|
-
* Represents a preformatted text element.
|
|
24
|
-
* @param props Optional properties for the pre element.
|
|
25
|
-
* @returns A pre element node.
|
|
26
|
-
*/export var Pre=function Pre(a){return Node("pre",a)};/**
|
|
27
|
-
* Represents a code element for displaying code snippets.
|
|
28
|
-
* @param props Optional properties for the code element.
|
|
29
|
-
* @returns A code element node.
|
|
30
|
-
*/export var Code=function Code(a){return Node("code",a)};// Layout components
|
|
14
|
+
*/export var Div=function Div(a){return Node("div",a)};// Layout components
|
|
31
15
|
/**
|
|
32
16
|
* Represents a column layout using flexbox.
|
|
33
17
|
* @param props Optional properties for the column layout.
|
|
@@ -66,46 +50,76 @@
|
|
|
66
50
|
* @returns A div element node with static positioning.
|
|
67
51
|
*/export var Static=function Static(a){return Div(_objectSpread({position:"static"},a))};// Typography
|
|
68
52
|
/**
|
|
69
|
-
*
|
|
53
|
+
* Creates an h1 heading element node.
|
|
54
|
+
* @param children Optional text or number content for the heading.
|
|
70
55
|
* @param props Optional properties for the h1 element.
|
|
71
56
|
* @returns An h1 element node.
|
|
72
|
-
*/export var H1=function H1(a){return Node("h1",a)};/**
|
|
73
|
-
*
|
|
57
|
+
*/export var H1=function H1(a,b){return Node("h1",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
58
|
+
* Creates an h2 heading element node.
|
|
59
|
+
* @param children Optional text or number content for the heading.
|
|
74
60
|
* @param props Optional properties for the h2 element.
|
|
75
61
|
* @returns An h2 element node.
|
|
76
|
-
*/export var H2=function H2(a){return Node("h2",a)};/**
|
|
77
|
-
*
|
|
62
|
+
*/export var H2=function H2(a,b){return Node("h2",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
63
|
+
* Creates an h3 heading element node.
|
|
64
|
+
* @param children Optional text or number content for the heading.
|
|
78
65
|
* @param props Optional properties for the h3 element.
|
|
79
66
|
* @returns An h3 element node.
|
|
80
|
-
*/export var H3=function H3(a){return Node("h3",a)};/**
|
|
81
|
-
*
|
|
67
|
+
*/export var H3=function H3(a,b){return Node("h3",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
68
|
+
* Creates an h4 heading element node.
|
|
69
|
+
* @param children Optional text or number content for the heading.
|
|
82
70
|
* @param props Optional properties for the h4 element.
|
|
83
71
|
* @returns An h4 element node.
|
|
84
|
-
*/export var H4=function H4(a){return Node("h4",a)};/**
|
|
85
|
-
*
|
|
72
|
+
*/export var H4=function H4(a,b){return Node("h4",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
73
|
+
* Creates an h5 heading element node.
|
|
74
|
+
* @param children Optional text or number content for the heading.
|
|
86
75
|
* @param props Optional properties for the h5 element.
|
|
87
76
|
* @returns An h5 element node.
|
|
88
|
-
*/export var H5=function H5(a){return Node("h5",a)};/**
|
|
89
|
-
*
|
|
77
|
+
*/export var H5=function H5(a,b){return Node("h5",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
78
|
+
* Creates an h6 heading element node.
|
|
79
|
+
* @param children Optional text or number content for the heading.
|
|
90
80
|
* @param props Optional properties for the h6 element.
|
|
91
81
|
* @returns An h6 element node.
|
|
92
|
-
*/export var H6=function H6(a){return Node("h6",a)};/**
|
|
93
|
-
*
|
|
82
|
+
*/export var H6=function H6(a,b){return Node("h6",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
83
|
+
* Creates a strong element node for important text.
|
|
84
|
+
* @param children Optional text or number content to emphasize.
|
|
94
85
|
* @param props Optional properties for the strong element.
|
|
95
86
|
* @returns A strong element node.
|
|
96
|
-
*/export var Strong=function Strong(a){return Node("strong",a)};/**
|
|
97
|
-
*
|
|
87
|
+
*/export var Strong=function Strong(a,b){return Node("strong",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
88
|
+
* Creates an em element node for emphasized text.
|
|
89
|
+
* @param children Optional text or number content to emphasize.
|
|
98
90
|
* @param props Optional properties for the em element.
|
|
99
91
|
* @returns An em element node.
|
|
100
|
-
*/export var Em=function Em(a){return Node("em",a)};/**
|
|
101
|
-
*
|
|
92
|
+
*/export var Em=function Em(a,b){return Node("em",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
93
|
+
* Creates a small element node for side-comments and small print.
|
|
94
|
+
* @param children Optional text or number content to display smaller.
|
|
102
95
|
* @param props Optional properties for the small element.
|
|
103
96
|
* @returns A small element node.
|
|
104
|
-
*/export var Small=function Small(a){return Node("small",a)};/**
|
|
105
|
-
*
|
|
97
|
+
*/export var Small=function Small(a,b){return Node("small",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
98
|
+
* Creates a mark element node for highlighted text.
|
|
99
|
+
* @param children Optional text or number content to highlight.
|
|
106
100
|
* @param props Optional properties for the mark element.
|
|
107
101
|
* @returns A mark element node.
|
|
108
|
-
*/export var Mark=function Mark(a){return Node("mark",a)}
|
|
102
|
+
*/export var Mark=function Mark(a,b){return Node("mark",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
103
|
+
* Creates a span element node.
|
|
104
|
+
* @param children Optional text or number content for the span.
|
|
105
|
+
* @param props Optional properties for the span element.
|
|
106
|
+
* @returns A span element node.
|
|
107
|
+
*/export var Span=function Span(a,b){return Node("span",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
108
|
+
* Creates a paragraph element node.
|
|
109
|
+
* @param children Optional text or number content for the paragraph.
|
|
110
|
+
* @param props Optional properties for the p element.
|
|
111
|
+
* @returns A paragraph element node.
|
|
112
|
+
*/export var P=function P(a,b){return Node("p",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
113
|
+
* Creates a preformatted text element node.
|
|
114
|
+
* @param children Optional text or number content for the pre element.
|
|
115
|
+
* @param props Optional properties for the pre element.
|
|
116
|
+
* @returns A pre element node.
|
|
117
|
+
*/export var Pre=function Pre(a,b){return Node("pre",_objectSpread(_objectSpread({},b),{},{children:a}))};/**
|
|
118
|
+
* Creates a code element node for displaying code snippets.
|
|
119
|
+
* @param children Optional text or number content for the code.
|
|
120
|
+
* @param props Optional properties for the code element.
|
|
121
|
+
* @returns A code element node.
|
|
122
|
+
*/export var Code=function Code(a,b){return Node("code",_objectSpread(_objectSpread({},b),{},{children:a}))};// Lists
|
|
109
123
|
/**
|
|
110
124
|
* Represents an ordered list.
|
|
111
125
|
* @param props Optional properties for the ol element.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meonode/ui",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.1.
|
|
3
|
+
"description": "A structured approach to component composition with built-in theming, prop separation, and dynamic children handling.",
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"types": "./dist/main.d.ts",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
16
|
-
"docs",
|
|
17
16
|
"package.json",
|
|
18
17
|
"LICENSE",
|
|
19
18
|
"README.md"
|
package/docs/basic-usage.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
```ts
|
|
2
|
-
// Component wraps a React Server Component into a Client Component
|
|
3
|
-
// Think of it like a factory that transforms JSX-like node definitions into actual React components
|
|
4
|
-
import { Component, Column, Row, Div, Img, P } from '@meonode/ui'
|
|
5
|
-
|
|
6
|
-
const theme = { background: { primary: 'red', secondary: 'blue' } }
|
|
7
|
-
|
|
8
|
-
// This is the actual exported component
|
|
9
|
-
export default Component(() => {
|
|
10
|
-
return Card({
|
|
11
|
-
title: 'Genshin Impact',
|
|
12
|
-
subtitle: 'Adventure awaits!',
|
|
13
|
-
imageUrl: 'https://upload-os-bbs.mihoyo.com/upload/2021/03/05/75387538/f37ce39baf72ffb84cb5c0040bdcbf10_2126420710320647353.jpg',
|
|
14
|
-
})
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
// This function returns a structured layout using html.node helpers only
|
|
18
|
-
const Card = ({ title, subtitle, imageUrl }: { title: string; subtitle: string; imageUrl: string }) =>
|
|
19
|
-
Column({
|
|
20
|
-
theme,
|
|
21
|
-
// Column is just a <div> with `display: flex; flex-direction: column`
|
|
22
|
-
borderRadius: 10,
|
|
23
|
-
overflow: 'hidden',
|
|
24
|
-
border: '1px solid theme.background.primary', // Can use theme references
|
|
25
|
-
width: 300,
|
|
26
|
-
children: [
|
|
27
|
-
// Img translates to a real <img> tag
|
|
28
|
-
Img({
|
|
29
|
-
src: imageUrl,
|
|
30
|
-
width: '100%',
|
|
31
|
-
height: 180,
|
|
32
|
-
style: {
|
|
33
|
-
objectFit: 'cover', // Ensures the image fills the area without distortion
|
|
34
|
-
},
|
|
35
|
-
}),
|
|
36
|
-
// Div is a basic <div> wrapper
|
|
37
|
-
Div({
|
|
38
|
-
padding: 10,
|
|
39
|
-
backgroundColor: 'theme.background.secondary',
|
|
40
|
-
children: Column({
|
|
41
|
-
gap: 5,
|
|
42
|
-
children: [
|
|
43
|
-
// P maps directly to <p>, with styling
|
|
44
|
-
P({
|
|
45
|
-
style: {
|
|
46
|
-
fontSize: 18,
|
|
47
|
-
fontWeight: 600,
|
|
48
|
-
},
|
|
49
|
-
children: title,
|
|
50
|
-
}),
|
|
51
|
-
P({
|
|
52
|
-
style: {
|
|
53
|
-
fontSize: 14,
|
|
54
|
-
color: 'gray',
|
|
55
|
-
},
|
|
56
|
-
children: subtitle,
|
|
57
|
-
}),
|
|
58
|
-
],
|
|
59
|
-
}),
|
|
60
|
-
}),
|
|
61
|
-
],
|
|
62
|
-
})
|
|
63
|
-
```
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
```ts
|
|
2
|
-
|
|
3
|
-
// Wraps a hook-capable component into a BaseNode-compatible Client Component
|
|
4
|
-
import { Component, Column, Row, Div, P } from '@meonode/ui'
|
|
5
|
-
import { useState, useEffect } from 'react'
|
|
6
|
-
|
|
7
|
-
// Shared theme object passed into components. This may be written in a different file and imported.
|
|
8
|
-
const theme = {
|
|
9
|
-
background: { primary: 'lightgreen', secondary: 'lightyellow' },
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Exported component rendered via <Component /> (client wrapper)
|
|
13
|
-
export default Component(() => {
|
|
14
|
-
// React hook for conditional UI
|
|
15
|
-
const [showDetails, setShowDetails] = useState(false)
|
|
16
|
-
|
|
17
|
-
// Declarative layout using Column as root container
|
|
18
|
-
return Column({
|
|
19
|
-
theme,
|
|
20
|
-
padding: 20,
|
|
21
|
-
gap: 15,
|
|
22
|
-
children: [
|
|
23
|
-
// Header row with a toggle button
|
|
24
|
-
Row({
|
|
25
|
-
gap: 10,
|
|
26
|
-
children: [
|
|
27
|
-
Div({
|
|
28
|
-
onClick: () => setShowDetails(prev => !prev),
|
|
29
|
-
style: {
|
|
30
|
-
cursor: 'pointer',
|
|
31
|
-
userSelect: 'none',
|
|
32
|
-
padding: '10px 20px',
|
|
33
|
-
backgroundColor: 'theme.background.primary', // Node engine will handle this
|
|
34
|
-
borderRadius: 5,
|
|
35
|
-
fontWeight: 'bold',
|
|
36
|
-
},
|
|
37
|
-
children: showDetails ? 'Hide Details' : 'Show Details',
|
|
38
|
-
}),
|
|
39
|
-
],
|
|
40
|
-
}),
|
|
41
|
-
|
|
42
|
-
// Conditionally render DetailComponent via function wrapper
|
|
43
|
-
// Ensures it's treated as a renderable function (deferred React class or element that is NOT called directly)
|
|
44
|
-
// Node engine will handle this like magic
|
|
45
|
-
showDetails ? () => DetailComponent({ info: 'Here are some details!' }) : null,
|
|
46
|
-
],
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
// A stateful detail section using useEffect and styled Div
|
|
51
|
-
const DetailComponent = ({ info }: { info: string }) => {
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
console.log('DetailComponent mounted')
|
|
54
|
-
return () => {
|
|
55
|
-
console.log('DetailComponent unmounted')
|
|
56
|
-
}
|
|
57
|
-
}, [])
|
|
58
|
-
|
|
59
|
-
return Div({
|
|
60
|
-
padding: 15,
|
|
61
|
-
border: '1px solid green',
|
|
62
|
-
borderRadius: 6,
|
|
63
|
-
backgroundColor: 'theme.background.secondary', // Node engine will handle this
|
|
64
|
-
children: P({ children: info }),
|
|
65
|
-
})
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
```
|