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)

45 lines (44 loc) 1.49 kB
import type { ComponentType } from 'react'; import { CMS } from './CMS.js'; import { Label } from './Label.js'; import { Meta, StripMeta } from './Meta.js'; import { Root } from './Root.js'; export interface WorkspaceMeta { /** A directory which contains the json entry files */ source: string; /** The directory where media files are placed in case a file backend is used */ mediaDir?: string; /** The main theme color used in the dashboard */ color?: string; icon?: ComponentType; } export interface WorkspaceData extends WorkspaceMeta { label: Label; roots: Roots; color: string; } type Roots = Record<string, Root>; export interface WorkspaceDefinition { [key: string]: Root; [Meta]: WorkspaceMeta; } export type Workspace<Definition extends Roots = Roots> = Definition & { [Workspace.Data]: WorkspaceData; [CMS.Link]?: CMS; }; export declare namespace Workspace { const Data: unique symbol; const Meta: unique symbol; function data(workspace: Workspace): WorkspaceData; function roots(workspace: Workspace): Roots; function label(workspace: Workspace): Label; function isWorkspace(value: any): value is Workspace; } /** Create a workspace */ export declare function workspace<Definition extends WorkspaceDefinition>( /** The name of the workspace */ label: Label, definition: Definition): Workspace<StripMeta<Definition>>; export declare namespace workspace { const meta: typeof Meta; } export {};