UNPKG

element-book

Version:

An [`element-vir`](https://npmjs.com/package/element-vir) drop-in element for building, testing, and demonstrating a collection of elements (or, in other words, a design system).

19 lines (18 loc) 678 B
import { check } from '@augment-vir/assert'; import { BookEntryType } from './book-entry-type.js'; import { checkControls } from './book-page/book-page-controls.js'; export const bookEntryVerifiers = { [BookEntryType.ElementExample]: () => { // currently all element example checking happens on page definition return []; }, [BookEntryType.Page]: (bookPage) => { return [ !bookPage.title && new Error(`Cannot define an element-book page with an empty title.`), ...checkControls(bookPage.controls, bookPage.title), ].filter(check.isTruthy); }, [BookEntryType.Root]: () => { return []; }, };