UNPKG

vue-intlayer

Version:

Easily internationalize i18n your Vue applications with type-safe multilingual content management.

46 lines 1.88 kB
import { NodeType, DeepTransformContent as DeepTransformContentCore, IInterpreterPluginState as IInterpreterPluginStateCore, Plugins } from '@intlayer/core'; /** --------------------------------------------- * INTLAYER NODE PLUGIN * --------------------------------------------- */ export type IntlayerNodeCond<T> = T extends number | string ? IntlayerNode<T> : never; export interface IntlayerNode<T, P = {}> { value: T; children?: any; additionalProps?: P; } /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */ export declare const intlayerNodePlugins: Plugins; /** * MARKDOWN PLUGIN */ export type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, { metadata: DeepTransformContent<string>; }> : never; /** Markdown string plugin. Replaces string node with a component that render the markdown. */ export declare const markdownStringPlugin: Plugins; export type MarkdownCond<T> = T extends { nodeType: NodeType | string; [NodeType.Markdown]: infer M; metadata?: infer U; } ? IntlayerNode<DeepTransformContent<M>, { metadata: DeepTransformContent<U>; }> : never; export declare const markdownPlugin: Plugins; /** --------------------------------------------- * PLUGINS RESULT * --------------------------------------------- */ export interface IInterpreterPluginVue<T> { intlayerNode: IntlayerNodeCond<T>; markdown: MarkdownCond<T>; } /** * Insert this type as param of `DeepTransformContent` to avoid `intlayer` package pollution. * * Otherwise the the `vue-intlayer` plugins will override the types of `intlayer` functions. */ export type IInterpreterPluginState = IInterpreterPluginStateCore & { intlayerNode: true; markdown: true; }; export type DeepTransformContent<T> = DeepTransformContentCore<T, IInterpreterPluginState>; //# sourceMappingURL=plugins.d.ts.map