main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

28
node_modules/use-sidecar/dist/es2019/renderProp.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
import * as React from 'react';
import { useState, useCallback, useEffect, useLayoutEffect } from 'react';
export function renderCar(WrappedComponent, defaults) {
function State({ stateRef, props }) {
const renderTarget = useCallback(function SideTarget(...args) {
useLayoutEffect(() => {
stateRef.current(args);
});
return null;
}, []);
// @ts-ignore
return React.createElement(WrappedComponent, { ...props, children: renderTarget });
}
const Children = React.memo(({ stateRef, defaultState, children }) => {
const [state, setState] = useState(defaultState.current);
useEffect(() => {
stateRef.current = setState;
}, []);
return children(...state);
}, () => true);
return function Combiner(props) {
const defaultState = React.useRef(defaults(props));
const ref = React.useRef((state) => (defaultState.current = state));
return (React.createElement(React.Fragment, null,
React.createElement(State, { stateRef: ref, props: props }),
React.createElement(Children, { stateRef: ref, defaultState: defaultState, children: props.children })));
};
}