@shijiu/jsview-vue 0.0.1-beta.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 (252) hide show
  1. package/docs/IMPORT_CHANGE_LOG.txt +3 -0
  2. package/docs/git_commit.md +15 -0
  3. package/docs/test_version_up.txt +1 -0
  4. package/dom/bin/jsview-dom-1.0.313.tgz +0 -0
  5. package/dom/browser-root-style.css +21 -0
  6. package/dom/jsv-browser-debug-dom.js +8 -0
  7. package/dom/jsv-dom.js +6 -0
  8. package/dom/jsv-forge-define.js +6 -0
  9. package/dom/target_core_revision.js +14 -0
  10. package/load/header_script_loader.js +134 -0
  11. package/load/jsview-main.js +42 -0
  12. package/load/jsview.config.default.js +37 -0
  13. package/load/jsview.default.config.js +37 -0
  14. package/load/loader.js +172 -0
  15. package/load/loader_webkit.js +40 -0
  16. package/package.json +27 -0
  17. package/patch/node_modules/@babel/preset-env/lib/available-plugins.js +219 -0
  18. package/patch/node_modules/@vue/cli-plugin-typescript/index.js +100 -0
  19. package/patch/node_modules/@vue/cli-service/lib/commands/serve.js +395 -0
  20. package/patch/node_modules/@vue/cli-service/lib/config/app.js +272 -0
  21. package/patch/node_modules/@vue/cli-service/lib/config/assets.js +70 -0
  22. package/patch/node_modules/@vue/cli-service/lib/config/base.js +212 -0
  23. package/patch/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +2566 -0
  24. package/patch/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +274 -0
  25. package/patch/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1596 -0
  26. package/patch/node_modules/postcss-js/objectifier.js +90 -0
  27. package/patch/node_modules/vue-loader/dist/resolveScript.js +70 -0
  28. package/patch/package-lock.json +30051 -0
  29. package/samples/AdvanceMetroWidget/App.vue +123 -0
  30. package/samples/AdvanceMetroWidget/Frame.vue +101 -0
  31. package/samples/AdvanceMetroWidget/Item.vue +58 -0
  32. package/samples/AdvanceMetroWidget/data.js +137 -0
  33. package/samples/AnimPicture/App.vue +224 -0
  34. package/samples/AnimPicture/assets/animated_webp.webp +0 -0
  35. package/samples/AnimPicture/assets/ball_3.webp +0 -0
  36. package/samples/AnimPicture/assets/girl_run.gif +0 -0
  37. package/samples/AnimPicture/assets/quan.webp +0 -0
  38. package/samples/Basic/App.vue +129 -0
  39. package/samples/Basic/assets/border.png +0 -0
  40. package/samples/Basic/assets/border2.png +0 -0
  41. package/samples/Basic/assets/icon.png +0 -0
  42. package/samples/Basic/assets/test.jpg +0 -0
  43. package/samples/Basic/components/ContentBlock.vue +36 -0
  44. package/samples/Basic/components/FontStyle.css +10 -0
  45. package/samples/Basic/components/TitleBar.vue +29 -0
  46. package/samples/Basic/components/anim/AnimGroup.vue +68 -0
  47. package/samples/Basic/components/anim/AnimKeyframeBasic.vue +102 -0
  48. package/samples/Basic/components/anim/AnimKeyframeComposite.vue +53 -0
  49. package/samples/Basic/components/anim/AnimTransition.vue +116 -0
  50. package/samples/Basic/components/div/DivBackground.vue +15 -0
  51. package/samples/Basic/components/div/DivClip.vue +81 -0
  52. package/samples/Basic/components/div/DivCssScoped.vue +27 -0
  53. package/samples/Basic/components/div/DivCssVar.vue +50 -0
  54. package/samples/Basic/components/div/DivGroup1.vue +33 -0
  55. package/samples/Basic/components/div/DivGroup2.vue +41 -0
  56. package/samples/Basic/components/div/DivLayout.vue +12 -0
  57. package/samples/Basic/components/div/DivRadius.vue +47 -0
  58. package/samples/Basic/components/text/TextAlign.vue +48 -0
  59. package/samples/Basic/components/text/TextFontStyle.vue +58 -0
  60. package/samples/Basic/components/text/TextGroup.vue +32 -0
  61. package/samples/Basic/components/text/TextOverflow.vue +78 -0
  62. package/samples/BasicFocusControl/App.vue +125 -0
  63. package/samples/BasicFocusControl/components/BaseBlock.vue +51 -0
  64. package/samples/BasicFocusControl/components/MainArea.vue +98 -0
  65. package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +21 -0
  66. package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +30 -0
  67. package/samples/BasicFocusControl/components/SideBar.vue +73 -0
  68. package/samples/BasicFocusControl/components/SideBarBlock.vue +30 -0
  69. package/samples/ClassNameDemo/App.vue +119 -0
  70. package/samples/ClassNameDemo/assets/bg.jpg +0 -0
  71. package/samples/ClassNameDemo/assets/coupon_content.png +0 -0
  72. package/samples/ClassNameDemo/assets/coupon_left.png +0 -0
  73. package/samples/ClassNameDemo/assets/coupon_mid.png +0 -0
  74. package/samples/ClassNameDemo/assets/coupon_right.png +0 -0
  75. package/samples/ClassNameDemo/assets/focus_border.png +0 -0
  76. package/samples/ClassNameDemo/assets/holder_logo.png +0 -0
  77. package/samples/ClassNameDemo/assets/jrbm.png +0 -0
  78. package/samples/ClassNameDemo/assets/line_left.png +0 -0
  79. package/samples/ClassNameDemo/assets/line_mid.png +0 -0
  80. package/samples/ClassNameDemo/assets/line_right.png +0 -0
  81. package/samples/ClassNameDemo/assets/loading.png +0 -0
  82. package/samples/ClassNameDemo/assets/logo.png +0 -0
  83. package/samples/ClassNameDemo/assets/mcjx.png +0 -0
  84. package/samples/ClassNameDemo/assets/tao.png +0 -0
  85. package/samples/ClassNameDemo/assets/tmall.png +0 -0
  86. package/samples/ClassNameDemo/components/ContentItem.vue +253 -0
  87. package/samples/ClassNameDemo/components/LoadingView.vue +43 -0
  88. package/samples/ClassNameDemo/components/TitleView.vue +24 -0
  89. package/samples/ClassNameDemo/data.js +24 -0
  90. package/samples/ColorSpace/App.vue +135 -0
  91. package/samples/ColorSpace/bmpDemo.bmp +0 -0
  92. package/samples/ColorSpace/jpegDemo.jpeg +0 -0
  93. package/samples/ColorSpace/pngDemo.png +0 -0
  94. package/samples/ColorSpace/pngNoAlphaDemo.png +0 -0
  95. package/samples/DemoHomepage/App.vue +31 -0
  96. package/samples/DemoHomepage/components/BodyFrame.vue +82 -0
  97. package/samples/DemoHomepage/components/Dialog.vue +94 -0
  98. package/samples/DemoHomepage/components/Item.vue +77 -0
  99. package/samples/DemoHomepage/components/TabFrame.vue +86 -0
  100. package/samples/DemoHomepage/router.js +132 -0
  101. package/samples/DemoHomepage/views/Homepage.vue +186 -0
  102. package/samples/FlipCard/App.vue +80 -0
  103. package/samples/FlipCard/FlipCard.vue +124 -0
  104. package/samples/FlipCard/assets/blue_egg.png +0 -0
  105. package/samples/FlipCard/assets/red_egg.png +0 -0
  106. package/samples/FlipCard/data.js +13 -0
  107. package/samples/FlowMultiWidget/App.vue +91 -0
  108. package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
  109. package/samples/FlowMultiWidget/components/Block.vue +107 -0
  110. package/samples/FlowMultiWidget/components/FlowPage.vue +60 -0
  111. package/samples/FlowMultiWidget/components/Item.vue +103 -0
  112. package/samples/FlowMultiWidget/components/MenuItem.vue +72 -0
  113. package/samples/FlowMultiWidget/components/MyMenu.vue +90 -0
  114. package/samples/FlowMultiWidget/data.js +446 -0
  115. package/samples/HashHistory/App.vue +124 -0
  116. package/samples/HashHistory/components/HorizontalButtonList.vue +114 -0
  117. package/samples/HashHistory/components/Item.vue +74 -0
  118. package/samples/HashHistory/router.js +30 -0
  119. package/samples/HashHistory/views/BasePage.vue +19 -0
  120. package/samples/HashHistory/views/MainPage.vue +68 -0
  121. package/samples/HashHistory/views/SubPage.vue +79 -0
  122. package/samples/HashHistory/views/SubPageFirst.vue +10 -0
  123. package/samples/HashHistory/views/SubPageSecond.vue +10 -0
  124. package/samples/LongImage/App.vue +96 -0
  125. package/samples/LongImage/Button.vue +153 -0
  126. package/samples/LongImage/LongImageScroll.vue +127 -0
  127. package/samples/LongImage/Scroll.vue +16 -0
  128. package/samples/LongImage/assets/1280x7200.jpg +0 -0
  129. package/samples/LongText/App.vue +111 -0
  130. package/samples/LongText/Button.vue +153 -0
  131. package/samples/LongText/LongTextScroll.vue +225 -0
  132. package/samples/LongText/Scroll.vue +16 -0
  133. package/samples/Preload/App.vue +146 -0
  134. package/samples/Preload/data.js +23 -0
  135. package/samples/Preload/images/awesomeface.png +0 -0
  136. package/samples/Preload/images/cat.jpg +0 -0
  137. package/samples/Preload/images/rank.png +0 -0
  138. package/samples/Preload/images/rank_focus.png +0 -0
  139. package/samples/Preload/images/rule.png +0 -0
  140. package/samples/Preload/images/rule_focus.png +0 -0
  141. package/samples/Preload/images/start.png +0 -0
  142. package/samples/Preload/images/start_focus.png +0 -0
  143. package/samples/Preload/preloadItem.vue +22 -0
  144. package/samples/QrcodeDemo/App.vue +73 -0
  145. package/samples/SimpleWidgetDemo/App.vue +204 -0
  146. package/samples/SimpleWidgetDemo/Item.vue +83 -0
  147. package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
  148. package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
  149. package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
  150. package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
  151. package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
  152. package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
  153. package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
  154. package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
  155. package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
  156. package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
  157. package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
  158. package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
  159. package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
  160. package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
  161. package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
  162. package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
  163. package/samples/SimpleWidgetDemo/border.png +0 -0
  164. package/samples/SimpleWidgetDemo/components/ContentItem.vue +412 -0
  165. package/samples/SimpleWidgetDemo/components/MyTab.vue +117 -0
  166. package/samples/SimpleWidgetDemo/data.js +110 -0
  167. package/samples/SprayView/App.vue +270 -0
  168. package/samples/SprayView/assets/snow.png +0 -0
  169. package/samples/SpriteImage/App.vue +174 -0
  170. package/samples/SpriteImage/images/cat_run.png +0 -0
  171. package/samples/SpriteImage/images/egg_break.json +116 -0
  172. package/samples/SpriteImage/images/egg_break.png +0 -0
  173. package/samples/SpriteImage/images/sprite.png +0 -0
  174. package/samples/TextBox/App.vue +179 -0
  175. package/samples/TextBox/RenderCenter.vue +109 -0
  176. package/samples/TextBox/RenderLeft.vue +109 -0
  177. package/samples/TextBox/RenderOneLine.vue +120 -0
  178. package/samples/TextBox/RenderRight.vue +107 -0
  179. package/samples/TextShadowDemo/App.vue +98 -0
  180. package/samples/TextureSize/App.vue +142 -0
  181. package/samples/TextureSize/bmpDemo.bmp +0 -0
  182. package/samples/TextureSize/jpegDemo.jpeg +0 -0
  183. package/samples/TextureSize/jpgDemo.jpg +0 -0
  184. package/samples/TextureSize/pngDemo.png +0 -0
  185. package/samples/TextureSize/pngNoAlphaDemo.png +0 -0
  186. package/samples/ThrowMoveDemo/AccelerateDemo.vue +118 -0
  187. package/samples/ThrowMoveDemo/App.vue +114 -0
  188. package/samples/ThrowMoveDemo/LRParabolicDemo.vue +116 -0
  189. package/samples/ThrowMoveDemo/TargetDemo.vue +117 -0
  190. package/samples/ThrowMoveDemo/UDParabolicDemo.vue +122 -0
  191. package/samples/TransitPage/App.vue +41 -0
  192. package/samples/VideoDemo/App.vue +137 -0
  193. package/samples/VideoDemo/components/Button.vue +69 -0
  194. package/samples/VideoDemo/components/Controllor.vue +195 -0
  195. package/samples/VideoDemo/components/VideoFrame.vue +152 -0
  196. package/scripts/git-commit-empty.js +21 -0
  197. package/scripts/install-local-packages.js +121 -0
  198. package/scripts/make-js.sh +181 -0
  199. package/scripts/post-build.js +132 -0
  200. package/scripts/post-install.js +127 -0
  201. package/scripts/pre-pack.js +2 -0
  202. package/scripts/run-android.js +64 -0
  203. package/utils/JsViewEngineWidget/bin/shijiu-jsview-vue-widget-1.0.1.tgz +0 -0
  204. package/utils/JsViewEngineWidget/index.d.ts +32 -0
  205. package/utils/JsViewEngineWidget/index.js +6 -0
  206. package/utils/JsViewVueTools/DebugContentShellJBridge.js +16 -0
  207. package/utils/JsViewVueTools/DebugTool.js +21 -0
  208. package/utils/JsViewVueTools/DefaultKeyMap.js +12 -0
  209. package/utils/JsViewVueTools/JsvDynamicCssStyle.js +73 -0
  210. package/utils/JsViewVueTools/JsvDynamicKeyFrames.js +128 -0
  211. package/utils/JsViewVueTools/JsvHashHistory.js +112 -0
  212. package/utils/JsViewVueTools/JsvRuntimeBridge.js +417 -0
  213. package/utils/JsViewVueTools/JsvStyleClass.js +290 -0
  214. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +80 -0
  215. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +148 -0
  216. package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +55 -0
  217. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/ApicDataBase.js +29 -0
  218. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +124 -0
  219. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/GifData.js +83 -0
  220. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/LoopToolBase.js +25 -0
  221. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/NormalLoopTool.js +61 -0
  222. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/PartLoopTool.js +119 -0
  223. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/Viewer.js +106 -0
  224. package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/WebpData.js +141 -0
  225. package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetLoader.js +20 -0
  226. package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetWrapper.js +11 -0
  227. package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +204 -0
  228. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +64 -0
  229. package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +427 -0
  230. package/utils/JsViewVueWidget/JsvActorMove/index.js +12 -0
  231. package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +179 -0
  232. package/utils/JsViewVueWidget/JsvApic/index.js +17 -0
  233. package/utils/JsViewVueWidget/JsvMarquee.vue +197 -0
  234. package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +92 -0
  235. package/utils/JsViewVueWidget/JsvNinePatch.vue +76 -0
  236. package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +351 -0
  237. package/utils/JsViewVueWidget/JsvPreload/index.js +21 -0
  238. package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +140 -0
  239. package/utils/JsViewVueWidget/JsvQrcode/index.js +18 -0
  240. package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +140 -0
  241. package/utils/JsViewVueWidget/JsvSpray/index.js +15 -0
  242. package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +448 -0
  243. package/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.js +57 -0
  244. package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +6 -0
  245. package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +35 -0
  246. package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +495 -0
  247. package/utils/JsViewVueWidget/JsvSwiper/index.js +10 -0
  248. package/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue +35 -0
  249. package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +404 -0
  250. package/utils/JsViewVueWidget/JsvSwiper3D/index.js +10 -0
  251. package/utils/JsViewVueWidget/JsvTextBox.vue +111 -0
  252. package/utils/JsViewVueWidget/JsvVideo.vue +36 -0
@@ -0,0 +1,123 @@
1
+ <!--
2
+ * 【界面概述】
3
+ * 展示SimpleWidget控件的嵌套用法
4
+ *
5
+ * 【控件介绍】
6
+ * SimpleWidget:见simpleMetroWidget
7
+ * SWidgetDispatcher:向SimpleWidget分发消息的对象,用于设置SimpleWidget内部状态
8
+ * 成员函数:
9
+ * dispatch
10
+ * @params msg {obj} 消息体,{type: SWidgetDispatcher.Type, data: 数据}
11
+ * SWidgetDispatcher.Type: 消息的类型
12
+ * "setFocusId": Focus时初始的焦点id data为int
13
+ * "setFocusRect": Focus时距离某区域最近的item获得焦点 data为{type:EdgeDirection, rect:{x:0, y:0, widht:0, height:0}}
14
+ * "updateItem": 重新描画某个item data为int
15
+ * "slideToItem": 界面移到某个item处 data为int
16
+ *
17
+ *
18
+ * 【技巧说明】
19
+ * Q: 如何实现嵌套?
20
+ * A: 当SimpleWidget的measure回调返回值中hasSub为true时,该item的renderItem就可以返回可获得焦点的控件
21
+ *
22
+ * Q: 如何实现焦点的就近切换?
23
+ * A: 通过dispatcher向将要获得焦点的控件发送setFocusRect消息。
24
+ -->
25
+
26
+ <script>
27
+ import { frameData, itemData } from "./data";
28
+ import {
29
+ HORIZONTAL,
30
+ SimpleWidget,
31
+ } from "jsview/utils/JsViewEngineWidget";
32
+ import Frame from "./Frame.vue";
33
+
34
+ const measures = (item) => {
35
+ return {
36
+ width: item.blocks.w,
37
+ height: item.blocks.h,
38
+ focusable: item.focusable,
39
+ hasSub: item.hasSub,
40
+ };
41
+ };
42
+ export default {
43
+ components: { SimpleWidget, Frame },
44
+ setup() {
45
+ return {
46
+ measures,
47
+ name: "/advanceMetroWidget",
48
+ direction: HORIZONTAL,
49
+ frameData,
50
+ itemData,
51
+ };
52
+ },
53
+ methods: {
54
+ onKeyDown(ev) {
55
+ // 8:Backspace, 27:Escape, 10000:盒子返回键
56
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
57
+ this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
58
+ return true;
59
+ }
60
+ return false;
61
+ },
62
+ onFocus() {
63
+ this.$refs.focusNode.findBlockByName("/advanceMetroWidget").requestFocus();
64
+ },
65
+ },
66
+
67
+ data() {
68
+ return {};
69
+ },
70
+ mounted() {},
71
+ };
72
+ </script>
73
+
74
+ <template>
75
+ <div class="rootSize">
76
+ <jsv-focus-block
77
+ autoFocus
78
+ ref="focusNode"
79
+ :onAction="{
80
+ onKeyDown: onKeyDown,
81
+ onFocus: onFocus,
82
+ }"
83
+ >
84
+ <simple-widget
85
+ :name="name"
86
+ :data="frameData"
87
+ :width="680"
88
+ :height="680"
89
+ :direction="direction"
90
+ :measures="measures"
91
+ >
92
+ <template #renderItem="{ data, query, onEdge, onAction }">
93
+ <frame
94
+ :name="name + '/frame_' + query.id"
95
+ :data="data"
96
+ :itemData="itemData"
97
+ :query="query"
98
+ :onEdge="onEdge"
99
+ :onAction="onAction"
100
+ />
101
+ </template>
102
+ </simple-widget>
103
+ </jsv-focus-block>
104
+ </div>
105
+ </template>
106
+
107
+ <style scoped>
108
+ .rootSize {
109
+ width: 1920;
110
+ height: 1080;
111
+ background-color: #334c4c;
112
+ }
113
+
114
+ .widgetPos {
115
+ top: 120;
116
+ left: 50;
117
+ }
118
+
119
+ .focusPos {
120
+ top: 10;
121
+ left: 10;
122
+ }
123
+ </style>
@@ -0,0 +1,101 @@
1
+ <script>
2
+ import {
3
+ HORIZONTAL,
4
+ SimpleWidget,
5
+ SWidgetDispatcher,
6
+ } from "jsview/utils/JsViewEngineWidget";
7
+ import Item from "./Item.vue";
8
+
9
+ export default {
10
+ components: { SimpleWidget, Item },
11
+ props: {
12
+ itemData: Object,
13
+ data: Object,
14
+ query: Object,
15
+ onEdge: Function,
16
+ onAction: Object,
17
+ name: String,
18
+ },
19
+ data() {
20
+ return {};
21
+ },
22
+ setup() {
23
+ let dispatcher = new SWidgetDispatcher();
24
+ return {
25
+ direction: HORIZONTAL,
26
+ dispatcher,
27
+ };
28
+ },
29
+ methods: {
30
+ onFocus(enterRect) {
31
+ if (enterRect) {
32
+ const foucsInfo = {
33
+ type: SWidgetDispatcher.Type.setFocusRect,
34
+ data: enterRect,
35
+ };
36
+ this.dispatcher.dispatch(foucsInfo);
37
+ }
38
+ this.$refs.focusNode.findBlockByName(this.name).requestFocus();
39
+ },
40
+ onBlur() {},
41
+ onClick() {},
42
+ measures(item) {
43
+ return {
44
+ width: item.blocks.w,
45
+ height: item.blocks.h,
46
+ focusable: item.focusable,
47
+ hasSub: item.hasSub,
48
+ };
49
+ },
50
+ },
51
+
52
+ created() {
53
+ this.onAction.register("onFocus", this.onFocus);
54
+ this.onAction.register("onBlur", this.onBlur);
55
+ this.onAction.register("onClick", this.onClick);
56
+ },
57
+ };
58
+ </script>
59
+
60
+ <template>
61
+ <jsv-focus-block ref="focusNode">
62
+ <simple-widget
63
+ :name="name"
64
+ :data="itemData"
65
+ :width="data.blocks.w"
66
+ :height="data.blocks.h"
67
+ :padding="{ left: 10, top: 10, right: 10, bottom: 10 }"
68
+ :direction="direction"
69
+ :measures="measures"
70
+ :onEdge="onEdge"
71
+ :dispatcher="dispatcher"
72
+ >
73
+ <template #renderItem="{ data, query, onEdge, onAction }">
74
+ <item
75
+ :data="data"
76
+ :query="query"
77
+ :onEdge="onEdge"
78
+ :onAction="onAction"
79
+ />
80
+ </template>
81
+ </simple-widget>
82
+ </jsv-focus-block>
83
+ </template>
84
+
85
+ <style scoped>
86
+ .rootSize {
87
+ width: 1920;
88
+ height: 1080;
89
+ background-color: "#FFFF00";
90
+ }
91
+
92
+ .widgetPos {
93
+ top: 120;
94
+ left: 50;
95
+ }
96
+
97
+ .focusPos {
98
+ top: 10;
99
+ left: 10;
100
+ }
101
+ </style>
@@ -0,0 +1,58 @@
1
+ <script>
2
+ export default {
3
+ props: {
4
+ data: Object,
5
+ query: Object,
6
+ onEdge: Function,
7
+ onAction: Object,
8
+ },
9
+ data() {
10
+ return {
11
+ focused: false,
12
+ };
13
+ },
14
+ computed: {
15
+ style() {
16
+ return {
17
+ width: this.data.blocks.w - 10,
18
+ height: this.data.blocks.h - 10,
19
+ color: "#FFFFFF",
20
+ backgroundColor: this.focused ? "#FF0000" : this.data.color,
21
+ };
22
+ },
23
+ },
24
+ methods: {
25
+ onFocus() {
26
+ this.focused = true;
27
+ },
28
+
29
+ onBlur() {
30
+ this.focused = false;
31
+ },
32
+ },
33
+ created() {
34
+ this.onAction.register("onFocus", this.onFocus);
35
+ this.onAction.register("onBlur", this.onBlur);
36
+ },
37
+ };
38
+ </script>
39
+
40
+ <template>
41
+ <div :class="focused ? 'focus' : 'blur'" :style="style">
42
+ {{ data.content }}
43
+ </div>
44
+ </template>
45
+
46
+ <style scoped>
47
+ .focus {
48
+ transform: scale3d(1.05, 1.05, 1);
49
+ transition: transform 0.25s linear;
50
+ font-size: 30px;
51
+ }
52
+
53
+ .blur {
54
+ transform: scale3d(1, 1, 1);
55
+ transition: transform 0.25s linear;
56
+ font-size: 30px;
57
+ }
58
+ </style>
@@ -0,0 +1,137 @@
1
+ const frameData = [
2
+ {
3
+ blocks: {
4
+ w: 340,
5
+ h: 340
6
+ },
7
+ focusable: true,
8
+ hasSub: true,
9
+ id: 0,
10
+ },
11
+ {
12
+ blocks: {
13
+ w: 340,
14
+ h: 340
15
+ },
16
+ focusable: true,
17
+ hasSub: true,
18
+ id: 1,
19
+ },
20
+ {
21
+ blocks: {
22
+ w: 340,
23
+ h: 340
24
+ },
25
+ focusable: true,
26
+ hasSub: true,
27
+ id: 2,
28
+ },
29
+ {
30
+ blocks: {
31
+ w: 340,
32
+ h: 340
33
+ },
34
+ focusable: true,
35
+ hasSub: true,
36
+ id: 3,
37
+ },
38
+ ];
39
+
40
+ const itemData = [
41
+ {
42
+ blocks: {
43
+ w: 300,
44
+ h: 100
45
+ },
46
+ focusable: true,
47
+ color: "#000022",
48
+ content: 0
49
+ },
50
+ {
51
+ blocks: {
52
+ w: 150,
53
+ h: 100
54
+ },
55
+ focusable: true,
56
+ color: "#003300",
57
+ content: 1
58
+ },
59
+ {
60
+ blocks: {
61
+ w: 150,
62
+ h: 100
63
+ },
64
+ focusable: true,
65
+ color: "#000044",
66
+ content: 2
67
+ },
68
+ {
69
+ blocks: {
70
+ w: 50,
71
+ h: 200
72
+ },
73
+ focusable: true,
74
+ color: "#000055",
75
+ content: 3
76
+ },
77
+ {
78
+ blocks: {
79
+ w: 50,
80
+ h: 200
81
+ },
82
+ focusable: true,
83
+ color: "#000066",
84
+ content: 4
85
+ },
86
+ {
87
+ blocks: {
88
+ w: 50,
89
+ h: 200
90
+ },
91
+ focusable: true,
92
+ color: "#0000CD",
93
+ content: 5
94
+ },
95
+ ];
96
+
97
+ let content = 6;
98
+ for (let i = 0; i < 4; i++) {
99
+ itemData.push({
100
+ blocks: {
101
+ w: 100,
102
+ h: 150
103
+ },
104
+ focusable: true,
105
+ color: "#000022",
106
+ content: content++
107
+ });
108
+ itemData.push({
109
+ blocks: {
110
+ w: 100,
111
+ h: 150
112
+ },
113
+ focusable: true,
114
+ color: "#003300",
115
+ content: content++
116
+ });
117
+ itemData.push({
118
+ blocks: {
119
+ w: 100,
120
+ h: 150
121
+ },
122
+ focusable: true,
123
+ color: "#003300",
124
+ content: content++
125
+ });
126
+ itemData.push({
127
+ blocks: {
128
+ w: 100,
129
+ h: 150
130
+ },
131
+ focusable: true,
132
+ color: "#000022",
133
+ content: content++
134
+ });
135
+ }
136
+
137
+ export { frameData, itemData };
@@ -0,0 +1,224 @@
1
+ <!--
2
+ * @Author: ChenChanghua
3
+ * @Date: 2021-10-13 14:44:03
4
+ * @LastEditors: ChenChanghua
5
+ * @LastEditTime: 2021-10-18 14:13:06
6
+ * @Description: file content
7
+ -->
8
+ <script>
9
+ import { ref } from "vue";
10
+ import JsvApic, { LoopType } from "jsview/utils/JsViewVueWidget/JsvApic";
11
+ import catRun from "./assets/animated_webp.webp";
12
+ import girlRun from "./assets/girl_run.gif";
13
+ import quan from "./assets/quan.webp";
14
+ import ball from "./assets/ball_3.webp";
15
+
16
+ export default {
17
+ components: {
18
+ JsvApic,
19
+ },
20
+ setup() {
21
+ let catRunPlay = ref(false);
22
+ let girlRunPlay = ref(false);
23
+ let quanPlay = ref(false);
24
+ let ballPlay = ref(false);
25
+
26
+ const catRunCallback = {
27
+ onStart: () => {
28
+ catRunPlay.value = true;
29
+ },
30
+ onEnd: () => {
31
+ catRunPlay.value = false;
32
+ },
33
+ };
34
+ const girlRunCallback = {
35
+ onStart: () => {
36
+ girlRunPlay.value = true;
37
+ },
38
+ onEnd: () => {
39
+ girlRunPlay.value = false;
40
+ },
41
+ };
42
+ const quanCallback = {
43
+ onStart: () => {
44
+ quanPlay.value = true;
45
+ },
46
+ onEnd: () => {
47
+ quanPlay.value = false;
48
+ },
49
+ };
50
+ const ballCallback = {
51
+ onStart: () => {
52
+ ballPlay.value = true;
53
+ },
54
+ onEnd: () => {
55
+ ballPlay.value = false;
56
+ },
57
+ };
58
+
59
+ return {
60
+ catRun,
61
+ girlRun,
62
+ quan,
63
+ ball,
64
+ catRunPlay,
65
+ girlRunPlay,
66
+ quanPlay,
67
+ ballPlay,
68
+ catRunCallback,
69
+ girlRunCallback,
70
+ quanCallback,
71
+ ballCallback,
72
+ LoopType,
73
+ };
74
+ },
75
+ methods: {
76
+ onKeyDown(ev) {
77
+ if (ev.keyCode == 8 || ev.keyCode == 27 || ev.keyCode == 10000) {
78
+ this.$router?.go(-1); // 有router时,是从DemoHomepage进入,回退
79
+ return true;
80
+ }
81
+
82
+ if (ev.keyCode === 37) {
83
+ if (this.$refs.catRunRef) {
84
+ if (this.catRunPlay) {
85
+ this.$refs.catRunRef.stop();
86
+ this.catRunPlay = false;
87
+ } else {
88
+ this.$refs.catRunRef.play();
89
+ this.catRunPlay = true;
90
+ }
91
+ }
92
+ } else if (ev.keyCode === 13) {
93
+ if (this.$refs.girlRunRef) {
94
+ if (this.girlRunPlay) {
95
+ this.$refs.girlRunRef.stop();
96
+ this.girlRunPlay = false;
97
+ } else {
98
+ this.$refs.girlRunRef.play();
99
+ this.girlRunPlay = true;
100
+ }
101
+ }
102
+ } else if (ev.keyCode === 39) {
103
+ if (this.$refs.quanRef) {
104
+ if (this.quanPlay) {
105
+ this.$refs.quanRef.stop();
106
+ this.quanPlay = false;
107
+ } else {
108
+ this.$refs.quanRef.play();
109
+ this.quanPlay = true;
110
+ }
111
+ }
112
+ } else if (ev.keyCode === 38) {
113
+ if (this.$refs.ballRef) {
114
+ if (this.ballPlay) {
115
+ this.$refs.ballRef.stop();
116
+ this.ballPlay = false;
117
+ } else {
118
+ this.$refs.ballRef.play();
119
+ this.ballPlay = true;
120
+ }
121
+ }
122
+ }
123
+ return true;
124
+ },
125
+ },
126
+ };
127
+ </script>
128
+
129
+ <template>
130
+ <jsv-focus-block ref="rootNode" autoFocus :onKeyDown="onKeyDown">
131
+ <div :style="{ width: 1920, height: 1080, backgroundColor: '#334C4C' }">
132
+ <div :style="{ left: 20, top: 20 }">
133
+ <jsv-apic
134
+ ref="catRunRef"
135
+ :src="`url(${catRun})`"
136
+ :style="{ width: 250, height: 250 }"
137
+ :autoPlay="true"
138
+ :loopType="LoopType.LOOP_DEFAULT"
139
+ :onStart="catRunCallback.onStart"
140
+ :onEnd="catRunCallback.onEnd"
141
+ />
142
+ <div className="text" :style="{ top: 270, width: 250 }">
143
+ {{ `WEBP(${catRunPlay ? "运行" : "停止"})\n左键控制` }}
144
+ </div>
145
+ </div>
146
+
147
+ <div :style="{ left: 280, top: 20 }">
148
+ <JsvApic
149
+ ref="girlRunRef"
150
+ :src="`url(${girlRun})`"
151
+ :style="{ width: 250, height: 214 }"
152
+ :autoPlay="true"
153
+ :loopType="LoopType.LOOP_DEFAULT"
154
+ :onStart="girlRunCallback.onStart"
155
+ :onEnd="girlRunCallback.onEnd"
156
+ />
157
+ <div className="text" :style="{ top: 219, width: 250 }">
158
+ {{ `GIF(${girlRunPlay ? "运行" : "停止"})\nOK键控制` }}
159
+ </div>
160
+ </div>
161
+
162
+ <div :style="{ left: 540, top: 20 }">
163
+ <JsvApic
164
+ ref="quanRef"
165
+ :src="`url(${quan})`"
166
+ :style="{ width: 250, height: 296 }"
167
+ :autoPlay="true"
168
+ :loopType="LoopType.LOOP_DEFAULT"
169
+ :onStart="quanCallback.onStart"
170
+ :onEnd="quanCallback.onEnd"
171
+ />
172
+ <div className="text" :style="{ top: 301, width: 250 }">
173
+ {{ `单次播放WEBP(${quanPlay ? "运行" : "停止"})\n右键控制` }}
174
+ </div>
175
+ </div>
176
+
177
+ <div :style="{ left: 800, top: 20 }">
178
+ <JsvApic
179
+ ref="ballRef"
180
+ :src="`url(${ball})`"
181
+ :style="{ width: 300, height: 200 }"
182
+ :autoPlay="true"
183
+ :loopType="LoopType.LOOP_PART"
184
+ :loopInfo="[
185
+ [3, 2, 4],
186
+ [5, 7, 10],
187
+ ]"
188
+ :onStart="ballCallback.onStart"
189
+ :onEnd="ballCallback.onEnd"
190
+ />
191
+ <div class="text" :style="{ top: 205, width: 300, height: 200 }">
192
+ {{
193
+ `局部循环WEBP(${
194
+ ballPlay ? "运行" : "停止"
195
+ })\n先循环2次后循环4次\n上键控制`
196
+ }}
197
+ </div>
198
+ </div>
199
+
200
+ <div
201
+ :style="{
202
+ left: 50,
203
+ top: 590,
204
+ width: 1180,
205
+ textAlign: 'center',
206
+ color: '#000000',
207
+ fontSize: '30px',
208
+ }"
209
+ >
210
+ {{ `(按键可进行停止/重播操作)` }}
211
+ </div>
212
+ </div>
213
+ </jsv-focus-block>
214
+ </template>
215
+
216
+ <style scoped>
217
+ .text {
218
+ font-size: 25px;
219
+ height: 68px;
220
+ line-height: 34px;
221
+ color: #000000;
222
+ text-align: center;
223
+ }
224
+ </style>