@meonode/ui 0.2.20 → 0.3.0

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.
@@ -1,21 +1,20 @@
1
- "use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}import{BaseNode,Node}from"../core.node.js";import{getElementTypeName}from"../helper/common.helper.js";/**
1
+ "use strict";import{BaseNode,Node}from"../core.node.js";import{getElementTypeName}from"../helper/common.helper.js";import{isNodeInstance}from"../helper/node.helper.js";/**
2
2
  * Props definition for components wrapped using the `Component` higher-order function.
3
3
  *
4
4
  * This type adapts based on whether the underlying component defines its own props:
5
5
  *
6
- * - If `TProps` is `undefined`, only `children` and `theme` can be passed.
6
+ * - If `TProps` is `undefined`, only `children` can be passed.
7
7
  * - If `TProps` is defined, the component will accept:
8
8
  * - The full prop shape `TProps`
9
9
  * - Optional `props` to override part of `TProps` (excluding `children`)
10
10
  * - Optional `children`
11
- * - Optional `theme`
12
11
  *
13
12
  * If the component supports inline styles (determined via `HasCSSCompatibleStyleProp`), the props also allow `CSSProperties`.
14
13
  *//**
15
14
  * Creates a component from a function that uses no custom props.
16
15
  * @template TProps Must be `undefined`
17
- * @param component A function that returns a MeoNode `ComponentNode` and only uses basic props like `children` and `theme`.
18
- * @returns A React-compatible component that can accept `children` and `theme`.
16
+ * @param component A function that returns a MeoNode `ComponentNode` and only uses basic props like `children`.
17
+ * @returns A React-compatible component that can accept `children`.
19
18
  * @example
20
19
  * ```ts
21
20
  * const Title = Component((props) => {
@@ -28,7 +27,7 @@
28
27
  * Creates a component from a function that uses a defined props interface.
29
28
  * @template TProps Props interface expected by the component.
30
29
  * @param component A function that returns a MeoNode `ComponentNode` using props of type `TProps`.
31
- * @returns A React-compatible component that supports full prop shape and `theme`/`children`/`props` overrides.
30
+ * @returns A React-compatible component that supports full prop shape and `children`/`props` overrides.
32
31
  * @example
33
32
  * ```ts
34
33
  * interface ButtonProps {
@@ -47,5 +46,5 @@
47
46
  * ```
48
47
  *//**
49
48
  * Internal implementation of the `Component` HOC.
50
- * Handles theme propagation, BaseNode conversion, and wrapper creation.
51
- */export function Component(a){function Func(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return Node(c,a).render()}var b=getElementTypeName(a),c=function Renderer(b){var c=a(b);if(c instanceof BaseNode){var d,e,f=(null===(d=c.rawProps)||void 0===d?void 0:d.nodetheme)||(null===(e=c.rawProps)||void 0===e?void 0:e.theme)||b.nodetheme||b.theme;return Node(c.element,_objectSpread(_objectSpread({},c.rawProps),{},{nodetheme:f})).render()}return c};return c.displayName="Renderer(".concat(b,")"),Func.displayName="Component(".concat(b,")"),Func}
49
+ * Handles BaseNode conversion and wrapper creation.
50
+ */export function Component(a){function Func(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};return Node(c,a).render()}var b=getElementTypeName(a),c=function Renderer(b){var c=a(b);return c instanceof BaseNode||isNodeInstance(c)?Node(c.element,c.rawProps).render():c};return c.displayName="Renderer(".concat(b,")"),Func.displayName="Component(".concat(b,")"),Func}
@@ -1,53 +1,53 @@
1
1
  import type { BasePortalProps, ComponentNode, NodeInstance, PortalLauncher, PortalProps } from '../node.type.js';
2
+ // --- Function Overloads ---
2
3
  /**
3
- * Creates a portal component with a single fixed provider.
4
- * The content component will be rendered within this provider. This is the preferred method
5
- * for providing fixed context to your portal content.
6
- * @param provider A single `NodeInstance` that will wrap the portal content. This should typically
7
- * be a React context provider (e.g., `ThemeProvider({ theme })`).
8
- * @param component The React component function that defines the portal's content. It receives
9
- * props of type `PortalProps<P>` and should return a `ComponentNode`.
10
- * @returns A launcher function that, when called, creates and controls the portal instance.
4
+ * Higher-Order Component (HOC) to create and manage React portals with optional provider wrapping.
5
+ * This function supports two overloads:
6
+ * 1. `Portal(providerNodeInstance, component)` - Creates a portal with a fixed provider node instance.
7
+ * 2. `Portal(component)` - Creates a portal without a fixed provider, allowing dynamic providers at launch time.
8
+ * @template P The prop types for the component rendered inside the portal, extending BasePortalProps.
9
+ * @param provider Optional NodeInstance to wrap the portal content (fixed provider).
10
+ * @param component The component function that returns the content to render inside the portal.
11
+ * @returns A function that launches the portal instance, accepting props and optional dynamic providers.
11
12
  * @example
12
- * ```ts
13
- * // Example of preferred usage with a single fixed provider:
14
- * const ThemedModal = Portal(
15
- * ThemeProvider({ theme: 'light' }),
16
- * (props) => Div({ children: props.children, style: { background: props.nodetheme?.background } })
17
- * );
13
+ * // Using Portal with a fixed provider
14
+ * const MyPortal = Portal(MyProviderNodeInstance, (props) => (
15
+ * Div({
16
+ * backgroundColor: 'white',
17
+ * padding: '20px',
18
+ * borderRadius: '8px',
19
+ * children: [
20
+ * H1({ children: 'Fixed Provider Portal' }),
21
+ * Button({
22
+ * onClick: () => props.portal.unmount(),
23
+ * children: 'Close',
24
+ * }),
25
+ * ],
26
+ * })
27
+ * ));
18
28
  *
19
- * const modalInstance = ThemedModal({ children: "Preferred content" });
20
- * modalInstance.unmount();
21
- * ```
22
- */
23
- export declare function Portal<P extends BasePortalProps | Record<string, any> = BasePortalProps>(provider: NodeInstance<any>, component: (props: PortalProps<P>) => ComponentNode): PortalLauncher<P>;
24
- /**
25
- * Creates a basic portal component without any fixed providers.
26
- * Dynamic providers can still be passed as props when launching the portal instance.
27
- * @param component The React component function that defines the portal's content. It receives
28
- * props of type `PortalProps<P>` and should return a `ComponentNode`.
29
- * @returns A launcher function that, when called, creates and controls the portal instance.
29
+ * // Launching the portal
30
+ * const portalInstance = MyPortal({ someProp: 'value' });
30
31
  * @example
31
- * ```ts
32
- * // Example of basic usage without fixed providers:
33
- * const BasicModal = Portal(
34
- * (props) => Div({ children: props.children, style: { padding: '20px', border: '1px solid black' } })
35
- * );
32
+ * // Using Portal without a fixed provider
33
+ * const MyPortal = Portal((props) => (
34
+ * Div({
35
+ * backgroundColor: 'white',
36
+ * padding: '20px',
37
+ * borderRadius: '8px',
38
+ * children: [
39
+ * H1({ children: 'Dynamic Provider Portal' }),
40
+ * Button({
41
+ * onClick: () => props.portal.unmount(),
42
+ * children: 'Close',
43
+ * }),
44
+ * ],
45
+ * })
46
+ * ));
36
47
  *
37
- * const basicModalInstance = BasicModal({ children: "Hello from a basic portal!" });
38
- * basicModalInstance.unmount();
39
- *
40
- * // Example with dynamic providers when launching:
41
- * const DynamicThemedModal = Portal(
42
- * (props) => Div({ children: props.children, style: { background: props.nodetheme?.background || 'white' } })
43
- * );
44
- *
45
- * const dynamicModalInstance = DynamicThemedModal({
46
- * providers: ThemeProvider({ theme: 'blue' }), // Dynamic provider
47
- * children: "Content with dynamic theme"
48
- * });
49
- * dynamicModalInstance.unmount();
50
- * ```
48
+ * // Launching the portal with a dynamic provider
49
+ * const portalInstance = MyPortal({ provider: AnotherProviderNodeInstance, someProp: 'value' });
51
50
  */
51
+ export declare function Portal<P extends BasePortalProps | Record<string, any> = BasePortalProps>(provider: NodeInstance<any>, component: (props: PortalProps<P>) => ComponentNode): PortalLauncher<P>;
52
52
  export declare function Portal<P extends BasePortalProps | Record<string, any> = BasePortalProps>(component: (props: PortalProps<P>) => ComponentNode): PortalLauncher<P>;
53
53
  //# sourceMappingURL=portal.hoc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"portal.hoc.d.ts","sourceRoot":"","sources":["../../src/hoc/portal.hoc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAe,YAAY,EAAyB,cAAc,EAAE,WAAW,EAAS,MAAM,mBAAmB,CAAA;AAG7J;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,EACtF,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,EAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,aAAa,GAClD,cAAc,CAAC,CAAC,CAAC,CAAA;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,EACtF,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,aAAa,GAClD,cAAc,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"portal.hoc.d.ts","sourceRoot":"","sources":["../../src/hoc/portal.hoc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAe,YAAY,EAAyB,cAAc,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAGtJ,6BAA6B;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,EACtF,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,EAC3B,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,aAAa,GAClD,cAAc,CAAC,CAAC,CAAC,CAAA;AAEpB,wBAAgB,MAAM,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,EACtF,SAAS,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,aAAa,GAClD,cAAc,CAAC,CAAC,CAAC,CAAA"}
@@ -1,50 +1,51 @@
1
- "use strict";var _excluded=["nodetheme"],_excluded2=["provider","nodetheme"];function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&{}.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}import{BaseNode,Node}from"../core.node.js";/**
2
- * Creates a portal component with a single fixed provider.
3
- * The content component will be rendered within this provider. This is the preferred method
4
- * for providing fixed context to your portal content.
5
- * @param provider A single `NodeInstance` that will wrap the portal content. This should typically
6
- * be a React context provider (e.g., `ThemeProvider({ theme })`).
7
- * @param component The React component function that defines the portal's content. It receives
8
- * props of type `PortalProps<P>` and should return a `ComponentNode`.
9
- * @returns A launcher function that, when called, creates and controls the portal instance.
1
+ "use strict";var _excluded=["provider"];function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _objectWithoutProperties(a,b){if(null==a)return{};var c,d,e=_objectWithoutPropertiesLoose(a,b);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(a);for(d=0;d<f.length;d++)c=f[d],-1===b.indexOf(c)&&{}.propertyIsEnumerable.call(a,c)&&(e[c]=a[c])}return e}function _objectWithoutPropertiesLoose(a,b){if(null==a)return{};var c={};for(var d in a)if({}.hasOwnProperty.call(a,d)){if(-1!==b.indexOf(d))continue;c[d]=a[d]}return c}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}import{BaseNode,Node}from"../core.node.js";// --- Function Overloads ---
2
+ /**
3
+ * Higher-Order Component (HOC) to create and manage React portals with optional provider wrapping.
4
+ * This function supports two overloads:
5
+ * 1. `Portal(providerNodeInstance, component)` - Creates a portal with a fixed provider node instance.
6
+ * 2. `Portal(component)` - Creates a portal without a fixed provider, allowing dynamic providers at launch time.
7
+ * @template P The prop types for the component rendered inside the portal, extending BasePortalProps.
8
+ * @param provider Optional NodeInstance to wrap the portal content (fixed provider).
9
+ * @param component The component function that returns the content to render inside the portal.
10
+ * @returns A function that launches the portal instance, accepting props and optional dynamic providers.
10
11
  * @example
11
- * ```ts
12
- * // Example of preferred usage with a single fixed provider:
13
- * const ThemedModal = Portal(
14
- * ThemeProvider({ theme: 'light' }),
15
- * (props) => Div({ children: props.children, style: { background: props.nodetheme?.background } })
16
- * );
12
+ * // Using Portal with a fixed provider
13
+ * const MyPortal = Portal(MyProviderNodeInstance, (props) => (
14
+ * Div({
15
+ * backgroundColor: 'white',
16
+ * padding: '20px',
17
+ * borderRadius: '8px',
18
+ * children: [
19
+ * H1({ children: 'Fixed Provider Portal' }),
20
+ * Button({
21
+ * onClick: () => props.portal.unmount(),
22
+ * children: 'Close',
23
+ * }),
24
+ * ],
25
+ * })
26
+ * ));
17
27
  *
18
- * const modalInstance = ThemedModal({ children: "Preferred content" });
19
- * modalInstance.unmount();
20
- * ```
21
- *//**
22
- * Creates a basic portal component without any fixed providers.
23
- * Dynamic providers can still be passed as props when launching the portal instance.
24
- * @param component The React component function that defines the portal's content. It receives
25
- * props of type `PortalProps<P>` and should return a `ComponentNode`.
26
- * @returns A launcher function that, when called, creates and controls the portal instance.
28
+ * // Launching the portal
29
+ * const portalInstance = MyPortal({ someProp: 'value' });
27
30
  * @example
28
- * ```ts
29
- * // Example of basic usage without fixed providers:
30
- * const BasicModal = Portal(
31
- * (props) => Div({ children: props.children, style: { padding: '20px', border: '1px solid black' } })
32
- * );
31
+ * // Using Portal without a fixed provider
32
+ * const MyPortal = Portal((props) => (
33
+ * Div({
34
+ * backgroundColor: 'white',
35
+ * padding: '20px',
36
+ * borderRadius: '8px',
37
+ * children: [
38
+ * H1({ children: 'Dynamic Provider Portal' }),
39
+ * Button({
40
+ * onClick: () => props.portal.unmount(),
41
+ * children: 'Close',
42
+ * }),
43
+ * ],
44
+ * })
45
+ * ));
33
46
  *
34
- * const basicModalInstance = BasicModal({ children: "Hello from a basic portal!" });
35
- * basicModalInstance.unmount();
36
- *
37
- * // Example with dynamic providers when launching:
38
- * const DynamicThemedModal = Portal(
39
- * (props) => Div({ children: props.children, style: { background: props.nodetheme?.background || 'white' } })
40
- * );
41
- *
42
- * const dynamicModalInstance = DynamicThemedModal({
43
- * providers: ThemeProvider({ theme: 'blue' }), // Dynamic provider
44
- * children: "Content with dynamic theme"
45
- * });
46
- * dynamicModalInstance.unmount();
47
- * ```
47
+ * // Launching the portal with a dynamic provider
48
+ * const portalInstance = MyPortal({ provider: AnotherProviderNodeInstance, someProp: 'value' });
48
49
  */// --- Implementation ---
49
50
  export function Portal(a,b){// --- Initialization ---
50
51
  var c,d=void 0,e={unmount:function unmount(){console.warn("Portal instance not yet created. Cannot unmount.")},update:function update(a){console.warn("Portal instance not yet created. Cannot update.",a)}};// --- Argument Parsing and Overload Handling ---
@@ -53,21 +54,20 @@ if("function"==typeof b&&a instanceof BaseNode)// Handles the case where a fixed
53
54
  d=[a],c=b;else if("function"==typeof a&&b===void 0)// Handles the case where only the component function is passed.
54
55
  c=a;else throw new Error("Invalid arguments for Portal HOC. Use Portal(component) or Portal(providerNodeInstance, component).");// --- Core Content Renderer Function ---
55
56
  // This function is the actual React component that will be rendered inside the portal.
56
- // It receives props and handles theme application and portal control.
57
- var f=function Renderer(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=a.nodetheme,d=_objectWithoutProperties(a,_excluded),f=c(_objectSpread(_objectSpread({},d),{},{portal:e// Passes the portal control object to the content component
58
- }));// Ensures that the theme is correctly applied if the result is a BaseNode.
59
- if(f instanceof BaseNode){var g,h;return Node(f.element,_objectSpread(_objectSpread({},f.rawProps),{},{nodetheme:(null===(g=f.rawProps)||void 0===g?void 0:g.nodetheme)||(null===(h=f.rawProps)||void 0===h?void 0:h.theme)||a.nodetheme})).render()}return f};// --- Portal Launcher Function (Returned to User) ---
57
+ var f=function Renderer(){var a=0<arguments.length&&arguments[0]!==void 0?arguments[0]:{},b=c(_objectSpread(_objectSpread({},a),{},{portal:e// Passes the portal control object to the content component
58
+ }));// If the result is a BaseNode, render it.
59
+ return b instanceof BaseNode?b.render():b};// --- Portal Launcher Function (Returned to User) ---
60
60
  // This is the function that developers call to actually create and manage a portal instance.
61
61
  return function Func(){// --- Helper for Deep Content Injection ---
62
62
  // Recursively injects content into the deepest child of a provider chain.
63
- function injectContentDeeply(a,b,c){var d,e,f,g=null===(d=a.rawProps)||void 0===d?void 0:d.children;// If no children, or children is not a NodeInstance, inject directly
64
- if(!g||!(g instanceof BaseNode)){var h,i;return Node(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{children:b,nodetheme:(null===(h=a.rawProps)||void 0===h?void 0:h.nodetheme)||(null===(i=a.rawProps)||void 0===i?void 0:i.theme)||c}))}// Recursively inject into the deepest node
65
- var j=injectContentDeeply(g,b);return Node(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{children:j,nodetheme:(null===(e=a.rawProps)||void 0===e?void 0:e.nodetheme)||(null===(f=a.rawProps)||void 0===f?void 0:f.theme)||c}))}// --- Provider Wrapping Logic ---
63
+ function injectContentDeeply(a,b){var c,d=null===(c=a.rawProps)||void 0===c?void 0:c.children;// If no children, or children is not a NodeInstance, inject directly
64
+ if(!d||!(d instanceof BaseNode))return Node(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{children:b}));// Recursively inject into the deepest node
65
+ var e=injectContentDeeply(d,b);return Node(a.element,_objectSpread(_objectSpread({},a.rawProps),{},{children:e}))}// --- Provider Wrapping Logic ---
66
66
  // Iterates through the combined providers (fixed + dynamic) to wrap the content.
67
67
  // Providers are applied in reverse order to ensure the innermost content is wrapped by the outermost provider.
68
68
  var a,b=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},c=[];// Combine fixed and dynamic providers
69
- b.provider&&c.push(b.provider);var g=[...(null!==d&&void 0!==d?d:[]),...c],h=b.provider,i=b.nodetheme,j=_objectWithoutProperties(b,_excluded2),k=_objectSpread(_objectSpread({},j),{},{nodetheme:i}),l=Node(f,k);// Separates props for the portal's content from internal props like 'provider' or 'nodetheme'.
69
+ b.provider&&c.push(b.provider);var g=[...(null!==d&&void 0!==d?d:[]),...c],h=b.provider,i=_objectWithoutProperties(b,_excluded),j=Node(f,i);// Separates props for the portal's content from internal props like 'provider'.
70
70
  // Creates the base node for the portal's content.
71
- return a=0<g.length?g.reduceRight(function(a,b){var c,d,e;if(!(b instanceof BaseNode))return console.warn("Portal: Item in provider is not a valid NodeInstance. Skipping.",b),a;var f=(null===(c=b.rawProps)||void 0===c?void 0:c.children)instanceof BaseNode;// If the provider already has nested children, inject content deeply.
71
+ return a=0<g.length?g.reduceRight(function(a,b){var c;if(!(b instanceof BaseNode))return console.warn("Portal: Item in provider is not a valid NodeInstance. Skipping.",b),a;var d=(null===(c=b.rawProps)||void 0===c?void 0:c.children)instanceof BaseNode;// If the provider already has nested children, inject content deeply.
72
72
  // Otherwise, simply set currentWrappedContent as its direct child.
73
- return f?injectContentDeeply(b,a,i):Node(b.element,_objectSpread(_objectSpread({},b.rawProps),{},{children:a,nodetheme:(null===(d=b.rawProps)||void 0===d?void 0:d.nodetheme)||(null===(e=b.rawProps)||void 0===e?void 0:e.theme)||i}))},l):l,e=a.toPortal(),e}}
73
+ return d?injectContentDeeply(b,a):Node(b.element,_objectSpread(_objectSpread({},b.rawProps),{},{children:a}))},j):j,e=a.toPortal(),e}}
@@ -1,2 +1,3 @@
1
1
  export * from '../hook/usePortal.js';
2
+ export * from '../hook/useTheme.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hook/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hook/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA"}
@@ -1 +1 @@
1
- export*from"./usePortal.js";
1
+ export*from"./usePortal.js";export*from"./useTheme.js";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A hook that provides access to the theme context.
3
+ * It also handles side effects like updating localStorage and applying the theme to the document root.
4
+ * @returns {ThemeContextValue} The theme context value.
5
+ * @throws {Error} If used outside of a ThemeProvider.
6
+ */
7
+ export declare const useTheme: () => import("../main").ThemeContextValue;
8
+ //# sourceMappingURL=useTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../src/hook/useTheme.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,6CA+BpB,CAAA"}
@@ -0,0 +1,8 @@
1
+ "use client";import{useContext,useEffect}from"react";import{ThemeContext}from"../components/theme-provider.client.js";/**
2
+ * A hook that provides access to the theme context.
3
+ * It also handles side effects like updating localStorage and applying the theme to the document root.
4
+ * @returns {ThemeContextValue} The theme context value.
5
+ * @throws {Error} If used outside of a ThemeProvider.
6
+ */export var useTheme=function useTheme(){var a=useContext(ThemeContext);if(!a)throw new Error("useTheme must be used within a ThemeProvider");var b=a.theme;return useEffect(function(){// Sync theme mode with localStorage
7
+ var a=localStorage.getItem("theme");a&&a===b.mode||localStorage.setItem("theme",b.mode);// Apply theme to document root
8
+ var c=document.documentElement;"dark"===b.mode?(c.setAttribute("data-theme","dark"),c.classList.add("dark-theme"),c.classList.remove("light-theme")):(c.setAttribute("data-theme","light"),c.classList.add("light-theme"),c.classList.remove("dark-theme"))},[b.mode,b.system]),a};
package/dist/main.d.ts CHANGED
@@ -3,5 +3,6 @@ export * from './hoc/index.js';
3
3
  export * from './helper/node.helper.js';
4
4
  export * from './node.type.js';
5
5
  export * from './components/html.node.js';
6
+ export * from './components/theme-provider.client.js';
6
7
  export * from './hook/index.js';
7
8
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC7E,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,mBAAmB,CAAA;AACjC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAE7E,cAAc,mBAAmB,CAAA;AAEjC,cAAc,4BAA4B,CAAA;AAE1C,cAAc,mBAAmB,CAAA;AAEjC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,0CAA0C,CAAA;AAExD,cAAc,oBAAoB,CAAA"}
package/dist/main.js CHANGED
@@ -1 +1 @@
1
- export{Node,createNode,createChildrenFirstNode}from"./core.node.js";export*from"./hoc/index.js";export*from"./helper/node.helper.js";export*from"./node.type.js";export*from"./components/html.node.js";export*from"./hook/index.js";
1
+ export{Node,createNode,createChildrenFirstNode}from"./core.node.js";export*from"./hoc/index.js";export*from"./helper/node.helper.js";export*from"./node.type.js";export*from"./components/html.node.js";export*from"./components/theme-provider.client.js";export*from"./hook/index.js";
@@ -1,6 +1,7 @@
1
1
  import React, { type CSSProperties, type ReactNode, type JSX, type ElementType, type ComponentType, type JSXElementConstructor, type Component, type ExoticComponent, type ReactElement } from 'react';
2
2
  import type { CSSInterpolation } from '@emotion/serialize';
3
3
  import type { NO_STYLE_TAGS } from './constants/common.const.js';
4
+ import type { ComponentNodeProps } from './hoc';
4
5
  // --- Utility Types ---
5
6
  // Utility to get keys of required properties in a type T.
6
7
  type RequiredKeys<T> = {
@@ -20,20 +21,22 @@ export type NonArrayReactNode = Exclude<ReactNode, ReactNode[]>;
20
21
  * Defines the various types that can represent a "node" in the Meonode system.
21
22
  * This includes React elements, components, promises resolving to React nodes, and NodeInstance objects.
22
23
  */
23
- export type NodeElement = ExoticComponent<any> | NonArrayReactNode | Promise<Awaited<NonArrayReactNode>> | Component<any, any, any> | ElementType | ComponentType<any> | NodeInstance<any> | ((props?: any) => NonArrayReactNode | Promise<Awaited<NonArrayReactNode>> | Component<any, any, any> | NodeInstance<any> | ComponentNode);
24
- export type NodeElementType = ElementType | ExoticComponent<any>;
24
+ export type NodeElement = ExoticComponent<any> | NonArrayReactNode | Promise<Awaited<NonArrayReactNode>> | Component<any, any, any> | ElementType | ComponentType<any> | NodeInstance<any> | NodeFunction<any> | NodeElementType | ((props?: Record<string, any>) => ExoticComponent<any> | NonArrayReactNode | Component<any, any, any> | ElementType | ComponentType<any> | NodeInstance<any>);
25
+ export type NodeElementType = ElementType | (ExoticComponent & {
26
+ $$typeof?: symbol;
27
+ }) | (<TProps extends Record<string, any> | undefined>(props: ComponentNodeProps<TProps>) => ComponentNode);
25
28
  /** A single NodeElement or an array of NodeElements */
26
29
  export type Children = NodeElement | NodeElement[];
27
30
  /**
28
31
  * Forward declaration of the BaseNode interface to avoid circular dependencies.
29
32
  * Defines the core structure and capabilities of a BaseNode instance.
30
- * @template T - The type of React element/component that this node represents
33
+ * @template E - The type of React element/component that this node represents
31
34
  */
32
- export interface NodeInstance<T extends NodeElement = NodeElement> {
35
+ export interface NodeInstance<E extends NodeElement = NodeElement> {
33
36
  /** The underlying React element or component type that this node will render */
34
- readonly element: T;
37
+ readonly element: E;
35
38
  /** Original props passed during node construction, preserved for cloning/recreation */
36
- readonly rawProps: RawNodeProps<T>;
39
+ readonly rawProps: Partial<NodeProps<E>>;
37
40
  readonly isBaseNode: true;
38
41
  /** Converts this node instance into a renderable React element/tree */
39
42
  render(): ReactElement;
@@ -52,15 +55,31 @@ export type PropsOf<E extends NodeElement> = E extends keyof JSX.IntrinsicElemen
52
55
  props: infer Q;
53
56
  } ? Q : never;
54
57
  /**
55
- * Theme configuration object that can be passed through the node tree.
56
- * Supports nested theme properties for complex styling systems:
57
- * - Simple values (strings, numbers)
58
+ * Theme mode - light or dark theme variant
59
+ */
60
+ export type ThemeMode = 'light' | 'dark' | string;
61
+ /**
62
+ * System theme configuration with base colors and semantic tokens
63
+ */
64
+ export interface ThemeSystem {
65
+ [key: string]: string | number | boolean | null | undefined | any | ThemeSystem | Record<string, ThemeSystem | string | number | boolean | null | undefined | any>;
66
+ }
67
+ /**
68
+ * Theme configuration object.
69
+ * Requires `mode` and `system` as core theme properties, with support for
70
+ * unlimited nested theme properties for complex styling systems:
71
+ * - Simple values (strings, numbers, booleans)
58
72
  * - Nested theme objects with unlimited depth
59
73
  * - Common CSS values and units
60
74
  * - Custom theme variables and tokens
61
75
  * Used for consistent styling and dynamic theme application.
62
76
  */
63
- export type Theme = Partial<{
77
+ export type Theme = {
78
+ /** Current theme mode (light/dark) */
79
+ mode: ThemeMode;
80
+ /** System theme configuration with colors and tokens */
81
+ system: ThemeSystem;
82
+ } & Partial<{
64
83
  [key: string]: string | number | boolean | null | undefined | any | Theme | Record<string, Theme | string | number | boolean | null | undefined | any>;
65
84
  }>;
66
85
  /**
@@ -77,10 +96,6 @@ export type FinalNodeProps = ReactAttributes & Partial<{
77
96
  style: any;
78
97
  css: any;
79
98
  children: Children;
80
- theme: Partial<{
81
- [p: string]: any;
82
- }> | any | undefined;
83
- nodetheme: Theme;
84
99
  }>;
85
100
  /**
86
101
  * Helper type to determine if the props P have a 'style' property
@@ -110,23 +125,19 @@ export type HasNoStyleProp<E extends NodeElement> = E extends NoStyleTags ? true
110
125
  * - Maintains React's key prop for reconciliation
111
126
  * @template E - The element type these props apply to
112
127
  */
113
- export type NodeProps<E extends NodeElement> = Omit<PropsOf<E>, keyof CSSProperties | 'children' | 'style' | 'theme' | 'props' | 'key'> & ReactAttributes & (HasCSSCompatibleStyleProp<PropsOf<E>> extends true ? CSSProperties : object) & (HasNoStyleProp<E> extends true ? Partial<{
128
+ export type NodeProps<E extends NodeElement> = Omit<PropsOf<E>, keyof CSSProperties | 'children' | 'style' | 'props' | 'key'> & ReactAttributes & (HasCSSCompatibleStyleProp<PropsOf<E>> extends true ? CSSProperties : object) & (HasNoStyleProp<E> extends true ? Partial<{
114
129
  css: CSSInterpolation;
115
130
  }> : object) & Partial<{
116
131
  props: Partial<Omit<PropsOf<E>, 'children'>>;
117
132
  children: Children;
118
- theme: Theme;
119
133
  }>;
120
134
  /**
121
- * BaseNode's internal props type, extending NodeProps:
122
- * - Makes all properties optional for flexible node creation
123
- * - Adds nodetheme for theme context handling
124
- * - Used for both initial construction and internal state
135
+ * Function type for dynamic node content generation.
136
+ * Accepts optional NodeProps and returns a ReactNode or NodeInstance.
137
+ * Enables advanced patterns like render props and dynamic theming.
125
138
  * @template E - The element type these props apply to
126
139
  */
127
- export type RawNodeProps<E extends NodeElement> = Partial<NodeProps<E>> & {
128
- nodetheme?: Theme;
129
- };
140
+ export type NodeFunction<E extends ReactNode | NodeInstance = ReactNode | NodeInstance> = (props?: NodeProps<E>) => ReactNode | NodeInstance | React.Component;
130
141
  /**
131
142
  * Props interface for the internal FunctionRenderer component.
132
143
  * Handles dynamic function children within React's component lifecycle:
@@ -134,12 +145,9 @@ export type RawNodeProps<E extends NodeElement> = Partial<NodeProps<E>> & {
134
145
  * - Maintains theme context for rendered content
135
146
  * - Enables hook usage in function children
136
147
  */
137
- export interface FunctionRendererProps<E extends NodeElement> {
148
+ export interface FunctionRendererProps<E extends ReactNode | NodeInstance> {
138
149
  /** Function that returns the child content to render */
139
- render: (props?: NodeProps<E>) => ReactNode | Promise<Awaited<ReactNode>> | React.Component | NodeInstance<E>;
140
- /** Theme context to be applied to the rendered content */
141
- passedTheme?: Theme;
142
- processRawNode: (node: NodeElement, parentTheme?: Theme, childIndex?: number) => NodeElement;
150
+ render: NodeFunction<E>;
143
151
  }
144
152
  export type ComponentNode = (NodeInstance<any> | ReactNode) | (() => NodeInstance<any> | ReactNode);
145
153
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"node.type.d.ts","sourceRoot":"","sources":["../src/node.type.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EACZ,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,OAAO,CAAA;AACd,OAAO,K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M,WAAW,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,eAAe,CAAA;AAE9F;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,MAAM,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAA;CACpC;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAC5E,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,KAC5E,UAAU,CAAA;AAEf;;;;;GAKG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,WAAW,EAAE,eAAe,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,eAAe,EAAE,MAAM,eAAe,CAAC,GACvJ,eAAe,CAAA"}
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.2.20",
4
+ "version": "0.3.0",
5
5
  "type": "module",
6
6
  "main": "./dist/main.js",
7
7
  "types": "./dist/main.d.ts",
@@ -48,19 +48,19 @@
48
48
  "@babel/preset-typescript": "^7.27.1",
49
49
  "@emotion/cache": "^11.14.0",
50
50
  "@emotion/jest": "^11.13.0",
51
- "@eslint/js": "^9.35.0",
51
+ "@eslint/js": "^9.36.0",
52
52
  "@testing-library/dom": "^10.4.1",
53
53
  "@testing-library/jest-dom": "^6.8.0",
54
54
  "@testing-library/react": "^16.3.0",
55
55
  "@types/jest": "^30.0.0",
56
- "@types/react": "^19.1.12",
56
+ "@types/react": "^19.1.13",
57
57
  "@types/react-dom": "^19.1.9",
58
- "@typescript-eslint/eslint-plugin": "^8.43.0",
59
- "@typescript-eslint/parser": "^8.43.0",
60
- "@typescript/native-preview": "^7.0.0-dev.20250909.1",
58
+ "@typescript-eslint/eslint-plugin": "^8.44.1",
59
+ "@typescript-eslint/parser": "^8.44.1",
60
+ "@typescript/native-preview": "^7.0.0-dev.20250922.1",
61
61
  "babel-plugin-module-resolver": "^5.0.2",
62
62
  "babel-preset-minify": "0.5.2",
63
- "eslint": "^9.35.0",
63
+ "eslint": "^9.36.0",
64
64
  "eslint-plugin-jsdoc": "^55.4.0",
65
65
  "eslint-plugin-prettier": "^5.5.4",
66
66
  "eslint-plugin-unused-imports": "^4.2.0",
@@ -71,10 +71,10 @@
71
71
  "prettier": "^3.6.2",
72
72
  "react": "^19.1.1",
73
73
  "react-dom": "^19.1.1",
74
- "ts-jest": "^29.4.1",
74
+ "ts-jest": "^29.4.4",
75
75
  "tsc-alias": "^1.8.16",
76
76
  "typescript": "^5.9.2",
77
- "typescript-eslint": "^8.43.0"
77
+ "typescript-eslint": "^8.44.1"
78
78
  },
79
79
  "packageManager": "yarn@4.10.2",
80
80
  "peerDependencies": {