mn-docs-mcp 0.6.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.trae/documents/libmn_cleanup_plan.md +51 -0
- package/.trae/documents/libmn_doc_restructure_plan.md +140 -0
- package/.trae/documents/libmn_indentation_plan.md +116 -0
- package/.trae/documents/libmn_title_hierarchy_plan.md +91 -0
- package/README.md +9 -7
- package/next-env.d.ts +6 -0
- package/next.config.mjs +14 -0
- package/package.json +25 -10
- package/postcss.config.mjs +7 -0
- package/scripts/sync-definitions.mjs +33 -0
- package/source.config.ts +5 -0
- package/src/app/[[...slug]]/page.tsx +259 -0
- package/src/app/api/search/route.ts +6 -0
- package/src/app/global.css +81 -0
- package/src/app/layout.tsx +33 -0
- package/src/components/JsbApiFooter.tsx +251 -0
- package/src/content/docs/{guides/contributing.md → contributing.md} +31 -6
- package/src/content/docs/{guides/cookbook → cookbook}/addon-settings.md +2 -2
- package/src/content/docs/{guides/cookbook → cookbook}/embed-webview-panel.md +2 -2
- package/src/content/docs/cookbook/meta.json +13 -0
- package/src/content/docs/{guides/cookbook → cookbook}/network-api-call.md +2 -2
- package/src/content/docs/{guides/cookbook → cookbook}/webview-bidirectional-js.md +1 -1
- package/src/content/docs/guides/getting-started.md +2 -2
- package/src/content/docs/guides/lifecycle-and-window.md +4 -4
- package/src/content/docs/guides/meta.json +14 -0
- package/src/content/docs/guides/mindmap-and-selection.md +2 -2
- package/src/content/docs/guides/native-ui.md +4 -4
- package/src/content/docs/guides/network-requests.md +8 -9
- package/src/content/docs/guides/notes-and-database.md +2 -2
- package/src/content/docs/guides/shortcut-keys.md +9 -9
- package/src/content/docs/guides/storage-and-files.md +4 -4
- package/src/content/docs/guides/toolbar-and-commands.md +1 -1
- package/src/content/docs/index.mdx +13 -38
- package/src/content/docs/libmn/data-converter.md +1572 -0
- package/src/content/docs/libmn/frame.md +279 -0
- package/src/content/docs/libmn/headers.md +234 -0
- package/src/content/docs/libmn/index.md +60 -0
- package/src/content/docs/libmn/internal-exposed.md +46 -0
- package/src/content/docs/libmn/locale.md +307 -0
- package/src/content/docs/libmn/menu.md +77 -0
- package/src/content/docs/libmn/meta.json +27 -0
- package/src/content/docs/libmn/mnbutton.md +966 -0
- package/src/content/docs/libmn/mncomment.md +533 -0
- package/src/content/docs/libmn/mnconnection.md +717 -0
- package/src/content/docs/libmn/mndocument.md +309 -0
- package/src/content/docs/libmn/mnextension-panel.md +340 -0
- package/src/content/docs/libmn/mnnote.md +533 -0
- package/src/content/docs/libmn/mnnotebook.md +725 -0
- package/src/content/docs/libmn/mnutil.md +2936 -0
- package/src/content/docs/libmn/mnwebview.md +693 -0
- package/src/content/docs/libmn/mustache.md +65 -0
- package/src/content/docs/libmn/response.md +352 -0
- package/src/content/docs/libmn/runtime-assets.md +64 -0
- package/src/content/docs/libmn/runtime-web-view-host.md +77 -0
- package/src/content/docs/libmn/runtime.md +178 -0
- package/src/content/docs/libmn/vendor-globals.md +34 -0
- package/src/content/docs/meta.json +11 -0
- package/src/content/docs/reference/black-box.md +2 -2
- package/src/content/docs/reference/foundation/meta.json +4 -0
- package/src/content/docs/reference/foundation/ns-attributed-string.md +1 -1
- package/src/content/docs/reference/foundation/ns-counted-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-date-components.md +2 -2
- package/src/content/docs/reference/foundation/ns-date-formatter.md +1 -3
- package/src/content/docs/reference/foundation/ns-decimal-number.md +1 -1
- package/src/content/docs/reference/foundation/ns-enumerator.md +1 -1
- package/src/content/docs/reference/foundation/ns-error.md +2 -2
- package/src/content/docs/reference/foundation/ns-file-manager.md +1 -1
- package/src/content/docs/reference/foundation/ns-formatter.md +2 -2
- package/src/content/docs/reference/foundation/ns-json-serialization.md +10 -2
- package/src/content/docs/reference/foundation/ns-mutable-attributed-string.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-character-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-dictionary.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-index-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-string.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-url-request.md +2 -3
- package/src/content/docs/reference/foundation/ns-null.md +1 -1
- package/src/content/docs/reference/foundation/ns-number-formatter.md +1 -1
- package/src/content/docs/reference/foundation/ns-operation.md +2 -2
- package/src/content/docs/reference/foundation/ns-pointer-array.md +1 -1
- package/src/content/docs/reference/foundation/ns-proxy.md +5 -3
- package/src/content/docs/reference/foundation/ns-scanner.md +7 -1
- package/src/content/docs/reference/foundation/ns-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-simple-c-string.md +3 -4
- package/src/content/docs/reference/foundation/ns-time-zone.md +1 -1
- package/src/content/docs/reference/foundation/ns-ubiquitous-key-value-store.md +61 -0
- package/src/content/docs/reference/foundation/ns-url-connection.md +2 -2
- package/src/content/docs/reference/foundation/ns-url-request.md +2 -2
- package/src/content/docs/reference/foundation/ns-url-response.md +5 -5
- package/src/content/docs/reference/foundation/ns-url.md +1 -1
- package/src/content/docs/reference/foundation/ns-user-defaults.md +5 -5
- package/src/content/docs/reference/foundation/ns-value.md +15 -15
- package/src/content/docs/reference/global/agent-tools.md +91 -0
- package/src/content/docs/reference/global/application.md +4 -4
- package/src/content/docs/reference/global/builtin-commands.md +2 -2
- package/src/content/docs/reference/global/database.md +4 -4
- package/src/content/docs/reference/global/document.md +21 -0
- package/src/content/docs/reference/global/global-variables.md +22 -5
- package/src/content/docs/reference/global/jsb.md +6 -4
- package/src/content/docs/reference/global/meta.json +18 -0
- package/src/content/docs/reference/global/note.md +2 -2
- package/src/content/docs/reference/global/notebook.md +21 -0
- package/src/content/docs/reference/global/popup-menu-item.md +2 -2
- package/src/content/docs/reference/global/popup-menu.md +5 -6
- package/src/content/docs/reference/global/search-manager.md +12 -6
- package/src/content/docs/reference/global/self.md +1 -13
- package/src/content/docs/reference/js-runtime.md +5 -4
- package/src/content/docs/reference/marginnote/document-controller.md +37 -5
- package/src/content/docs/reference/marginnote/jsextension.md +7 -7
- package/src/content/docs/reference/marginnote/mb-book-note.md +162 -72
- package/src/content/docs/reference/marginnote/mb-book.md +3 -3
- package/src/content/docs/reference/marginnote/mb-model-tool.md +2 -2
- package/src/content/docs/reference/marginnote/mb-topic.md +13 -2
- package/src/content/docs/reference/marginnote/meta.json +18 -0
- package/src/content/docs/reference/marginnote/mindmap-node.md +2 -2
- package/src/content/docs/reference/marginnote/mindmap-view.md +2 -2
- package/src/content/docs/reference/marginnote/notebook-controller.md +1 -1
- package/src/content/docs/reference/marginnote/outline-view.md +2 -2
- package/src/content/docs/reference/marginnote/reader-controller.md +1 -1
- package/src/content/docs/reference/marginnote/study-controller.md +19 -19
- package/src/content/docs/reference/meta.json +14 -0
- package/src/content/docs/reference/quartzcore/caanimation-group.md +3 -3
- package/src/content/docs/reference/quartzcore/cabasic-animation.md +3 -3
- package/src/content/docs/reference/quartzcore/caemitter-layer.md +44 -0
- package/src/content/docs/reference/quartzcore/cagradient-layer.md +1 -1
- package/src/content/docs/reference/quartzcore/cakeyframe-animation.md +3 -3
- package/src/content/docs/reference/quartzcore/calayer.md +1 -1
- package/src/content/docs/reference/quartzcore/camedia-timing-function.md +1 -1
- package/src/content/docs/reference/quartzcore/caproperty-animation.md +1 -1
- package/src/content/docs/reference/quartzcore/careplicator-layer.md +2 -2
- package/src/content/docs/reference/quartzcore/cascroll-layer.md +1 -1
- package/src/content/docs/reference/quartzcore/cashape-layer.md +2 -2
- package/src/content/docs/reference/quartzcore/catext-layer.md +4 -4
- package/src/content/docs/reference/quartzcore/catransaction.md +5 -3
- package/src/content/docs/reference/quartzcore/catransform-layer.md +3 -3
- package/src/content/docs/reference/quartzcore/catransition.md +10 -6
- package/src/content/docs/reference/quartzcore/cavalue-function.md +1 -1
- package/src/content/docs/reference/quartzcore/meta.json +4 -0
- package/src/content/docs/reference/uikit/meta.json +4 -0
- package/src/content/docs/reference/uikit/ns-mutable-paragraph-style.md +3 -3
- package/src/content/docs/reference/uikit/ns-paragraph-style.md +3 -4
- package/src/content/docs/reference/uikit/ns-text-storage.md +4 -5
- package/src/content/docs/reference/uikit/uiactivity-indicator-view.md +2 -2
- package/src/content/docs/reference/uikit/uiapplication.md +1 -1
- package/src/content/docs/reference/uikit/uibar-button-item.md +3 -4
- package/src/content/docs/reference/uikit/uibar-item.md +2 -3
- package/src/content/docs/reference/uikit/uibezier-path.md +2 -2
- package/src/content/docs/reference/uikit/uibutton.md +1 -1
- package/src/content/docs/reference/uikit/uicollection-view-cell.md +5 -5
- package/src/content/docs/reference/uikit/uicollection-view-controller.md +22 -2
- package/src/content/docs/reference/uikit/uicollection-view-flow-layout.md +54 -0
- package/src/content/docs/reference/uikit/uicollection-view-layout.md +9 -2
- package/src/content/docs/reference/uikit/uicollection-view.md +13 -4
- package/src/content/docs/reference/uikit/uicolor.md +1 -1
- package/src/content/docs/reference/uikit/uicontrol.md +3 -5
- package/src/content/docs/reference/uikit/uidate-picker.md +1 -1
- package/src/content/docs/reference/uikit/uievent.md +2 -2
- package/src/content/docs/reference/uikit/uifont.md +1 -1
- package/src/content/docs/reference/uikit/uigesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uiimage-picker-controller.md +1 -1
- package/src/content/docs/reference/uikit/uiimage-view.md +2 -2
- package/src/content/docs/reference/uikit/uiimage.md +2 -2
- package/src/content/docs/reference/uikit/uikey-command.md +2 -2
- package/src/content/docs/reference/uikit/uilabel.md +3 -3
- package/src/content/docs/reference/uikit/uilocal-notification.md +2 -2
- package/src/content/docs/reference/uikit/uilong-press-gesture-recognizer.md +2 -2
- package/src/content/docs/reference/uikit/uinavigation-bar.md +2 -2
- package/src/content/docs/reference/uikit/uinavigation-controller.md +1 -1
- package/src/content/docs/reference/uikit/uinavigation-item.md +1 -1
- package/src/content/docs/reference/uikit/uipage-control.md +1 -1
- package/src/content/docs/reference/uikit/uipage-view-controller.md +1 -1
- package/src/content/docs/reference/uikit/uipan-gesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uipasteboard.md +1 -1
- package/src/content/docs/reference/uikit/uipicker-view.md +3 -3
- package/src/content/docs/reference/uikit/uipinch-gesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uipopover-controller.md +1 -1
- package/src/content/docs/reference/uikit/uiresponder.md +3 -4
- package/src/content/docs/reference/uikit/uirotation-gesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uiscreen-mode.md +2 -2
- package/src/content/docs/reference/uikit/uiscrollview.md +1 -1
- package/src/content/docs/reference/uikit/uisearch-bar.md +25 -2
- package/src/content/docs/reference/uikit/uisegmented-control.md +1 -1
- package/src/content/docs/reference/uikit/uislider.md +1 -1
- package/src/content/docs/reference/uikit/uiswipe-gesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uiswitch.md +2 -2
- package/src/content/docs/reference/uikit/uitab-bar-controller.md +2 -2
- package/src/content/docs/reference/uikit/uitab-bar-item.md +1 -1
- package/src/content/docs/reference/uikit/uitab-bar.md +1 -1
- package/src/content/docs/reference/uikit/uitable-view-cell.md +6 -6
- package/src/content/docs/reference/uikit/uitable-view-controller.md +1 -1
- package/src/content/docs/reference/uikit/uitable-view.md +3 -3
- package/src/content/docs/reference/uikit/uitap-gesture-recognizer.md +2 -2
- package/src/content/docs/reference/uikit/uitext-input-mode.md +7 -3
- package/src/content/docs/reference/uikit/uitext-position.md +5 -5
- package/src/content/docs/reference/uikit/uitext-range.md +4 -4
- package/src/content/docs/reference/uikit/uitext-view.md +2 -2
- package/src/content/docs/reference/uikit/uitextfield.md +3 -3
- package/src/content/docs/reference/uikit/uitoolbar.md +1 -1
- package/src/content/docs/reference/uikit/uitouch.md +3 -3
- package/src/content/docs/reference/uikit/uiview-controller.md +2 -2
- package/src/content/docs/reference/uikit/uiview.md +5 -5
- package/src/content/docs/reference/uikit/uiwebview.md +5 -5
- package/src/content/docs/reference/uikit/uiwindow.md +2 -2
- package/src/content/docs/reference/utility/menu-controller.md +1 -1
- package/src/content/docs/reference/utility/meta.json +4 -0
- package/src/content/docs/reference/utility/sqlite-result-set.md +1 -1
- package/src/content/docs/reference/utility/sqlite-statement.md +2 -2
- package/src/content/docs/reference/utility/zip-archive.md +13 -14
- package/src/content/docs/reference/value-sturct.md +105 -0
- package/src/lib/layout.tsx +31 -0
- package/src/lib/source.ts +7 -0
- package/tsconfig.json +42 -3
- package/astro.config.mjs +0 -126
- package/src/client/jsb-api-footer.ts +0 -242
- package/src/components/Footer.astro +0 -57
- package/src/components/Search.astro +0 -330
- package/src/content.config.ts +0 -7
- package/src/styles/starlight-overrides.css +0 -23
- /package/src/content/docs/{guides/cookbook → cookbook}/append-selection-as-comment.md +0 -0
- /package/src/content/docs/{guides/cookbook → cookbook}/batch-rename-notes.md +0 -0
- /package/src/content/docs/{guides/cookbook → cookbook}/export-notebook.md +0 -0
- /package/src/content/docs/{guides/cookbook → cookbook}/focus-note-in-mindmap.md +0 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Locale
|
|
3
|
+
description: LibMN中的Locale对象API文档。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`Locale`用于加载中英文文案配置并提供本地化读取、模板渲染和HUD展示能力。
|
|
7
|
+
|
|
8
|
+
## 类成员(Class members)
|
|
9
|
+
|
|
10
|
+
### 属性
|
|
11
|
+
|
|
12
|
+
#### `preferredLanguages`
|
|
13
|
+
|
|
14
|
+
#### 类型
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
static get preferredLanguages(): string[]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
#### 说明
|
|
21
|
+
|
|
22
|
+
返回系统偏好语言列表。
|
|
23
|
+
|
|
24
|
+
#### 返回值
|
|
25
|
+
|
|
26
|
+
- 类型:`string[]`
|
|
27
|
+
- 语义:按系统优先级排序的语言标识数组。
|
|
28
|
+
|
|
29
|
+
### 方法
|
|
30
|
+
|
|
31
|
+
#### `init`
|
|
32
|
+
|
|
33
|
+
#### 类型
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
static init(mainPath: string): void
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### 说明
|
|
40
|
+
|
|
41
|
+
初始化本地化配置与语言状态。
|
|
42
|
+
|
|
43
|
+
#### 参数
|
|
44
|
+
|
|
45
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
46
|
+
|:---|:---|:---|:---|
|
|
47
|
+
| `mainPath` | `string` | 是 | 插件根目录路径。 |
|
|
48
|
+
|
|
49
|
+
#### 返回值
|
|
50
|
+
|
|
51
|
+
- 类型:`void`
|
|
52
|
+
- 语义:无返回值。
|
|
53
|
+
|
|
54
|
+
#### `copy`
|
|
55
|
+
|
|
56
|
+
#### 类型
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
static copy(message: string): void
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### 说明
|
|
63
|
+
|
|
64
|
+
把文本写入系统剪贴板。
|
|
65
|
+
|
|
66
|
+
#### 参数
|
|
67
|
+
|
|
68
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
69
|
+
|:---|:---|:---|:---|
|
|
70
|
+
| `message` | `string` | 是 | 待复制文本。 |
|
|
71
|
+
|
|
72
|
+
#### 返回值
|
|
73
|
+
|
|
74
|
+
- 类型:`void`
|
|
75
|
+
- 语义:无返回值。
|
|
76
|
+
|
|
77
|
+
#### `addZHConfig`
|
|
78
|
+
|
|
79
|
+
#### 类型
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
static addZHConfig(config: Record<string,string>): void
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### 说明
|
|
86
|
+
|
|
87
|
+
合并中文文案配置。
|
|
88
|
+
|
|
89
|
+
#### 参数
|
|
90
|
+
|
|
91
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
92
|
+
|:---|:---|:---|:---|
|
|
93
|
+
| `config` | `Record<string,string>` | 是 | 键值形式的中文文案配置。 |
|
|
94
|
+
|
|
95
|
+
#### 返回值
|
|
96
|
+
|
|
97
|
+
- 类型:`void`
|
|
98
|
+
- 语义:无返回值。
|
|
99
|
+
|
|
100
|
+
#### `addENConfig`
|
|
101
|
+
|
|
102
|
+
#### 类型
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
static addENConfig(config: Record<string,string>): void
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
#### 说明
|
|
109
|
+
|
|
110
|
+
合并英文文案配置。
|
|
111
|
+
|
|
112
|
+
#### 参数
|
|
113
|
+
|
|
114
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
115
|
+
|:---|:---|:---|:---|
|
|
116
|
+
| `config` | `Record<string,string>` | 是 | 键值形式的英文文案配置。 |
|
|
117
|
+
|
|
118
|
+
#### 返回值
|
|
119
|
+
|
|
120
|
+
- 类型:`void`
|
|
121
|
+
- 语义:无返回值。
|
|
122
|
+
|
|
123
|
+
#### `isfileExists`
|
|
124
|
+
|
|
125
|
+
#### 类型
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
static isfileExists(path: string): boolean
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### 说明
|
|
132
|
+
|
|
133
|
+
判断路径对应文件是否存在。
|
|
134
|
+
|
|
135
|
+
#### 参数
|
|
136
|
+
|
|
137
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
138
|
+
|:---|:---|:---|:---|
|
|
139
|
+
| `path` | `string` | 是 | 文件路径。 |
|
|
140
|
+
|
|
141
|
+
#### 返回值
|
|
142
|
+
|
|
143
|
+
- 类型:`boolean`
|
|
144
|
+
- 语义:存在时返回`true`。
|
|
145
|
+
|
|
146
|
+
#### `readJSON`
|
|
147
|
+
|
|
148
|
+
#### 类型
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
static readJSON(path: string): object|undefined
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### 说明
|
|
155
|
+
|
|
156
|
+
读取JSON文件并返回对象。返回值结构在当前源码未暴露稳定结构,需按调用场景使用。
|
|
157
|
+
#### 参数
|
|
158
|
+
|
|
159
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
160
|
+
|:---|:---|:---|:---|
|
|
161
|
+
| `path` | `string` | 是 | JSON文件路径。 |
|
|
162
|
+
|
|
163
|
+
#### 返回值
|
|
164
|
+
|
|
165
|
+
- 类型:`object|undefined`
|
|
166
|
+
- 语义:文件不存在或无效时返回`undefined`。
|
|
167
|
+
|
|
168
|
+
#### `getZHNameForKey`
|
|
169
|
+
|
|
170
|
+
#### 类型
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
static getZHNameForKey(key: string): string
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### 说明
|
|
177
|
+
|
|
178
|
+
按键名读取中文文案。
|
|
179
|
+
#### 参数
|
|
180
|
+
|
|
181
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
182
|
+
|:---|:---|:---|:---|
|
|
183
|
+
| `key` | `string` | 是 | 文案键名。 |
|
|
184
|
+
|
|
185
|
+
#### 返回值
|
|
186
|
+
|
|
187
|
+
- 类型:`string`
|
|
188
|
+
- 语义:命中时返回中文文案,未命中回退到英文或键名本身。
|
|
189
|
+
|
|
190
|
+
#### `getENNameForKey`
|
|
191
|
+
|
|
192
|
+
#### 类型
|
|
193
|
+
|
|
194
|
+
```ts
|
|
195
|
+
static getENNameForKey(key: string): string
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### 说明
|
|
199
|
+
|
|
200
|
+
按键名读取英文文案。
|
|
201
|
+
#### 参数
|
|
202
|
+
|
|
203
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
204
|
+
|:---|:---|:---|:---|
|
|
205
|
+
| `key` | `string` | 是 | 文案键名。 |
|
|
206
|
+
|
|
207
|
+
#### 返回值
|
|
208
|
+
|
|
209
|
+
- 类型:`string`
|
|
210
|
+
- 语义:命中时返回英文文案,未命中返回键名。
|
|
211
|
+
|
|
212
|
+
#### `getLocalNameForKey`
|
|
213
|
+
|
|
214
|
+
#### 类型
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
static getLocalNameForKey(key: string): string
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
#### 说明
|
|
221
|
+
|
|
222
|
+
按当前语言读取文案。
|
|
223
|
+
#### 参数
|
|
224
|
+
|
|
225
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
226
|
+
|:---|:---|:---|:---|
|
|
227
|
+
| `key` | `string` | 是 | 文案键名。 |
|
|
228
|
+
|
|
229
|
+
#### 返回值
|
|
230
|
+
|
|
231
|
+
- 类型:`string`
|
|
232
|
+
- 语义:返回当前语言对应文案。
|
|
233
|
+
|
|
234
|
+
#### `at`
|
|
235
|
+
|
|
236
|
+
#### 类型
|
|
237
|
+
|
|
238
|
+
```ts
|
|
239
|
+
static at(key: string): string
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### 说明
|
|
243
|
+
|
|
244
|
+
`getLocalNameForKey`的别名方法。
|
|
245
|
+
|
|
246
|
+
#### 参数
|
|
247
|
+
|
|
248
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
249
|
+
|:---|:---|:---|:---|
|
|
250
|
+
| `key` | `string` | 是 | 文案键名。 |
|
|
251
|
+
|
|
252
|
+
#### 返回值
|
|
253
|
+
|
|
254
|
+
- 类型:`string`
|
|
255
|
+
- 语义:返回当前语言对应文案。
|
|
256
|
+
|
|
257
|
+
#### `render`
|
|
258
|
+
|
|
259
|
+
#### 类型
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
static render(template: string,additionalConfig?: Record<string,string>): string
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
#### 说明
|
|
266
|
+
|
|
267
|
+
按当前语言配置渲染Mustache模板。
|
|
268
|
+
|
|
269
|
+
#### 参数
|
|
270
|
+
|
|
271
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
272
|
+
|:---|:---|:---|:---|
|
|
273
|
+
| `template` | `string` | 是 | 模板字符串。 |
|
|
274
|
+
| `additionalConfig` | `Record<string,string>` | 否 | 额外渲染变量。 |
|
|
275
|
+
|
|
276
|
+
#### 返回值
|
|
277
|
+
|
|
278
|
+
- 类型:`string`
|
|
279
|
+
- 语义:返回渲染后的字符串。
|
|
280
|
+
|
|
281
|
+
#### `showHUD`
|
|
282
|
+
|
|
283
|
+
#### 类型
|
|
284
|
+
|
|
285
|
+
```ts
|
|
286
|
+
static showHUD(message: string,additionalConfig?: Record<string,string>): void
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
#### 说明
|
|
290
|
+
|
|
291
|
+
渲染本地化消息后调用`MNUtil.showHUD`展示提示。
|
|
292
|
+
|
|
293
|
+
#### 参数
|
|
294
|
+
|
|
295
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
296
|
+
|:---|:---|:---|:---|
|
|
297
|
+
| `message` | `string` | 是 | 文案模板或普通文本。 |
|
|
298
|
+
| `additionalConfig` | `Record<string,string>` | 否 | 额外渲染变量。 |
|
|
299
|
+
|
|
300
|
+
#### 返回值
|
|
301
|
+
|
|
302
|
+
- 类型:`void`
|
|
303
|
+
- 语义:无返回值。
|
|
304
|
+
|
|
305
|
+
## 实例成员(Instance members)
|
|
306
|
+
|
|
307
|
+
无实例成员。
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Menu
|
|
3
|
+
description: LibMN中的Menu对象使用文档。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`Menu`是用于创建和管理弹出菜单的对象,在指定视图(如按钮或卡片)附近显示操作选项,构建和展示自定义菜单。
|
|
7
|
+
|
|
8
|
+
## 构造函数
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
new Menu(sender: UIView|MNButton,delegate: object,width?: number,preferredPosition?: number)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
构造一个新的Menu实例。
|
|
15
|
+
|
|
16
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
17
|
+
|:-------|:-----|:-----|:-----|
|
|
18
|
+
| `sender` | `UIView\|MNButton` | 是 | 触发视图。 |
|
|
19
|
+
| `delegate` | `object` | 是 | 代理对象。 |
|
|
20
|
+
| `width` | `number` | 否 | 菜单宽度。 |
|
|
21
|
+
| `preferredPosition` | `number` | 否 | 期望弹出方向。 |
|
|
22
|
+
|
|
23
|
+
## 类成员(Class members)
|
|
24
|
+
|
|
25
|
+
### 属性
|
|
26
|
+
|
|
27
|
+
| 成员 | 类型 | 说明 |
|
|
28
|
+
| :--- | :--- | :--- |
|
|
29
|
+
| `popover` | `UIPopoverController\|undefined` | 当前全局菜单弹层实例。 |
|
|
30
|
+
|
|
31
|
+
### 方法
|
|
32
|
+
|
|
33
|
+
| 成员 | 类型 | 说明 |
|
|
34
|
+
| :--- | :--- | :--- |
|
|
35
|
+
| `item` | `static item(title: string,selector: string,params?: string,checked?: boolean): {title:string;selector:string;param:string;checked:boolean}` | 创建菜单项对象。 |
|
|
36
|
+
| `dismissCurrentMenu` | `static dismissCurrentMenu(animate?: boolean): void` | 关闭当前全局菜单。 |
|
|
37
|
+
|
|
38
|
+
## 实例成员(Instance members)
|
|
39
|
+
|
|
40
|
+
### 属性
|
|
41
|
+
|
|
42
|
+
| 成员 | 类型 | 说明 |
|
|
43
|
+
| :--- | :--- | :--- |
|
|
44
|
+
| `preferredPosition` | `number` | 期望弹出方向。`0`左侧,`1/3`下方,`2`上方,`4`右侧。 |
|
|
45
|
+
| `titles` | `string[]` | 标题数组占位字段。通常用`menuItems`维护真实菜单内容。 |
|
|
46
|
+
| `menuItems` | `Array<{title:string;object?:object;selector:string;param?:string;checked?:boolean}>` | 菜单项数组。 |
|
|
47
|
+
| `rowHeight` | `number` | 每一行菜单项高度。 |
|
|
48
|
+
| `fontSize` | `number` | 菜单字号。 |
|
|
49
|
+
|
|
50
|
+
### 方法
|
|
51
|
+
|
|
52
|
+
| 成员 | 类型 | 说明 |
|
|
53
|
+
| :--- | :--- | :--- |
|
|
54
|
+
| `constructor` | `constructor(sender: UIView,delegate: object,width?: number,preferredPosition?: number)` | 用触发视图和代理初始化菜单。 |
|
|
55
|
+
| `addMenuItem` | `addMenuItem(title: string\|{key:string;prefix?:string;suffix?:string},selector: string,params?: string,checked?: boolean): void` | 追加一个菜单项。 |
|
|
56
|
+
| `addItem` | `addItem(title: string\|{key:string;prefix?:string;suffix?:string},selector: string,params?: string,checked?: boolean): void` | `addMenuItem`别名。 |
|
|
57
|
+
| `addMenuItems` | `addMenuItems(items: object[]): void` | 批量追加菜单项。 |
|
|
58
|
+
| `addItems` | `addItems(items: object[]): void` | `addMenuItems`别名。 |
|
|
59
|
+
| `insertMenuItem` | `insertMenuItem(index: number,title: string,selector: string,params?: string,checked?: boolean): void` | 在指定位置插入一个菜单项。 |
|
|
60
|
+
| `insertMenuItems` | `insertMenuItems(index: number,items: object[]): void` | 在指定位置批量插入菜单项。 |
|
|
61
|
+
| `show` | `show(autoWidth?: boolean,animate?: boolean): void` | 显示菜单。 |
|
|
62
|
+
| `dismiss` | `dismiss(): void` | 关闭当前实例菜单并清空全局`popover`引用。 |
|
|
63
|
+
|
|
64
|
+
## 快速示例
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const menu = Menu.new(button, self, 220, 2)
|
|
68
|
+
|
|
69
|
+
menu.menuItems = [
|
|
70
|
+
Menu.item('复制链接', 'onCopyLink:'),
|
|
71
|
+
Menu.item('删除卡片', 'onDeleteNote:', '', true)
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
menu.rowHeight = 38
|
|
75
|
+
menu.fontSize = 15
|
|
76
|
+
menu.show(true, true)
|
|
77
|
+
```
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "LibMN",
|
|
3
|
+
"pages": [
|
|
4
|
+
"index",
|
|
5
|
+
"runtime",
|
|
6
|
+
"headers",
|
|
7
|
+
"runtime-assets",
|
|
8
|
+
"runtime-web-view-host",
|
|
9
|
+
"internal-exposed",
|
|
10
|
+
"vendor-globals",
|
|
11
|
+
"locale",
|
|
12
|
+
"data-converter",
|
|
13
|
+
"frame",
|
|
14
|
+
"menu",
|
|
15
|
+
"mnbutton",
|
|
16
|
+
"mncomment",
|
|
17
|
+
"mnconnection",
|
|
18
|
+
"mndocument",
|
|
19
|
+
"mnextension-panel",
|
|
20
|
+
"mnnote",
|
|
21
|
+
"mnnotebook",
|
|
22
|
+
"mnutil",
|
|
23
|
+
"mnwebview",
|
|
24
|
+
"mustache",
|
|
25
|
+
"response"
|
|
26
|
+
]
|
|
27
|
+
}
|