import * as _nuxt_schema from '@nuxt/schema'; import { NuxtPage } from '@nuxt/schema'; /** * Parsed doctype data read from a JSON file in the doctypes directory. * @public */ interface ParsedDoctype { /** Original filename without extension (e.g., 'user-table', 'User') */ fileName: string; /** Parsed JSON content of the doctype file */ data: Record; /** Schema fields array (from `schema` or `fields` property) */ fields: Record[]; } /** * Route strategy function signature. * * Receives all parsed doctypes from the `doctypes/` directory and returns * an array of NuxtPage definitions to register. The user is responsible * for providing the `file` property on each page (pointing to their own * page component). * * @example * ```typescript * const myStrategy: RouteStrategyFn = (doctypes) => { * return doctypes.flatMap(({ fileName, data, fields }) => [ * { * name: `${fileName}-list`, * path: `/${data.slug || fileName.toLowerCase()}`, * file: resolve('./pages/MyListPage.vue'), * meta: { schema: fields, doctype: data, viewMode: 'list' }, * }, * { * name: `${fileName}-detail`, * path: `/${data.slug || fileName.toLowerCase()}/:id`, * file: resolve('./pages/MyDetailPage.vue'), * meta: { schema: fields, doctype: data, viewMode: 'detail' }, * }, * ]) * } * ``` * * @public */ type RouteStrategyFn = (doctypes: ParsedDoctype[]) => NuxtPage[]; interface ModuleOptions { /** Enable the DocBuilder feature with /docbuilder routes */ docbuilder?: boolean; /** Allow DocBuilder routes and handlers outside development (e.g. public documentation playground) */ docbuilderPublic?: boolean; /** Path to doctypes folder relative to the project root (defaults to 'doctypes') */ doctypesDir?: string; /** * Path to the page component every doctype route renders. * * When `routeStrategy` is not set, one route is registered per doctype that **declares** a * `route`, at exactly that path — `/order` for a collection, `/order/:id` for a record. A * doctype without one gets no page: most doctypes are not meant to be visited directly. * * The path is resolved relative to the application's `srcDir`. * * @example `'pages/StonecropPage.vue'` */ pageComponent?: string; /** * Custom route strategy function for full control over route generation. * When provided, `pageComponent` is ignored and this function is called * with all parsed doctypes to produce the NuxtPage array. * * @example * ```typescript * routeStrategy: (doctypes) => doctypes.map(({ fileName, data, fields }) => ({ * name: `stonecrop-${fileName}`, * path: `/${data.slug || fileName.toLowerCase()}`, * file: resolve('./pages/MyPage.vue'), * meta: { schema: fields, doctype: data }, * })) * ``` */ routeStrategy?: RouteStrategyFn; } declare const STONECROP_PACKAGES: string[]; /** * The Stonecrop token floor — the single definition of every `--sc-*` variable the component * packages consume. Named once here so the specifier lives in one place. */ declare const STONECROP_TOKENS = "@stonecrop/themes/default.css"; declare const _default: _nuxt_schema.NuxtModule; export { STONECROP_PACKAGES, STONECROP_TOKENS, _default as default }; export type { ModuleOptions, ParsedDoctype, RouteStrategyFn };