@meonode/ui 0.3.0 → 0.3.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/CHANGELOG.md +13 -0
- package/README.md +40 -26
- package/dist/components/theme-provider.client.d.ts +3 -2
- package/dist/components/theme-provider.client.d.ts.map +1 -1
- package/dist/components/theme-provider.client.js +2 -2
- package/dist/hook/usePortal.js +1 -1
- package/dist/nextjs-registry/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.2] - 2025-09-26
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **fix**: update import paths for Node component to improve module structure
|
|
13
|
+
- **fix(theme-provider):** update type imports and enhance function return type for better clarity
|
|
14
|
+
|
|
15
|
+
## [0.3.1] - 2025-09-26
|
|
16
|
+
|
|
17
|
+
### Docs
|
|
18
|
+
|
|
19
|
+
- **docs(readme):** update readme with new theme system
|
|
20
|
+
|
|
8
21
|
## [0.3.0] - 2025-09-26
|
|
9
22
|
|
|
10
23
|
### Added
|
package/README.md
CHANGED
|
@@ -15,38 +15,51 @@ npm install @meonode/ui react
|
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
```typescript
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
Component,
|
|
20
|
+
ThemeProvider,
|
|
21
|
+
Div,
|
|
22
|
+
Center,
|
|
23
|
+
Column,
|
|
24
|
+
H1,
|
|
25
|
+
Button,
|
|
26
|
+
} from "@meonode/ui";
|
|
19
27
|
|
|
20
28
|
const theme = {
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
mode: "light",
|
|
30
|
+
system: {
|
|
31
|
+
primary: { default: '#FF6B6B', content: '#4A0000' },
|
|
32
|
+
base: { default: '#F8F8F8', content: '#333333' },
|
|
33
|
+
}
|
|
23
34
|
};
|
|
24
35
|
|
|
25
36
|
const App = Component(() =>
|
|
26
|
-
|
|
37
|
+
ThemeProvider({
|
|
27
38
|
theme,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
children: Div({
|
|
40
|
+
backgroundColor: "theme.base.default",
|
|
41
|
+
children: Center({
|
|
42
|
+
padding: 40,
|
|
43
|
+
children: Column({
|
|
44
|
+
gap: 24,
|
|
45
|
+
textAlign: "center",
|
|
46
|
+
children: [
|
|
47
|
+
H1("Welcome to MeoNode", {
|
|
48
|
+
fontSize: "3rem",
|
|
49
|
+
color: "theme.primary.default",
|
|
50
|
+
}),
|
|
51
|
+
Button("Get Started", {
|
|
52
|
+
backgroundColor: "theme.primary.default",
|
|
53
|
+
color: "theme.primary.content",
|
|
54
|
+
padding: "12px 24px",
|
|
55
|
+
borderRadius: 8,
|
|
56
|
+
cursor: "pointer",
|
|
57
|
+
onClick: () => alert("Hello MeoNode!"),
|
|
58
|
+
}),
|
|
59
|
+
],
|
|
60
|
+
}),
|
|
61
|
+
}),
|
|
62
|
+
}),
|
|
50
63
|
})
|
|
51
64
|
);
|
|
52
65
|
```
|
|
@@ -54,6 +67,7 @@ const App = Component(() =>
|
|
|
54
67
|
## Key Features
|
|
55
68
|
|
|
56
69
|
- **Function-based components** - No JSX required, pure TypeScript functions
|
|
70
|
+
- **Built-in Theming System** - Use `ThemeProvider` to propagate theme through your app.
|
|
57
71
|
- **Theme-aware styling** - Direct CSS props with automatic theme resolution
|
|
58
72
|
- **Advanced CSS support** - Pseudo-classes, media queries, animations via `css` prop
|
|
59
73
|
- **Portal system** - Context-aware modals and overlays
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import type { Children, Theme } from '../node.type.js';
|
|
2
3
|
export interface ThemeContextValue {
|
|
3
4
|
theme: Theme;
|
|
@@ -9,13 +10,13 @@ export declare const ThemeContext: import("react").Context<ThemeContextValue | n
|
|
|
9
10
|
* @param {object} props The props for the component.
|
|
10
11
|
* @param {Children} [props.children] The children to render.
|
|
11
12
|
* @param {Theme} props.theme The theme to provide.
|
|
12
|
-
* @returns {
|
|
13
|
+
* @returns {ReactNode} The rendered component.
|
|
13
14
|
* @private
|
|
14
15
|
*/
|
|
15
16
|
export declare function _ThemeProvider({ children, theme }: {
|
|
16
17
|
children?: Children;
|
|
17
18
|
theme: Theme;
|
|
18
|
-
}):
|
|
19
|
+
}): ReactNode;
|
|
19
20
|
/**
|
|
20
21
|
* A component that provides a theme to its children.
|
|
21
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-provider.client.d.ts","sourceRoot":"","sources":["../../src/components/theme-provider.client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme-provider.client.d.ts","sourceRoot":"","sources":["../../src/components/theme-provider.client.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAA;AAC/D,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAGxD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CACjC;AAED,eAAO,MAAM,YAAY,mDAAgD,CAAA;AAEzE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG,SAAS,CAgBpG;AAED;;GAEG;AACH,eAAO,MAAM,aAAa;;CAA6B,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use client";function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d["return"]&&(k=d["return"](),Object(k)!==k))return}finally{if(m)throw h}}return l}}function _arrayWithHoles(a){if(Array.isArray(a))return a}import{createContext,useState}from"react";import{createNode,Node}from"../
|
|
1
|
+
"use client";function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d["return"]&&(k=d["return"](),Object(k)!==k))return}finally{if(m)throw h}}return l}}function _arrayWithHoles(a){if(Array.isArray(a))return a}import{createContext,useState}from"react";import{createNode,Node}from"../core.node.js";export var ThemeContext=createContext(null);/**
|
|
2
2
|
* The internal implementation of the ThemeProvider component.
|
|
3
3
|
* @param {object} props The props for the component.
|
|
4
4
|
* @param {Children} [props.children] The children to render.
|
|
5
5
|
* @param {Theme} props.theme The theme to provide.
|
|
6
|
-
* @returns {
|
|
6
|
+
* @returns {ReactNode} The rendered component.
|
|
7
7
|
* @private
|
|
8
8
|
*/export function _ThemeProvider(a){var b=a.children,c=a.theme,d=useState(c),e=_slicedToArray(d,2),f=e[0],g=e[1];if(!c)throw new Error("`theme` prop must be defined");return Node(ThemeContext.Provider,{value:{theme:f,setTheme:function setTheme(a){document.cookie="theme=".concat(a.mode),g(a)}},children:b}).render()}/**
|
|
9
9
|
* A component that provides a theme to its children.
|
package/dist/hook/usePortal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d["return"]&&(k=d["return"](),Object(k)!==k))return}finally{if(m)throw h}}return l}}function _arrayWithHoles(a){if(Array.isArray(a))return a}import{useCallback,useEffect,useRef}from"react";import{Node}from"../
|
|
1
|
+
"use client";function _slicedToArray(a,b){return _arrayWithHoles(a)||_iterableToArrayLimit(a,b)||_unsupportedIterableToArray(a,b)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _iterableToArrayLimit(b,c){var d=null==b?null:"undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(null!=d){var g,h,j,k,l=[],a=!0,m=!1;try{if(j=(d=d.call(b)).next,0===c){if(Object(d)!==d)return;a=!1}else for(;!(a=(g=j.call(d)).done)&&(l.push(g.value),l.length!==c);a=!0);}catch(a){m=!0,h=a}finally{try{if(!a&&null!=d["return"]&&(k=d["return"](),Object(k)!==k))return}finally{if(m)throw h}}return l}}function _arrayWithHoles(a){if(Array.isArray(a))return a}import{useCallback,useEffect,useRef}from"react";import{Node}from"../core.node.js";export function usePortal(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:[],b=useRef({}),c=useCallback(function(a){return b.current.component=a,new Proxy(a,{apply:function apply(a,c,d){var e=_slicedToArray(d,1),f=e[0];return b.current.props=f,a.call(c,f)}})},[]);return useEffect(function(){var a=b.current,c=a.portal,d=a.component,e=a.props;c&&d&&c.update(Node(d,e))},a),useEffect(function(){return function(){var a;null===(a=b.current.portal)||void 0===a||a.unmount(),b.current.portal=void 0,b.current.component=void 0,b.current.props=void 0}},[]),{portal:b.current.portal,setPortal:function setPortal(a){return b.current.portal=a},createComponent:c}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import _StyleRegistry from"../components/registry.client.js";import{Node}from"../
|
|
1
|
+
import _StyleRegistry from"../components/registry.client.js";import{Node}from"../core.node.js";export var StyleRegistry=function StyleRegistry(a){return Node(_StyleRegistry,a)};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meonode/ui",
|
|
3
3
|
"description": "A structured approach to component composition, direct CSS-first prop styling, built-in theming, smart prop handling (including raw property pass-through), and dynamic children.",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/main.js",
|
|
7
7
|
"types": "./dist/main.d.ts",
|