UNPKG

alinea

Version:

[![npm](https://img.shields.io/npm/v/alinea.svg)](https://npmjs.org/package/alinea) [![install size](https://packagephobia.com/badge?p=alinea)](https://packagephobia.com/result?p=alinea)

40 lines (39 loc) 1.2 kB
import type { ComponentType } from 'react'; import { Label } from './Label.js'; import { Meta, StripMeta } from './Meta.js'; import { PageSeed } from './Page.js'; export interface RootI18n { locales: Array<string>; } export interface RootMeta { contains?: Array<string>; icon?: ComponentType; i18n?: RootI18n; /** A React component used to view this root in the dashboard */ view?: ComponentType<{ root: RootData; }>; } export interface RootDefinition { [key: string]: PageSeed; [Meta]?: RootMeta; } export interface RootData extends RootMeta { label: Label; } type Seed = Record<string, PageSeed>; export type Root<Definition extends Seed = Seed> = Definition & { [Root.Data]: RootData; }; export declare namespace Root { const Data: unique symbol; function label(root: Root): Label; function data(root: Root): RootData; function defaultLocale(root: Root): string | undefined; function isRoot(value: any): value is Root; } export declare function root<Definition extends RootDefinition>(label: Label, definition: Definition): Root<StripMeta<Definition>>; export declare namespace root { const meta: typeof Meta; } export {};