diff --git a/src/index.d.ts b/src/index.d.ts new file mode 100644 index 0000000..6fb8316 --- /dev/null +++ b/src/index.d.ts @@ -0,0 +1,28 @@ +export type Framework = 'vue' | 'react' + +export interface BaseOptions { + /** + * if use controller + */ + isController?: boolean + /** + * framework name + */ + framework?: Framework +} + +export interface PlantumlOptions extends BaseOptions { + /** + * image format + */ + imageFormat?: string + /** + * server url + */ + server?: string + [key: string]: any +} + +export interface MermaidOptions extends BaseOptions { + [key: string]: any +} diff --git a/src/index.ts b/src/index.ts index e160274..1062c3d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,7 +2,7 @@ import type MarkdownIt from 'markdown-it/index.js' import type { Renderer, Token } from 'markdown-it/index.js' import * as mermaidFunctions from './mermaid-parser' import * as platumlFunctions from './plantuml-parser' -import type { PlantumlOptions } from './types' +import type { PlantumlOptions } from './index.d' export default function umlPlugin(md: MarkdownIt, options: PlantumlOptions = {}) { platumlFunctions.default.functions.initialize(options) diff --git a/src/mermaid-parser.ts b/src/mermaid-parser.ts index d472c7f..b8f552c 100644 --- a/src/mermaid-parser.ts +++ b/src/mermaid-parser.ts @@ -1,7 +1,7 @@ 'use strict' import { getController } from './render-control' -import type { MermaidOptions } from './types' +import type { MermaidOptions } from '.' const functions = { options: { diff --git a/src/plantuml-parser.ts b/src/plantuml-parser.ts index 10570ce..241fb4c 100644 --- a/src/plantuml-parser.ts +++ b/src/plantuml-parser.ts @@ -1,9 +1,9 @@ // Process block-level uml diagrams // 'use strict' +import type { PlantumlOptions } from './index.d' import deflate from './deflate' import { getController } from './render-control' -import type { PlantumlOptions } from './types' const functions = { options: { diff --git a/src/render-control.ts b/src/render-control.ts index c2e107b..27ff843 100644 --- a/src/render-control.ts +++ b/src/render-control.ts @@ -1,4 +1,4 @@ -import type { Framework } from './types' +import type { Framework } from './index.d' /** * Render controller for other frameworks diff --git a/src/types.ts b/src/types.ts deleted file mode 100644 index 3fa31f9..0000000 --- a/src/types.ts +++ /dev/null @@ -1,14 +0,0 @@ -export type Framework = 'vue' | 'react' -export interface PlantumlOptions { - imageFormat?: string - server?: string - isController?: boolean - framework?: Framework - [key: string]: any -} - -export interface MermaidOptions { - isController?: boolean - framework?: Framework - [key: string]: any -}