diff --git a/README.md b/README.md index f4ab5c7..8f6d782 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,8 @@ The `` tag is where content that you pass to a component will be The plugin configures the PostHTML parser to recognize self-closing tags, so you can also just write is as ``. +For brevity, we will use self-closing tags in the examples. + ### More examples See also the `docs-src` folder where you can find more examples. diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..d395054 --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,214 @@ +import type { PostHTMLExpressions } from 'posthtml-expressions'; +import type { Options as PostHTMLParserOptions } from 'posthtml-parser'; + +interface AnyObject { + [key: string]: string | AnyObject; +} + +export type PostHTMLComponents = { + /** + * Root path where to look for folders containing component files. + * + * @default './' + */ + root?: string; + + /** + * Paths where to look for component files. Must be relative to `root`. + * + * @default [''] + */ + folders?: string[]; + + /** + * Prefix to use for component tags. + * + * @default 'x-' + */ + tagPrefix?: string; + + /** + * Tag name to be used in HTML when using a component. + * + * @default false + */ + tag?: string|false; + + /** + * Attribute name to be used when referencing a component via its path. + * + * @default 'src' + */ + attribute?: string; + + /** + * Array of namespace root paths, fallback paths and custom override paths. + * + * @default [] + */ + namespaces?: string[]; + + /** + * Separator to use between namespace and component name. + * + * @default '::' + */ + namespaceSeparator?: string; + + /** + * File extension that component files must use. + * + * @default 'html' + */ + fileExtension?: string; + + /** + * Name of the tag that will be replaced with the content that is passed to the component. + * + * @default 'yield' + */ + yield?: string; + + /** + * Name of the slot tag, where the content will be injected. + * + * @default 'slot' + */ + slot?: string; + + /** + * Name of the fill tag, where the content to be injected is defined. + * + * @default 'fill' + */ + fill?: string; + + /** + * String to use as a separator between the slot tag and its name. + * + * @default ':' + */ + slotSeparator?: string; + + /** + * Tag name for pushing content to a stack. + * + * @default 'push' + */ + push?: string; + + /** + * Tag name for popping (rendering) content from a stack. + * + * @default 'stack' + */ + stack?: string; + + /** + * Name of the props attribute to use in the `