import { type ComputedRef, inject, provide } from 'vue' export interface DataListState { labelWidth: ComputedRef } export const DataListStateKey = 'sefirot-data-list-state-key' export function provideDataListState(state: DataListState): void { provide(DataListStateKey, state) } export function useDataListState(): DataListState { const state = inject(DataListStateKey, null) || null if (!state) { throw new Error( 'Unexpected call to `useDataListState`. This probably means you are using' + '`` child component outside of ``. Make sure' + ' to wrap the component within `` component.' ) } return state }