@bifrostui/types 0.0.5
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.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/package.json +22 -0
- package/src/index.ts +177 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Alibaba
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bifrostui/types",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "Utility types for BUI",
|
|
5
|
+
"typings": "src/index.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"src",
|
|
8
|
+
"package.json",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "http://bui.taopiaopiao.com",
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"@types/react": "^17.0.0 || ^18.0.0",
|
|
14
|
+
"react": "^17.0.0 || ^18.0.0"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public",
|
|
19
|
+
"registry": "https://registry.npmjs.org/"
|
|
20
|
+
},
|
|
21
|
+
"gitHead": "f24f431d8291f7838d943eb887c970c7bb0ce5ec"
|
|
22
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
declare module 'react' {
|
|
4
|
+
interface CSSProperties {
|
|
5
|
+
// Allow any CSS Custom Properties
|
|
6
|
+
[index: `--${string}`]: string | number;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Remove properties `K` from `T`.
|
|
12
|
+
* Distributive for union types.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export type DistributiveOmit<T, K extends keyof any> = T extends any
|
|
16
|
+
? Omit<T, K>
|
|
17
|
+
: never;
|
|
18
|
+
|
|
19
|
+
export interface ICommonProps {
|
|
20
|
+
className?: string;
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
}
|
|
23
|
+
export interface IOverridableTypeMap {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
25
|
+
props: {};
|
|
26
|
+
defaultComponent: React.ElementType;
|
|
27
|
+
}
|
|
28
|
+
export type BaseProps<M extends IOverridableTypeMap> = M['props'] &
|
|
29
|
+
ICommonProps;
|
|
30
|
+
export type OverrideProps<
|
|
31
|
+
M extends IOverridableTypeMap,
|
|
32
|
+
C extends React.ElementType,
|
|
33
|
+
> = BaseProps<M> &
|
|
34
|
+
DistributiveOmit<React.ComponentPropsWithRef<C>, keyof BaseProps<M>>;
|
|
35
|
+
|
|
36
|
+
export type StandardProps<
|
|
37
|
+
C,
|
|
38
|
+
Removals extends keyof C = never,
|
|
39
|
+
> = DistributiveOmit<C, Removals> & {
|
|
40
|
+
ref?: C extends { ref?: infer RefType } ? RefType : React.Ref<unknown>;
|
|
41
|
+
className?: string;
|
|
42
|
+
style?: React.CSSProperties;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type ThemeColor = 'primary' | 'info' | 'success' | 'warning' | 'danger';
|
|
46
|
+
|
|
47
|
+
/** Button元素小程序专属的 open-type 的合法值 */
|
|
48
|
+
interface ButtonOpenTypeKeys {
|
|
49
|
+
weapp: {
|
|
50
|
+
/** 打开客服会话,如果用户在会话中点击消息卡片后返回小程序,可以从回调中获得具体信息
|
|
51
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/customer-message.html
|
|
52
|
+
*/
|
|
53
|
+
contact;
|
|
54
|
+
/** 触发用户转发,使用前建议先阅读使用指引
|
|
55
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html#%E4%BD%BF%E7%94%A8%E6%8C%87%E5%BC%95
|
|
56
|
+
*/
|
|
57
|
+
share;
|
|
58
|
+
/** 获取用户手机号,可以从回调中获取到用户信息
|
|
59
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html
|
|
60
|
+
*/
|
|
61
|
+
getPhoneNumber;
|
|
62
|
+
/**
|
|
63
|
+
* 手机号实时验证,向用户申请,并在用户同意后,快速填写和实时验证手机号。(*小程序插件中不能使用*)
|
|
64
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getRealtimePhoneNumber.html
|
|
65
|
+
*/
|
|
66
|
+
getRealtimePhoneNumber;
|
|
67
|
+
/** 获取用户信息,可以从回调中获取到用户信息 */
|
|
68
|
+
getUserInfo;
|
|
69
|
+
/** 打开APP,可以通过 app-parameter 属性设定向APP传的参数
|
|
70
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/launchApp.html
|
|
71
|
+
*/
|
|
72
|
+
launchApp;
|
|
73
|
+
/** 打开授权设置页 */
|
|
74
|
+
openSetting;
|
|
75
|
+
/** 打开“意见反馈”页面,用户可提交反馈内容并上传日志,开发者可以登录小程序管理后台后进入左侧菜单“客服反馈”页面获取到反馈内容 */
|
|
76
|
+
feedback;
|
|
77
|
+
/** 获取用户头像,可以从回调中获得具体信息 */
|
|
78
|
+
chooseAvatar;
|
|
79
|
+
/**
|
|
80
|
+
* 用户同意隐私协议按钮。可通过 bindagreeprivacyauthorization 监听用户同意隐私协议事件
|
|
81
|
+
*/
|
|
82
|
+
agreePrivacyAuthorization;
|
|
83
|
+
/**
|
|
84
|
+
* 从基础库 2.32.3 版本起,隐私同意按钮支持与手机号快速验证组件耦合使用,调用方式为:
|
|
85
|
+
* <button open-type="getPhoneNumber|agreePrivacyAuthorization">
|
|
86
|
+
*/
|
|
87
|
+
['getPhoneNumber|agreePrivacyAuthorization'];
|
|
88
|
+
/**
|
|
89
|
+
* 从基础库 2.32.3 版本起,支持隐私同意按钮与手机号实时验证组件耦合使用,调用方式为:
|
|
90
|
+
* <button open-type="getRealtimePhoneNumber|agreePrivacyAuthorization">
|
|
91
|
+
*/
|
|
92
|
+
['getRealtimePhoneNumber|agreePrivacyAuthorization'];
|
|
93
|
+
/**
|
|
94
|
+
* 从基础库 2.32.3 版本起,支持隐私同意按钮与获取用户信息组件耦合使用,调用方式为:
|
|
95
|
+
* <button open-type="getUserInfo|agreePrivacyAuthorization">
|
|
96
|
+
*/
|
|
97
|
+
['getUserInfo|agreePrivacyAuthorization'];
|
|
98
|
+
};
|
|
99
|
+
/** 支付宝小程序专属的 open-type 合法值
|
|
100
|
+
* @see https://opendocs.alipay.com/mini/component/button
|
|
101
|
+
*/
|
|
102
|
+
alipay: {
|
|
103
|
+
/** 触发 自定义分享 */
|
|
104
|
+
share;
|
|
105
|
+
/** 支持小程序授权 */
|
|
106
|
+
getAuthorize;
|
|
107
|
+
/** 分享到通讯录好友 */
|
|
108
|
+
contactShare;
|
|
109
|
+
/** 关注生活号 */
|
|
110
|
+
lifestyle;
|
|
111
|
+
};
|
|
112
|
+
/** QQ 小程序专属的 open-type 合法值
|
|
113
|
+
* @see https://q.qq.com/wiki/develop/miniprogram/component/form/button.html
|
|
114
|
+
*/
|
|
115
|
+
qq: {
|
|
116
|
+
/** 触发用户转发,使用前建议先阅读使用指引
|
|
117
|
+
* @see https://q.qq.com/wiki/develop/miniprogram/frame/open_ability/open_share.html#%E8%BD%AC%E5%8F%91-2
|
|
118
|
+
*/
|
|
119
|
+
share;
|
|
120
|
+
/** 获取用户信息,可以从 onGetUserInfo 回调中获取到用户信息 */
|
|
121
|
+
getUserInfo;
|
|
122
|
+
/** 打开APP,可以通过 app-parameter 属性设定向APP传的参数
|
|
123
|
+
* @see https://q.qq.com/wiki/develop/miniprogram/frame/open_ability/open_app.html
|
|
124
|
+
*/
|
|
125
|
+
launchApp;
|
|
126
|
+
/** 打开授权设置页 */
|
|
127
|
+
openSetting;
|
|
128
|
+
/** 呼起吐个槽反馈页面,开发者可以到官网查看反馈 */
|
|
129
|
+
feedback;
|
|
130
|
+
/** 呼起群资料卡页面,可以通过 group-id 属性设定需要打开的群资料卡的群号,同时 app.json 中必须配置 groupIdList(数量不超过 10 个),表明可以打开群资料卡的群号 */
|
|
131
|
+
openGroupProfile;
|
|
132
|
+
/** 添加好友,对方需要通过该小程序进行授权,允许被加好友后才能调用成功[用户授权](https://q.qq.com/wiki/develop/miniprogram/frame/open_ability/open_userinfo.html#%E6%8E%88%E6%9D%83) */
|
|
133
|
+
addFriend;
|
|
134
|
+
/** 添加彩签,点击后添加状态有用户提示,无回调 */
|
|
135
|
+
addColorSign;
|
|
136
|
+
/** 打开公众号资料卡,可以通过 public-id 属性设定需要打开的公众号资料卡的号码,同时 app.json 中必须配置 publicIdList(目前只能配置 1 个),表明可以打开的公众号资料卡的号码 */
|
|
137
|
+
openPublicProfile;
|
|
138
|
+
/** 添加群应用(只有管理员或群主有权操作,建议先调用 qq.getGroupInfo 获取当前用户是否为管理员,如果是管理员才显示该按钮),添加后给button绑定 onAddGroupApp 事件接收回调数据。 */
|
|
139
|
+
addGroupApp;
|
|
140
|
+
/** 在自定义开放数据域组件中,向指定好友发起分享据 */
|
|
141
|
+
shareMessageToFriend;
|
|
142
|
+
};
|
|
143
|
+
/** TT 小程序专属的 open-type 合法值
|
|
144
|
+
* @see https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/component/list/button/#open-type-%E7%9A%84%E5%90%88%E6%B3%95%E5%80%BC
|
|
145
|
+
*/
|
|
146
|
+
tt: {
|
|
147
|
+
/** 触发用户转发, 可以配合 data-channel 属性来设置分享的 channel,具体请参考 ShareParam */
|
|
148
|
+
share;
|
|
149
|
+
/** 获取用户手机号,可以从 bindgetphonenumber 回调中获取到用户信息,详情请参见获取手机号 */
|
|
150
|
+
getPhoneNumber;
|
|
151
|
+
/** 跳转到抖音IM客服,详情请参见抖音IM客服能力 */
|
|
152
|
+
im;
|
|
153
|
+
/** 跳转到抖音平台客服,详情请参见平台客服能力 */
|
|
154
|
+
platformIm;
|
|
155
|
+
/** 跳转视频播放页,详情请参见跳转视频播放页 */
|
|
156
|
+
navigateToVideoView;
|
|
157
|
+
/** 跳转抖音号个人页,详情请参见跳转抖音号个人页 */
|
|
158
|
+
openAwemeUserProfile;
|
|
159
|
+
/** 跳转抖音直播间,详情请参见跳转抖音直播间 */
|
|
160
|
+
openWebcastRoom;
|
|
161
|
+
/** 写入系统日历,详情请参见写入系统日历 */
|
|
162
|
+
addCalendarEvent;
|
|
163
|
+
/** 添加到桌面,详情请参见添加到桌面 */
|
|
164
|
+
addShortcut;
|
|
165
|
+
/** 加群,详情请参见加群 */
|
|
166
|
+
joinGroup;
|
|
167
|
+
/** 私信,详情请参见私信 */
|
|
168
|
+
privateMessage;
|
|
169
|
+
/** 主动授权私信,详情请参见主动授权私信 */
|
|
170
|
+
authorizePrivateMessage;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
export type ButtonOpenType =
|
|
174
|
+
| keyof ButtonOpenTypeKeys['weapp']
|
|
175
|
+
| keyof ButtonOpenTypeKeys['alipay']
|
|
176
|
+
| keyof ButtonOpenTypeKeys['qq']
|
|
177
|
+
| keyof ButtonOpenTypeKeys['tt'];
|