Skip to content

Commit caaf3b3

Browse files
committed
docs: update docs
1 parent dc788ae commit caaf3b3

File tree

6 files changed

+141
-19
lines changed

6 files changed

+141
-19
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ yarn-error.log*
2727
/playwright-report/
2828
/blob-report/
2929
/playwright/.cache/
30+
31+
/md

api/mind-elixir.api.json

Lines changed: 104 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"metadata": {
33
"toolPackage": "@microsoft/api-extractor",
4-
"toolVersion": "7.39.1",
4+
"toolVersion": "7.47.0",
55
"schemaVersion": 1011,
66
"oldestForwardsCompatibleVersion": 1001,
77
"tsdocConfig": {
@@ -717,6 +717,32 @@
717717
}
718718
]
719719
},
720+
{
721+
"kind": "TypeAlias",
722+
"canonicalReference": "mind-elixir!Locale:type",
723+
"docComment": "",
724+
"excerptTokens": [
725+
{
726+
"kind": "Content",
727+
"text": "export type Locale = "
728+
},
729+
{
730+
"kind": "Content",
731+
"text": "'cn' | 'zh_CN' | 'zh_TW' | 'en' | 'ru' | 'ja' | 'pt' | 'it' | 'es'"
732+
},
733+
{
734+
"kind": "Content",
735+
"text": ";"
736+
}
737+
],
738+
"fileUrlPath": "dist/types/i18n.d.ts",
739+
"releaseTag": "Public",
740+
"name": "Locale",
741+
"typeTokenRange": {
742+
"startIndex": 1,
743+
"endIndex": 2
744+
}
745+
},
720746
{
721747
"kind": "TypeAlias",
722748
"canonicalReference": "mind-elixir!MainLineParams:type",
@@ -728,7 +754,7 @@
728754
},
729755
{
730756
"kind": "Content",
731-
"text": "{\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n direction: 'lhs' | 'rhs';\n}"
757+
"text": "{\n pT: number;\n pL: number;\n pW: number;\n pH: number;\n cT: number;\n cL: number;\n cW: number;\n cH: number;\n direction: 'lhs' | 'rhs';\n containerHeight: number;\n}"
732758
},
733759
{
734760
"kind": "Content",
@@ -781,7 +807,25 @@
781807
},
782808
{
783809
"kind": "Content",
784-
"text": " | undefined;\n exportSvg: (this: "
810+
"text": " | undefined;\n destroy(this: "
811+
},
812+
{
813+
"kind": "Reference",
814+
"text": "Partial",
815+
"canonicalReference": "!Partial:type"
816+
},
817+
{
818+
"kind": "Content",
819+
"text": "<"
820+
},
821+
{
822+
"kind": "Reference",
823+
"text": "MindElixirInstance",
824+
"canonicalReference": "mind-elixir!MindElixirInstance:interface"
825+
},
826+
{
827+
"kind": "Content",
828+
"text": ">): void;\n exportSvg: (this: "
785829
},
786830
{
787831
"kind": "Reference",
@@ -1744,7 +1788,16 @@
17441788
},
17451789
{
17461790
"kind": "Content",
1747-
"text": ", locale: string) => void;\n expandNode: (this: "
1791+
"text": ", locale: import(\"./i18n\")."
1792+
},
1793+
{
1794+
"kind": "Reference",
1795+
"text": "Locale",
1796+
"canonicalReference": "mind-elixir!Locale:type"
1797+
},
1798+
{
1799+
"kind": "Content",
1800+
"text": ") => void;\n expandNode: (this: "
17481801
},
17491802
{
17501803
"kind": "Reference",
@@ -2041,7 +2094,7 @@
20412094
"name": "methods",
20422095
"variableTypeTokenRange": {
20432096
"startIndex": 1,
2044-
"endIndex": 286
2097+
"endIndex": 292
20452098
}
20462099
},
20472100
{
@@ -2504,6 +2557,38 @@
25042557
"endIndex": 2
25052558
}
25062559
},
2560+
{
2561+
"kind": "PropertySignature",
2562+
"canonicalReference": "mind-elixir!MindElixirInstance#disposable:member",
2563+
"docComment": "",
2564+
"excerptTokens": [
2565+
{
2566+
"kind": "Content",
2567+
"text": "disposable: "
2568+
},
2569+
{
2570+
"kind": "Reference",
2571+
"text": "Array",
2572+
"canonicalReference": "!Array:interface"
2573+
},
2574+
{
2575+
"kind": "Content",
2576+
"text": "<() => void>"
2577+
},
2578+
{
2579+
"kind": "Content",
2580+
"text": ";"
2581+
}
2582+
],
2583+
"isReadonly": false,
2584+
"isOptional": false,
2585+
"releaseTag": "Public",
2586+
"name": "disposable",
2587+
"propertyTypeTokenRange": {
2588+
"startIndex": 1,
2589+
"endIndex": 3
2590+
}
2591+
},
25072592
{
25082593
"kind": "PropertySignature",
25092594
"canonicalReference": "mind-elixir!MindElixirInstance#draggable:member",
@@ -2876,8 +2961,9 @@
28762961
"text": "locale: "
28772962
},
28782963
{
2879-
"kind": "Content",
2880-
"text": "string"
2964+
"kind": "Reference",
2965+
"text": "Locale",
2966+
"canonicalReference": "mind-elixir!Locale:type"
28812967
},
28822968
{
28832969
"kind": "Content",
@@ -3742,7 +3828,16 @@
37423828
},
37433829
{
37443830
"kind": "Content",
3745-
"text": ";\n direction?: number;\n locale?: string;\n draggable?: boolean;\n editable?: boolean;\n contextMenu?: boolean;\n contextMenuOption?: any;\n toolBar?: boolean;\n keypress?: boolean;\n mouseSelectionButton?: 0 | 2;\n before?: "
3831+
"text": ";\n direction?: number;\n locale?: "
3832+
},
3833+
{
3834+
"kind": "Reference",
3835+
"text": "Locale",
3836+
"canonicalReference": "mind-elixir!Locale:type"
3837+
},
3838+
{
3839+
"kind": "Content",
3840+
"text": ";\n draggable?: boolean;\n editable?: boolean;\n contextMenu?: boolean;\n contextMenuOption?: any;\n toolBar?: boolean;\n keypress?: boolean;\n mouseSelectionButton?: 0 | 2;\n before?: "
37463841
},
37473842
{
37483843
"kind": "Reference",
@@ -3826,7 +3921,7 @@
38263921
"name": "Options",
38273922
"typeTokenRange": {
38283923
"startIndex": 1,
3829-
"endIndex": 20
3924+
"endIndex": 22
38303925
}
38313926
},
38323927
{

api/mind-elixir.api.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,27 @@ export interface Expander extends HTMLElement {
6262
previousSibling: Topic;
6363
}
6464

65+
// @public (undocumented)
66+
export type Locale = 'cn' | 'zh_CN' | 'zh_TW' | 'en' | 'ru' | 'ja' | 'pt' | 'it' | 'es';
67+
6568
// @public (undocumented)
6669
export type MainLineParams = {
67-
x1: number;
68-
y1: number;
69-
x2: number;
70-
y2: number;
70+
pT: number;
71+
pL: number;
72+
pW: number;
73+
pH: number;
74+
cT: number;
75+
cL: number;
76+
cW: number;
77+
cH: number;
7178
direction: 'lhs' | 'rhs';
79+
containerHeight: number;
7280
};
7381

7482
// @public
7583
export const methods: {
7684
init(this: MindElixirInstance, data: MindElixirData): Error | undefined;
85+
destroy(this: Partial<MindElixirInstance>): void;
7786
exportSvg: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string | undefined) => Blob;
7887
exportPng: (this: MindElixirInstance, noForeignObject?: boolean, injectCss?: string | undefined) => Promise<Blob | null>;
7988
createSummary: (this: MindElixirInstance) => void;
@@ -89,7 +98,7 @@ export const methods: {
8998
removeArrow: (this: MindElixirInstance, linkSvg?: CustomSvg | undefined) => void;
9099
selectArrow: (this: MindElixirInstance, link: CustomSvg) => void;
91100
unselectArrow: (this: MindElixirInstance) => void;
92-
mainToSub: (this: MindElixirInstance, tpc: Topic) => Promise<void>;
101+
rmSubline: (this: MindElixirInstance, tpc: Topic) => Promise<void>;
93102
reshapeNode: (this: MindElixirInstance, tpc: Topic, patchData: NodeObj) => Promise<void>;
94103
insertSibling: (this: MindElixirInstance, type: "before" | "after", el?: Topic | undefined, node?: NodeObj | undefined) => Promise<void>;
95104
insertParent: (this: MindElixirInstance, el?: Topic | undefined, node?: NodeObj | undefined) => Promise<void>;
@@ -123,7 +132,7 @@ export const methods: {
123132
initLeft: (this: MindElixirInstance) => void;
124133
initRight: (this: MindElixirInstance) => void;
125134
initSide: (this: MindElixirInstance) => void;
126-
setLocale: (this: MindElixirInstance, locale: string) => void;
135+
setLocale: (this: MindElixirInstance, locale: Locale) => void;
127136
expandNode: (this: MindElixirInstance, el: Topic, isExpand?: boolean | undefined) => void;
128137
refresh: (this: MindElixirInstance, data?: MindElixirData | undefined) => void;
129138
getObjById: (id: string, data: NodeObj) => NodeObj | null;
@@ -187,6 +196,8 @@ export interface MindElixirInstance extends MindElixirMethods {
187196
// (undocumented)
188197
direction: number;
189198
// (undocumented)
199+
disposable: Array<() => void>;
200+
// (undocumented)
190201
draggable: boolean;
191202
// (undocumented)
192203
editable: boolean;
@@ -221,7 +232,7 @@ export interface MindElixirInstance extends MindElixirMethods {
221232
// (undocumented)
222233
linkSvgGroup: SVGElement;
223234
// (undocumented)
224-
locale: string;
235+
locale: Locale;
225236
// (undocumented)
226237
mainBranchStyle: number;
227238
// (undocumented)
@@ -311,7 +322,7 @@ export type NodeObjExport = Omit<NodeObj, 'parent'>;
311322
export type Options = {
312323
el: string | HTMLElement;
313324
direction?: number;
314-
locale?: string;
325+
locale?: Locale;
315326
draggable?: boolean;
316327
editable?: boolean;
317328
contextMenu?: boolean;
@@ -441,7 +452,7 @@ export interface Wrapper extends HTMLElement {
441452
// Warnings were encountered during analysis:
442453
//
443454
// dist/types/arrow.d.ts:6:5 - (ae-forgotten-export) The symbol "Uid" needs to be exported by the entry point docs.d.ts
444-
// dist/types/methods.d.ts:18:5 - (ae-forgotten-export) The symbol "summary" needs to be exported by the entry point docs.d.ts
455+
// dist/types/methods.d.ts:19:5 - (ae-forgotten-export) The symbol "summary" needs to be exported by the entry point docs.d.ts
445456

446457
// (No @packageDocumentation comment for this package)
447458

readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,17 @@ pnpm build
368368
pnpm link ./
369369
```
370370

371+
Update docs:
372+
373+
```
374+
# Install api-extractor
375+
pnpm install -g @microsoft/api-extractor
376+
# Maintain /src/docs.ts
377+
# Generate docs
378+
pnpm doc
379+
pnpm doc:md
380+
```
381+
371382
## Thanks
372383

373384
- [@viselect/vanilla](https://github.com/simonwep/selection/tree/master/packages/vanilla)

src/docs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { MindElixirMethods } from './methods'
44
import type { Summary, SummarySvgGroup } from './summary'
55
import type { MindElixirData, MindElixirInstance, NodeObj, NodeObjExport, Options, Theme } from './types'
66
import type { MainLineParams, SubLineParams } from './utils/generateBranch'
7+
import type { Locale } from './i18n'
78

89
export {
910
methods,
@@ -19,6 +20,7 @@ export {
1920
Arrow,
2021
MainLineParams,
2122
SubLineParams,
23+
Locale,
2224
}
2325

2426
export * from './types/dom'

src/interact.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { Locale } from './i18n'
12
import { rmSubline } from './nodeOperation'
23
import type { Topic } from './types/dom'
34
import type { MindElixirData, MindElixirInstance, NodeObj } from './types/index'
@@ -265,7 +266,7 @@ export const initSide = function (this: MindElixirInstance) {
265266
* @name setLocale
266267
* @memberof MapInteraction
267268
*/
268-
export const setLocale = function (this: MindElixirInstance, locale: string) {
269+
export const setLocale = function (this: MindElixirInstance, locale: Locale) {
269270
this.locale = locale
270271
this.refresh()
271272
}

0 commit comments

Comments
 (0)