@shijiu/jsview-vue-samples 2.3.0 → 2.3.151-test.0

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.
Files changed (117) hide show
  1. package/DashPath/App.vue +17 -16
  2. package/DashPath/AppForOperator.vue +2 -4
  3. package/DemoForOperator/AnimPic/AnimPic.vue +24 -2
  4. package/DemoForOperator/Banger/Banger/Banger.vue +73 -9
  5. package/DemoForOperator/Blur/Blur.vue +146 -0
  6. package/DemoForOperator/Blur/BlurInOut/BlurInOut.vue +158 -0
  7. package/DemoForOperator/Blur/BlurInOut/StaticBgSlide.vue +162 -0
  8. package/DemoForOperator/Blur/BlurPopup/BlurPopup.vue +113 -0
  9. package/DemoForOperator/BookFlip/App.vue +115 -0
  10. package/DemoForOperator/BookFlip/BookFlip/FlipPage.vue +179 -0
  11. package/DemoForOperator/BookFlip/BookFlip/FlippingBook.vue +310 -0
  12. package/DemoForOperator/BookFlip/BookFlip/flip.glsl +135 -0
  13. package/DemoForOperator/BookFlip/BookPage.vue +82 -0
  14. package/DemoForOperator/Bounce/Bounce.vue +33 -1
  15. package/DemoForOperator/ChunLian/Couplets.vue +44 -1
  16. package/DemoForOperator/ClickSpriteAnim/App.vue +130 -0
  17. package/DemoForOperator/ClickSpriteAnim/Item.vue +74 -0
  18. package/DemoForOperator/DominantColor/App.vue +187 -0
  19. package/DemoForOperator/EpisodeList/EpisodeList/Controller.vue +0 -3
  20. package/DemoForOperator/EpisodeList/EpisodeList/EpisodeList.vue +76 -2
  21. package/DemoForOperator/Firework1/App.vue +1 -1
  22. package/DemoForOperator/Firework1/Fireworks.vue +50 -11
  23. package/DemoForOperator/FlipPage/FlipPage/FlipPage.vue +29 -1
  24. package/DemoForOperator/Focus/Alpha/AlphaFocusBox.vue +27 -2
  25. package/DemoForOperator/Focus/Light/LightFocusBox.vue +42 -1
  26. package/DemoForOperator/Focus/Normal/NormalFocusBox.vue +12 -0
  27. package/DemoForOperator/FrameShadow/App.vue +193 -0
  28. package/DemoForOperator/FrameShadow/FrameShadow.vue +61 -0
  29. package/DemoForOperator/FullscreenIn/App.vue +1 -1
  30. package/DemoForOperator/FullscreenIn/FullscreenPoster.vue +18 -3
  31. package/DemoForOperator/Genie/geniePakcer/Genie.vue +60 -18
  32. package/DemoForOperator/GrayFilter/GrayFilter.vue +21 -0
  33. package/DemoForOperator/Jigsaw/JigsawFull.vue +46 -4
  34. package/DemoForOperator/Jigsaw/JigsawSingle.vue +34 -2
  35. package/DemoForOperator/LongChatBox/App.vue +36 -0
  36. package/DemoForOperator/LongChatBox/Bubble.vue +104 -0
  37. package/DemoForOperator/LongChatBox/LongChat.vue +173 -0
  38. package/DemoForOperator/LongChatBox/TextManager.ts +147 -0
  39. package/DemoForOperator/LongChatBox/VirtualList.vue +298 -0
  40. package/DemoForOperator/LongChatBox/testData.js +51 -0
  41. package/DemoForOperator/LongChatBox/utile.js +331 -0
  42. package/DemoForOperator/Particle/Drop/DropParticle.vue +33 -1
  43. package/DemoForOperator/Particle/Explode/ExplodeParticle.vue +23 -2
  44. package/DemoForOperator/PosterAnim/PosterAnim.js +21 -0
  45. package/DemoForOperator/PosterOverflow/PosterOverflow.vue +16 -0
  46. package/DemoForOperator/Resize/App.vue +157 -0
  47. package/DemoForOperator/Resize/Resize/Item.vue +234 -0
  48. package/DemoForOperator/Resize/Resize/Resize.vue +96 -0
  49. package/DemoForOperator/Ripple/Ripple.vue +16 -1
  50. package/DemoForOperator/ScreenShootScale/App.vue +96 -0
  51. package/DemoForOperator/ScreenShootScale/Back.vue +86 -0
  52. package/DemoForOperator/ScreenShootScale/Front.vue +133 -0
  53. package/DemoForOperator/ScreenShootScale/Item.vue +62 -0
  54. package/DemoForOperator/ScreenShootScale/ScreenShootScale.vue +109 -0
  55. package/DemoForOperator/SmoothSwiper/App.vue +50 -0
  56. package/DemoForOperator/Sound/Bounce/App.vue +56 -0
  57. package/DemoForOperator/Sound/Bounce/Bounce.vue +87 -0
  58. package/DemoForOperator/Sound/Bounce/FreeMoveBuilder.js +146 -0
  59. package/DemoForOperator/Sound/Bounce/bgmusic.mp3 +0 -0
  60. package/DemoForOperator/Sound/Bounce/coin.mp3 +0 -0
  61. package/DemoForOperator/Sound/FocusMove/App.vue +134 -0
  62. package/DemoForOperator/Sound/FocusMove/Item.vue +43 -0
  63. package/DemoForOperator/Sound/FocusMove/move.mp3 +0 -0
  64. package/DemoForOperator/Sound/Rain/App.vue +11 -0
  65. package/DemoForOperator/Sound/Rain/Raining/Rain.vue +69 -0
  66. package/DemoForOperator/Sound/Rain/Raining/RainScene.vue +118 -0
  67. package/DemoForOperator/Sound/Sound/Sound.vue +24 -0
  68. package/DemoForOperator/Sound/Sound/index.js +4 -0
  69. package/DemoForOperator/Sound/Sound/useSound.js +112 -0
  70. package/DemoForOperator/Sprite/Sprite.vue +62 -5
  71. package/DemoForOperator/Stretch/Stretch/Stretch.vue +52 -2
  72. package/DemoForOperator/Swiper/App.vue +101 -0
  73. package/DemoForOperator/Swiper/Item.vue +56 -0
  74. package/DemoForOperator/Swiper/ParallaxSlide.vue +164 -0
  75. package/DemoForOperator/TabContent/TabContent/TabContent.vue +39 -1
  76. package/DemoForOperator/TabContentVertical/App.vue +104 -0
  77. package/DemoForOperator/TabContentVertical/ContentPage.vue +67 -0
  78. package/DemoForOperator/TabContentVertical/Item.vue +94 -0
  79. package/DemoForOperator/TabContentVertical/PageItem.vue +40 -0
  80. package/DemoForOperator/TabContentVertical/TabContent/CreepFocus.vue +160 -0
  81. package/DemoForOperator/TabContentVertical/TabContent/Item.vue +63 -0
  82. package/DemoForOperator/TabContentVertical/TabContent/TabContent.vue +184 -0
  83. package/DemoForOperator/TabContentVertical/TabContent/TabItem.vue +368 -0
  84. package/DemoForOperator/TabContentVertical/TabContent/TabWidget.vue +259 -0
  85. package/DemoForOperator/TabContentVertical/TabContent/Util.js +3 -0
  86. package/DemoForOperator/TabContentVertical/TabContent/ViewSwiper.vue +110 -0
  87. package/DemoForOperator/TabContentVertical/assets/children_science.png +0 -0
  88. package/DemoForOperator/TabContentVertical/assets/documentary.png +0 -0
  89. package/DemoForOperator/TabContentVertical/assets/free.png +0 -0
  90. package/DemoForOperator/TabContentVertical/assets/game.png +0 -0
  91. package/DemoForOperator/TabContentVertical/assets/home_selected.png +0 -0
  92. package/DemoForOperator/TabContentVertical/assets/movie_ticket.png +0 -0
  93. package/DemoForOperator/TabContentVertical/assets/my_account.png +0 -0
  94. package/DemoForOperator/TabContentVertical/assets/opera.png +0 -0
  95. package/DemoForOperator/TabContentVertical/assets/sports.png +0 -0
  96. package/DemoForOperator/TabContentVertical/assets/tv_drama.png +0 -0
  97. package/DemoForOperator/TabContentVertical/assets/variety_show.png +0 -0
  98. package/DemoForOperator/TabContentVertical/assets/vip.png +0 -0
  99. package/DemoForOperator/TabContentVertical/testData.js +76 -0
  100. package/DemoForOperator/Vortex/Vortex/Vortex.vue +26 -0
  101. package/DemoForOperator/routeList.js +118 -1
  102. package/DemoHomepage/components/Item.vue +11 -0
  103. package/DemoHomepage/router.js +75 -1
  104. package/GiftRain/components/SpriteTranslate.vue +68 -48
  105. package/HashHistory/App.vue +2 -2
  106. package/HashHistory/router.js +1 -1
  107. package/MetroWidgetDemos/TripleWidget/App.vue +7 -1
  108. package/MetroWidgetDemos/TripleWidget/Item.vue +16 -2
  109. package/MetroWidgetDemos/TripleWidget/SWidgetItem.vue +7 -1
  110. package/MetroWidgetDemos/TripleWidget/WidgetItem.vue +8 -2
  111. package/MetroWidgetDemos/routeList.js +17 -0
  112. package/PosterPacker/App.vue +2 -2
  113. package/ViewOpacity/App.vue +19 -0
  114. package/package.json +1 -1
  115. package/DashPath/DashPath.vue +0 -118
  116. package/DemoForOperator/ScalePoster/App.vue +0 -4
  117. package/DemoForOperator/ScalePoster/ScalePoster.vue +0 -0
@@ -0,0 +1,331 @@
1
+ //测试文本
2
+ let string = "# 袁隆平\n\n- **姓名**:袁隆平\n- **出生日期**:1930年9月7日\n- **籍贯**:江西省九江市德安县\n- **职业**:农业科学家、杂交水稻育种专家\n- **主要成就**:成功研究出杂交水稻技术,被誉为“杂交水稻之父”\n- **荣誉**:获得共和国勋章等多项国内外荣誉\n\n袁隆平是中国著名的农业科学家,他致力于杂交水稻的研究,为解决世界粮食问题作出了巨大贡献。\n为您推荐这些好看的影视\n 测试 一级标题\n# 一级标题\n 测试---二级标题\n## 二级标题 \n测试---三级标题\n### 三级标题 \n测试---四级标题\n#### 四级标题 \n测试---五级标题\n##### 五级标题 \n测试---六级级标题\n###### 六级标题 \n 测试---水平线\n--- \n测试---无序列表\n- 无序列表项 1 \n- 无序列表项 2\n- 无序列表项 3\n- 无序列表项 4\n测试---有序列表\n1. 有序列表项 1\n2. 有序列表项 2\n3. 有序列表项 3\n测试---引用\n> 这是个引用\n测试---长段落\n`新华社`北京4月1日电 4月1日,国家主席习近平同印度总统穆尔穆互致贺电,庆祝两国建交75周年\n习近平指出,中国和印度同为文明古国、发展中大国、“全球南方”重要成员,都处在各自现代化建设的关键时期。中印关系发展历程表明,做相互成就的伙伴、实现“龙象共舞”是双方的正确选择,完全符合两国和两国人民根本利益。双方应坚持从战略高度和长远角度看待和处理中印关系,共谋相邻大国和平共处、互信互利、共同发展的相处之道,共同推进世界多极化和国际关系民主化。\n"
3
+
4
+
5
+ function extractBracketsText(markdown) {
6
+ // 正则表达式:匹配 [文本](链接) 格式,捕获中括号内的文本
7
+ const regex = /$(.*?)$$(.*?)$/g;
8
+
9
+ const results = [];
10
+ let match;
11
+
12
+ // 循环提取所有匹配项的中括号内容
13
+ while ((match = regex.exec(markdown)) !== null) {
14
+ results.push(match); // 第一个捕获组(中括号内的文本)
15
+ }
16
+
17
+ return results; // 返回所有匹配的中括号文本数组
18
+ }
19
+ //api
20
+ //text
21
+ //img
22
+ //公式
23
+ export function TypeTransitionApi(string){
24
+ // img 图片
25
+ //gptText 文本
26
+ // div结构 水平线
27
+ if(/^-{3,}/gm.test(string)){
28
+ return 'horizontalLine'
29
+ }
30
+ return 'text' //默认
31
+
32
+
33
+ }
34
+ // md格式 替换 latex 正则
35
+ export function TextTransitionApi(string){
36
+ let tranSting = string
37
+ // 行内代码 、 代码块
38
+ // 水平线
39
+ tranSting = tranSting.replace(/^-{3,}$/gm, ''); //去掉标识
40
+ //加粗
41
+ tranSting = tranSting.replace(/(\*\*|__)(.*?)\1/g, '\\textb{$2}')
42
+ //斜体
43
+ tranSting = tranSting.replace(/(\*|_)(.*?)\1/g, '\\texti{$2}')
44
+ // 删除线
45
+ tranSting = tranSting.replace(/~~(.*?)~~/g, '\\textdecoration{line-through}{$1}')
46
+ //链接这是个[链接](https://example.com)\n
47
+ tranSting = tranSting.replace((/$([^$]+)\]$([^)]+)$/g,'\\textdecoration{underline}{\\textcolor{#FF0000}{$1}}'))
48
+ // tranSting = tranSting.replace(/$(.*?)$$(.*?)$/g, '\\textdecoration{underline}{\\textcolor{#FF0000}{$1}}')
49
+ // `` 行内代码块
50
+ tranSting = tranSting.replace(/`(.*?)`/g, '\\textcolor{#FF0000}{$1}')
51
+
52
+
53
+ // 行内代码
54
+ // .replace(/`(.*?)`/g, '<code>$1</code>')🚨
55
+
56
+ // 图片
57
+ // .replace(/!$(.*?)$$(.*?)$/g, '<img src="$2" alt="$1">')🚨
58
+
59
+ //////////////////////
60
+ //匹配头部 处理
61
+
62
+ // 标题:
63
+ if(/^######\s+(.+)/.test(string)){
64
+ tranSting = tranSting.replace(/^######\s+(.+)/g, '$1');
65
+ }else if(/^#####\s+(.+)/.test(string)){
66
+ tranSting = tranSting.replace(/^#####\s+(.+)/g, '$1');
67
+ }else if(/^####\s+(.+)/.test(string)){
68
+ tranSting = tranSting.replace(/^####\s+(.+)/g, '$1');
69
+ }else if(/^###\s+(.+)/.test(string)){
70
+ tranSting = tranSting.replace(/^###\s+(.+)/g, '$1');
71
+ }else if(/^##\s+(.+)/.test(string)){
72
+ tranSting = tranSting.replace(/^##\s+(.+)/g, '$1');
73
+ }else if(/^#\s+(.+)/.test(string)){
74
+ tranSting = tranSting.replace(/^#\s+(.+)/g, '$1');
75
+ }
76
+ else if (/^\s*[-*+]\s/.test(tranSting)) {
77
+ //无序列表 /●
78
+ // 无序列表
79
+ tranSting = tranSting.replace(/^\s*[-*+]\s+(.*)/, '● $1');
80
+ }else if (/^\s*\d+\.\s/.test(tranSting)) {
81
+ // 有序列表
82
+ tranSting = tranSting.replace(/^\s*(\d+)\.\s+(.*)/, '$1. $2');
83
+ }else if (tranSting.startsWith('> ')) {
84
+ // 引用块 ---- 引用 -- 两个空格
85
+ tranSting = tranSting.replace(/^> (.*)/, '▍ $1');
86
+ }else{
87
+ //段落 四个空格 //首行缩进
88
+ tranSting = ' ' + tranSting
89
+
90
+ }
91
+
92
+ return tranSting
93
+
94
+
95
+
96
+ }
97
+ // md格式 转 样式
98
+ export function StyleTransitionApi(string){
99
+ //特殊的标签进行处理
100
+ const em = 28
101
+ const color = '#ffffff'
102
+ //标题 -- 加粗 、字号、行高
103
+ if(/^######\s+(.+)/.test(string)){
104
+ //h6
105
+ return{
106
+ fontSize: Math.floor(0.8 * em),
107
+ fontWeight:"bold",
108
+ height:Math.floor(1.7*0.8 * em),
109
+ lineHeight:Math.floor(1.7*0.8 * em),
110
+ color:color,
111
+ }
112
+ }
113
+ if(/^#####\s+(.+)/.test(string)){
114
+ //h5
115
+ return{
116
+ fontSize: Math.floor(1 * em),
117
+ fontWeight:"bold",
118
+ height:Math.floor(1.6*1 * em),
119
+ lineHeight:Math.floor(1.6*1 * em),
120
+ color:color,
121
+ }
122
+ }
123
+ if(/^####\s+(.+)/.test(string)){
124
+ //h4
125
+ return{
126
+ fontSize: Math.floor(1.2 * em),
127
+ fontWeight:"bold",
128
+ height:Math.floor(1.5*1.2 * em),
129
+ lineHeight:Math.floor(1.5*1.2 * em),
130
+ color:color,
131
+ }
132
+ }
133
+ if(/^###\s+(.+)/.test(string)){
134
+ //h3
135
+ return{
136
+ fontSize: Math.floor(1.4 * em),
137
+ fontWeight:"bold",
138
+ height:Math.floor(1.4*1.4 * em),
139
+ lineHeight:Math.floor(1.4*1.4 * em),
140
+ color:color,
141
+ }
142
+ }
143
+ if(/^##\s+(.+)/.test(string)){
144
+ //h2
145
+ return{
146
+ fontSize: Math.floor(1.7 * em),
147
+ fontWeight:"bold",
148
+ height:Math.floor(1.3*1.7 * em),
149
+ lineHeight:Math.floor(1.3*1.7 * em),
150
+ color:color,
151
+ }
152
+ }
153
+ if(/^#\s+(.+)/.test(string)){
154
+ //h1
155
+ return{
156
+ fontSize: Math.floor(2 * em),
157
+ fontWeight:"bold",
158
+ height:Math.floor(1.2*2 * em),
159
+ lineHeight:Math.floor(1.2*2 * em),
160
+ color:color,
161
+ }
162
+ }
163
+ // 引用块 ---- 引用 -- 加背景颜色
164
+ if (string.startsWith('> ')) {
165
+ return{
166
+ fontSize: em,
167
+ color:'#cccccc',
168
+ lineHeight:Math.floor(1.6* em),
169
+ //缩进四个字符
170
+ }
171
+ }
172
+ //水平线 --- <hr>
173
+ if(/^-{3,}$/gm.test(string)){
174
+ //父 margin 15 0 32
175
+ return {
176
+ top:18,
177
+ height:4,
178
+ borderRadius:2,
179
+ backgroundColor:color,
180
+ }
181
+ }
182
+
183
+ //默认格式
184
+ return{
185
+ fontSize: em,
186
+ color:color,
187
+ lineHeight:Math.floor(1.6* em),
188
+ }
189
+
190
+
191
+
192
+ }
193
+
194
+ export function StyleTransitionApi2(string){
195
+ //特殊的标签进行处理
196
+ const em = 28
197
+ const color = '#ffffff'
198
+ //标题 -- 加粗 、字号、行高
199
+ if(/^######\s?(.?)/.test(string)){
200
+ //h6
201
+ return{
202
+ fontSize: Math.floor(0.8 * em),
203
+ fontWeight:"bold",
204
+ height:Math.floor(1.7*0.8 * em),
205
+ lineHeight:Math.floor(1.7*0.8 * em),
206
+ color:color,
207
+ }
208
+ }
209
+ if(/^#####\s?(.?)/.test(string)){
210
+ //h5
211
+ return{
212
+ fontSize: Math.floor(1 * em),
213
+ fontWeight:"bold",
214
+ height:Math.floor(1.6*1 * em),
215
+ lineHeight:Math.floor(1.6*1 * em),
216
+ color:color,
217
+ }
218
+ }
219
+ if(/^####\s?(.?)/.test(string)){
220
+ //h4
221
+ return{
222
+ fontSize: Math.floor(1.2 * em),
223
+ fontWeight:"bold",
224
+ height:Math.floor(1.5*1.2 * em),
225
+ lineHeight:Math.floor(1.5*1.2 * em),
226
+ color:color,
227
+ }
228
+ }
229
+ if(/^###\s?(.?)/.test(string)){
230
+ //h3
231
+ return{
232
+ fontSize: Math.floor(1.4 * em),
233
+ fontWeight:"bold",
234
+ height:Math.floor(1.4*1.4 * em),
235
+ lineHeight:Math.floor(1.4*1.4 * em),
236
+ color:color,
237
+ }
238
+ }
239
+ if(/^##\s?(.?)/.test(string)){
240
+ //h2
241
+ return{
242
+ fontSize: Math.floor(1.7 * em),
243
+ fontWeight:"bold",
244
+ height:Math.floor(1.3*1.7 * em),
245
+ lineHeight:Math.floor(1.3*1.7 * em),
246
+ color:color,
247
+ }
248
+ }
249
+ if(/^#\s?(.?)/.test(string)){
250
+ //h1
251
+ return{
252
+ fontSize: Math.floor(2 * em),
253
+ fontWeight:"bold",
254
+ height:Math.floor(1.2*2 * em),
255
+ lineHeight:Math.floor(1.2*2 * em),
256
+ color:color,
257
+ }
258
+ }
259
+ // 引用块 ---- 引用 -- 加背景颜色
260
+ if (string.startsWith('> ')) {
261
+ return{
262
+ fontSize: em,
263
+ color:'#cccccc',
264
+ lineHeight:Math.floor(1.6* em),
265
+ //缩进四个字符
266
+ }
267
+ }
268
+ //水平线 --- <hr>
269
+ if(/^-{3,}$/gm.test(string)){
270
+ //父 margin 15 0 32
271
+ return {
272
+ top:18,
273
+ height:4,
274
+ borderRadius:2,
275
+ backgroundColor:color,
276
+ }
277
+ }
278
+
279
+ //默认格式
280
+ return{
281
+ fontSize: em,
282
+ color:color,
283
+ lineHeight:Math.floor(1.6* em),
284
+ }
285
+
286
+
287
+
288
+ }
289
+
290
+
291
+ //api:未能开发:图片、表格 、代码块 、公式
292
+ export function splitWithNewlines(str) {
293
+ // 匹配所有换行符类型(\r\n, \n, \r)并保留
294
+ return str.split(/(\r\n|\n|\r)/)
295
+ .reduce((acc, part, i, arr) => {
296
+ // 将换行符与前一个元素合并
297
+ if (i % 2 === 0) {
298
+ const newline = arr[i + 1] || '';
299
+ acc.push(part + newline);
300
+ }
301
+ return acc;
302
+ }, []);
303
+ }
304
+
305
+ //长文本 分块函数
306
+ export function splitStringByLength(str) {
307
+ const result = [];
308
+ const chunkSize = 112;
309
+ const minLastChunk = 10;
310
+
311
+ // 遍历字符串按 150 长度分块
312
+ for (let i = 0; i < str.length; i += chunkSize) {
313
+ const chunk = str.slice(i, i + chunkSize);
314
+ result.push(chunk);
315
+ }
316
+
317
+ // 处理最后一块的逻辑
318
+ if (result.length > 1) {
319
+ const lastChunk = result[result.length - 1];
320
+ if (lastChunk.length < minLastChunk) {
321
+ result.pop(); // 移除最后一块
322
+ result[result.length - 1] += lastChunk; // 合并到前一块
323
+ }
324
+ }
325
+
326
+ return result;
327
+ }
328
+
329
+
330
+
331
+
@@ -48,23 +48,51 @@ import { JsvSpray } from "jsview";
48
48
  import { ref, onBeforeUnmount, onMounted } from "vue";
49
49
 
50
50
  const props = defineProps({
51
+ /**
52
+ * 粒子图片资源URL列表
53
+ * @type {Array}
54
+ * @required
55
+ */
51
56
  urlList: {
52
57
  type: Array,
53
58
  required: true,
54
59
  },
60
+ /**
61
+ * 是否自动开始动画
62
+ * @type {Boolean}
63
+ * @default true
64
+ */
55
65
  autoStart: {
56
66
  type: Boolean,
57
67
  default: true,
58
68
  },
69
+ /**
70
+ * 粒子容器布局配置
71
+ * @type {Object}
72
+ * @required
73
+ * @property {string} left - CSS left值
74
+ * @property {string} top - CSS top值
75
+ * @property {string} width - 容器宽度
76
+ * @property {string} height - 容器高度
77
+ */
59
78
  layout: {
60
79
  type: Object,
61
80
  required: true,
62
81
  },
63
- // low, middle, high
82
+ /**
83
+ * 粒子数量级别
84
+ * @type {'low'|'middle'|'high'}
85
+ * @default 'middle'
86
+ */
64
87
  numLevel: {
65
88
  type: String,
66
89
  default: "middle",
67
90
  },
91
+ /**
92
+ * 粒子生成速度级别
93
+ * @type {'low'|'middle'|'high'}
94
+ * @default 'middle'
95
+ */
68
96
  sprayLevel: {
69
97
  type: String,
70
98
  default: "middle",
@@ -150,6 +178,10 @@ let list3 = sprayInfos.slice(3);
150
178
 
151
179
  let show = ref(false);
152
180
  let timeoutHandler = -1;
181
+ /**
182
+ * 启动粒子动画
183
+ * @expose 通过defineExpose暴露给父组件调用
184
+ */
153
185
  function start() {
154
186
  show.value = true;
155
187
  timeoutHandler = setTimeout(() => {
@@ -25,14 +25,31 @@ import { JsvSpray } from "jsview";
25
25
  import { shallowRef, computed } from "vue";
26
26
 
27
27
  const props = defineProps({
28
+ /**
29
+ * 粒子容器的布局配置
30
+ * @type {Object}
31
+ * @property {string} left - 左定位(带单位)
32
+ * @property {string} top - 上定位(带单位)
33
+ * @property {number} width - 容器宽度
34
+ * @property {number} height - 容器高度
35
+ */
28
36
  layout: {
29
37
  type: Object,
30
- requreid: true,
38
+ required: true,
31
39
  },
40
+ /**
41
+ * 粒子图片URL列表
42
+ * @type {Array<string>}
43
+ */
32
44
  urlList: {
33
45
  type: Array,
34
46
  required: true,
35
47
  },
48
+ /**
49
+ * 粒子密度级别
50
+ * @type {'low'|'middle'|'high'}
51
+ * @default 'middle'
52
+ */
36
53
  numLevel: {
37
54
  type: String,
38
55
  default: "middle",
@@ -53,7 +70,7 @@ function getTotalParticleNum() {
53
70
  case "high":
54
71
  return 150;
55
72
  default:
56
- 400;
73
+ return 400;
57
74
  }
58
75
  }
59
76
 
@@ -92,6 +109,10 @@ let sprayStyle = {
92
109
  };
93
110
 
94
111
  defineExpose({
112
+ /**
113
+ * 触发粒子动画开始
114
+ * @description 通过改变token值强制重新渲染组件来启动动画
115
+ */
95
116
  start() {
96
117
  ++token.value;
97
118
  },
@@ -5,6 +5,27 @@ const scaleLevel = [1.03, 1.07, 1.1];
5
5
  const shaleLevel = [1, 3, 5];
6
6
 
7
7
  let styleSheet = null;
8
+
9
+ /**
10
+ * 获取海报动画配置
11
+ * @param {string} type - 动画类型,可选值:
12
+ * 'bounce-left' - 向左弹跳
13
+ * 'bounce-bottom' - 向下弹跳
14
+ * 'bounce-right' - 向右弹跳
15
+ * 'bounce-top' - 向上弹跳
16
+ * 'shake' - 摇晃
17
+ * 'scale' - 缩放
18
+ * 'breath' - 呼吸效果
19
+ * @param {Object} params - 动画参数
20
+ * @param {'low'|'middle'|'high'} params.level - 动画幅度级别
21
+ * @param {number} [params.scale0] - scale动画的起始缩放值
22
+ * @param {number} [params.scale1] - scale动画的中间缩放值
23
+ * @param {number} [params.scale] - breath动画的缩放值
24
+ * @returns {Object} 动画配置对象
25
+ * @property {string} name - 动画名称
26
+ * @property {Function} release - 释放动画资源的函数
27
+ */
28
+
8
29
  export function getPosterAnim(type, params) {
9
30
  if (!styleSheet) {
10
31
  styleSheet = getKeyFramesGroup();
@@ -7,16 +7,32 @@
7
7
 
8
8
  <script setup>
9
9
  import { ref, watchEffect, computed } from "vue";
10
+
10
11
  const props = defineProps({
12
+ /**
13
+ * 控制图片显示类型
14
+ * @type {'small' | 'large'}
15
+ */
11
16
  showType: {
12
17
  type: String,
13
18
  },
19
+ /**
20
+ * 大图位置样式配置对象
21
+ * @type {Object}
22
+ * @property {string} position - 定位方式
23
+ * @property {string} width - 宽度
24
+ * @property {string} height - 高度
25
+ * @property {string} left - 左侧位置
26
+ * @property {string} top - 顶部位置
27
+ */
14
28
  largePos: {
15
29
  type: Object,
16
30
  },
17
31
  });
18
32
 
19
33
  const imgType = ref("small");
34
+
35
+ // 监听showType变化更新图片类型
20
36
  watchEffect(() => {
21
37
  imgType.value = props.showType;
22
38
  });
@@ -0,0 +1,157 @@
1
+ <template>
2
+ <div
3
+ :style="{
4
+ width: 1280,
5
+ height: 720,
6
+ backgroundColor: '#007788',
7
+ }"
8
+ ></div>
9
+ <div
10
+ :style="{
11
+ left: 300,
12
+ top: 100,
13
+ }"
14
+ >
15
+ <Resize
16
+ name="resize"
17
+ :provideData="provideData"
18
+ :measures="measures"
19
+ :initFocusId="0"
20
+ :layout="widgetLayout"
21
+ :padding="padding"
22
+ :onEdge="onEdge"
23
+ :anim="anim"
24
+ >
25
+ <template #itemLarge="{ data }">
26
+ <div
27
+ :style="{
28
+ width: 400,
29
+ height: 120,
30
+ backgroundColor: '#0F0',
31
+ fontSize: 30,
32
+ transition,
33
+ }"
34
+ >
35
+ {{ "测试文字" + data.content + "测试文字" }}
36
+ </div>
37
+ </template>
38
+ <template #itemSmall="{ data, focused }">
39
+ <div
40
+ :style="{
41
+ width: focused ? 120 : 100,
42
+ height: focused ? 120 : 100,
43
+ backgroundColor: '#F00',
44
+ fontSize: 30,
45
+ transition,
46
+ }"
47
+ >
48
+ {{ data.content + (data.resizable ? "展开" : "不展开") }}
49
+ </div>
50
+ </template>
51
+ <template #itemLeftEdge>
52
+ <div
53
+ :style="{
54
+ width: 10,
55
+ height: 10,
56
+ backgroundColor: '#00F',
57
+ }"
58
+ ></div>
59
+ </template>
60
+ <template #itemRightEdge>
61
+ <div
62
+ :style="{
63
+ left: 90,
64
+ width: 10,
65
+ height: 10,
66
+ backgroundColor: '#00F',
67
+ }"
68
+ ></div>
69
+ </template>
70
+ </Resize>
71
+ </div>
72
+ </template>
73
+
74
+ <script setup>
75
+ import Resize from "./Resize/Resize.vue";
76
+ import { useFocusHub } from "jsview";
77
+ import { onMounted } from "vue";
78
+
79
+ const randomColor = () => {
80
+ let randomColor = Math.round(Math.random() * 2 ** 24).toString(16);
81
+ return (
82
+ "#" + new Array(6 - randomColor.length).fill("0").join("") + randomColor
83
+ );
84
+ };
85
+
86
+ const anim = {
87
+ duration: 200,
88
+ easing: "jsv-ease(0.2, 0.6, 2)",
89
+ };
90
+
91
+ const transition = `left ${anim.duration / 1000}s ${anim.easing}, top ${
92
+ anim.duration / 1000
93
+ }s ${anim.easing}, width ${anim.duration / 1000}s ${anim.easing}, height ${
94
+ anim.duration / 1000
95
+ }s ${anim.easing}`;
96
+
97
+ const focusHub = useFocusHub();
98
+ const dataLength = 15;
99
+ const provideData = () => {
100
+ const data = [];
101
+ for (let i = 0; i < dataLength; ++i) {
102
+ data.push({
103
+ width: 100,
104
+ height: 100,
105
+ marginRight: 10,
106
+ color: randomColor(),
107
+ content: i,
108
+ resizable: i !== 5,
109
+ resizeDelay: 1000,
110
+ blurSize: {
111
+ w: 100,
112
+ h: 100,
113
+ },
114
+ focusSize: {
115
+ w: 120,
116
+ h: 120,
117
+ },
118
+ expandSize: {
119
+ w: 400,
120
+ h: 120,
121
+ },
122
+ });
123
+ }
124
+ return data;
125
+ };
126
+
127
+ const measures = (data) => {
128
+ return {
129
+ width: data.width,
130
+ height: data.height,
131
+ marginRight: data.marginRight,
132
+ marginBottom: data.marginBottom,
133
+ };
134
+ };
135
+
136
+ const onEdge = (edgeInfo) => {
137
+ console.log("onEdge");
138
+ };
139
+
140
+ const widgetLayout = {
141
+ left: 0,
142
+ top: 0,
143
+ width: 700,
144
+ height: 200,
145
+ };
146
+
147
+ const padding = {
148
+ left: 80,
149
+ top: 50,
150
+ right: 80,
151
+ bottom: 50,
152
+ };
153
+
154
+ onMounted(() => {
155
+ focusHub.setFocus("resize");
156
+ });
157
+ </script>