import { VueReactiveAdapterResult, useReactive } from "@cfcs/vue2";
import { FRAME_REACTIVE, FrameReactiveData } from "scenejs";
/**
* You can use reactive state and frame methods.
* To access the state in Vue you need to add $ prefix.
* @typedef
* @memberof Vue2Scene
* @see Frame
* @extends Reactive.FrameReactiveState
*/
export interface VueFrameResult extends VueReactiveAdapterResult<typeof FRAME_REACTIVE> { }
/**
* @memberof Vue2Scene
* @param {Reactive.FrameReactiveData} - Can be used as frame, cssText, cssObject, etc.
* @return - You can use Frame methods and cssText, cssObject, ...etc
* @example
* import { useFrame } from "vue2-scenejs";
*
* const { cssText } = useFrame("text-align: center; transform: translate(10px, 10px);");
*
* console.log(cssText.value);
*/
export function useFrame(props: FrameReactiveData): VueFrameResult {
return useReactive({
...FRAME_REACTIVE,
data: () => props,
});
}