@occultus/article-api 0.24.0-beta.2 → 0.24.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occultus/article-api",
3
- "version": "0.24.0-beta.2",
3
+ "version": "0.24.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://codeberg.org/TeamOccultus/StarTenonAPI"
@@ -90,7 +90,14 @@ export class Article extends FormLike {
90
90
  parseText(this.chapters![response.selection].title, player),
91
91
  parseText(this.chapters![response.selection].body, player)
92
92
  ];
93
- const chapter = new Article("temp:chapter", chapterTitle, chapterBody);
93
+ const chapter = new Article(
94
+ "temp:chapter",
95
+ chapterTitle,
96
+ chapterBody,
97
+ undefined,
98
+ undefined,
99
+ false
100
+ );
94
101
  this.jumpTo(player, chapter, backTo);
95
102
  })
96
103
  .catch((err) => {
@@ -16,6 +16,9 @@ export type ArticleContent =
16
16
  | TextProvider
17
17
  | { chapter: ChapterData[]; description: TextProvider };
18
18
 
19
+ /**
20
+ * 用于实现数据驱动组件绑定到服务端文章系统的类
21
+ */
19
22
  export class ArticleServerBindings {
20
23
  private static instance: ArticleServerBindings | undefined;
21
24
  private static center: ArticleCenter | undefined;
@@ -90,6 +93,11 @@ export class ArticleServerBindings {
90
93
  this.registryArticleCenterContent(event, config);
91
94
  });
92
95
  }
96
+ /**
97
+ * 创建绑定
98
+ * @param config
99
+ * @throws OccultusSDKError 如果已经创建过绑定
100
+ */
93
101
  static create(config: ArticleBindingConfig): void {
94
102
  if (ArticleServerBindings.instance) {
95
103
  throw new OccultusSDKError("ArticleServerBindings already created!");
@@ -125,6 +133,11 @@ export class ArticleServerBindings {
125
133
  }
126
134
  this.preloadedContent.set(id, content);
127
135
  }
136
+ /**
137
+ * 读取预载文章内容
138
+ * @param id
139
+ * @return ID 对应的文章预载内容
140
+ */
128
141
  readPreloadedContent(
129
142
  id: string
130
143
  ):
@@ -1,12 +1,37 @@
1
1
  import { RawMessage } from "@minecraft/server";
2
2
 
3
+ /**
4
+ * 文章绑定配置
5
+ */
3
6
  export type ArticleBindingConfig = {
7
+ /**
8
+ * 主组件名称
9
+ */
4
10
  componentName: string;
11
+ /**
12
+ * 文章中心组件名称
13
+ */
5
14
  centerComponentName: string;
15
+ /**
16
+ * 文章内容组件名称
17
+ */
6
18
  contentComponentName: string;
19
+ /**
20
+ * 文章中心相关配置
21
+ */
7
22
  centerConfig: {
23
+ /**
24
+ * 文章标题
25
+ */
8
26
  title: RawMessage | string;
27
+ /**
28
+ * 文章描述
29
+ */
9
30
  description: RawMessage | string;
31
+ /**
32
+ * 文章的图标路径
33
+ * @example "textures/items/diamond"
34
+ */
10
35
  icon_path?: string;
11
36
  };
12
37
  };
@@ -1,10 +1,23 @@
1
1
  import { RawMessage } from "@minecraft/server";
2
2
 
3
+ /**
4
+ * 文章组件参数
5
+ */
3
6
  export type ArticleComponentParams = {
7
+ /**
8
+ * 文章标题
9
+ */
4
10
  title: RawMessage | string;
11
+ /**
12
+ * 文章图标路径
13
+ * @example "textures/items/diamond"
14
+ */
5
15
  icon_path?: string;
6
16
  };
7
17
 
18
+ /**
19
+ * 文章内容组件参数
20
+ */
8
21
  export type ArticleContentParams = RawMessage[] | string;
9
22
 
10
23
  export type ArticleCenterComponentParams = {};