@meonode/ui 0.0.1-alpha.1
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/LICENSE +20 -0
- package/README.md +188 -0
- package/dist/core.node.d.ts +25 -0
- package/dist/core.node.d.ts.map +1 -0
- package/dist/core.node.js +105 -0
- package/dist/html.node.d.ts +596 -0
- package/dist/html.node.d.ts.map +1 -0
- package/dist/html.node.js +408 -0
- package/dist/json/css-properties.json +1311 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +1 -0
- package/dist/node.helper.d.ts +71 -0
- package/dist/node.helper.d.ts.map +1 -0
- package/dist/node.helper.js +76 -0
- package/dist/node.type.d.ts +108 -0
- package/dist/node.type.d.ts.map +1 -0
- package/dist/node.type.js +1 -0
- package/dist/react-is.helper.d.ts +139 -0
- package/dist/react-is.helper.d.ts.map +1 -0
- package/dist/react-is.helper.js +84 -0
- package/docs/basic-usage.md +66 -0
- package/docs/conditional-component-with-hook.md +71 -0
- package/package.json +54 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
```ts
|
|
2
|
+
|
|
3
|
+
// Wraps a hook-capable component into a BaseNode-compatible Client Component
|
|
4
|
+
import { Component } from '@src/lib/node/core.node'
|
|
5
|
+
|
|
6
|
+
// Layout primitives (synthetic components for JSX-less DOM generation)
|
|
7
|
+
import { Column, Row, Div, P } from '@src/lib/node/html.node'
|
|
8
|
+
import { useState, useEffect } from 'react'
|
|
9
|
+
|
|
10
|
+
// Shared theme object passed into components. This may be written in a different file and imported.
|
|
11
|
+
const theme = {
|
|
12
|
+
background: { primary: 'lightgreen', secondary: 'lightyellow' },
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Exported component rendered via <Component /> (client wrapper)
|
|
16
|
+
export default Component(() => {
|
|
17
|
+
// React hook for conditional UI
|
|
18
|
+
const [showDetails, setShowDetails] = useState(false)
|
|
19
|
+
|
|
20
|
+
// Declarative layout using Column as root container
|
|
21
|
+
return Column({
|
|
22
|
+
theme,
|
|
23
|
+
padding: 20,
|
|
24
|
+
gap: 15,
|
|
25
|
+
children: [
|
|
26
|
+
// Header row with a toggle button
|
|
27
|
+
Row({
|
|
28
|
+
gap: 10,
|
|
29
|
+
children: [
|
|
30
|
+
Div({
|
|
31
|
+
onClick: () => setShowDetails(prev => !prev),
|
|
32
|
+
style: {
|
|
33
|
+
cursor: 'pointer',
|
|
34
|
+
userSelect: 'none',
|
|
35
|
+
padding: '10px 20px',
|
|
36
|
+
backgroundColor: 'theme.background.primary', // Node engine will handle this
|
|
37
|
+
borderRadius: 5,
|
|
38
|
+
fontWeight: 'bold',
|
|
39
|
+
},
|
|
40
|
+
children: showDetails ? 'Hide Details' : 'Show Details',
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
}),
|
|
44
|
+
|
|
45
|
+
// Conditionally render DetailComponent via function wrapper
|
|
46
|
+
// Ensures it's treated as a renderable function (deferred React class or element that is NOT called directly)
|
|
47
|
+
// Node engine will handle this like magic
|
|
48
|
+
showDetails ? () => DetailComponent({ info: 'Here are some details!' }) : null,
|
|
49
|
+
],
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
// A stateful detail section using useEffect and styled Div
|
|
54
|
+
const DetailComponent = ({ info }: { info: string }) => {
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
console.log('DetailComponent mounted')
|
|
57
|
+
return () => {
|
|
58
|
+
console.log('DetailComponent unmounted')
|
|
59
|
+
}
|
|
60
|
+
}, [])
|
|
61
|
+
|
|
62
|
+
return Div({
|
|
63
|
+
padding: 15,
|
|
64
|
+
border: '1px solid green',
|
|
65
|
+
borderRadius: 6,
|
|
66
|
+
backgroundColor: 'theme.background.secondary', // Node engine will handle this
|
|
67
|
+
children: P({ children: info }),
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@meonode/ui",
|
|
3
|
+
"description": "`@meonode/ui` is a lightweight yet powerful utility for the programmatic creation and manipulation of React elements. It offers an enhanced, structured way to define components, manage props (separating CSS from DOM attributes), handle theming, and compose children *before* they are rendered by React. This provides greater control and flexibility, especially for dynamic UIs and design systems.",
|
|
4
|
+
"version": "0.0.1-alpha.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/main.js",
|
|
7
|
+
"types": "./dist/main.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/main.js",
|
|
11
|
+
"types": "./dist/main.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"docs",
|
|
17
|
+
"package.json",
|
|
18
|
+
"LICENSE",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"lint": "eslint --fix",
|
|
23
|
+
"build": "rm -rf ./dist && babel src --out-dir dist --extensions \".ts,.js\" && tsc && tsc-alias && copyfiles -u 1 \"src/**/*.json\" dist",
|
|
24
|
+
"publish": "npm publish"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@babel/cli": "^7.0.0",
|
|
28
|
+
"@babel/core": "^7.0.0",
|
|
29
|
+
"@babel/plugin-transform-json-modules": "^7.27.1",
|
|
30
|
+
"@babel/preset-env": "^7.0.0",
|
|
31
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
32
|
+
"@eslint/js": "^9.27.0",
|
|
33
|
+
"@types/copyfiles": "^2",
|
|
34
|
+
"@types/react": "^19.1.4",
|
|
35
|
+
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
36
|
+
"@typescript-eslint/parser": "^8.32.1",
|
|
37
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
|
38
|
+
"babel-preset-minify": "^0.5.2",
|
|
39
|
+
"copyfiles": "^2.4.1",
|
|
40
|
+
"eslint": "^9.27.0",
|
|
41
|
+
"eslint-plugin-jsdoc": "^50.6.17",
|
|
42
|
+
"eslint-plugin-prettier": "^5.4.0",
|
|
43
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
44
|
+
"prettier": "^3.5.3",
|
|
45
|
+
"tsc-alias": "^1.8.16",
|
|
46
|
+
"typescript": "^5.8.3",
|
|
47
|
+
"typescript-eslint": "^8.32.1"
|
|
48
|
+
},
|
|
49
|
+
"packageManager": "yarn@4.9.1",
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"react": "*"
|
|
52
|
+
},
|
|
53
|
+
"license": "MIT"
|
|
54
|
+
}
|