mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
build(react): build26 from 45504a2b
This commit is contained in:
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
import { renderElement } from "../utils/use-render.js";
|
||||
import { forwardRef } from "react";
|
||||
//#region src/ui/create-context-part.tsx
|
||||
function createContextPart(config) {
|
||||
const { displayName, tag, useContext, staticProps, getProps } = config;
|
||||
const Component = forwardRef(function ContextPart(componentProps, forwardedRef) {
|
||||
const { render, className, style, ...elementProps } = componentProps;
|
||||
const context = useContext();
|
||||
const dynamicProps = getProps?.(context.state);
|
||||
return renderElement(tag, {
|
||||
render,
|
||||
className,
|
||||
style
|
||||
}, {
|
||||
state: context.state,
|
||||
stateAttrMap: context.stateAttrMap,
|
||||
ref: forwardedRef,
|
||||
props: [
|
||||
staticProps,
|
||||
dynamicProps,
|
||||
elementProps
|
||||
].filter(Boolean)
|
||||
});
|
||||
});
|
||||
Component.displayName = displayName;
|
||||
return Component;
|
||||
}
|
||||
//#endregion
|
||||
export { createContextPart };
|
||||
|
||||
//# sourceMappingURL=create-context-part.js.map
|
||||
Reference in New Issue
Block a user