im-ui-mobile 0.0.66 → 0.0.67

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,5 +1,5 @@
1
1
  <template>
2
- <view class="btn-bar" :style="style">
2
+ <view class="button" :style="style">
3
3
  <text v-if="icon" class="icon iconfont" :class="icon"></text>
4
4
  <text class="title">{{ title }}</text>
5
5
  </view>
@@ -38,7 +38,7 @@ const style = computed(() => {
38
38
  </script>
39
39
 
40
40
  <style lang="scss" scoped>
41
- .btn-bar {
41
+ .button {
42
42
  width: 100%;
43
43
  height: 100rpx;
44
44
  margin-top: 5rpx;
package/index.js CHANGED
@@ -1,5 +1,19 @@
1
1
  // import { PiniaPlugin } from './plugins/pinia.js'
2
2
  import { UViewPlusPlugin } from './plugins/uview-plus.js'
3
+ import eventBus from "./utils/eventBus.js";
4
+ import datetime from "./utils/datetime.js";
5
+ import Emoji from "./utils/emoji.js";
6
+ import { emoji } from "./utils/emoji.js";
7
+ import dom from "./utils/dom.js";
8
+ import messageType from "./utils/messageType.js";
9
+ import RecorderApp from "./utils/recorderApp.js";
10
+ import RecorderH5 from "./utils/recorderH5.js";
11
+ import Requester from "./utils/requester.js";
12
+ import url from "./utils/url.js";
13
+ import { useDynamicRefs } from "./utils/useDynamicRefs.js";
14
+ import WebSocket from "./utils/websocket.js";
15
+ import { webSocket } from "./utils/websocket.js";
16
+ import { MESSAGE_TYPE, RTC_STATE, TERMINAL_TYPE, MESSAGE_STATUS } from "./utils/enums.js";
3
17
 
4
18
  const importFn = import.meta.glob('./components/im-*/im-*.vue', { eager: true })
5
19
  const components = [];
@@ -24,7 +38,25 @@ for (const key in importFn) {
24
38
  }
25
39
  }
26
40
 
41
+ // 全局配置对象
42
+ let globalConfig = {
43
+ emojiUrl: '',
44
+ };
45
+
27
46
  const install = (app, options = {}) => {
47
+ // 合并配置
48
+ globalConfig = { ...globalConfig, ...options };
49
+
50
+ // 配置 Emoji
51
+ if (globalConfig.emojiUrl) {
52
+ emoji.setEmojiUrl(globalConfig.emojiUrl);
53
+ }
54
+
55
+ // 提供全局配置
56
+ app.provide('im-config', options.config || {})
57
+
58
+ // 安装插件
59
+
28
60
  // // 安装pinia插件
29
61
  // if (options.usePinia !== false) {
30
62
  // app.use(PiniaPlugin, options.piniaOptions)
@@ -37,29 +69,25 @@ const install = (app, options = {}) => {
37
69
  components.forEach(component => {
38
70
  app.component(component.name || '', component)
39
71
  })
40
-
41
- // 提供全局配置
42
- app.provide('im-config', options.config || {})
43
72
  }
44
73
 
45
- import eventBus from "./utils/eventBus.js";
46
- import datetime from "./utils/datetime.js";
47
- import { emoji, Emoji } from "./utils/emoji.js";
48
- import dom from "./utils/dom.js";
49
- import messageType from "./utils/messageType.js";
50
- import RecorderApp from "./utils/recorderApp.js";
51
- import RecorderH5 from "./utils/recorderH5.js";
52
- import Requester from "./utils/requester.js";
53
- import url from "./utils/url.js";
54
- import { useDynamicRefs } from "./utils/useDynamicRefs.js";
55
- import { webSocketManager, WebSocketManager } from "./utils/websocket.js";
56
- import { MESSAGE_TYPE, RTC_STATE, TERMINAL_TYPE, MESSAGE_STATUS } from "./utils/enums.js";
74
+ // 导出安装函数和配置方法
75
+ const setConfig = (options) => {
76
+ Object.assign(globalConfig, options);
77
+ if (options.emojiUrl) {
78
+ emoji.setEmojiUrl(options.emojiUrl);
79
+ }
80
+ };
81
+
82
+ const getConfig = () => ({ ...globalConfig });
57
83
 
58
84
  export {
85
+ setConfig,
86
+ getConfig,
59
87
  eventBus,
60
88
  datetime,
61
- emoji,
62
89
  Emoji,
90
+ emoji,
63
91
  dom,
64
92
  messageType,
65
93
  RecorderApp as recorderApp,
@@ -67,16 +95,14 @@ export {
67
95
  Requester,
68
96
  url,
69
97
  useDynamicRefs,
70
- webSocketManager,
71
- WebSocketManager,
98
+ WebSocket,
99
+ webSocket,
72
100
 
73
101
  // Enums
74
102
  MESSAGE_TYPE,
75
103
  RTC_STATE,
76
104
  TERMINAL_TYPE,
77
105
  MESSAGE_STATUS
78
-
79
- // 类型常量
80
106
  }
81
107
 
82
108
  export default {
package/index.scss CHANGED
@@ -1,17 +1,5 @@
1
- .emoji-large {
2
- width: 64rpx !important;
3
- height: 64rpx !important;
4
- vertical-align: bottom !important;
5
- }
1
+ @import "./styles/common.scss";
6
2
 
7
- .emoji-normal {
8
- width: 54rpx !important;
9
- height: 54rpx !important;
10
- vertical-align: bottom !important;
11
- }
3
+ @import "./styles/button.scss";
12
4
 
13
- .emoji-small {
14
- width: 36rpx !important;
15
- height: 36rpx !important;
16
- vertical-align: bottom !important;
17
- }
5
+ @import "./styles/emoji.scss";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "im-ui-mobile",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "description": "A Vue3.0 + typescript instant messaging component library for Uniapp",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -12,6 +12,7 @@
12
12
  "utils",
13
13
  "plugins",
14
14
  "index.js",
15
+ "styles",
15
16
  "theme.scss",
16
17
  "index.scss"
17
18
  ],
@@ -0,0 +1,39 @@
1
+
2
+ // #ifdef MP-WEIXIN
3
+ // wx小程序只有button,没有uni-botton
4
+ button {
5
+ font-size: $im-font-size !important;
6
+ }
7
+
8
+ button[type='primary'] {
9
+ color: #fff !important;
10
+ background: linear-gradient(135deg, $im-color-primary, lighten($im-color-primary, 15%)) !important;
11
+ }
12
+
13
+ button[type='primary'][plain] {
14
+ color: $im-color-primary !important;
15
+ border: 2px solid $im-color-primary;
16
+ background: transparent;
17
+ }
18
+
19
+ button[type='warn'] {
20
+ color: #fff !important;
21
+ background: linear-gradient(135deg, $im-color-danger, lighten($im-color-danger, 15%)) !important;
22
+ }
23
+
24
+ button[type='warn'][plain] {
25
+ color: $im-color-danger !important;
26
+ border: 1px solid $im-color-danger !important;
27
+ background: transparent !important;
28
+ }
29
+
30
+ button[size='mini'] {
31
+ font-size: $im-font-size-smaller !important;
32
+ }
33
+
34
+ // #endif
35
+
36
+ .button-hover[type='primary'] {
37
+ color: #fff !important;
38
+ background-color: $im-color-primary-dark-1 !important;
39
+ }
@@ -0,0 +1,9 @@
1
+ .none-pointer-events {
2
+ uni-image img {
3
+ // 阻止微信默认长按菜单
4
+ pointer-events: none;
5
+ -webkit-pointer-events: none;
6
+ -ms-pointer-events: none;
7
+ -moz-pointer-events: none;
8
+ }
9
+ }
@@ -0,0 +1,17 @@
1
+ .emoji-large {
2
+ width: 64rpx !important;
3
+ height: 64rpx !important;
4
+ vertical-align: bottom !important;
5
+ }
6
+
7
+ .emoji-normal {
8
+ width: 54rpx !important;
9
+ height: 54rpx !important;
10
+ vertical-align: bottom !important;
11
+ }
12
+
13
+ .emoji-small {
14
+ width: 36rpx !important;
15
+ height: 36rpx !important;
16
+ vertical-align: bottom !important;
17
+ }
package/theme.scss CHANGED
@@ -59,100 +59,4 @@ $im-title-size: 26px;
59
59
  $im-title-size-1: 22px;
60
60
  $im-title-size-2: 18px;
61
61
 
62
- // $font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
63
-
64
62
  $im-nav-bar-height: 50px;
65
-
66
-
67
- // // #ifdef MP-WEIXIN
68
- // // wx小程序只有button,没有uni-botton
69
- // button {
70
- // font-size: $im-font-size !important;
71
- // }
72
-
73
- // button[type='primary'] {
74
- // color: #fff !important;
75
- // background: linear-gradient(135deg, $im-color-primary, lighten($im-color-primary, 15%)) !important;
76
- // }
77
-
78
- // button[type='primary'][plain] {
79
- // color: $im-color-primary !important;
80
- // border: 2px solid $im-color-primary;
81
- // background: transparent;
82
- // }
83
-
84
- // button[type='warn'] {
85
- // color: #fff !important;
86
- // background: linear-gradient(135deg, $im-color-danger, lighten($im-color-danger, 15%)) !important;
87
- // }
88
-
89
- // button[type='warn'][plain] {
90
- // color: $im-color-danger !important;
91
- // border: 1px solid $im-color-danger !important;
92
- // background: transparent !important;
93
- // }
94
-
95
- // button[size='mini'] {
96
- // font-size: $im-font-size-smaller !important;
97
- // }
98
-
99
- // // #endif
100
-
101
- // .button-hover[type='primary'] {
102
- // color: #fff !important;
103
- // background-color: $im-color-primary-dark-1 !important;
104
- // }
105
-
106
- // .nav-bar {
107
- // height: 100rpx;
108
- // padding: 0 20rpx;
109
- // display: flex;
110
- // align-items: center;
111
- // border-bottom: 1rpx solid $im-border;
112
-
113
- // .nav-search {
114
- // flex: 1;
115
- // }
116
-
117
- // .nav-add {
118
- // cursor: pointer;
119
- // }
120
- // }
121
-
122
-
123
- // .bottom-btn {
124
- // margin: 40rpx 40rpx;
125
- // }
126
-
127
- // .emoji-large {
128
- // width: 64rpx !important;
129
- // height: 64rpx !important;
130
- // vertical-align: bottom !important;
131
- // }
132
-
133
- // .emoji-normal {
134
- // width: 54rpx !important;
135
- // height: 54rpx !important;
136
- // vertical-align: bottom !important;
137
- // }
138
-
139
- // .emoji-small {
140
- // width: 36rpx !important;
141
- // height: 36rpx !important;
142
- // vertical-align: bottom !important;
143
- // }
144
-
145
- // .none-pointer-events {
146
- // uni-image img {
147
- // // 阻止微信默认长按菜单
148
- // pointer-events: none;
149
- // -webkit-pointer-events: none;
150
- // -ms-pointer-events: none;
151
- // -moz-pointer-events: none;
152
- // }
153
- // }
154
-
155
- // p {
156
- // margin-block-start: 1em;
157
- // margin-block-end: 1em;
158
- // }
@@ -1,16 +1,16 @@
1
1
  import { AllowedComponentProps, VNodeProps } from './_common'
2
2
 
3
- declare interface BtnBarProps {
3
+ declare interface ButtonProps {
4
4
  title: string
5
5
  icon?: string
6
6
  type?: 'normal' | 'danger' | 'primary'
7
7
  color?: string
8
8
  }
9
9
 
10
- declare interface _BtnBar {
10
+ declare interface _Button {
11
11
  new(): {
12
- $props: AllowedComponentProps & VNodeProps & BtnBarProps
12
+ $props: AllowedComponentProps & VNodeProps & ButtonProps
13
13
  }
14
14
  }
15
15
 
16
- export declare const BtnBar: _BtnBar
16
+ export declare const Button: _Button
@@ -2,7 +2,7 @@ declare module 'vue' {
2
2
  export interface GlobalComponents {
3
3
  ['im-arrow-bar']: typeof import('./components/arrow-bar')['ArrowBar']
4
4
  ['im-bar-group']: typeof import('./components/bar-group')['BarGroup']
5
- ['im-btn-bar']: typeof import('./components/btn-bar')['BtnBar']
5
+ ['im-button']: typeof import('./components/button')['Button']
6
6
  ['im-chat-at-box']: typeof import('./components/chat-at-box')['ChatAtBox']
7
7
  ['im-chat-group-readed']: typeof import('./components/chat-group-readed')['ChatGroupReaded']
8
8
  ['im-chat-item']: typeof import('./components/chat-item')['ChatItem']
package/types/index.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  import eventBus from "./utils/eventBus.d.ts";
4
4
  import datetime from "./utils/datetime.d.ts";
5
5
  import Emoji from "./utils/emoji.d.ts";
6
+ import {emoji} from "./utils/emoji.d.ts";
6
7
  import { MESSAGE_TYPE, RTC_STATE, TERMINAL_TYPE, MESSAGE_STATUS } from "./utils/enums.d.ts";
7
8
  import * as dom from "./utils/dom.d.ts";
8
9
  import messageType from "./utils/messageType.d.ts";
@@ -11,7 +12,8 @@ import * as recorderH5 from "./utils/recorderH5.d.ts";
11
12
  import Requester from "./utils/requester.d.ts";
12
13
  import * as url from "./utils/url.d.ts";
13
14
  import { useDynamicRefs } from "./utils/useDynamicRefs.d.ts";
14
- import webSocketManager from "./utils/websocket.d.ts";
15
+ import WebSocket from "./utils/websocket.d.ts";
16
+ import {webSocket} from "./utils/websocket.d.ts";
15
17
  import type {
16
18
  // 类型常量
17
19
  RtcMode,
@@ -44,12 +46,14 @@ declare module 'im-ui-mobile' {
44
46
  eventBus,
45
47
  datetime,
46
48
  Emoji,
49
+ emoji,
47
50
  dom,
48
51
  messageType,
49
52
  Requester,
50
53
  url,
51
54
  useDynamicRefs,
52
- webSocketManager,
55
+ WebSocket,
56
+ webSocket,
53
57
 
54
58
  // 枚举类型
55
59
  RTC_STATE,
@@ -1,8 +1,12 @@
1
- declare const _default: {
1
+ declare class Emoji {
2
+ setEmojiUrl: (url: string) => void;
3
+ getEmojiUrl: (F) => string;
2
4
  containEmoji: (content: string) => boolean;
3
5
  emoTextList: string[];
4
6
  transform: (content: string, extClass?: string) => string;
5
7
  textToPath: (emoText: string) => string;
6
8
  pathToText: (path: string) => string;
7
9
  };
8
- export default _default;
10
+ declare const emoji: Emoji;
11
+ export { emoji, Emoji };
12
+ export default emoji;
@@ -1,7 +1,7 @@
1
1
  type MessageCallback = (cmd: number, data: any) => void;
2
2
  type CloseCallback = (res: any) => void;
3
3
  type ConnectCallback = () => void;
4
- declare class WebSocketManager {
4
+ declare class WebSocket {
5
5
  private messageCallBack;
6
6
  private closeCallBack;
7
7
  private connectCallBack;
@@ -30,6 +30,6 @@ declare class WebSocketManager {
30
30
  setHeartCheckTimeout(timeout: number): void;
31
31
  destroy(): void;
32
32
  }
33
- declare const webSocketManager: WebSocketManager;
34
- export { webSocketManager, WebSocketManager };
35
- export default webSocketManager;
33
+ declare const webSocket: WebSocket;
34
+ export { webSocket, WebSocket };
35
+ export default webSocket;
@@ -1,4 +1,4 @@
1
- class WebSocketManager {
1
+ class WebSocket {
2
2
  constructor() {
3
3
  // 私有属性
4
4
  this.messageCallBack = null;
@@ -223,8 +223,8 @@ class WebSocketManager {
223
223
  }
224
224
 
225
225
  // 创建单例实例
226
- const webSocketManager = new WebSocketManager();
226
+ const webSocket = new WebSocket();
227
227
 
228
228
  // 导出单例和类
229
- export { webSocketManager, WebSocketManager };
230
- export default webSocketManager;
229
+ export { webSocket, WebSocket };
230
+ export default webSocket;