@blocklet/discuss-kit-ux 2.4.41 → 2.4.43

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.
@@ -1,4 +1,4 @@
1
1
  import { BlogPost } from './types';
2
2
  type PartialBlog = Pick<BlogPost, 'id' | 'slug' | 'createdAt' | 'locale'>;
3
- export declare const getBlogLink: (post: PartialBlog, locale?: string) => any;
3
+ export declare const getBlogLink: (post: PartialBlog, locale?: string) => string;
4
4
  export {};
@@ -3,9 +3,10 @@ export declare const blogPrefix: string;
3
3
  export declare const discussionPrefix: string;
4
4
  export declare const docPrefix: string;
5
5
  export declare const bookmarkPrefix: string;
6
- export declare const blogPath: (path: string) => any;
7
- export declare const discussionPath: (path: string) => any;
8
- export declare const docPath: (path: string) => any;
9
- export declare const bookmarkPath: (path: string) => any;
6
+ export declare const blogPath: (path: string) => string;
7
+ export declare const discussionPath: (path: string) => string;
8
+ export declare const docPath: (path: string) => string;
9
+ export declare const bookmarkPath: (path: string) => string;
10
+ export declare const isDocPath: (path: string) => boolean;
10
11
  declare const getPostPrefix: (type: string) => string | undefined;
11
12
  export { pageGroup, getPostPrefix };
@@ -1,20 +1,23 @@
1
- import joinUrl from "url-join";
1
+ import { joinURL } from "ufo";
2
2
  const { pageGroup } = window.blocklet;
3
3
  export const blogPrefix = pageGroup === "blog" ? "" : "blog";
4
4
  export const discussionPrefix = pageGroup === "discussion" ? "" : "discussions";
5
5
  export const docPrefix = pageGroup === "doc" ? "" : "docs";
6
6
  export const bookmarkPrefix = pageGroup === "bookmark" ? "" : "bookmark";
7
7
  export const blogPath = (path) => {
8
- return window.blocklet.pageGroup === "blog" ? path : joinUrl("/blog", path);
8
+ return window.blocklet.pageGroup === "blog" ? path : joinURL("/blog", path);
9
9
  };
10
10
  export const discussionPath = (path) => {
11
- return window.blocklet.pageGroup === "discussion" ? path : joinUrl("/discussions", path);
11
+ return window.blocklet.pageGroup === "discussion" ? path : joinURL("/discussions", path);
12
12
  };
13
13
  export const docPath = (path) => {
14
- return window.blocklet.pageGroup === "doc" ? path : joinUrl("/docs", path);
14
+ return window.blocklet.pageGroup === "doc" ? path : joinURL("/docs", path);
15
15
  };
16
16
  export const bookmarkPath = (path) => {
17
- return window.blocklet.pageGroup === "bookmark" ? path : joinUrl("/bookmark", path);
17
+ return window.blocklet.pageGroup === "bookmark" ? path : joinURL("/bookmark", path);
18
+ };
19
+ export const isDocPath = (path) => {
20
+ return window.blocklet.pageGroup === "doc" || path.startsWith(joinURL(window.blocklet.prefix, "/docs"));
18
21
  };
19
22
  const getPostPrefix = (type) => {
20
23
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "2.4.41",
3
+ "version": "2.4.43",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -47,8 +47,8 @@
47
47
  "unstated-next": "^1.1.0",
48
48
  "url-join": "^4.0.1",
49
49
  "zustand": "^4.5.5",
50
- "@blocklet/editor": "2.4.41",
51
- "@blocklet/labels": "2.4.41"
50
+ "@blocklet/editor": "2.4.43",
51
+ "@blocklet/labels": "2.4.43"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "@arcblock/did-connect-react": "^3.1.5",