floating-live 0.16.0-alpha.1 → 0.16.0-alpha.2

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,3 +1,4 @@
1
+ import { EnumValue } from "../utils/types";
1
2
  /** 用户信息 */
2
3
  export interface UserInfo {
3
4
  /** 用户名 */
@@ -66,28 +67,30 @@ export interface GiftInfo {
66
67
  /** 单位 */
67
68
  unit?: string;
68
69
  }
69
- /** 图片大小 */
70
- export declare enum ImageSize {
70
+ export declare const ImageSize: {
71
71
  /** 自定义大小 */
72
- custom = 0,
72
+ readonly custom: 0;
73
73
  /** 小表情(文字行高) */
74
- small = 1,
74
+ readonly small: 1;
75
75
  /** 大表情 */
76
- large = 2
77
- }
76
+ readonly large: 2;
77
+ };
78
+ export type ImageSize = EnumValue<typeof ImageSize>;
78
79
  /** 弹幕模式 */
79
- export declare enum DanmakuMode {
80
- left = 1,
81
- bottom = 4,
82
- top = 5,
83
- right = 6
84
- }
80
+ export declare const DanmakuMode: {
81
+ readonly left: 1;
82
+ readonly bottom: 4;
83
+ readonly top: 5;
84
+ readonly right: 6;
85
+ };
86
+ export type DanmakuMode = EnumValue<typeof DanmakuMode>;
85
87
  /** 用户类型 */
86
- export declare enum UserType {
88
+ export declare const UserType: {
87
89
  /** 普通观众 */
88
- normal = 0,
90
+ readonly normal: 0;
89
91
  /** 房管 */
90
- admin = 1,
92
+ readonly admin: 1;
91
93
  /** 主播 */
92
- anchor = 2
93
- }
94
+ readonly anchor: 2;
95
+ };
96
+ export type UserType = EnumValue<typeof UserType>;
@@ -1,28 +1,24 @@
1
- /** 图片大小 */
2
- export var ImageSize;
3
- (function (ImageSize) {
1
+ export const ImageSize = {
4
2
  /** 自定义大小 */
5
- ImageSize[ImageSize["custom"] = 0] = "custom";
3
+ custom: 0,
6
4
  /** 小表情(文字行高) */
7
- ImageSize[ImageSize["small"] = 1] = "small";
5
+ small: 1,
8
6
  /** 大表情 */
9
- ImageSize[ImageSize["large"] = 2] = "large";
10
- })(ImageSize || (ImageSize = {}));
7
+ large: 2,
8
+ };
11
9
  /** 弹幕模式 */
12
- export var DanmakuMode;
13
- (function (DanmakuMode) {
14
- DanmakuMode[DanmakuMode["left"] = 1] = "left";
15
- DanmakuMode[DanmakuMode["bottom"] = 4] = "bottom";
16
- DanmakuMode[DanmakuMode["top"] = 5] = "top";
17
- DanmakuMode[DanmakuMode["right"] = 6] = "right";
18
- })(DanmakuMode || (DanmakuMode = {}));
10
+ export const DanmakuMode = {
11
+ left: 1,
12
+ bottom: 4,
13
+ top: 5,
14
+ right: 6,
15
+ };
19
16
  /** 用户类型 */
20
- export var UserType;
21
- (function (UserType) {
17
+ export const UserType = {
22
18
  /** 普通观众 */
23
- UserType[UserType["normal"] = 0] = "normal";
19
+ normal: 0,
24
20
  /** 房管 */
25
- UserType[UserType["admin"] = 1] = "admin";
21
+ admin: 1,
26
22
  /** 主播 */
27
- UserType[UserType["anchor"] = 2] = "anchor";
28
- })(UserType || (UserType = {}));
23
+ anchor: 2,
24
+ };
@@ -1,4 +1,5 @@
1
1
  import { CustomEventEmitter } from "../utils/EventEmitter";
2
+ import { EnumValue } from "../utils/types";
2
3
  import { LiveMessage } from "./message";
3
4
  import { UserInfo } from "./messageInfo";
4
5
  export declare abstract class LiveRoom extends CustomEventEmitter implements LiveRoomData {
@@ -95,31 +96,33 @@ export interface LiveRoomStatsInfo {
95
96
  popularity?: number;
96
97
  }
97
98
  /** 直播间状态 */
98
- export declare enum LiveRoomStatus {
99
+ export declare const LiveRoomStatus: {
99
100
  /** 未开播 */
100
- off = 0,
101
+ readonly off: 0;
101
102
  /** 正在直播 */
102
- live = 1,
103
+ readonly live: 1;
103
104
  /** 正在轮播 */
104
- round = 2,
105
+ readonly round: 2;
105
106
  /** 被封禁 */
106
- banned = -1,
107
+ readonly banned: -1;
107
108
  /** 已上锁 */
108
- locked = -2
109
- }
109
+ readonly locked: -2;
110
+ };
111
+ export type LiveRoomStatus = EnumValue<typeof LiveRoomStatus>;
110
112
  /** 直播间状态 */
111
- export declare enum LiveConnectionStatus {
113
+ export declare const LiveConnectionStatus: {
112
114
  /** 未连接 */
113
- off = 0,
115
+ off: number;
114
116
  /** 连接中 */
115
- connecting = 1,
117
+ connecting: number;
116
118
  /** 连接到服务器 */
117
- connected = 2,
119
+ connected: number;
118
120
  /** 连接到房间 */
119
- entered = 3,
121
+ entered: number;
120
122
  /** 连接失败或断开 */
121
- disconnected = -1
122
- }
123
+ disconnected: number;
124
+ };
125
+ export type LiveConnectionStatus = EnumValue<typeof LiveConnectionStatus>;
123
126
  export interface LiveRoomEventMap {
124
127
  status: {
125
128
  status: LiveRoomStatus;
package/dist/live/room.js CHANGED
@@ -91,30 +91,28 @@ export class LiveRoom extends CustomEventEmitter {
91
91
  }
92
92
  }
93
93
  /** 直播间状态 */
94
- export var LiveRoomStatus;
95
- (function (LiveRoomStatus) {
94
+ export const LiveRoomStatus = {
96
95
  /** 未开播 */
97
- LiveRoomStatus[LiveRoomStatus["off"] = 0] = "off";
96
+ off: 0,
98
97
  /** 正在直播 */
99
- LiveRoomStatus[LiveRoomStatus["live"] = 1] = "live";
98
+ live: 1,
100
99
  /** 正在轮播 */
101
- LiveRoomStatus[LiveRoomStatus["round"] = 2] = "round";
100
+ round: 2,
102
101
  /** 被封禁 */
103
- LiveRoomStatus[LiveRoomStatus["banned"] = -1] = "banned";
102
+ banned: -1,
104
103
  /** 已上锁 */
105
- LiveRoomStatus[LiveRoomStatus["locked"] = -2] = "locked";
106
- })(LiveRoomStatus || (LiveRoomStatus = {}));
104
+ locked: -2,
105
+ };
107
106
  /** 直播间状态 */
108
- export var LiveConnectionStatus;
109
- (function (LiveConnectionStatus) {
107
+ export const LiveConnectionStatus = {
110
108
  /** 未连接 */
111
- LiveConnectionStatus[LiveConnectionStatus["off"] = 0] = "off";
109
+ off: 0,
112
110
  /** 连接中 */
113
- LiveConnectionStatus[LiveConnectionStatus["connecting"] = 1] = "connecting";
111
+ connecting: 1,
114
112
  /** 连接到服务器 */
115
- LiveConnectionStatus[LiveConnectionStatus["connected"] = 2] = "connected";
113
+ connected: 2,
116
114
  /** 连接到房间 */
117
- LiveConnectionStatus[LiveConnectionStatus["entered"] = 3] = "entered";
115
+ entered: 3,
118
116
  /** 连接失败或断开 */
119
- LiveConnectionStatus[LiveConnectionStatus["disconnected"] = -1] = "disconnected";
120
- })(LiveConnectionStatus || (LiveConnectionStatus = {}));
117
+ disconnected: -1,
118
+ };
@@ -0,0 +1 @@
1
+ export type EnumValue<T> = T[keyof T];
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "floating-live",
3
- "version": "0.16.0-alpha.1",
3
+ "version": "0.16.0-alpha.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1 +0,0 @@
1
- {"root":["./src/floatinglive.ts","./src/app.ts","./src/index.ts","./src/command/index.ts","./src/command/manager.ts","./src/command/types.ts","./src/error/index.ts","./src/error/types.ts","./src/event/index.ts","./src/event/manager.ts","./src/event/types.ts","./src/hook/index.ts","./src/hook/manager.ts","./src/hook/types.ts","./src/live/index.ts","./src/live/message.ts","./src/live/messageinfo.ts","./src/live/platform.ts","./src/live/room.ts","./src/plugin/index.ts","./src/plugin/manager.ts","./src/plugin/types.ts","./src/plugin/context/commonplugincontext.ts","./src/plugin/context/safeplugincontext.ts","./src/plugins/room/index.ts","./src/utils/eventemitter.ts","./src/utils/index.ts","./src/value/index.ts","./src/value/manager.ts","./src/value/types.ts"],"version":"5.6.3"}