lke-component 1.2.22 → 1.2.23

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,46 @@
1
+
2
+
3
+ // function toUpperCase(str) {
4
+ // return str.slice(0, 1).toUpperCase() + str.slice(1);
5
+ // }
6
+
7
+ // export const withInstall = (comp) => {
8
+ // const c = comp;
9
+ // c.install = function (app) {
10
+ // app.component(toUpperCase(c.name), comp);
11
+ // };
12
+
13
+ // return comp;
14
+ // };
15
+
16
+
17
+ function withInstall(comp) {
18
+ const componentPlugin = comp
19
+
20
+ componentPlugin.install = (Vue) => {
21
+ Vue.component(componentPlugin.name, comp);
22
+ };
23
+
24
+ return componentPlugin;
25
+ }
26
+
27
+ /**
28
+ * 解码 HTML 实体(用于 XSS 防护前的预处理)
29
+ * @param {string} str - 包含 HTML 实体的字符串
30
+ * @returns {string} 解码后的字符串
31
+ */
32
+ export const decodeHtmlEntities = (str) => {
33
+ if (!str || typeof str !== 'string') return str;
34
+
35
+ // 使用 textarea 元素解码 HTML 实体
36
+ const textarea = document.createElement('textarea');
37
+ textarea.innerHTML = str;
38
+ const decoded = textarea.value;
39
+
40
+ // 清理
41
+ textarea.remove();
42
+
43
+ return decoded;
44
+ };
45
+
46
+ export default withInstall;
@@ -0,0 +1,78 @@
1
+ import { getDefaultWhiteList, escapeAttrValue } from 'xss';
2
+
3
+
4
+ // 自定义白名单
5
+ const thoughtWhiteList = getDefaultWhiteList();
6
+ thoughtWhiteList.a = ['href', 'title', 'target']; // 允许 a 标签的 href, title 和 target 属性
7
+ thoughtWhiteList.source = ['src', 'type']; // 允许 source 标签用于 video/audio
8
+ export const thoughtXssHtmlOptions = {
9
+ css: false,
10
+ whiteList: thoughtWhiteList,
11
+ onTagAttr (tag, name, value, isWhiteAttr) {
12
+ if (tag.indexOf('_') !== -1) {
13
+ // 如果包含下划线,则认为是自定义标签,放过
14
+ return `${name}="${value}"`;
15
+ }
16
+ const tagIgnore = ['div', 'span', 'strong', 'p', 'mark'];
17
+ if (tagIgnore.includes(tag)) {
18
+ // do not filter its attributes
19
+ const blockAttrsReg = new RegExp('^on');
20
+ if (!blockAttrsReg.test(name)) {
21
+ return `${name}="${value}"`;
22
+ }
23
+ }
24
+ const tagAttrIgnore = ['class', 'style'];
25
+ if (tagAttrIgnore.includes(name)) {
26
+ return `${name}="${value}"`;
27
+ }
28
+ // 自定义属性省略
29
+ const aTagAttrIgnore = ['rel', 'data-link-url'];
30
+ if (tag === 'a' && aTagAttrIgnore.includes(name)) {
31
+ return `${name}="${value}"`;
32
+ }
33
+ if (tag === 'a' && name === 'href') {
34
+ // 允许的协议列表
35
+ const allowedProtocols = ['qdweb', 'qdim', 'mqqwpa'];
36
+ const protocol = value.split(':')[0];
37
+ if (allowedProtocols.includes(protocol)) {
38
+ return `${name}="${escapeAttrValue(value)}"`;
39
+ }
40
+ }
41
+ const videoTagAttrIgnore = [
42
+ 'rel',
43
+ 'webkit-playsinline',
44
+ 'x5-playsinline',
45
+ 'title',
46
+ 'size',
47
+ 'format'
48
+ ];
49
+ if (tag === 'video' && videoTagAttrIgnore.includes(name)) {
50
+ return `${name}="${value}"`;
51
+ }
52
+ const audioTagAttrIgnore = [
53
+ 'controls',
54
+ 'controlslist',
55
+ 'id',
56
+ 'speed',
57
+ 'title',
58
+ 'size',
59
+ 'format',
60
+ 'data-duration-ms'
61
+ ];
62
+ if (tag === 'audio' && audioTagAttrIgnore.includes(name)) {
63
+ return `${name}="${value}"`;
64
+ }
65
+ const imgTagAttrIgnore = ['alt', 'data-value'];
66
+ if (tag === 'img' && imgTagAttrIgnore.includes(name)) {
67
+ return `${name}="${value}"`;
68
+ }
69
+ }
70
+ };
71
+
72
+
73
+ export const THOUGHT_STATUS = {
74
+ success: 'success',
75
+ failed: 'failed',
76
+ processing: 'processing',
77
+ stop: 'stop'
78
+ };
@@ -0,0 +1,309 @@
1
+ .cursor {
2
+ display: inline-block;
3
+ width: 2px;
4
+ height: 17px;
5
+ vertical-align: text-bottom;
6
+ background-color: black;
7
+ animation: blink 1s infinite;
8
+ }
9
+
10
+ .little-tags {
11
+ cursor: pointer;
12
+ width: 16px;
13
+ height: 16px;
14
+ display: inline-block;
15
+ /* padding: 0 4px; */
16
+ /* border-radius: 20px; */
17
+ background: var(--color-gray-6);
18
+ color: #fff;
19
+ border-radius: 10px;
20
+ text-align: center;
21
+ line-height: 16px;
22
+ // 解决角标两位数换行问题
23
+ word-break: normal;
24
+ word-wrap: normal;
25
+ }
26
+
27
+ @keyframes blink {
28
+ 0% {
29
+ opacity: 1;
30
+ }
31
+
32
+ 50% {
33
+ opacity: 0;
34
+ }
35
+
36
+ 100% {
37
+ opacity: 1;
38
+ }
39
+ }
40
+ mjx-container mjx-math {
41
+ display: block;
42
+ white-space: normal;
43
+ overflow-wrap: break-word;
44
+ word-wrap: break-word;
45
+ word-break: break-word;
46
+ }
47
+ mjx-container {
48
+ display: inline-block;
49
+ }
50
+ mjx-assistive-mml {
51
+ right: 0px;
52
+ bottom: 0px;
53
+ }
54
+
55
+ .answer-md {
56
+ font-size: 400 14px/20px;
57
+ // word-break: break-all;
58
+ // word-wrap: break-word;
59
+ word-break: break-word;
60
+ word-wrap: break-word;
61
+ video {
62
+ display: none;
63
+ }
64
+ /* 你可以在这里添加自定义样式 */
65
+ .code-language-label {
66
+ position: absolute;
67
+ top: 0;
68
+ right: 0;
69
+ background: #f0f0f0;
70
+ color: #333;
71
+ padding: 2px 8px;
72
+ font-size: 12px;
73
+ border-bottom-left-radius: 4px;
74
+ }
75
+
76
+
77
+ .hljs {
78
+ color: #121319;
79
+ background: #ffffff;
80
+ }
81
+
82
+ .hljs-comment,
83
+ .hljs-quote {
84
+ color: #979BAA;
85
+ font-style: italic;
86
+ }
87
+
88
+ .hljs-doctag,
89
+ .hljs-keyword,
90
+ .hljs-formula {
91
+ color: #4A70FF;
92
+ }
93
+
94
+ .hljs-section,
95
+ .hljs-name,
96
+ .hljs-selector-tag,
97
+ .hljs-deletion,
98
+ .hljs-subst {
99
+ color: #FF8345;
100
+ }
101
+
102
+ .hljs-literal {
103
+ color: #1492FF;
104
+ }
105
+
106
+ .hljs-string,
107
+ .hljs-regexp,
108
+ .hljs-addition,
109
+ .hljs-attribute,
110
+ .hljs-meta .hljs-string {
111
+ color: #0FB87F;
112
+ }
113
+
114
+ .hljs-attr,
115
+ .hljs-variable,
116
+ .hljs-template-variable,
117
+ .hljs-type,
118
+ .hljs-selector-class,
119
+ .hljs-selector-attr,
120
+ .hljs-selector-pseudo,
121
+ .hljs-number {
122
+ color: #FFA436;
123
+ }
124
+
125
+ .hljs-symbol,
126
+ .hljs-bullet,
127
+ .hljs-link,
128
+ .hljs-meta,
129
+ .hljs-selector-id,
130
+ .hljs-title {
131
+ color: #D20FD2;
132
+ }
133
+
134
+ .hljs-built_in,
135
+ .hljs-title.class_,
136
+ .hljs-class .hljs-title {
137
+ color: #F7C51E;
138
+ }
139
+
140
+ .hljs-emphasis {
141
+ font-style: italic;
142
+ }
143
+
144
+ .hljs-strong {
145
+ font-weight: bold;
146
+ }
147
+
148
+ .hljs-link {
149
+ text-decoration: underline;
150
+ }
151
+
152
+ .hljs-ln {
153
+ border-collapse: collapse;
154
+
155
+ td {
156
+ padding: 0;
157
+ }
158
+
159
+ /* for block of numbers */
160
+ td.hljs-ln-numbers {
161
+ -webkit-touch-callout: none;
162
+ -webkit-user-select: none;
163
+ -khtml-user-select: none;
164
+ -moz-user-select: none;
165
+ -ms-user-select: none;
166
+ user-select: none;
167
+ text-align: left;
168
+ vertical-align: top;
169
+ padding: 0 10px 0 10px;
170
+ color: #abb2bf !important;
171
+ white-space: nowrap;
172
+ /* border-right: 1px solid; */
173
+ border-right: 1px solid #c5c5c5 !important;
174
+ }
175
+
176
+ /* for block of code */
177
+ td.hljs-ln-code {
178
+ padding-left: 10px;
179
+ }
180
+ }
181
+
182
+ .hljs-ln-n:before {
183
+ content: attr(data-line-number)
184
+ }
185
+
186
+ pre {
187
+ position: relative;
188
+ }
189
+
190
+ .table:not(.hljs-ln) {
191
+
192
+ /* 滚动条Track */
193
+ ::-webkit-scrollbar-track {
194
+ background: transparent;
195
+ }
196
+
197
+ /* Handle */
198
+ ::-webkit-scrollbar-thumb {
199
+ border-radius: 10px;
200
+ background: rgba(17, 32, 70, 0.13);
201
+ ;
202
+ }
203
+ }
204
+
205
+ img {
206
+ max-width: 100%;
207
+ cursor: pointer;
208
+ border-radius: 6px;
209
+ }
210
+
211
+ p {
212
+ // word-break: break-all;
213
+ // word-wrap: break-word;
214
+ word-break: break-word;
215
+ word-wrap: break-word;
216
+ }
217
+
218
+ ::marker {
219
+ color: rgba(1, 11, 50, 0.41);
220
+ }
221
+
222
+ h1 {
223
+ font-size: 18px;
224
+ padding-top: 18px;
225
+ }
226
+
227
+ h2,
228
+ h3,
229
+ h4,
230
+ h5,
231
+ h6 {
232
+ font-size: 16px;
233
+ }
234
+
235
+ code {
236
+ white-space: break-spaces;
237
+ }
238
+
239
+ table:not(.hljs-ln) {
240
+ // display: inline-block;
241
+ // white-space: nowrap;
242
+ // max-width: 100%;
243
+ // overflow: scroll;
244
+ // background: white;
245
+ // border-bottom: 1px solid rgba(18, 42, 79, 0.08);
246
+ // border-right: 1px solid rgba(18, 42, 79, 0.08);
247
+ // border-spacing: 0;
248
+ // border-collapse: collapse;
249
+ display: inline-block;
250
+ overflow-x: scroll;
251
+ background: white;
252
+ border-spacing: 0;
253
+ border-collapse: collapse;
254
+ border-bottom: 1px solid rgba(18, 42, 79, 0.08);
255
+ border-right: 1px solid rgba(18, 42, 79, 0.08);
256
+ max-width: 100%;
257
+
258
+ th {
259
+ background: #eaecef;
260
+ color: rgba(1, 11, 50, 0.41);
261
+ // padding: 12px;
262
+ // font-weight: 400;
263
+ // background: #eaecef;
264
+ }
265
+
266
+ td,
267
+ th {
268
+ border-left: 1px solid rgba(18, 42, 79, 0.08);
269
+ border-top: 1px solid rgba(18, 42, 79, 0.08);
270
+ }
271
+
272
+ td {
273
+ padding: 8px 12px;
274
+ min-width: 20px;
275
+ }
276
+ }
277
+
278
+ .table-style:not(.hljs-ln) {
279
+ display: inline-block;
280
+ white-space: nowrap;
281
+ max-width: 100%;
282
+ overflow: scroll;
283
+ background: white;
284
+ border-bottom: 1px solid rgba(18, 42, 79, 0.08);
285
+ border-right: 1px solid rgba(18, 42, 79, 0.08);
286
+ border-spacing: 0;
287
+ border-collapse: collapse;
288
+
289
+ th {
290
+ color: rgba(1, 11, 50, 0.41);
291
+ padding: 12px;
292
+ font-weight: 400;
293
+ background: #eaecef;
294
+ }
295
+
296
+ td,
297
+ th {
298
+ border-left: 1px solid rgba(18, 42, 79, 0.08);
299
+ border-top: 1px solid rgba(18, 42, 79, 0.08);
300
+ }
301
+
302
+ td {
303
+ padding: 8px 4px;
304
+ min-width: 45px;
305
+ overflow-wrap: break-word;
306
+ white-space: break-spaces;
307
+ }
308
+ }
309
+ }
@@ -0,0 +1,38 @@
1
+ .v-icon {
2
+ display: inline-block;
3
+ width: 16px;
4
+ height: 16px;
5
+ transition: -webkit-transform .5s;
6
+ transition: transform .5s;
7
+ transition: transform .5s, -webkit-transform .5s;
8
+ }
9
+ .v-icon.is-vertical {
10
+ -webkit-transform: scaleY(-1);
11
+ -ms-transform: scaleY(-1);
12
+ transform: scaleY(-1)
13
+ }
14
+ .v-icon.is-horizontal {
15
+ -webkit-transform: scaleX(-1);
16
+ -ms-transform: scaleX(-1);
17
+ transform: scaleX(-1)
18
+ }
19
+ .v-icon--fill {
20
+ fill: #0fb87f;
21
+ }
22
+ .v-icon--stroke {
23
+ stroke: #0fb87f
24
+ }
25
+ a:hover .v-icon .hover,button:hover .v-icon .hover,span:hover .v-icon .hover,svg:hover .v-icon .hover {
26
+ opacity: 1
27
+ }
28
+
29
+ a:hover .v-icon--hover-hide-default,button:hover .v-icon--hover-hide-default,span:hover .v-icon--hover-hide-default,svg:hover .v-icon--hover-hide-default {
30
+ opacity: 0
31
+ }
32
+
33
+ a:active .v-icon .active,button:active .v-icon .active,span:active .v-icon .active,svg:active .v-icon .active {
34
+ opacity: 1
35
+ }
36
+ a:active .v-icon--active-hide-default,a:active .v-icon--active-hide-hover,button:active .v-icon--active-hide-default,button:active .v-icon--active-hide-hover,span:active .v-icon--active-hide-default,span:active .v-icon--active-hide-hover,svg:active .v-icon--active-hide-default,svg:active .v-icon--active-hide-hover {
37
+ opacity: 0
38
+ }
@@ -0,0 +1,92 @@
1
+ .question-text {
2
+ // width: 680px;
3
+ width: 100%;
4
+ }
5
+ .question-text-mobile {
6
+ width: 100%;
7
+ }
8
+ .thought-clps {
9
+ &-title {
10
+ color: rgba(1,11,50,0.41);
11
+ font-size: 12px;
12
+ font-style: normal;
13
+ font-weight: 400;
14
+ line-height: 16px;
15
+ cursor: pointer;
16
+ padding: 12px 0 8px 0;
17
+
18
+ display: flex;
19
+
20
+ align-items: center;
21
+ gap: 4px;
22
+ }
23
+ &-content {
24
+ display: flex;
25
+ flex-direction: column;
26
+ gap: 12px;
27
+ align-self: stretch;
28
+ p {
29
+ margin: 0;
30
+ }
31
+ .thought-title {
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: space-between;
35
+ cursor: pointer;
36
+
37
+ .thought-title-container {
38
+ display: flex;
39
+ align-items: center;
40
+ gap: 5px;
41
+ }
42
+
43
+ .thought-title-icon {
44
+ display: flex;
45
+ width: 16px;
46
+ height: 16px;
47
+ flex-direction: column;
48
+ justify-content: center;
49
+ border-radius: 8px;
50
+ }
51
+
52
+ .thought-title-name {
53
+ color: rgba(0,1,10,0.93);
54
+ font-size: 14px;
55
+ font-style: normal;
56
+ font-weight: 600;
57
+ line-height: normal;
58
+ }
59
+
60
+ .thought-title-elapsed {
61
+ color: rgba(1,11,50,0.41);
62
+ font-family: Monaco;
63
+ font-size: 12px;
64
+ font-style: normal;
65
+ font-weight: 400;
66
+ line-height: normal;
67
+ }
68
+ }
69
+
70
+ .thought-detail {
71
+ display: flex;
72
+ padding: 12px 0;
73
+ gap: 10px;
74
+ border-bottom: 0.5px solid rgba(18,42,79,0.08);
75
+ color: rgba(3,10,38,0.65);
76
+ font-size: 14px;
77
+ font-style: normal;
78
+ font-weight: 400;
79
+ line-height: 20px; /* 142.857% */
80
+
81
+ p {
82
+ word-break: break-all;
83
+ word-wrap: break-word;
84
+ margin: 0;
85
+ }
86
+ &.last-item{
87
+ border-bottom: 1.5px solid #cdd0d9;
88
+
89
+ }
90
+ }
91
+ }
92
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lke-component",
3
- "version": "1.2.22",
3
+ "version": "1.2.23",
4
4
  "main": "dist/lke-component.umd.js",
5
5
  "module": "dist/lke-component.esm.js",
6
6
  "files": [