@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,160 @@
1
+ <script setup>
2
+ import { JsvNinePatch, getKeyFramesGroup, JsvTextureStoreApi } from "jsview";
3
+ import { reactive, onBeforeUnmount, ref } from "vue";
4
+
5
+ const props = defineProps({
6
+ color: {
7
+ type: String,
8
+ default: "#e26c44" // 默认橙色,完全不透明
9
+ },
10
+ borderWidth: {
11
+ type: Number,
12
+ default: 3 // 边框宽度
13
+ },
14
+ initWidth: {
15
+ type: Number,
16
+ default: 0,
17
+ },
18
+ initHeight: {
19
+ type: Number,
20
+ default: 0,
21
+ },
22
+ initLeft: {
23
+ type: Number,
24
+ default: 0,
25
+ },
26
+ initTop: {
27
+ type: Number,
28
+ default: 0,
29
+ },
30
+ });
31
+
32
+ // 创建圆形纹理
33
+ const sourceId = ref('');
34
+ const circleSize = 35; // 保持原有imageWidth的大小
35
+ const canvasRef = JsvTextureStoreApi.canvasTexture(
36
+ circleSize,
37
+ circleSize
38
+ );
39
+
40
+ // 创建圆形路径
41
+ const radius = Math.floor(circleSize / 2);
42
+ const customPath = canvasRef.circlePath(
43
+ radius,
44
+ radius,
45
+ radius - props.borderWidth/2
46
+ );
47
+
48
+ // 设置透明背景
49
+ canvasRef.drawColor("rgba(0,0,0,0)");
50
+
51
+ // 绘制圆形边框
52
+ customPath?.fill(props.color);
53
+
54
+ // 提交并获取纹理ID
55
+ sourceId.value = canvasRef.commit();
56
+
57
+ const styleShell = getKeyFramesGroup();
58
+
59
+ const animationCache = {};
60
+ const addAnimation = (fromRect, toRect, name) => {
61
+ if (animationCache.hasOwnProperty(name)) {
62
+ styleShell?.removeRule(name);
63
+ delete animationCache[name];
64
+ }
65
+ if (!(name in animationCache)) {
66
+ const animStr = `@keyframes ${name} {
67
+ 0% {
68
+ left: ${fromRect.left};
69
+ top: ${fromRect.top};
70
+ width: ${fromRect.width};
71
+ height: ${fromRect.height};
72
+ }
73
+ 50% {
74
+ left: ${Math.min(fromRect.left, toRect.left)};
75
+ top: ${Math.min(fromRect.top, toRect.top)};
76
+ width: ${
77
+ Math.max(fromRect.left + fromRect.width, toRect.left + toRect.width) -
78
+ Math.min(fromRect.left, toRect.left)
79
+ };
80
+ height: ${
81
+ Math.max(fromRect.top + fromRect.height, toRect.top + toRect.height) -
82
+ Math.min(fromRect.top, toRect.top)
83
+ };
84
+ }
85
+ 100% {
86
+ left: ${toRect.left};
87
+ top: ${toRect.top};
88
+ width: ${toRect.width};
89
+ height: ${toRect.height};
90
+ }
91
+ }`;
92
+ animationCache[name] = animStr;
93
+ styleShell.insertRule(animStr);
94
+ }
95
+ };
96
+ const removeAnimation = (name) => {
97
+ styleShell?.removeRule(name);
98
+ };
99
+
100
+ const focusSize = reactive({
101
+ width: props.initWidth,
102
+ height: props.initHeight,
103
+ left: props.initLeft,
104
+ top: props.initTop,
105
+ animation: null,
106
+ onTransitionEnd: null,
107
+ });
108
+
109
+ let animateChange = 0; // A B版动画切换,解决animation属性不变化引起不刷新问题
110
+ let preRect = null;
111
+ let curRect = null;
112
+ let first = true;
113
+
114
+ const changeRect = (rect, doAnim = true) => {
115
+ preRect = curRect;
116
+ curRect = rect;
117
+ if (first) {
118
+ first = false;
119
+ } else if (doAnim) {
120
+ const animName = "test_focusMove_" + animateChange;
121
+ animateChange = animateChange == 0 ? 1 : 0; // A B 版切换
122
+ addAnimation(preRect, curRect, animName);
123
+ focusSize.animation = `${animName} 0.3s linear`;
124
+ }
125
+ focusSize.left = curRect.left;
126
+ focusSize.top = curRect.top;
127
+ focusSize.width = curRect.width;
128
+ focusSize.height = curRect.height;
129
+ };
130
+
131
+ onBeforeUnmount(() => {
132
+ for (let name in animationCache) {
133
+ removeAnimation(name);
134
+ }
135
+ JsvTextureStoreApi.deleteTexture(sourceId.value);
136
+ });
137
+
138
+ defineExpose({
139
+ changeRect,
140
+ });
141
+ </script>
142
+
143
+ <template>
144
+ <jsv-nine-patch
145
+ :style="{
146
+ width: focusSize.width,
147
+ height: focusSize.height,
148
+ top: focusSize.top,
149
+ left: focusSize.left,
150
+ }"
151
+ :animation="focusSize.animation"
152
+ :imageUrl="`jsvtexturestore://${sourceId}`"
153
+ :imageWidth="circleSize"
154
+ :centerWidth="2"
155
+ :imageDspWidth="circleSize"
156
+ :borderOutset="borderWidth"
157
+ :animTime="0.2"
158
+ :waitForInit="true"
159
+ ></jsv-nine-patch>
160
+ </template>
@@ -0,0 +1,63 @@
1
+ <script setup>
2
+ import { onMounted } from "vue";
3
+ const props = defineProps({
4
+ data: Object,
5
+ query: Object,
6
+ onEdge: Function,
7
+ onAction: Object,
8
+ onItemFocus: Function,
9
+ focusRectController: {
10
+ type: Object,
11
+ },
12
+ onItemClick: Function,
13
+ });
14
+
15
+ const customCallbacks = {};
16
+ const selfOnAction = {
17
+ register: (name, func) => {
18
+ customCallbacks[name] = func;
19
+ },
20
+ unregister: (name) => {
21
+ delete customCallbacks[name];
22
+ },
23
+ };
24
+
25
+ const onFocus = (params) => {
26
+ const rect = props.query.templatePosition(props.query.index);
27
+ props.focusRectController?.onFocusChange(rect);
28
+ props.onItemFocus?.(props.data, rect);
29
+ customCallbacks.onFocus?.(params);
30
+ };
31
+
32
+ const onBlur = () => {
33
+ customCallbacks.onBlur?.();
34
+ };
35
+
36
+ const onClicked = () => {
37
+ console.log("item clicked", props.data);
38
+ props.onItemClick?.(props.data);
39
+ customCallbacks.onClick?.();
40
+ };
41
+
42
+ const onGaze = () => {
43
+ customCallbacks.onGaze?.();
44
+ };
45
+
46
+ const onIgnore = () => {
47
+ customCallbacks.onIgnore?.();
48
+ };
49
+
50
+ props.onAction.register("onFocus", onFocus);
51
+ props.onAction.register("onBlur", onBlur);
52
+ props.onAction.register("onClick", onClicked);
53
+ props.onAction.register("onGaze", onGaze);
54
+ props.onAction.register("onIgnore", onIgnore);
55
+
56
+ onMounted(() => {});
57
+ </script>
58
+
59
+ <template>
60
+ <slot name="tabItem" :data="data" :query="query" :onAction="selfOnAction"></slot>
61
+ </template>
62
+
63
+ <style scoped></style>
@@ -0,0 +1,184 @@
1
+ <template>
2
+ <jsv-focus-block
3
+ :name="name"
4
+ :onAction="{
5
+ onFocus,
6
+ onDispatchKeyUp,
7
+ }"
8
+ >
9
+ <tab-widget
10
+ :data="data"
11
+ :name="tabName"
12
+ :onEdge="tabOnEdge"
13
+ :layout="tabLayout"
14
+ :padding="tabPadding"
15
+ :itemGap="tabItemGap"
16
+ :initFocusId="initFocusId"
17
+ :tabTextFontSize="tabTextFontSize"
18
+ :creepFocusColor="creepFocusColor"
19
+ >
20
+ <template #tabItem="{ data, onAction, query }">
21
+ <slot
22
+ name="tabItem"
23
+ :data="data"
24
+ :query="query"
25
+ :onAction="onAction"
26
+ ></slot>
27
+ </template>
28
+ </tab-widget>
29
+ <view-swiper
30
+ :name="contentName"
31
+ :dataLoader="contentDataLoader"
32
+ :onEdge="contentOnEdge"
33
+ :layout="contentLayout"
34
+ :onFocus="contentOnFocus"
35
+ :onBlur="contentOnBlur"
36
+ >
37
+ <template #default="{ data, onEdge }">
38
+ <slot name="content" :data="data" :onEdge="onEdge"></slot>
39
+ </template>
40
+ </view-swiper>
41
+ </jsv-focus-block>
42
+ </template>
43
+
44
+ <script setup>
45
+ /**
46
+ * @slot tabItem - 自定义标签项内容
47
+ * @property {Object} data - 当前标签项数据
48
+ * @property {Object} query - 查询参数对象
49
+ * @property {Function} onAction - 动作处理函数
50
+ *
51
+ * @slot content - 自定义内容区域
52
+ * @property {Object} data - 内容区域数据
53
+ * @property {Function} onEdge - 边缘事件处理函数
54
+ */
55
+
56
+ import TabWidget from "./TabWidget.vue";
57
+ import ViewSwiper from "./ViewSwiper.vue";
58
+ import { ref, reactive, provide } from "vue";
59
+ import { useFocusHub, EdgeDirection } from "jsview";
60
+
61
+ const props = defineProps({
62
+ /** @type {String} 组件唯一标识名称 */
63
+ name: {
64
+ type: String,
65
+ required: true,
66
+ },
67
+ /** @type {Array} 标签数据源 */
68
+ data: {
69
+ type: Array,
70
+ required: true,
71
+ },
72
+ /** @type {Object} 标签栏布局配置 */
73
+ tabLayout: {
74
+ type: Object,
75
+ required: true,
76
+ },
77
+ /** @type {Object} 标签栏内边距配置 */
78
+ tabPadding: {
79
+ type: Object,
80
+ required: true,
81
+ },
82
+ /** @type {Number} 标签项之间的间隔 */
83
+ tabItemGap: {
84
+ type: Number,
85
+ required: true,
86
+ },
87
+ /** @type {Object} 内容区域布局配置 */
88
+ contentLayout: {
89
+ type: Object,
90
+ required: true,
91
+ },
92
+ /** @type {Function} 内容区域数据加载器 */
93
+ contentDataLoader: {
94
+ type: Function,
95
+ required: true,
96
+ },
97
+ /** @type {Number} 初始聚焦项的ID,默认0 */
98
+ initFocusId: {
99
+ type: Number,
100
+ default: 0,
101
+ },
102
+ /** @type {Number} 标签文字字体大小,默认30px */
103
+ tabTextFontSize: {
104
+ type: Number,
105
+ default: 30,
106
+ },
107
+ /** @type {Function} 内容区域获取焦点时的回调 */
108
+ contentOnFocus: {
109
+ type: Function,
110
+ default: () => {},
111
+ },
112
+ /** @type {Function} 内容区域失去焦点时的回调 */
113
+ contentOnBlur: {
114
+ type: Function,
115
+ default: () => {},
116
+ },
117
+ /** @type {String} 聚焦时的颜色,默认#e26c44 */
118
+ creepFocusColor: {
119
+ type: String,
120
+ default: "#e26c44",
121
+ },
122
+ });
123
+ const focusHub = useFocusHub();
124
+ const tabName = `${props.name}-tab`;
125
+ const contentName = `${props.name}-content`;
126
+ let focusName = tabName;
127
+
128
+ const animState = ref(0);
129
+ const globalInfo = reactive({
130
+ tabId: -1,
131
+ updateTabId: -1,
132
+ });
133
+ const getTouchFlag = () => {
134
+ return 0;
135
+ };
136
+ const tabFocus = ref(false);
137
+ const modeIsKey = () => {
138
+ return true;
139
+ };
140
+
141
+ /**
142
+ * 处理组件获取焦点事件
143
+ */
144
+ function onFocus() {
145
+ console.log("ccht onFocus", focusName);
146
+ focusHub.setFocus(focusName);
147
+ }
148
+
149
+ /**
150
+ * 处理标签栏边缘事件
151
+ * @param {Object} edgeInfo - 边缘事件信息
152
+ */
153
+ function tabOnEdge(edgeInfo) {
154
+ console.log("testtest tab on edge");
155
+ if (edgeInfo.direction == EdgeDirection.right) {
156
+ focusHub.setFocus(contentName);
157
+ focusName = contentName;
158
+ }
159
+ }
160
+
161
+ /**
162
+ * 处理内容区域边缘事件
163
+ * @param {Object} edgeInfo - 边缘事件信息
164
+ */
165
+ function contentOnEdge(edgeInfo) {
166
+ if (edgeInfo.direction == EdgeDirection.left) {
167
+ focusHub.setFocus(tabName);
168
+ focusName = tabName;
169
+ }
170
+ }
171
+
172
+ /**
173
+ * 处理按键抬起事件,更新当前标签ID
174
+ */
175
+ const onDispatchKeyUp = () => {
176
+ globalInfo.updateTabId = globalInfo.tabId;
177
+ };
178
+
179
+ provide("animState", animState);
180
+ provide("globalInfo", globalInfo);
181
+ provide("tabFocus", tabFocus);
182
+ provide("modeIsKey", modeIsKey);
183
+ provide("getTouchFlag", getTouchFlag);
184
+ </script>