@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.
- package/docs/IMPORT_CHANGE_LOG.txt +3 -0
- package/docs/git_commit.md +15 -0
- package/docs/test_version_up.txt +1 -0
- package/dom/bin/jsview-dom-1.0.313.tgz +0 -0
- package/dom/browser-root-style.css +21 -0
- package/dom/jsv-browser-debug-dom.js +8 -0
- package/dom/jsv-dom.js +6 -0
- package/dom/jsv-forge-define.js +6 -0
- package/dom/target_core_revision.js +14 -0
- package/load/header_script_loader.js +134 -0
- package/load/jsview-main.js +42 -0
- package/load/jsview.config.default.js +37 -0
- package/load/jsview.default.config.js +37 -0
- package/load/loader.js +172 -0
- package/load/loader_webkit.js +40 -0
- package/package.json +27 -0
- package/patch/node_modules/@babel/preset-env/lib/available-plugins.js +219 -0
- package/patch/node_modules/@vue/cli-plugin-typescript/index.js +100 -0
- package/patch/node_modules/@vue/cli-service/lib/commands/serve.js +395 -0
- package/patch/node_modules/@vue/cli-service/lib/config/app.js +272 -0
- package/patch/node_modules/@vue/cli-service/lib/config/assets.js +70 -0
- package/patch/node_modules/@vue/cli-service/lib/config/base.js +212 -0
- package/patch/node_modules/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +2566 -0
- package/patch/node_modules/@vue/compiler-sfc/dist/jsview-css-to-js.js +274 -0
- package/patch/node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +1596 -0
- package/patch/node_modules/postcss-js/objectifier.js +90 -0
- package/patch/node_modules/vue-loader/dist/resolveScript.js +70 -0
- package/patch/package-lock.json +30051 -0
- package/samples/AdvanceMetroWidget/App.vue +123 -0
- package/samples/AdvanceMetroWidget/Frame.vue +101 -0
- package/samples/AdvanceMetroWidget/Item.vue +58 -0
- package/samples/AdvanceMetroWidget/data.js +137 -0
- package/samples/AnimPicture/App.vue +224 -0
- package/samples/AnimPicture/assets/animated_webp.webp +0 -0
- package/samples/AnimPicture/assets/ball_3.webp +0 -0
- package/samples/AnimPicture/assets/girl_run.gif +0 -0
- package/samples/AnimPicture/assets/quan.webp +0 -0
- package/samples/Basic/App.vue +129 -0
- package/samples/Basic/assets/border.png +0 -0
- package/samples/Basic/assets/border2.png +0 -0
- package/samples/Basic/assets/icon.png +0 -0
- package/samples/Basic/assets/test.jpg +0 -0
- package/samples/Basic/components/ContentBlock.vue +36 -0
- package/samples/Basic/components/FontStyle.css +10 -0
- package/samples/Basic/components/TitleBar.vue +29 -0
- package/samples/Basic/components/anim/AnimGroup.vue +68 -0
- package/samples/Basic/components/anim/AnimKeyframeBasic.vue +102 -0
- package/samples/Basic/components/anim/AnimKeyframeComposite.vue +53 -0
- package/samples/Basic/components/anim/AnimTransition.vue +116 -0
- package/samples/Basic/components/div/DivBackground.vue +15 -0
- package/samples/Basic/components/div/DivClip.vue +81 -0
- package/samples/Basic/components/div/DivCssScoped.vue +27 -0
- package/samples/Basic/components/div/DivCssVar.vue +50 -0
- package/samples/Basic/components/div/DivGroup1.vue +33 -0
- package/samples/Basic/components/div/DivGroup2.vue +41 -0
- package/samples/Basic/components/div/DivLayout.vue +12 -0
- package/samples/Basic/components/div/DivRadius.vue +47 -0
- package/samples/Basic/components/text/TextAlign.vue +48 -0
- package/samples/Basic/components/text/TextFontStyle.vue +58 -0
- package/samples/Basic/components/text/TextGroup.vue +32 -0
- package/samples/Basic/components/text/TextOverflow.vue +78 -0
- package/samples/BasicFocusControl/App.vue +125 -0
- package/samples/BasicFocusControl/components/BaseBlock.vue +51 -0
- package/samples/BasicFocusControl/components/MainArea.vue +98 -0
- package/samples/BasicFocusControl/components/MainAreaLeftBlock.vue +21 -0
- package/samples/BasicFocusControl/components/MainAreaRightBlock.vue +30 -0
- package/samples/BasicFocusControl/components/SideBar.vue +73 -0
- package/samples/BasicFocusControl/components/SideBarBlock.vue +30 -0
- package/samples/ClassNameDemo/App.vue +119 -0
- package/samples/ClassNameDemo/assets/bg.jpg +0 -0
- package/samples/ClassNameDemo/assets/coupon_content.png +0 -0
- package/samples/ClassNameDemo/assets/coupon_left.png +0 -0
- package/samples/ClassNameDemo/assets/coupon_mid.png +0 -0
- package/samples/ClassNameDemo/assets/coupon_right.png +0 -0
- package/samples/ClassNameDemo/assets/focus_border.png +0 -0
- package/samples/ClassNameDemo/assets/holder_logo.png +0 -0
- package/samples/ClassNameDemo/assets/jrbm.png +0 -0
- package/samples/ClassNameDemo/assets/line_left.png +0 -0
- package/samples/ClassNameDemo/assets/line_mid.png +0 -0
- package/samples/ClassNameDemo/assets/line_right.png +0 -0
- package/samples/ClassNameDemo/assets/loading.png +0 -0
- package/samples/ClassNameDemo/assets/logo.png +0 -0
- package/samples/ClassNameDemo/assets/mcjx.png +0 -0
- package/samples/ClassNameDemo/assets/tao.png +0 -0
- package/samples/ClassNameDemo/assets/tmall.png +0 -0
- package/samples/ClassNameDemo/components/ContentItem.vue +253 -0
- package/samples/ClassNameDemo/components/LoadingView.vue +43 -0
- package/samples/ClassNameDemo/components/TitleView.vue +24 -0
- package/samples/ClassNameDemo/data.js +24 -0
- package/samples/ColorSpace/App.vue +135 -0
- package/samples/ColorSpace/bmpDemo.bmp +0 -0
- package/samples/ColorSpace/jpegDemo.jpeg +0 -0
- package/samples/ColorSpace/pngDemo.png +0 -0
- package/samples/ColorSpace/pngNoAlphaDemo.png +0 -0
- package/samples/DemoHomepage/App.vue +31 -0
- package/samples/DemoHomepage/components/BodyFrame.vue +82 -0
- package/samples/DemoHomepage/components/Dialog.vue +94 -0
- package/samples/DemoHomepage/components/Item.vue +77 -0
- package/samples/DemoHomepage/components/TabFrame.vue +86 -0
- package/samples/DemoHomepage/router.js +132 -0
- package/samples/DemoHomepage/views/Homepage.vue +186 -0
- package/samples/FlipCard/App.vue +80 -0
- package/samples/FlipCard/FlipCard.vue +124 -0
- package/samples/FlipCard/assets/blue_egg.png +0 -0
- package/samples/FlipCard/assets/red_egg.png +0 -0
- package/samples/FlipCard/data.js +13 -0
- package/samples/FlowMultiWidget/App.vue +91 -0
- package/samples/FlowMultiWidget/assets/nine_patch_focus.png +0 -0
- package/samples/FlowMultiWidget/components/Block.vue +107 -0
- package/samples/FlowMultiWidget/components/FlowPage.vue +60 -0
- package/samples/FlowMultiWidget/components/Item.vue +103 -0
- package/samples/FlowMultiWidget/components/MenuItem.vue +72 -0
- package/samples/FlowMultiWidget/components/MyMenu.vue +90 -0
- package/samples/FlowMultiWidget/data.js +446 -0
- package/samples/HashHistory/App.vue +124 -0
- package/samples/HashHistory/components/HorizontalButtonList.vue +114 -0
- package/samples/HashHistory/components/Item.vue +74 -0
- package/samples/HashHistory/router.js +30 -0
- package/samples/HashHistory/views/BasePage.vue +19 -0
- package/samples/HashHistory/views/MainPage.vue +68 -0
- package/samples/HashHistory/views/SubPage.vue +79 -0
- package/samples/HashHistory/views/SubPageFirst.vue +10 -0
- package/samples/HashHistory/views/SubPageSecond.vue +10 -0
- package/samples/LongImage/App.vue +96 -0
- package/samples/LongImage/Button.vue +153 -0
- package/samples/LongImage/LongImageScroll.vue +127 -0
- package/samples/LongImage/Scroll.vue +16 -0
- package/samples/LongImage/assets/1280x7200.jpg +0 -0
- package/samples/LongText/App.vue +111 -0
- package/samples/LongText/Button.vue +153 -0
- package/samples/LongText/LongTextScroll.vue +225 -0
- package/samples/LongText/Scroll.vue +16 -0
- package/samples/Preload/App.vue +146 -0
- package/samples/Preload/data.js +23 -0
- package/samples/Preload/images/awesomeface.png +0 -0
- package/samples/Preload/images/cat.jpg +0 -0
- package/samples/Preload/images/rank.png +0 -0
- package/samples/Preload/images/rank_focus.png +0 -0
- package/samples/Preload/images/rule.png +0 -0
- package/samples/Preload/images/rule_focus.png +0 -0
- package/samples/Preload/images/start.png +0 -0
- package/samples/Preload/images/start_focus.png +0 -0
- package/samples/Preload/preloadItem.vue +22 -0
- package/samples/QrcodeDemo/App.vue +73 -0
- package/samples/SimpleWidgetDemo/App.vue +204 -0
- package/samples/SimpleWidgetDemo/Item.vue +83 -0
- package/samples/SimpleWidgetDemo/assets/bg.jpg +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_content.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/coupon_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/focus_border.png +0 -0
- package/samples/SimpleWidgetDemo/assets/holder_logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/jrbm.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_left.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_mid.png +0 -0
- package/samples/SimpleWidgetDemo/assets/line_right.png +0 -0
- package/samples/SimpleWidgetDemo/assets/loading.png +0 -0
- package/samples/SimpleWidgetDemo/assets/logo.png +0 -0
- package/samples/SimpleWidgetDemo/assets/mcjx.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tao.png +0 -0
- package/samples/SimpleWidgetDemo/assets/tmall.png +0 -0
- package/samples/SimpleWidgetDemo/border.png +0 -0
- package/samples/SimpleWidgetDemo/components/ContentItem.vue +412 -0
- package/samples/SimpleWidgetDemo/components/MyTab.vue +117 -0
- package/samples/SimpleWidgetDemo/data.js +110 -0
- package/samples/SprayView/App.vue +270 -0
- package/samples/SprayView/assets/snow.png +0 -0
- package/samples/SpriteImage/App.vue +174 -0
- package/samples/SpriteImage/images/cat_run.png +0 -0
- package/samples/SpriteImage/images/egg_break.json +116 -0
- package/samples/SpriteImage/images/egg_break.png +0 -0
- package/samples/SpriteImage/images/sprite.png +0 -0
- package/samples/TextBox/App.vue +179 -0
- package/samples/TextBox/RenderCenter.vue +109 -0
- package/samples/TextBox/RenderLeft.vue +109 -0
- package/samples/TextBox/RenderOneLine.vue +120 -0
- package/samples/TextBox/RenderRight.vue +107 -0
- package/samples/TextShadowDemo/App.vue +98 -0
- package/samples/TextureSize/App.vue +142 -0
- package/samples/TextureSize/bmpDemo.bmp +0 -0
- package/samples/TextureSize/jpegDemo.jpeg +0 -0
- package/samples/TextureSize/jpgDemo.jpg +0 -0
- package/samples/TextureSize/pngDemo.png +0 -0
- package/samples/TextureSize/pngNoAlphaDemo.png +0 -0
- package/samples/ThrowMoveDemo/AccelerateDemo.vue +118 -0
- package/samples/ThrowMoveDemo/App.vue +114 -0
- package/samples/ThrowMoveDemo/LRParabolicDemo.vue +116 -0
- package/samples/ThrowMoveDemo/TargetDemo.vue +117 -0
- package/samples/ThrowMoveDemo/UDParabolicDemo.vue +122 -0
- package/samples/TransitPage/App.vue +41 -0
- package/samples/VideoDemo/App.vue +137 -0
- package/samples/VideoDemo/components/Button.vue +69 -0
- package/samples/VideoDemo/components/Controllor.vue +195 -0
- package/samples/VideoDemo/components/VideoFrame.vue +152 -0
- package/scripts/git-commit-empty.js +21 -0
- package/scripts/install-local-packages.js +121 -0
- package/scripts/make-js.sh +181 -0
- package/scripts/post-build.js +132 -0
- package/scripts/post-install.js +127 -0
- package/scripts/pre-pack.js +2 -0
- package/scripts/run-android.js +64 -0
- package/utils/JsViewEngineWidget/bin/shijiu-jsview-vue-widget-1.0.1.tgz +0 -0
- package/utils/JsViewEngineWidget/index.d.ts +32 -0
- package/utils/JsViewEngineWidget/index.js +6 -0
- package/utils/JsViewVueTools/DebugContentShellJBridge.js +16 -0
- package/utils/JsViewVueTools/DebugTool.js +21 -0
- package/utils/JsViewVueTools/DefaultKeyMap.js +12 -0
- package/utils/JsViewVueTools/JsvDynamicCssStyle.js +73 -0
- package/utils/JsViewVueTools/JsvDynamicKeyFrames.js +128 -0
- package/utils/JsViewVueTools/JsvHashHistory.js +112 -0
- package/utils/JsViewVueTools/JsvRuntimeBridge.js +417 -0
- package/utils/JsViewVueTools/JsvStyleClass.js +290 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserPreload.vue +80 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserQrcode.vue +148 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/BrowserSpray.vue +55 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/ApicDataBase.js +29 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/BrowserApic.vue +124 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/GifData.js +83 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/LoopToolBase.js +25 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/NormalLoopTool.js +61 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/PartLoopTool.js +119 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/Viewer.js +106 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/JsvApic/WebpData.js +141 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetLoader.js +20 -0
- package/utils/JsViewVueWidget/BrowserDebugWidget/WidgetWrapper.js +11 -0
- package/utils/JsViewVueWidget/JsvActorMove/ActorControlBase.js +204 -0
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMove.vue +64 -0
- package/utils/JsViewVueWidget/JsvActorMove/JsvActorMoveControl.js +427 -0
- package/utils/JsViewVueWidget/JsvActorMove/index.js +12 -0
- package/utils/JsViewVueWidget/JsvApic/JsvApic.vue +179 -0
- package/utils/JsViewVueWidget/JsvApic/index.js +17 -0
- package/utils/JsViewVueWidget/JsvMarquee.vue +197 -0
- package/utils/JsViewVueWidget/JsvNativeSharedDiv.vue +92 -0
- package/utils/JsViewVueWidget/JsvNinePatch.vue +76 -0
- package/utils/JsViewVueWidget/JsvPreload/JsvPreload.vue +351 -0
- package/utils/JsViewVueWidget/JsvPreload/index.js +21 -0
- package/utils/JsViewVueWidget/JsvQrcode/JsvQrcode.vue +140 -0
- package/utils/JsViewVueWidget/JsvQrcode/index.js +18 -0
- package/utils/JsViewVueWidget/JsvSpray/JsvSpray.vue +140 -0
- package/utils/JsViewVueWidget/JsvSpray/index.js +15 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/JsvSpriteAnim.vue +448 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/SpriteController.js +57 -0
- package/utils/JsViewVueWidget/JsvSpriteAnim/index.js +6 -0
- package/utils/JsViewVueWidget/JsvSwiper/Indicator.vue +35 -0
- package/utils/JsViewVueWidget/JsvSwiper/JsvSwiper.vue +495 -0
- package/utils/JsViewVueWidget/JsvSwiper/index.js +10 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/Indicator.vue +35 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/JsvSwiper.vue +404 -0
- package/utils/JsViewVueWidget/JsvSwiper3D/index.js +10 -0
- package/utils/JsViewVueWidget/JsvTextBox.vue +111 -0
- package/utils/JsViewVueWidget/JsvVideo.vue +36 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
class BridgeProxy {
|
|
2
|
+
indicateHomePageLoadDone() {
|
|
3
|
+
const bridge = this._GetBridge();
|
|
4
|
+
if (bridge && bridge.indicateHomePageLoadDone) {
|
|
5
|
+
bridge.indicateHomePageLoadDone();
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
_GetBridge() {
|
|
10
|
+
return window.jContentShellJBridge;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const instance = new BridgeProxy();
|
|
15
|
+
|
|
16
|
+
export { instance as JSBridge };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
// 用于存储用于Debug的全局引用
|
|
4
|
+
let DebugObjectRefer = {
|
|
5
|
+
RootRouter: null,
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
let DebugTools = {
|
|
9
|
+
// 打印当前活跃的FDiv元素
|
|
10
|
+
printFocusNodes: ()=>{
|
|
11
|
+
DebugObjectRefer.RootRouter.printNodes();
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// 全局引用,以便于在devtools中能直接进行查询
|
|
16
|
+
window.JsvDebugTools = DebugTools;
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
DebugTools,
|
|
20
|
+
DebugObjectRefer,
|
|
21
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by donglin.lu@qcast.cn on 11/13/2020.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* 【模块 export 内容】
|
|
7
|
+
* CssStyleSheet:面向对象类,CSS rule的操作器,用于添加和删除CssStyle,服务于JsvStyleClass
|
|
8
|
+
* 接口:
|
|
9
|
+
* insertRule {String} 将传入的Css rule对象插入到CSS列表中,
|
|
10
|
+
* 请保证不要和其他css rule重名,重名场合以最后一个为准
|
|
11
|
+
* removeRule {String} 从CSS列表中删除指定名字的css rule
|
|
12
|
+
* removeMultiRules {String[]} 从CSS列表中删除复数个css rule
|
|
13
|
+
* getCssStyleSheet: 函数,获取 _StyleSheet 实例的函数,可接受一个参数anchor_tag,用来定位CSS rule的群组
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
class CssStyleSheet {
|
|
17
|
+
constructor(style_sheet_ref) {
|
|
18
|
+
this._SS = style_sheet_ref;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
insertRule(rule_define_string) {
|
|
22
|
+
const index = this._SS.cssRules.length;
|
|
23
|
+
this._SS.insertRule(rule_define_string, index);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
hasRule(name) {
|
|
27
|
+
const css_rules_ref = this._SS.cssRules;
|
|
28
|
+
for (let i = css_rules_ref.length - 1; i >= 0; i--) {
|
|
29
|
+
if (css_rules_ref[i].selectorText === name) {
|
|
30
|
+
// Found
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
removeRule(name) {
|
|
39
|
+
this.removeMultiRules([name]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
removeMultiRules(names_array) {
|
|
43
|
+
const style_sheet_ref = this._SS;
|
|
44
|
+
const css_rules_ref = this._SS.cssRules;
|
|
45
|
+
// 对CssRules进行删除操作,倒序轮询
|
|
46
|
+
for (let i = css_rules_ref.length - 1; i >= 0; i--) {
|
|
47
|
+
for (const j in names_array) {
|
|
48
|
+
if (css_rules_ref[i].selectorText === names_array[j]) {
|
|
49
|
+
names_array.splice(j, 1);
|
|
50
|
+
style_sheet_ref.deleteRule(i);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function getCssStyleGroup() {
|
|
59
|
+
// 获取所有的style
|
|
60
|
+
const ss = document.styleSheets;
|
|
61
|
+
if (!ss || ss.length === 0) {
|
|
62
|
+
console.error("Error: styleSheet empty");
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const style_sheets_ref = ss[0]; // 使用第0个作为动态css rule的加入点
|
|
67
|
+
|
|
68
|
+
return new CssStyleSheet(style_sheets_ref);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
getCssStyleGroup,
|
|
73
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by donglin.lu@qcast.cn on 11/13/2020.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* 【模块 export 内容】
|
|
7
|
+
* getKeyFramesGroup: 函数,获取KeyFrame操作类 KeyFrameStyleSheet
|
|
8
|
+
* KeyFrameStyleSheet:面向对象类,KeyFrames CSS rule的操作类,用于添加和删除KeyFrame
|
|
9
|
+
* 功能函数:(参数说明见函数本体)
|
|
10
|
+
* insertRule(key_frame_string) 动态添加keyFrame
|
|
11
|
+
* removeRule(name) 动态删除keyFrame
|
|
12
|
+
* removeMultiRules(names_array) 批量动态删除keyFrame
|
|
13
|
+
* hasRule(name) 查询KeyFrame是否存在
|
|
14
|
+
*/
|
|
15
|
+
class KeyFrameStyleSheet {
|
|
16
|
+
constructor(style_sheet_ref) {
|
|
17
|
+
this._SS = style_sheet_ref;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* insertRule 参数说明:
|
|
22
|
+
* key_frame_string (String) 要添加的keyFrame声明,
|
|
23
|
+
* 格式为"@keyframes name {0%: XXX, 100%:XXX}",同CSS文件中声明
|
|
24
|
+
* 请使用者保证不要和其他KeyFrame重名
|
|
25
|
+
* 返回值:
|
|
26
|
+
* 无
|
|
27
|
+
*/
|
|
28
|
+
insertRule(key_frame_string) {
|
|
29
|
+
if (window.jsvInAndroidWebView) {
|
|
30
|
+
// Convert keyframe => -webkit-keyframe
|
|
31
|
+
// Convert transform => -webkit-transform
|
|
32
|
+
// Convert transform-origin => -webkit-transform-origin
|
|
33
|
+
key_frame_string = key_frame_string.replace(/@keyframes/, "@-webkit-keyframes");
|
|
34
|
+
key_frame_string = key_frame_string.replace(/transform/g, "-webkit-transform");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const index = this._SS.cssRules.length;
|
|
38
|
+
this._SS.insertRule(key_frame_string, index);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/*
|
|
42
|
+
* hasRule 参数说明:
|
|
43
|
+
* name (String) 要动态删除的keyframe的名字
|
|
44
|
+
* 返回值:
|
|
45
|
+
* boolean 是否含有指定名称的keyframe
|
|
46
|
+
*/
|
|
47
|
+
hasRule(name) {
|
|
48
|
+
const css_rules_ref = this._SS.cssRules;
|
|
49
|
+
for (let i = css_rules_ref.length - 1; i >= 0; i--) {
|
|
50
|
+
if (css_rules_ref[i].name === name) {
|
|
51
|
+
// Found
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* removeRule 参数说明:
|
|
61
|
+
* name (String) 要动态删除的keyframe的名字
|
|
62
|
+
* 返回值:
|
|
63
|
+
* 无
|
|
64
|
+
*/
|
|
65
|
+
removeRule(name) {
|
|
66
|
+
this.removeMultiRules([name]);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
* removeMultiRules 参数说明:
|
|
71
|
+
* names_array (Array) Array<String>,要动态删除的keyframe的名字数组
|
|
72
|
+
* 返回值:
|
|
73
|
+
* 无
|
|
74
|
+
*/
|
|
75
|
+
removeMultiRules(names_array) {
|
|
76
|
+
const style_sheet_ref = this._SS;
|
|
77
|
+
const css_rules_ref = this._SS.cssRules;
|
|
78
|
+
// 对CssRules进行删除操作,倒序轮询
|
|
79
|
+
for (let i = css_rules_ref.length - 1; i >= 0; i--) {
|
|
80
|
+
for (const j in names_array) {
|
|
81
|
+
if (css_rules_ref[i].name === names_array[j]) {
|
|
82
|
+
names_array.splice(j, 1);
|
|
83
|
+
style_sheet_ref.deleteRule(i);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
* getKeyFramesGroup 参数说明:
|
|
93
|
+
* anchor_tag (String) keyFrame的名称,可以不设置或者为undefined
|
|
94
|
+
* 返回值:
|
|
95
|
+
* KeyFrameStyleSheet 以anchor_tag为锚点,找到对应的cssRule,以此cssRule创建出的KeyFrame管理句柄
|
|
96
|
+
*/
|
|
97
|
+
function getKeyFramesGroup(anchor_tag) {
|
|
98
|
+
let style_sheets_ref = null;
|
|
99
|
+
|
|
100
|
+
// 获取所有的style
|
|
101
|
+
const ss = document.styleSheets;
|
|
102
|
+
if (!ss || ss.length === 0) {
|
|
103
|
+
console.error("Error: styleSheet empty");
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (anchor_tag) {
|
|
108
|
+
for (let i = 0; i < ss.length; ++i) {
|
|
109
|
+
const item = ss[i];
|
|
110
|
+
if (item.cssRules[0] && item.cssRules[0].name && item.cssRules[0].name === anchor_tag) {
|
|
111
|
+
style_sheets_ref = item;
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (style_sheets_ref === null) {
|
|
116
|
+
console.error(`Error: no found tag=${anchor_tag}`);
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
style_sheets_ref = ss[0];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return new KeyFrameStyleSheet(style_sheets_ref);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
getKeyFramesGroup,
|
|
128
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createMemoryHistory, createWebHashHistory } from "vue-router";
|
|
2
|
+
|
|
3
|
+
class JsvHashHistory {
|
|
4
|
+
constructor(base) {
|
|
5
|
+
if(window.jsvIsBrowserDebug) {
|
|
6
|
+
this.$_history = createWebHashHistory(base)
|
|
7
|
+
} else {
|
|
8
|
+
this.$_history = this.#createMockHashHistory(base);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get location() {
|
|
13
|
+
return this.$_history.location;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get state() {
|
|
17
|
+
return this.$_history.state;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get base() {
|
|
21
|
+
return this.$_history.base;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
createHref(location) {
|
|
25
|
+
return this.$_history.createHref(location);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
listen(callback) {
|
|
29
|
+
return this.$_history.listen(callback);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
replace(to, data) {
|
|
33
|
+
this.$_history.replace(to, data);
|
|
34
|
+
this.#updateLocation(this.$_history.location);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
push(to, data) {
|
|
38
|
+
this.$_history.push(to, data);
|
|
39
|
+
this.#updateLocation(this.$_history.location);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
go(delta, triggerListeners) {
|
|
43
|
+
this.$_history.go(delta, triggerListeners);
|
|
44
|
+
this.#updateLocation(this.$_history.location);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
destroy() {
|
|
48
|
+
this.$_history.destroy();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#createMockHashHistory(base) {
|
|
52
|
+
// 抄 createWebHashHistory 作业
|
|
53
|
+
base = location.host ? base || location.pathname + location.search : '';
|
|
54
|
+
if (!base.includes('#'))
|
|
55
|
+
base += '#';
|
|
56
|
+
if (!base.endsWith('#/') && !base.endsWith('#')) {
|
|
57
|
+
console.warn(`A hash base must end with a "#":\n"${base}" should be "${base.replace(/#.*$/, '#')}".`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this.baseURL = window.location.origin + base;
|
|
61
|
+
|
|
62
|
+
const history = createMemoryHistory(base)
|
|
63
|
+
const initHash = this.#getInitHash();
|
|
64
|
+
if(initHash) {
|
|
65
|
+
// 已设置hash,替换到hash页面
|
|
66
|
+
history.replace({
|
|
67
|
+
path: initHash.substring(1),// 去除#
|
|
68
|
+
query: window.location.search
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
// 未设置hash定位,追加hash根的显示
|
|
72
|
+
this.#updateLocation(null);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return history;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#getInitHash() {
|
|
79
|
+
let initHash;
|
|
80
|
+
|
|
81
|
+
// 抓取history hash在启动过程中的变更, 用于warmUp/warmLoad不一致的情况。
|
|
82
|
+
if (window.JsView.takeNativeHashChange) {
|
|
83
|
+
initHash = window.JsView.takeNativeHashChange({
|
|
84
|
+
//this.push(new_hash.substring(1)); // 去除#
|
|
85
|
+
});
|
|
86
|
+
if (initHash != null) {
|
|
87
|
+
// 将新hash融入window.location中
|
|
88
|
+
console.log("History: found init hash change to:" + initHash);
|
|
89
|
+
} else {
|
|
90
|
+
initHash = window.location.hash;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return initHash;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
#updateLocation(location) {
|
|
98
|
+
if(!window.jsvIsBrowserDebug) {
|
|
99
|
+
const url = new window.JsView.Dom.UrlRef(
|
|
100
|
+
location ? this.baseURL + location : this.baseURL,
|
|
101
|
+
true
|
|
102
|
+
)
|
|
103
|
+
window.location.applyUrlInfo(url);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function createJsvHashHistory(base) {
|
|
109
|
+
return new JsvHashHistory(base)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { createJsvHashHistory }
|