@blocklet/labels 1.5.200 → 1.5.202

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.
@@ -0,0 +1,21 @@
1
+ import { LabelTreeNode } from './tree';
2
+ import { LabelsResponse } from '../types';
3
+ interface InitialState {
4
+ loading: boolean;
5
+ data?: LabelsResponse;
6
+ }
7
+ export declare const LabelsContainer: import("unstated-next").Container<{
8
+ popularLabels: LabelTreeNode[];
9
+ counts: Record<string, number>;
10
+ getLabelsByIds: (ids: string[]) => LabelTreeNode[];
11
+ getLabelName: (id: string) => string;
12
+ getRelatedLabels: (id: string) => import("./tree").TreeNode<import("./tree").Label>[];
13
+ getRecommended: (id: string) => import("./tree").TreeNode<import("./tree").Label>[];
14
+ loading: boolean;
15
+ tree: LabelTreeNode;
16
+ stats: {
17
+ id: string;
18
+ count: number;
19
+ }[];
20
+ }, InitialState>;
21
+ export {};
@@ -0,0 +1,34 @@
1
+ export declare class TreeNode<T> {
2
+ data: T;
3
+ parent?: TreeNode<T>;
4
+ children: TreeNode<T>[];
5
+ constructor({ data, parent, children }: {
6
+ data: T;
7
+ parent?: TreeNode<T>;
8
+ children?: TreeNode<T>[];
9
+ });
10
+ setParent(node: TreeNode<T>): void;
11
+ add(...nodes: TreeNode<T>[]): void;
12
+ isLeaf(node: TreeNode<T>): boolean;
13
+ getAllParents(includeSelf?: boolean): TreeNode<T>[];
14
+ getAllSiblings(): TreeNode<T>[];
15
+ flatten(includeRoot?: boolean): TreeNode<T>[];
16
+ }
17
+ export declare class Label {
18
+ id: string;
19
+ name: string;
20
+ icon?: string;
21
+ color: string;
22
+ translation?: {
23
+ [locale: string]: string;
24
+ };
25
+ constructor(data: any);
26
+ _normalizeTranslation(translation: string | {
27
+ [locale: string]: string;
28
+ }): any;
29
+ getName(locale: string): string;
30
+ }
31
+ export declare class LabelTreeNode extends TreeNode<Label> {
32
+ }
33
+ export declare const initLabelTree: (data: any[]) => LabelTreeNode;
34
+ export declare const createEmptyLabelTree: () => LabelTreeNode;
@@ -0,0 +1,15 @@
1
+ export interface LabelsResponse {
2
+ labels: {
3
+ id: string;
4
+ name: string;
5
+ icon?: string;
6
+ color: string;
7
+ translation?: string;
8
+ parentId?: string;
9
+ }[];
10
+ stats: {
11
+ id: string;
12
+ count: number;
13
+ }[];
14
+ }
15
+ export type FetchLabels = () => Promise<LabelsResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/labels",
3
- "version": "1.5.200",
3
+ "version": "1.5.202",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -28,14 +28,17 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@blocklet/translation-input": "1.5.200",
31
+ "@blocklet/translation-input": "1.5.202",
32
32
  "@emotion/css": "^11.10.5",
33
33
  "@emotion/react": "^11.10.5",
34
34
  "@emotion/styled": "^11.10.5",
35
35
  "@iconify/react": "^4.0.1",
36
+ "ahooks": "^3.7.8",
37
+ "performant-array-to-tree": "^1.11.0",
36
38
  "react-arborist": "^2.2.0",
37
39
  "react-color": "^2.19.3",
38
- "react-select": "^5.6.0"
40
+ "react-select": "^5.6.0",
41
+ "unstated-next": "^1.1.0"
39
42
  },
40
43
  "peerDependencies": {
41
44
  "@arcblock/ux": "^2.4.61",
@@ -67,6 +70,7 @@
67
70
  "babel-loader": "^8.3.0",
68
71
  "react": "^18.2.0",
69
72
  "react-dom": "^18.2.0",
73
+ "rollup-plugin-node-externals": "^5.1.3",
70
74
  "typescript": "^4.6.4",
71
75
  "unplugin-icons": "^0.14.14",
72
76
  "vite": "^4.4.11",
@@ -76,5 +80,5 @@
76
80
  "resolutions": {
77
81
  "react": "^18.2.0"
78
82
  },
79
- "gitHead": "e23edea6d69466a51935048f9e310e3d0ae6e7b1"
83
+ "gitHead": "42f877c25278280cfc5b3a61189405d241a6e9bd"
80
84
  }