UNPKG

permix

Version:

Permix is a lightweight, framework-agnostic, type-safe permissions management library for JavaScript applications on the client and server sides.

37 lines (32 loc) 1.39 kB
import { SetupContext, SlotsType, VNode, Plugin } from 'vue'; import { P as PermixDefinition, a as Permix, f as CheckFunctionObject, h as CheckFunctionParams } from '../shared/permix.CuefdCK4.mjs'; type CheckProps<Definition extends PermixDefinition, K extends keyof Definition> = CheckFunctionObject<Definition, K> & { reverse?: boolean; }; type CheckContext = SetupContext<any, SlotsType<{ default: void; otherwise?: void; }>>; interface PermixComponents<Definition extends PermixDefinition> { Check: <K extends keyof Definition>(props: CheckProps<Definition, K>, context: CheckContext) => VNode | VNode[] | undefined; } declare function createComponents<Definition extends PermixDefinition>(permix: Permix<Definition>): PermixComponents<Definition>; /** * Composable that provides the Permix context to your Vue components. * * @link https://permix.letstri.dev/docs/integrations/vue */ declare function usePermix<T extends PermixDefinition>(permix: Permix<T>): { check: <K extends keyof T>(...args: CheckFunctionParams<T, K>) => boolean; isReady: any; }; /** * Vue plugin that provides the Permix context to your application. * * @link https://permix.letstri.dev/docs/integrations/vue */ declare const permixPlugin: Plugin<{ permix: Permix<any>; }>; export { createComponents, permixPlugin, usePermix }; export type { CheckProps, PermixComponents };