This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Removes wrappers such as effects and pipelines | |
| * and returns the inner object schema. | |
| */ | |
| function unwrapObjectSchema(schema: z.ZodTypeAny): z.AnyZodObject { | |
| if (schema instanceof z.ZodObject) { | |
| return schema | |
| } | |
| if (schema instanceof z.ZodEffects) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { Ref } from "react" | |
| function mergeRefs<T>(...refs: (Ref<T> | undefined)[]): Ref<T> { | |
| return (value) => { | |
| const cleanups = refs.reduce<VoidFunction[]>((accumulator, ref) => { | |
| if (typeof ref === "function") { | |
| const cleanup = ref(value) | |
| if (typeof cleanup === "function") { | |
| accumulator.push(cleanup) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { ReactNode } from "react" | |
| import { useEffect, useState, useTransition } from "react" | |
| import { createSafeContext } from "@/lib/context" | |
| type TransitionRouterStage = "entering" | "leaving" | undefined | |
| type TransitionRouterStartFunction = ( | |
| callback: () => void | Promise<void> | |
| ) => void |