@tencentcloud/ai-desk-customer-vue 0.1.3 → 0.1.4
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/components/CustomerServiceChat/index-web.vue +6 -14
- package/components/CustomerServiceChat/message-input/message-input-quote/index.vue +3 -14
- package/components/CustomerServiceChat/message-input-toolbar/emoji-dialog-mobile/emoji-dialog-mobile.vue +2 -5
- package/components/CustomerServiceChat/message-input-toolbar/emoji-picker/emoji-picker-dialog.vue +8 -15
- package/components/CustomerServiceChat/message-input-toolbar/file-upload/index.vue +3 -7
- package/components/CustomerServiceChat/message-input-toolbar/image-upload/index.vue +6 -44
- package/components/CustomerServiceChat/message-input-toolbar/index-web.vue +1 -14
- package/components/CustomerServiceChat/message-input-toolbar/style/uni.scss +0 -56
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/index.vue +4 -7
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/index.scss +0 -1
- package/components/CustomerServiceChat/message-input-toolbar/video-upload/index.vue +7 -50
- package/components/CustomerServiceChat/message-list/index-web.vue +3 -7
- package/components/CustomerServiceChat/message-list/message-elements/{plugins/plugin-components → message-desk}/index.ts +1 -1
- package/components/{customer-icon.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/customer-icon.vue} +0 -9
- package/components/CustomerServiceChat/message-list/message-elements/{plugins/plugin-components/message-customer → message-desk/message-desk-elements}/index.ts +1 -1
- package/components/{message-branch.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-branch.vue} +4 -4
- package/components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-desk.vue +126 -0
- package/components/{message-multi-branch → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-branch}/branch-pc.vue +1 -1
- package/components/{message-multi-branch → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-branch}/index.vue +2 -3
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-mobile/form-popup.vue +2 -3
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-mobile/input-mobile.vue +1 -1
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-mobile/radios-mobile.vue +7 -7
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-pc/input-pc.vue +1 -1
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-pc/radio-pc.vue +4 -5
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/form-mobile.vue +8 -7
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/form-pc.vue +5 -5
- package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/index.vue +3 -3
- package/components/{message-product-card.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-product-card.vue} +2 -2
- package/components/{message-rating → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rating}/index.vue +4 -4
- package/components/{message-rating → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rating}/message-rating-number.vue +3 -3
- package/components/{message-rating → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rating}/message-rating-star.vue +5 -5
- package/components/{message-rich-text.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-rich-text.vue} +5 -17
- package/components/{message-robot-welcome.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-robot-welcome.vue} +7 -7
- package/components/{message-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-single-form}/form-input.vue +5 -5
- package/components/{message-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-single-form}/index.vue +1 -1
- package/components/{message-stream.vue → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-stream.vue} +2 -2
- package/{styles → components/CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/styles}/common.scss +1 -1
- package/components/CustomerServiceChat/message-list/message-elements/{plugins/plugin-components → message-desk}/message-plugin-layout-web.vue +2 -9
- package/components/CustomerServiceChat/message-list/message-elements/{plugins/plugin-components → message-desk}/message-plugin-web.vue +5 -5
- package/components/CustomerServiceChat/message-list/message-elements/message-quote/index-web.vue +2 -4
- package/components/CustomerServiceChat/message-list/message-elements/message-record/index.vue +3 -6
- package/components/CustomerServiceChat/message-list/message-elements/simple-message-list/index.vue +3 -29
- package/components/CustomerServiceChat/style/index.scss +0 -2
- package/components/common/Avatar/index.vue +2 -23
- package/components/common/BottomPopup/index.vue +2 -3
- package/components/common/Dialog/index.vue +2 -2
- package/components/common/ImagePreviewer/index-web.vue +2 -84
- package/components/common/ProgressMessage/index.vue +0 -8
- package/index.ts +4 -13
- package/index.vue +1 -60
- package/package.json +1 -1
- package/server.ts +2 -12
- package/utils/chatStorage.ts +2 -11
- package/utils/index.ts +2 -1
- package/assets/audio-before-delete.svg +0 -4
- package/assets/audio-blue.png +0 -0
- package/assets/audio-bubble-blue.svg +0 -3
- package/assets/audio-bubble-red.svg +0 -3
- package/assets/audio-delete.svg +0 -10
- package/assets/audio.svg +0 -6
- package/assets/camera-uni.png +0 -0
- package/assets/face-uni.png +0 -0
- package/assets/more-uni.png +0 -0
- package/assets/translate.svg +0 -12
- package/assets/video-uni.png +0 -0
- package/components/CustomerServiceChat/message-input-toolbar/toolbar-item-container/style/uni.scss +0 -36
- package/components/CustomerServiceChat/message-list/link/index.ts +0 -23
- package/components/CustomerServiceChat/message-list/message-elements/plugins/plugin-components/message-customer/message-customer-service.vue +0 -22
- package/components/CustomerServiceChat/style/uni.scss +0 -12
- package/components/CustomerServiceChat/style/wx.scss +0 -5
- package/components/common/RichText/LICENSE +0 -21
- package/components/common/RichText/README.md +0 -244
- package/components/common/RichText/dist/mp-alipay/index.acss +0 -1
- package/components/common/RichText/dist/mp-alipay/index.axml +0 -1
- package/components/common/RichText/dist/mp-alipay/index.js +0 -8
- package/components/common/RichText/dist/mp-alipay/index.json +0 -1
- package/components/common/RichText/dist/mp-alipay/node/node.acss +0 -1
- package/components/common/RichText/dist/mp-alipay/node/node.axml +0 -1
- package/components/common/RichText/dist/mp-alipay/node/node.js +0 -1
- package/components/common/RichText/dist/mp-alipay/node/node.json +0 -1
- package/components/common/RichText/dist/mp-alipay/parser.js +0 -1
- package/components/common/RichText/dist/mp-baidu/index.css +0 -1
- package/components/common/RichText/dist/mp-baidu/index.js +0 -8
- package/components/common/RichText/dist/mp-baidu/index.json +0 -1
- package/components/common/RichText/dist/mp-baidu/index.swan +0 -1
- package/components/common/RichText/dist/mp-baidu/node/node.css +0 -1
- package/components/common/RichText/dist/mp-baidu/node/node.js +0 -1
- package/components/common/RichText/dist/mp-baidu/node/node.json +0 -1
- package/components/common/RichText/dist/mp-baidu/node/node.swan +0 -1
- package/components/common/RichText/dist/mp-baidu/parser.js +0 -1
- package/components/common/RichText/dist/mp-qq/index.js +0 -8
- package/components/common/RichText/dist/mp-qq/index.json +0 -1
- package/components/common/RichText/dist/mp-qq/index.qml +0 -1
- package/components/common/RichText/dist/mp-qq/index.qss +0 -1
- package/components/common/RichText/dist/mp-qq/node/node.js +0 -1
- package/components/common/RichText/dist/mp-qq/node/node.json +0 -1
- package/components/common/RichText/dist/mp-qq/node/node.qml +0 -1
- package/components/common/RichText/dist/mp-qq/node/node.qss +0 -1
- package/components/common/RichText/dist/mp-qq/parser.js +0 -1
- package/components/common/RichText/dist/mp-toutiao/index.js +0 -8
- package/components/common/RichText/dist/mp-toutiao/index.json +0 -1
- package/components/common/RichText/dist/mp-toutiao/index.ttml +0 -1
- package/components/common/RichText/dist/mp-toutiao/index.ttss +0 -1
- package/components/common/RichText/dist/mp-toutiao/node/node.js +0 -1
- package/components/common/RichText/dist/mp-toutiao/node/node.json +0 -1
- package/components/common/RichText/dist/mp-toutiao/node/node.ttml +0 -1
- package/components/common/RichText/dist/mp-toutiao/node/node.ttss +0 -1
- package/components/common/RichText/dist/mp-toutiao/parser.js +0 -1
- package/components/common/RichText/dist/mp-weixin/index.js +0 -8
- package/components/common/RichText/dist/mp-weixin/index.json +0 -1
- package/components/common/RichText/dist/mp-weixin/index.wxml +0 -1
- package/components/common/RichText/dist/mp-weixin/index.wxss +0 -1
- package/components/common/RichText/dist/mp-weixin/node/node.js +0 -1
- package/components/common/RichText/dist/mp-weixin/node/node.json +0 -1
- package/components/common/RichText/dist/mp-weixin/node/node.wxml +0 -1
- package/components/common/RichText/dist/mp-weixin/node/node.wxss +0 -1
- package/components/common/RichText/dist/mp-weixin/parser.js +0 -1
- package/components/common/RichText/dist/uni-app/components/mp-html/mp-html.vue +0 -498
- package/components/common/RichText/dist/uni-app/components/mp-html/node/node.vue +0 -587
- package/components/common/RichText/dist/uni-app/components/mp-html/parser.js +0 -1393
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/handler.js +0 -1
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +0 -1
- package/components/common/RichText/dist/uni-app/static/app-plus/mp-html/local.html +0 -1
- package/components/common/RichText/docs/.nojekyll +0 -0
- package/components/common/RichText/docs/index.html +0 -50
- package/components/common/RichText/docs/lib/docsify.min.js +0 -1
- package/components/common/RichText/docs/lib/prism-bash.min.js +0 -1
- package/components/common/RichText/docs/lib/search.min.js +0 -1
- package/components/common/RichText/docs/lib/vue.css +0 -858
- package/components/common/RichText/gulpfile.js +0 -113
- package/components/common/RichText/lint.js +0 -63
- package/components/common/RichText/package.json +0 -74
- package/components/common/RichText/plugins/README.md +0 -2
- package/components/common/RichText/plugins/audio/README.md +0 -25
- package/components/common/RichText/plugins/audio/build.js +0 -11
- package/components/common/RichText/plugins/audio/context.js +0 -7
- package/components/common/RichText/plugins/audio/index.js +0 -34
- package/components/common/RichText/plugins/audio/miniprogram/audio.js +0 -189
- package/components/common/RichText/plugins/audio/miniprogram/audio.json +0 -3
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxml +0 -17
- package/components/common/RichText/plugins/audio/miniprogram/audio.wxss +0 -127
- package/components/common/RichText/plugins/audio/miniprogram/build.js +0 -3
- package/components/common/RichText/plugins/audio/uni-app/audio.vue +0 -269
- package/components/common/RichText/plugins/audio/uni-app/build.js +0 -3
- package/components/common/RichText/plugins/card/README.md +0 -30
- package/components/common/RichText/plugins/card/build.js +0 -14
- package/components/common/RichText/plugins/card/index.js +0 -7
- package/components/common/RichText/plugins/card/miniprogram/build.js +0 -3
- package/components/common/RichText/plugins/card/miniprogram/card.js +0 -26
- package/components/common/RichText/plugins/card/miniprogram/card.json +0 -3
- package/components/common/RichText/plugins/card/miniprogram/card.wxml +0 -9
- package/components/common/RichText/plugins/card/miniprogram/card.wxss +0 -55
- package/components/common/RichText/plugins/card/uni-app/build.js +0 -3
- package/components/common/RichText/plugins/card/uni-app/card.vue +0 -122
- package/components/common/RichText/plugins/editable/README.md +0 -137
- package/components/common/RichText/plugins/editable/config.js +0 -15
- package/components/common/RichText/plugins/editable/miniprogram/build.js +0 -813
- package/components/common/RichText/plugins/editable/miniprogram/index.js +0 -551
- package/components/common/RichText/plugins/editable/uni-app/build.js +0 -744
- package/components/common/RichText/plugins/editable/uni-app/index.js +0 -553
- package/components/common/RichText/plugins/emoji/README.md +0 -15
- package/components/common/RichText/plugins/emoji/index.js +0 -203
- package/components/common/RichText/plugins/highlight/README.md +0 -26
- package/components/common/RichText/plugins/highlight/config.js +0 -5
- package/components/common/RichText/plugins/highlight/index.js +0 -96
- package/components/common/RichText/plugins/highlight/miniprogram/build.js +0 -88
- package/components/common/RichText/plugins/highlight/prism.css +0 -125
- package/components/common/RichText/plugins/highlight/prism.min.js +0 -7
- package/components/common/RichText/plugins/highlight/uni-app/build.js +0 -88
- package/components/common/RichText/plugins/img-cache/README.md +0 -24
- package/components/common/RichText/plugins/img-cache/build.js +0 -16
- package/components/common/RichText/plugins/img-cache/index.js +0 -138
- package/components/common/RichText/plugins/latex/README.md +0 -16
- package/components/common/RichText/plugins/latex/build.js +0 -14
- package/components/common/RichText/plugins/latex/index.js +0 -77
- package/components/common/RichText/plugins/latex/katex.css +0 -1070
- package/components/common/RichText/plugins/latex/katex.min.js +0 -1
- package/components/common/RichText/plugins/markdown/README.md +0 -17
- package/components/common/RichText/plugins/markdown/index.js +0 -34
- package/components/common/RichText/plugins/markdown/marked.min.js +0 -6
- package/components/common/RichText/plugins/markdown/miniprogram/build.js +0 -70
- package/components/common/RichText/plugins/markdown/uni-app/build.js +0 -68
- package/components/common/RichText/plugins/search/README.md +0 -46
- package/components/common/RichText/plugins/search/miniprogram/index.js +0 -137
- package/components/common/RichText/plugins/search/uni-app/index.js +0 -132
- package/components/common/RichText/plugins/style/README.md +0 -30
- package/components/common/RichText/plugins/style/index.js +0 -129
- package/components/common/RichText/plugins/style/parser.js +0 -175
- package/components/common/RichText/plugins/template/README.md +0 -2
- package/components/common/RichText/plugins/template/build.js +0 -65
- package/components/common/RichText/plugins/template/index.js +0 -67
- package/components/common/RichText/plugins/txv-video/README.md +0 -18
- package/components/common/RichText/plugins/txv-video/build.js +0 -3
- package/components/common/RichText/plugins/txv-video/index.js +0 -46
- package/components/common/RichText/plugins/txv-video/miniprogram/build.js +0 -6
- package/components/common/RichText/plugins/txv-video/uni-app/build.js +0 -3
- package/components/common/RichText/src/miniprogram/index.js +0 -396
- package/components/common/RichText/src/miniprogram/index.json +0 -6
- package/components/common/RichText/src/miniprogram/index.wxml +0 -7
- package/components/common/RichText/src/miniprogram/index.wxss +0 -13
- package/components/common/RichText/src/miniprogram/node/node.js +0 -247
- package/components/common/RichText/src/miniprogram/node/node.json +0 -6
- package/components/common/RichText/src/miniprogram/node/node.wxml +0 -112
- package/components/common/RichText/src/miniprogram/node/node.wxss +0 -164
- package/components/common/RichText/src/miniprogram/parser.js +0 -1269
- package/components/common/RichText/src/uni-app/components/mp-html/mp-html.vue +0 -498
- package/components/common/RichText/src/uni-app/components/mp-html/node/node.vue +0 -585
- package/components/common/RichText/src/uni-app/components/mp-html/parser.js +0 -1393
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/handler.js +0 -254
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/js/uni.webview.min.js +0 -1
- package/components/common/RichText/src/uni-app/static/app-plus/mp-html/local.html +0 -33
- package/components/common/RichText/tools/config.js +0 -82
- package/components/common/RichText/tools/converter.js +0 -205
- package/components/common/RichText/tools/ifdef.js +0 -115
- package/components/common/RichText/tools/minifier.js +0 -40
- package/components/common/RichText/tools/plugin.js +0 -248
- package/components/message-customer-service.vue +0 -114
- package/script/fileCopy.js +0 -60
- package/script/syncVersion.js +0 -35
- /package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-mobile/label-mobile.vue +0 -0
- /package/components/{message-multi-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-multi-form}/component-pc/label-pc.vue +0 -0
- /package/components/{message-form → CustomerServiceChat/message-list/message-elements/message-desk/message-desk-elements/message-single-form}/form-branch.vue +0 -0
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview style 插件
|
|
3
|
-
*/
|
|
4
|
-
// #ifndef APP-PLUS-NVUE
|
|
5
|
-
const Parser = require('./parser')
|
|
6
|
-
// #endif
|
|
7
|
-
|
|
8
|
-
function Style () {
|
|
9
|
-
this.styles = []
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// #ifndef APP-PLUS-NVUE
|
|
13
|
-
Style.prototype.onParse = function (node, vm) {
|
|
14
|
-
// 获取样式
|
|
15
|
-
if (node.name === 'style' && node.children.length && node.children[0].type === 'text') {
|
|
16
|
-
this.styles = this.styles.concat(new Parser().parse(node.children[0].text))
|
|
17
|
-
} else if (node.name) {
|
|
18
|
-
// 匹配样式(对非文本标签)
|
|
19
|
-
// 存储不同优先级的样式 name < class < id < 后代
|
|
20
|
-
let matched = ['', '', '', '']
|
|
21
|
-
for (let i = 0, len = this.styles.length; i < len; i++) {
|
|
22
|
-
const item = this.styles[i]
|
|
23
|
-
let res = match(node, item.key || item.list[item.list.length - 1])
|
|
24
|
-
let j
|
|
25
|
-
if (res) {
|
|
26
|
-
// 后代选择器
|
|
27
|
-
if (!item.key) {
|
|
28
|
-
j = item.list.length - 2
|
|
29
|
-
for (let k = vm.stack.length; j >= 0 && k--;) {
|
|
30
|
-
// 子选择器
|
|
31
|
-
if (item.list[j] === '>') {
|
|
32
|
-
// 错误情况
|
|
33
|
-
if (j < 1 || j > item.list.length - 2) break
|
|
34
|
-
if (match(vm.stack[k], item.list[j - 1])) {
|
|
35
|
-
j -= 2
|
|
36
|
-
} else {
|
|
37
|
-
j++
|
|
38
|
-
}
|
|
39
|
-
} else if (match(vm.stack[k], item.list[j])) {
|
|
40
|
-
j--
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
res = 4
|
|
44
|
-
}
|
|
45
|
-
if (item.key || j < 0) {
|
|
46
|
-
// 添加伪类
|
|
47
|
-
if (item.pseudo && node.children) {
|
|
48
|
-
let text
|
|
49
|
-
item.style = item.style.replace(/content:([^;]+)/, (_, $1) => {
|
|
50
|
-
text = $1.replace(/['"]/g, '')
|
|
51
|
-
// 处理 attr 函数
|
|
52
|
-
.replace(/attr\((.+?)\)/, (_, $1) => node.attrs[$1.trim()] || '')
|
|
53
|
-
// 编码 \xxx
|
|
54
|
-
.replace(/\\(\w{4})/, (_, $1) => String.fromCharCode(parseInt($1, 16)))
|
|
55
|
-
return ''
|
|
56
|
-
})
|
|
57
|
-
const pseudo = {
|
|
58
|
-
name: 'span',
|
|
59
|
-
attrs: {
|
|
60
|
-
style: item.style
|
|
61
|
-
},
|
|
62
|
-
children: [{
|
|
63
|
-
type: 'text',
|
|
64
|
-
text
|
|
65
|
-
}]
|
|
66
|
-
}
|
|
67
|
-
if (item.pseudo === 'before') {
|
|
68
|
-
node.children.unshift(pseudo)
|
|
69
|
-
} else {
|
|
70
|
-
node.children.push(pseudo)
|
|
71
|
-
}
|
|
72
|
-
} else {
|
|
73
|
-
matched[res - 1] += item.style + (item.style[item.style.length - 1] === ';' ? '' : ';')
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
matched = matched.join('')
|
|
79
|
-
if (matched.length > 2) {
|
|
80
|
-
node.attrs.style = matched + (node.attrs.style || '')
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* @description 匹配样式
|
|
87
|
-
* @param {object} node 要匹配的标签
|
|
88
|
-
* @param {string|string[]} keys 选择器
|
|
89
|
-
* @returns {number} 0:不匹配;1:name 匹配;2:class 匹配;3:id 匹配
|
|
90
|
-
*/
|
|
91
|
-
function match (node, keys) {
|
|
92
|
-
function matchItem (key) {
|
|
93
|
-
if (key[0] === '#') {
|
|
94
|
-
// 匹配 id
|
|
95
|
-
if (node.attrs.id && node.attrs.id.trim() === key.substr(1)) return 3
|
|
96
|
-
} else if (key[0] === '.') {
|
|
97
|
-
// 匹配 class
|
|
98
|
-
key = key.substr(1)
|
|
99
|
-
const selectors = (node.attrs.class || '').split(' ')
|
|
100
|
-
for (let i = 0; i < selectors.length; i++) {
|
|
101
|
-
if (selectors[i].trim() === key) return 2
|
|
102
|
-
}
|
|
103
|
-
} else if (node.name === key) {
|
|
104
|
-
// 匹配 name
|
|
105
|
-
return 1
|
|
106
|
-
}
|
|
107
|
-
return 0
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// 多选择器交集
|
|
111
|
-
if (keys instanceof Array) {
|
|
112
|
-
let res = 0
|
|
113
|
-
for (let j = 0; j < keys.length; j++) {
|
|
114
|
-
const tmp = matchItem(keys[j])
|
|
115
|
-
// 任意一个不匹配就失败
|
|
116
|
-
if (!tmp) return 0
|
|
117
|
-
// 优先级最大的一个作为最终优先级
|
|
118
|
-
if (tmp > res) {
|
|
119
|
-
res = tmp
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return res
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return matchItem(keys)
|
|
126
|
-
}
|
|
127
|
-
// #endif
|
|
128
|
-
|
|
129
|
-
module.exports = Style
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
const blank = {
|
|
2
|
-
' ': true,
|
|
3
|
-
'\n': true,
|
|
4
|
-
'\t': true,
|
|
5
|
-
'\r': true,
|
|
6
|
-
'\f': true
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function Parser () {
|
|
10
|
-
this.styles = []
|
|
11
|
-
this.selectors = []
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @description 解析 css 字符串
|
|
16
|
-
* @param {string} content css 内容
|
|
17
|
-
*/
|
|
18
|
-
Parser.prototype.parse = function (content) {
|
|
19
|
-
new Lexer(this).parse(content)
|
|
20
|
-
return this.styles
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @description 解析到一个选择器
|
|
25
|
-
* @param {string} name 名称
|
|
26
|
-
*/
|
|
27
|
-
Parser.prototype.onSelector = function (name) {
|
|
28
|
-
// 不支持的选择器
|
|
29
|
-
if (name.includes('[') || name.includes('*') || name.includes('@')) return
|
|
30
|
-
const selector = {}
|
|
31
|
-
// 伪类
|
|
32
|
-
if (name.includes(':')) {
|
|
33
|
-
const info = name.split(':')
|
|
34
|
-
const pseudo = info.pop()
|
|
35
|
-
if (pseudo === 'before' || pseudo === 'after') {
|
|
36
|
-
selector.pseudo = pseudo
|
|
37
|
-
name = info[0]
|
|
38
|
-
} else return
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// 分割交集选择器
|
|
42
|
-
function splitItem (str) {
|
|
43
|
-
const arr = []
|
|
44
|
-
let i, start
|
|
45
|
-
for (i = 1, start = 0; i < str.length; i++) {
|
|
46
|
-
if (str[i] === '.' || str[i] === '#') {
|
|
47
|
-
arr.push(str.substring(start, i))
|
|
48
|
-
start = i
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (!arr.length) {
|
|
52
|
-
return str
|
|
53
|
-
} else {
|
|
54
|
-
arr.push(str.substring(start, i))
|
|
55
|
-
return arr
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// 后代选择器
|
|
60
|
-
if (name.includes(' ')) {
|
|
61
|
-
selector.list = []
|
|
62
|
-
const list = name.split(' ')
|
|
63
|
-
for (let i = 0; i < list.length; i++) {
|
|
64
|
-
if (list[i].length) {
|
|
65
|
-
// 拆分子选择器
|
|
66
|
-
const arr = list[i].split('>')
|
|
67
|
-
for (let j = 0; j < arr.length; j++) {
|
|
68
|
-
selector.list.push(splitItem(arr[j]))
|
|
69
|
-
if (j < arr.length - 1) {
|
|
70
|
-
selector.list.push('>')
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
selector.key = splitItem(name)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
this.selectors.push(selector)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* @description 解析到选择器内容
|
|
84
|
-
* @param {string} content 内容
|
|
85
|
-
*/
|
|
86
|
-
Parser.prototype.onContent = function (content) {
|
|
87
|
-
// 并集选择器
|
|
88
|
-
for (let i = 0; i < this.selectors.length; i++) {
|
|
89
|
-
this.selectors[i].style = content
|
|
90
|
-
}
|
|
91
|
-
this.styles = this.styles.concat(this.selectors)
|
|
92
|
-
this.selectors = []
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* @description css 词法分析器
|
|
97
|
-
* @param {object} handler 高层处理器
|
|
98
|
-
*/
|
|
99
|
-
function Lexer (handler) {
|
|
100
|
-
this.selector = ''
|
|
101
|
-
this.style = ''
|
|
102
|
-
this.handler = handler
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
Lexer.prototype.parse = function (content) {
|
|
106
|
-
this.i = 0
|
|
107
|
-
this.content = content
|
|
108
|
-
this.state = this.blank
|
|
109
|
-
for (let len = content.length; this.i < len; this.i++) {
|
|
110
|
-
this.state(content[this.i])
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
Lexer.prototype.comment = function () {
|
|
115
|
-
this.i = this.content.indexOf('*/', this.i) + 1
|
|
116
|
-
if (!this.i) {
|
|
117
|
-
this.i = this.content.length
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
Lexer.prototype.blank = function (c) {
|
|
122
|
-
if (!blank[c]) {
|
|
123
|
-
if (c === '/' && this.content[this.i + 1] === '*') {
|
|
124
|
-
this.comment()
|
|
125
|
-
return
|
|
126
|
-
}
|
|
127
|
-
this.selector += c
|
|
128
|
-
this.state = this.name
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
Lexer.prototype.name = function (c) {
|
|
133
|
-
if (c === '/' && this.content[this.i + 1] === '*') {
|
|
134
|
-
this.comment()
|
|
135
|
-
return
|
|
136
|
-
}
|
|
137
|
-
if (c === '{' || c === ',' || c === ';') {
|
|
138
|
-
this.handler.onSelector(this.selector.trimEnd())
|
|
139
|
-
this.selector = ''
|
|
140
|
-
if (c !== '{') {
|
|
141
|
-
while (blank[this.content[++this.i]]);
|
|
142
|
-
}
|
|
143
|
-
if (this.content[this.i] === '{') {
|
|
144
|
-
this.floor = 1
|
|
145
|
-
this.state = this.val
|
|
146
|
-
} else {
|
|
147
|
-
this.selector += this.content[this.i]
|
|
148
|
-
}
|
|
149
|
-
} else if (blank[c]) {
|
|
150
|
-
this.selector += ' '
|
|
151
|
-
} else {
|
|
152
|
-
this.selector += c
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
Lexer.prototype.val = function (c) {
|
|
157
|
-
if (c === '/' && this.content[this.i + 1] === '*') {
|
|
158
|
-
this.comment()
|
|
159
|
-
return
|
|
160
|
-
}
|
|
161
|
-
if (c === '{') {
|
|
162
|
-
this.floor++
|
|
163
|
-
} else if (c === '}') {
|
|
164
|
-
this.floor--
|
|
165
|
-
if (!this.floor) {
|
|
166
|
-
this.handler.onContent(this.style)
|
|
167
|
-
this.style = ''
|
|
168
|
-
this.state = this.blank
|
|
169
|
-
return
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
this.style += c
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
module.exports = Parser
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description 插件构建文件模板
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
/**
|
|
7
|
-
* @description 入口文件
|
|
8
|
-
* @type {String}
|
|
9
|
-
* @default 'index.js'
|
|
10
|
-
*/
|
|
11
|
-
main: 'index.js',
|
|
12
|
-
/**
|
|
13
|
-
* @description 支持的平台
|
|
14
|
-
* @type {String[]}
|
|
15
|
-
* @default ['mp-weixin','mp-qq','mp-baidu','mp-alipay','mp-toutiao','uni-app']
|
|
16
|
-
*/
|
|
17
|
-
platform: ['mp-weixin', 'mp-qq', 'mp-baidu', 'mp-alipay', 'mp-toutiao', 'uni-app'],
|
|
18
|
-
/**
|
|
19
|
-
* @description 要被添加到模板文件中的标签(将被添加到 src/node/node.wxml)
|
|
20
|
-
* 必须要有 wx:if 表明什么情况下使用该标签
|
|
21
|
-
* n 表示标签结构体,<node> 标签用于递归显示子节点(可参考源文件中的写法)
|
|
22
|
-
* @type {String}
|
|
23
|
-
*/
|
|
24
|
-
template: '',
|
|
25
|
-
/**
|
|
26
|
-
* @description 用于处理模板中事件的方法(将被添加到 src/node/node.js)
|
|
27
|
-
* 需要触发顶层组件的事件请使用 this.root.triggerEvent
|
|
28
|
-
* @type {Object}
|
|
29
|
-
*/
|
|
30
|
-
methods: {
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
/**
|
|
34
|
-
* @description 用于模板文件的 css 样式(将被添加到 src/node/node.wxss)
|
|
35
|
-
* @type {String}
|
|
36
|
-
*/
|
|
37
|
-
style: '',
|
|
38
|
-
/**
|
|
39
|
-
* @description 要被引入到模板文件的 css 文件路径(将被添加到 src/node/node.wxss)
|
|
40
|
-
* @type {String|String[]}
|
|
41
|
-
*/
|
|
42
|
-
import: [],
|
|
43
|
-
/**
|
|
44
|
-
* @description 在模板中需要使用的组件或插件列表(将被添加到 src/node/node.json)
|
|
45
|
-
* @type {Object}
|
|
46
|
-
*/
|
|
47
|
-
usingComponents: {
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
/**
|
|
51
|
-
* @description 自定义文件处理器
|
|
52
|
-
* 如果上述处理还无法满足要求,可以在此方法中进行处理
|
|
53
|
-
* 所有 src 目录下的文件和本插件目录下的文件都会经过此方法的处理
|
|
54
|
-
* @param {Vinyl} file 关于该文件对象的格式可参考 https://github.com/gulpjs/vinyl#instance-methods
|
|
55
|
-
* @param {String} platform 平台
|
|
56
|
-
*/
|
|
57
|
-
handler (file, platform) {
|
|
58
|
-
let content = file.contents.toString()
|
|
59
|
-
// 进行处理
|
|
60
|
-
if (platform === 'xxx') {
|
|
61
|
-
content = content.replace('aaa', 'bbb')
|
|
62
|
-
}
|
|
63
|
-
file.contents = Buffer.from(content)
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview 插件入口文件模板
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const data = {} // 全局数据
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @description 组件被创建时将实例化插件
|
|
9
|
-
* @param {Component} vm 组件实例
|
|
10
|
-
*/
|
|
11
|
-
function Plugin (vm) {
|
|
12
|
-
this.vm = vm // 保存实例在其他周期使用
|
|
13
|
-
this.compData = {} // 仅在单个组件中使用的数据
|
|
14
|
-
data.xxx = 'xxx' // 记录全局数据
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @description html 数据更新时触发
|
|
19
|
-
* @param {string} content 要更新的 html 字符串
|
|
20
|
-
* @param {object} config 解析配置
|
|
21
|
-
* @returns {string|void} 如果要对 html 字符串进行一些预处理,则返回处理后的字符串
|
|
22
|
-
*/
|
|
23
|
-
Plugin.prototype.onUpdate = function (content, config) {
|
|
24
|
-
config.ignoreTags.xxx = true // 移除 xxx 标签
|
|
25
|
-
// 对 html 内容进行预处理并返回修改,没有修改则不需要返回
|
|
26
|
-
return content
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @description 解析到一个标签时触发
|
|
31
|
-
* @param {object} node 标签
|
|
32
|
-
* @param {object} parser 解析器实例
|
|
33
|
-
* @returns {boolean|void} 如果返回 false 将移除该标签
|
|
34
|
-
*/
|
|
35
|
-
Plugin.prototype.onParse = function (node, parser) {
|
|
36
|
-
// 处理文本标签
|
|
37
|
-
if (node.type === 'text') {
|
|
38
|
-
// node.text 文本内容
|
|
39
|
-
} else {
|
|
40
|
-
// 处理元素标签
|
|
41
|
-
// node.name 标签名
|
|
42
|
-
// node.attrs 属性列表
|
|
43
|
-
// node.children 子节点(非自闭合标签有)
|
|
44
|
-
|
|
45
|
-
if (node.name === 'xxx') {
|
|
46
|
-
parser.expose() // 如果该标签不能被 rich-text 包含,需要调用此方法暴露出来
|
|
47
|
-
// parser.options 组件传入的一些解析属性
|
|
48
|
-
// parser.stack 可以从栈中获取祖先节点
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* @description dom 树加载完毕时触发(load 事件)
|
|
55
|
-
*/
|
|
56
|
-
Plugin.prototype.onLoad = function () {
|
|
57
|
-
// 可以获取媒体 context 对象等
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @description 组件被移除时触发
|
|
62
|
-
*/
|
|
63
|
-
Plugin.prototype.onDetached = function () {
|
|
64
|
-
// 可以释放一些必要的资源(计时器等)
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
module.exports = Plugin
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# txv-video
|
|
2
|
-
功能:使用腾讯视频
|
|
3
|
-
大小:*≈1KB*
|
|
4
|
-
支持平台:
|
|
5
|
-
|
|
6
|
-
| 微信小程序 | QQ 小程序 | 百度小程序 | 支付宝小程序 | 头条小程序 | uni-app |
|
|
7
|
-
|:---:|:---:|:---:|:---:|:---:|:---:|
|
|
8
|
-
| √ | √ | | | | √ (h5 和 app 直接支持) |
|
|
9
|
-
|
|
10
|
-
说明:
|
|
11
|
-
引入本插件后,*html* 中符合下方格式的 *iframe* 标签(*src* 中含有 *vid*)将被转为通过腾讯视频播放:
|
|
12
|
-
```html
|
|
13
|
-
<iframe src="https://v.qq.com/txp/iframe/player.html?vid=xxxxxx" allowFullScreen="true"></iframe>
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
同时,其可以被 *pause-video* 属性控制
|
|
17
|
-
|
|
18
|
-
!> 本插件仅用于将官方 [腾讯视频插件](https://github.com/tvfe/txv-miniprogram-plugin) 应用于本组件,仅在微信和 *qq* 平台有效,使用前请确认已经成功申请使用该插件并按要求在小程序 *app.json* 中配置完成,否则可能报错 **This application has not registered any plugins yet** 且无法生效
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview txv-video 插件
|
|
3
|
-
* Include txv-video (https://github.com/tvfe/txv-miniprogram-plugin)
|
|
4
|
-
*/
|
|
5
|
-
const TxvVideo = function (vm) {
|
|
6
|
-
this.vm = vm
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// #ifdef MP-WEIXIN || MP-QQ
|
|
10
|
-
try {
|
|
11
|
-
const TxvContext = requirePlugin('tencentvideo')
|
|
12
|
-
|
|
13
|
-
TxvVideo.prototype.onLoad = function () {
|
|
14
|
-
setTimeout(() => {
|
|
15
|
-
for (let i = 0; i < this.videos.length; i++) {
|
|
16
|
-
const ctx = TxvContext.getTxvContext(this.videos[i])
|
|
17
|
-
ctx.id = this.videos[i]
|
|
18
|
-
this.vm._videos.push(ctx)
|
|
19
|
-
}
|
|
20
|
-
}, 50)
|
|
21
|
-
}
|
|
22
|
-
} catch (e) {
|
|
23
|
-
console.error('使用txv-video扩展需注册腾讯视频插件')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
TxvVideo.prototype.onUpdate = function (_, config) {
|
|
27
|
-
config.trustTags['txv-video'] = true
|
|
28
|
-
this.videos = []
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
TxvVideo.prototype.onParse = function (node, parser) {
|
|
32
|
-
if (node.name === 'iframe' && (node.attrs.src || '').includes('vid')) {
|
|
33
|
-
const vid = node.attrs.src.match(/vid=([^&\s]+)/)
|
|
34
|
-
if (vid) {
|
|
35
|
-
node.name = 'txv-video'
|
|
36
|
-
node.attrs.vid = vid[1]
|
|
37
|
-
this.videos.push(vid[1])
|
|
38
|
-
node.attrs.src = undefined
|
|
39
|
-
parser.expose()
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// #endif
|
|
45
|
-
|
|
46
|
-
module.exports = TxvVideo
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
template: '<txv-video wx:if="{{n.name==\'txv-video\'}}" vid="{{n.attrs.vid}}" playerid="{{n.attrs.vid}}" id="{{n.attrs.vid}}" class="{{n.attrs.class}}" style="{{n.attrs.style}}" controls data-i="{{i}}" bindplay="play" binderror="mediaError" />',
|
|
3
|
-
usingComponents: {
|
|
4
|
-
'txv-video': 'plugin://tencentvideo/video'
|
|
5
|
-
}
|
|
6
|
-
}
|