@cleanweb/oore 2.0.0-beta.7 → 2.0.0-beta.9
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.
|
@@ -86,7 +86,7 @@ export declare class ComponentInstance<TProps extends TPropsBase = null> extends
|
|
|
86
86
|
* PS: You can conditionally update state from here, but with certain caveats.
|
|
87
87
|
* {@link https://react.dev/reference/react/useState#storing-information-from-previous-renders | See the React docs for details}.
|
|
88
88
|
*/
|
|
89
|
-
beforeRender: () =>
|
|
89
|
+
beforeRender: () => any;
|
|
90
90
|
/**
|
|
91
91
|
* Runs **_after_** every render cycle, including the first.
|
|
92
92
|
*
|
|
@@ -69,7 +69,7 @@ var ComponentInstance = /** @class */ (function (_super) {
|
|
|
69
69
|
* PS: You can conditionally update state from here, but with certain caveats.
|
|
70
70
|
* {@link https://react.dev/reference/react/useState#storing-information-from-previous-renders | See the React docs for details}.
|
|
71
71
|
*/
|
|
72
|
-
_this.beforeRender = function () { };
|
|
72
|
+
_this.beforeRender = function () { return ({}); };
|
|
73
73
|
/**
|
|
74
74
|
* Runs **_after_** every render cycle, including the first.
|
|
75
75
|
*
|
package/build/slots/hook.js
CHANGED
|
@@ -47,9 +47,6 @@ var getComponentSlotName = function (TargetComponent, child) {
|
|
|
47
47
|
var keyTypes = ['string', 'number', 'symbol'];
|
|
48
48
|
var slotName = child.props['data-slot-name'];
|
|
49
49
|
if (keyTypes.includes(typeof slotName)) {
|
|
50
|
-
if (typeof child.type === 'string') {
|
|
51
|
-
child.props.tagName = child.type;
|
|
52
|
-
}
|
|
53
50
|
return slotName;
|
|
54
51
|
}
|
|
55
52
|
}
|
package/build/slots/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode, ComponentType, ReactPortal, JSX } from 'react';
|
|
2
|
+
/** @todo ComponentType force children to be ReactNode, but custom components can have any children type. */
|
|
2
3
|
type JSXTagLike = string | keyof JSX.IntrinsicElements | ComponentType<any>;
|
|
3
4
|
/** This fixes overly narrow T type used by React's ComponentProps type. */
|
|
4
5
|
export type ComponentProps<T extends JSXTagLike> = (T extends ComponentType<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : {});
|