@coffic/cosy-ui 0.6.6 → 0.6.8

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.
@@ -195,5 +195,4 @@ class BlogDB extends BaseDB<typeof COLLECTION_BLOG, BlogEntry, BlogDoc> {
195
195
  }
196
196
 
197
197
  // 创建并导出单例实例
198
- const blogDB = new BlogDB();
199
- export default blogDB;
198
+ export const blogDB = new BlogDB();
@@ -99,5 +99,4 @@ class ExperimentDB extends BaseDB<typeof COLLECTION_EXPERIMENT, ExperimentEntry,
99
99
  }
100
100
 
101
101
  // 创建并导出单例实例
102
- const experimentDB = new ExperimentDB();
103
- export default experimentDB;
102
+ export const experimentDB = new ExperimentDB();
@@ -99,5 +99,4 @@ class LessonDB extends BaseDB<typeof COLLECTION_LESSON, LessonEntry, LessonDoc>
99
99
  }
100
100
 
101
101
  // 创建并导出单例实例
102
- const lessonDB = new LessonDB();
103
- export default lessonDB;
102
+ export const lessonDB = new LessonDB();
@@ -71,5 +71,4 @@ class MetaDB extends BaseDB<typeof COLLECTION_META, MetaEntry, MetaDoc> {
71
71
  }
72
72
 
73
73
  // 创建并导出单例实例
74
- const metaDB = new MetaDB();
75
- export default metaDB;
74
+ export const metaDB = new MetaDB();
@@ -43,7 +43,7 @@ export abstract class BaseDoc<
43
43
  */
44
44
  getAncestorIds(): string[] {
45
45
  const parts = this.entry.id.split('/');
46
- return parts.slice(0, -1).map((part, index) => parts.slice(0, index + 1).join('/'));
46
+ return parts.slice(0, -1).map((_part, index) => parts.slice(0, index + 1).join('/'));
47
47
  }
48
48
 
49
49
  /**
@@ -3,7 +3,7 @@ import { LinkUtil } from '../utils/link';
3
3
  import Tag from './Tag';
4
4
  import { BaseDoc } from './BaseDoc';
5
5
  import { COLLECTION_BLOG } from '../database/BlogDB';
6
- import blogDB from '../database/BlogDB';
6
+ import { blogDB } from '../database/BlogDB';
7
7
 
8
8
  export default class BlogDoc extends BaseDoc<typeof COLLECTION_BLOG, BlogEntry> {
9
9
  private constructor(entry: BlogEntry) {
@@ -1,5 +1,5 @@
1
1
  import type { ExperimentEntry } from '../database/ExperimentDB';
2
- import experimentDB from '../database/ExperimentDB';
2
+ import { experimentDB } from '../database/ExperimentDB';
3
3
  import { logger } from '../utils/logger';
4
4
  import { SidebarItemEntity } from './SidebarItem';
5
5
  import { LinkUtil } from '../utils/link';
@@ -17,7 +17,7 @@ export default class ExperimentDoc extends BaseDoc<typeof COLLECTION_EXPERIMENT,
17
17
  }
18
18
 
19
19
  async getBookId(): Promise<string> {
20
- return await this.getTopDocId();
20
+ return this.getTopDocId();
21
21
  }
22
22
 
23
23
  async getBook(): Promise<ExperimentDoc | null> {
@@ -1,5 +1,5 @@
1
1
  import type { LessonEntry } from '../database/LessonDB';
2
- import lessonDB from '../database/LessonDB';
2
+ import { lessonDB } from '../database/LessonDB';
3
3
  import { logger } from '../utils/logger';
4
4
  import { SidebarItemEntity } from './SidebarItem';
5
5
  import { LinkUtil } from '../utils/link';
@@ -17,7 +17,7 @@ export default class LessonDoc extends BaseDoc<typeof COLLECTION_LESSON, LessonE
17
17
  }
18
18
 
19
19
  async getBookId(): Promise<string> {
20
- return await this.getTopDocId();
20
+ return this.getTopDocId();
21
21
  }
22
22
 
23
23
  async getBook(): Promise<LessonDoc | null> {
@@ -2,7 +2,7 @@ import { SidebarItemEntity } from './SidebarItem';
2
2
  import type { MetaEntry } from '../database/MetaDB';
3
3
  import { LinkUtil } from '../utils/link';
4
4
  import { BaseDoc } from './BaseDoc';
5
- import metaDB from '../database/MetaDB';
5
+ import { metaDB } from '../database/MetaDB';
6
6
  import { COLLECTION_META } from '../database/MetaDB';
7
7
 
8
8
  export default class MetaDoc extends BaseDoc<typeof COLLECTION_META, MetaEntry> {
@@ -14,6 +14,14 @@ export default class MetaDoc extends BaseDoc<typeof COLLECTION_META, MetaEntry>
14
14
  return new MetaDoc(entry);
15
15
  }
16
16
 
17
+ getTopDoc(): Promise<MetaDoc | null> {
18
+ return Promise.resolve(null);
19
+ }
20
+
21
+ getChildren(): Promise<MetaDoc[]> {
22
+ return Promise.resolve([]);
23
+ }
24
+
17
25
  getLink(): string {
18
26
  return LinkUtil.getMetaLink(this.getLang(), this.getSlug());
19
27
  }
@@ -1,4 +1,4 @@
1
- import blogDB from '../database/BlogDB';
1
+ import { blogDB } from '../database/BlogDB';
2
2
  import { SidebarItemEntity } from './SidebarItem';
3
3
  import { type ITagStaticPath } from '../types/static-path';
4
4
  import { LinkUtil } from '../utils/link';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffic/cosy-ui",
3
- "version": "0.6.6",
3
+ "version": "0.6.8",
4
4
  "description": "An astro component library",
5
5
  "author": {
6
6
  "name": "nookery",