@shijiu/jsview 1.9.730 → 1.9.747
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/dom/jsv-browser-debug-dom.js +1 -1
- package/dom/jsv-dom.js +1 -1
- package/dom/jsv-engine-js-browser.js +1 -1
- package/dom/jsv-forge-define.js +1 -1
- package/package.json +14 -17
- package/patches/node_modules/vite/dist/node/chunks/dep-0fc8e132.js +8 -1
- package/patches/node_modules/vite/dist/node/jsview.vite.config.js +12 -6
- package/dom/jsview-dom/README.md +0 -5
- package/dom/jsview-dom/package-lock.json-perfect +0 -3898
- package/dom/jsview-dom/package.json +0 -23
- package/dom/jsview-dom/rollup/browser-debug-dom.rollup.config.js +0 -15
- package/dom/jsview-dom/rollup/dom.rollup.config.js +0 -14
- package/dom/jsview-dom/rollup/engine-js-browser.rollup.config.js +0 -14
- package/dom/jsview-dom/rollup/forge-define.rollup.config.js +0 -14
- package/dom/jsview-dom/scripts/release_dist.sh +0 -36
- package/dom/jsview-dom/src/dom-browser-hook/HookDocument.js +0 -118
- package/dom/jsview-dom/src/dom-browser-hook/OriginDocument.js +0 -19
- package/dom/jsview-dom/src/dom-browser-hook/StyleFormatCheck.js +0 -559
- package/dom/jsview-dom/src/dom-browser-hook/index.js +0 -6
- package/dom/jsview-dom/src/dom-wrapper/ForgeExtension.js +0 -226
- package/dom/jsview-dom/src/dom-wrapper/JsViewForgeApp.js +0 -85
- package/dom/jsview-dom/src/dom-wrapper/JsViewProxy.js +0 -51
- package/dom/jsview-dom/src/dom-wrapper/event/AnimationEvent.js +0 -7
- package/dom/jsview-dom/src/dom-wrapper/event/Event.js +0 -12
- package/dom/jsview-dom/src/dom-wrapper/event/FocusEvent.js +0 -9
- package/dom/jsview-dom/src/dom-wrapper/event/KeyboardEvent.js +0 -43
- package/dom/jsview-dom/src/dom-wrapper/event/LoadEvent.js +0 -8
- package/dom/jsview-dom/src/dom-wrapper/index.js +0 -16
- package/dom/jsview-dom/src/dom-wrapper/node/AnchorElement.js +0 -24
- package/dom/jsview-dom/src/dom-wrapper/node/AudioElement.js +0 -60
- package/dom/jsview-dom/src/dom-wrapper/node/Comment.js +0 -10
- package/dom/jsview-dom/src/dom-wrapper/node/DivElement.js +0 -498
- package/dom/jsview-dom/src/dom-wrapper/node/Document.js +0 -274
- package/dom/jsview-dom/src/dom-wrapper/node/Element.js +0 -852
- package/dom/jsview-dom/src/dom-wrapper/node/FDivElement.js +0 -48
- package/dom/jsview-dom/src/dom-wrapper/node/HeadElement.js +0 -47
- package/dom/jsview-dom/src/dom-wrapper/node/ImageElement.js +0 -203
- package/dom/jsview-dom/src/dom-wrapper/node/JsvAudioTrackElement.js +0 -22
- package/dom/jsview-dom/src/dom-wrapper/node/JsvElement.js +0 -40
- package/dom/jsview-dom/src/dom-wrapper/node/LinkElement.js +0 -48
- package/dom/jsview-dom/src/dom-wrapper/node/MediaElement.js +0 -230
- package/dom/jsview-dom/src/dom-wrapper/node/Node.js +0 -178
- package/dom/jsview-dom/src/dom-wrapper/node/SVGElement.js +0 -9
- package/dom/jsview-dom/src/dom-wrapper/node/ScriptElement.js +0 -45
- package/dom/jsview-dom/src/dom-wrapper/node/StyleElement.js +0 -33
- package/dom/jsview-dom/src/dom-wrapper/node/StyleElementCache.js +0 -41
- package/dom/jsview-dom/src/dom-wrapper/node/Text.js +0 -22
- package/dom/jsview-dom/src/dom-wrapper/node/UnknownElement.js +0 -4
- package/dom/jsview-dom/src/dom-wrapper/node/VideoElement.js +0 -237
- package/dom/jsview-dom/src/dom-wrapper/style/BorderImage.js +0 -25
- package/dom/jsview-dom/src/dom-wrapper/style/Inset.js +0 -26
- package/dom/jsview-dom/src/dom-wrapper/style/JsvStyleVariable.js +0 -65
- package/dom/jsview-dom/src/dom-wrapper/style/KeyframeRule.js +0 -11
- package/dom/jsview-dom/src/dom-wrapper/style/StyleDeclaration.js +0 -609
- package/dom/jsview-dom/src/dom-wrapper/style/StyleSheet.js +0 -51
- package/dom/jsview-dom/src/dom-wrapper/style/StyleValue.js +0 -385
- package/dom/jsview-dom/src/dom-wrapper/style/TextStylePackMap.js +0 -43
- package/dom/jsview-dom/src/dom-wrapper/style/URL.js +0 -144
- package/dom/jsview-dom/src/dom-wrapper/utils/EventHandler.js +0 -42
- package/dom/jsview-dom/src/dom-wrapper/utils/FDivRoot.js +0 -86
- package/dom/jsview-dom/src/dom-wrapper/utils/JsvLazySyncCache.js +0 -64
- package/dom/jsview-dom/src/dom-wrapper/utils/Log.js +0 -42
- package/dom/jsview-dom/src/dom-wrapper/utils/MutationObserver.js +0 -32
- package/dom/jsview-dom/src/dom-wrapper/utils/focusableNode.js +0 -715
- package/dom/jsview-dom/src/engine-js/ForgeDefine.js +0 -8
- package/dom/jsview-dom/src/engine-js/ForgeExtensionDefine.js +0 -14
- package/dom/jsview-dom/src/engine-js/browser/PlatformUtils.js +0 -100
- package/dom/jsview-dom/src/engine-js/browser/animation_base.js +0 -313
- package/dom/jsview-dom/src/engine-js/browser/animation_keyframe.js +0 -64
- package/dom/jsview-dom/src/engine-js/browser/animation_progress.js +0 -287
- package/dom/jsview-dom/src/engine-js/browser/animation_proxy.js +0 -906
- package/dom/jsview-dom/src/engine-js/browser/apic_decoder/demux.js +0 -143
- package/dom/jsview-dom/src/engine-js/browser/apic_decoder/gifDecoder.js +0 -12
- package/dom/jsview-dom/src/engine-js/browser/apic_decoder/libwebp-0.6.0.min.js +0 -160
- package/dom/jsview-dom/src/engine-js/browser/console_log.js +0 -25
- package/dom/jsview-dom/src/engine-js/browser/dynamic_key_frames.js +0 -95
- package/dom/jsview-dom/src/engine-js/browser/easing.js +0 -114
- package/dom/jsview-dom/src/engine-js/browser/html_shared_tools/element_transform.js +0 -122
- package/dom/jsview-dom/src/engine-js/browser/html_shared_tools/gjk.js +0 -450
- package/dom/jsview-dom/src/engine-js/browser/html_shared_tools/mat.js +0 -102
- package/dom/jsview-dom/src/engine-js/browser/html_shared_tools/range_model.js +0 -296
- package/dom/jsview-dom/src/engine-js/browser/html_shared_tools/test_collide.js +0 -10
- package/dom/jsview-dom/src/engine-js/browser/index.js +0 -38
- package/dom/jsview-dom/src/engine-js/browser/latex_parse.js +0 -336
- package/dom/jsview-dom/src/engine-js/browser/layout_params.js +0 -113
- package/dom/jsview-dom/src/engine-js/browser/layout_view.js +0 -3545
- package/dom/jsview-dom/src/engine-js/browser/layout_view_debug.js +0 -15
- package/dom/jsview-dom/src/engine-js/browser/media.js +0 -379
- package/dom/jsview-dom/src/engine-js/browser/page_base.js +0 -941
- package/dom/jsview-dom/src/engine-js/browser/particle_view.js +0 -526
- package/dom/jsview-dom/src/engine-js/browser/platform_timer.js +0 -61
- package/dom/jsview-dom/src/engine-js/browser/react_utils.js +0 -5
- package/dom/jsview-dom/src/engine-js/browser/rect_utils.js +0 -91
- package/dom/jsview-dom/src/engine-js/browser/render_bridge.js +0 -128
- package/dom/jsview-dom/src/engine-js/browser/render_texture_proxy.js +0 -155
- package/dom/jsview-dom/src/engine-js/browser/renderer_deprecated.js +0 -75
- package/dom/jsview-dom/src/engine-js/browser/sound_pool.js +0 -139
- package/dom/jsview-dom/src/engine-js/browser/steps_animation.js +0 -192
- package/dom/jsview-dom/src/engine-js/browser/text_style_cache.js +0 -454
- package/dom/jsview-dom/src/engine-js/browser/text_utils.js +0 -299
- package/dom/jsview-dom/src/engine-js/browser/text_view.js +0 -428
- package/dom/jsview-dom/src/engine-js/browser/texture_manager.js +0 -1060
- package/dom/jsview-dom/src/engine-js/browser/url.js +0 -69
- package/dom/jsview-dom/src/engine-js/browser/velocity.js +0 -40
- package/dom/jsview-dom/src/engine-js/browser/view_sensor/autofroze_sensor.js +0 -77
- package/dom/jsview-dom/src/engine-js/browser/view_sensor/drag_impact_sensor.js +0 -67
- package/dom/jsview-dom/src/engine-js/browser/view_sensor/impact_sensor.js +0 -98
- package/dom/jsview-dom/src/engine-js/browser/view_sensor/impact_sensor_callback.js +0 -21
- package/dom/jsview-dom/src/engine-js/browser/view_sensor/impact_sensor_manager.js +0 -24
- package/dom/jsview-dom/src/engine-js/browser/view_sensor/index.js +0 -9
- package/dom/jsview-dom/src/engine-js/browser/view_sensor/view_sensor.js +0 -268
- package/dom/jsview-dom/src/engine-js/browser/view_sensor/view_sensor_manager.js +0 -84
- package/dom/jsview-dom/src/engine-js/browser/view_sensor/visible_sensor.js +0 -213
- package/dom/jsview-dom/src/engine-js/browser/view_store.js +0 -41
- package/dom/jsview-dom/src/engine-js/index.js +0 -2
- package/dom/jsview-dom/src/engine-js/native/README.md +0 -1
|
@@ -1,559 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by luocf on 2020/3/4.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable no-unused-vars */
|
|
6
|
-
class StyleFormat {
|
|
7
|
-
static _isUndefined(name, value) {
|
|
8
|
-
let is_undefined = typeof value == "undefined";
|
|
9
|
-
if (is_undefined) {
|
|
10
|
-
console.error(name+" property is undefined!");
|
|
11
|
-
}
|
|
12
|
-
return is_undefined;
|
|
13
|
-
}
|
|
14
|
-
static _isUndefinedOrNumber(name, value) {
|
|
15
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return typeof value == "number";
|
|
20
|
-
}
|
|
21
|
-
static _keyframesCheck(name, value) {
|
|
22
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
if (value.indexOf("transform") < 0 && value.indexOf("opacity") < 0) {
|
|
26
|
-
console.error("keyframes property is only support transform and opacity, value:", value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static _objectFit(name, value) {
|
|
31
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const test_list = 'fill contain cover none scale-down';
|
|
35
|
-
if (test_list.indexOf(value) < 0) {
|
|
36
|
-
console.error(" objectFit is only support one of string[" + test_list + "]");
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static _clipPathCheck(name, value) {
|
|
41
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (!value.startsWith("inset")) {
|
|
45
|
-
console.error("clipPath property is support inset only.");
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
static _transitionOtherCheck(name, value) {
|
|
49
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
console.error(name+" property is not support, you can use transition property, e.g. transition='width 2s'");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
static _transitionCheck(name, value) {
|
|
56
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
static _transformCheck(name, value) {
|
|
62
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (value.length > 0
|
|
66
|
-
&& value.indexOf("translate3d") < 0
|
|
67
|
-
&& value.indexOf("scale3d") < 0
|
|
68
|
-
&& value.indexOf("rotate3d") < 0
|
|
69
|
-
&& value.indexOf("skew") < 0) {
|
|
70
|
-
console.error("transform property's value only support translate3d、scale3d、rotate3d、skew, value:", value);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
static _transformOriginCheck(name, value) {
|
|
75
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (value.length > 0
|
|
80
|
-
&& value.indexOf("%") < 0
|
|
81
|
-
&& value.indexOf("left") < 0
|
|
82
|
-
&& value.indexOf("center") < 0
|
|
83
|
-
&& value.indexOf("top") < 0
|
|
84
|
-
&& value.indexOf("right") < 0
|
|
85
|
-
&& value.indexOf("bottom") < 0) {
|
|
86
|
-
console.error("transformOrigin property's value only support XX%、left、top、right, bottom:", value);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
static _textOverflowCheck(name, value) {
|
|
91
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
switch (value) {
|
|
95
|
-
case "clip":
|
|
96
|
-
case "ellipsis":
|
|
97
|
-
break;
|
|
98
|
-
default:
|
|
99
|
-
console.error("textOverflow property's value is not support, value:", value);
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
static _whiteSpaceCheck(name, value) {
|
|
105
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
switch (value) {
|
|
109
|
-
case "normal":
|
|
110
|
-
case "nowrap":
|
|
111
|
-
case "pre-wrap":
|
|
112
|
-
break;
|
|
113
|
-
default:
|
|
114
|
-
console.error("whiteSpace property's value is not support, value:", value);
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
static _textAlignCheck(name, value) {
|
|
120
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
switch (value) {
|
|
124
|
-
case "left":
|
|
125
|
-
case "right":
|
|
126
|
-
case "center":
|
|
127
|
-
case "start":
|
|
128
|
-
case "end":
|
|
129
|
-
break;
|
|
130
|
-
default:
|
|
131
|
-
console.error("textAlign property's value is not support, value:", value);
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
static _lineHeightCheck(name,value) {
|
|
137
|
-
if (StyleFormat._isUndefinedOrNumber(name, value)) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
switch (value) {
|
|
141
|
-
case "normal":
|
|
142
|
-
case "inherit":
|
|
143
|
-
console.error("lineHeight property's value is support number only, value:", value);
|
|
144
|
-
break;
|
|
145
|
-
default:
|
|
146
|
-
if (value.indexOf("%") >= 0) {
|
|
147
|
-
console.error("lineHeight property's value is support number only, value:", value);
|
|
148
|
-
}
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
static _colorCheck(name, value) {
|
|
154
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
StyleFormat._checkColorFormat("Color()", value);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
static _visibilityCheck(name, value) {
|
|
161
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (value !== "visible" && value !== "hidden" && value !== "inherit") {
|
|
165
|
-
console.error("visibility property's value is not support, value:", value);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
static _displayCheck(name, value) {
|
|
170
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
if (value !== "block" && value !== "inline" && value !== "none"
|
|
175
|
-
&& value !== "inline-block" && value !== "inherit" && value !== "") {
|
|
176
|
-
console.error("display property's value is not support, value:", value);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
static _overflowCheck(name, value) {
|
|
182
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
if (value !== "visible" && value !== "hidden") {
|
|
186
|
-
console.error("overflow property's value is support visible or hidden only, value:", value);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
static _topCheck(name, value) {
|
|
190
|
-
if (StyleFormat._isUndefinedOrNumber(name, value)) {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
switch(value) {
|
|
194
|
-
case "auto":
|
|
195
|
-
case "inherit":
|
|
196
|
-
console.error("top property's value is support number only, value:", value);
|
|
197
|
-
break;
|
|
198
|
-
default:
|
|
199
|
-
if (value.indexOf("%") >= 0) {
|
|
200
|
-
console.error("top property's value is support number only, value:", value);
|
|
201
|
-
}
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
static _leftCheck(name, value) {
|
|
207
|
-
if (StyleFormat._isUndefinedOrNumber(name, value)) {
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
switch(value) {
|
|
211
|
-
case "auto":
|
|
212
|
-
case "inherit":
|
|
213
|
-
console.error("left property's value is support number only, value:", value);
|
|
214
|
-
break;
|
|
215
|
-
default:
|
|
216
|
-
if (value.indexOf("%") >= 0) {
|
|
217
|
-
console.error("left property's value is support number only, value:", value);
|
|
218
|
-
}
|
|
219
|
-
break;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
static _heightCheck(name, value) {
|
|
223
|
-
if (StyleFormat._isUndefinedOrNumber(name, value)) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
switch(value) {
|
|
227
|
-
case "auto":
|
|
228
|
-
case "inherit":
|
|
229
|
-
console.error("height property's value is support number only, value:", value);
|
|
230
|
-
break;
|
|
231
|
-
default:
|
|
232
|
-
if (value.indexOf("%") >=0) {
|
|
233
|
-
console.error("height property's value is support number only, value:", value);
|
|
234
|
-
}
|
|
235
|
-
break;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
}
|
|
239
|
-
static _widthCheck(name, value) {
|
|
240
|
-
if (StyleFormat._isUndefinedOrNumber(name, value)) {
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
switch(value) {
|
|
244
|
-
case "auto":
|
|
245
|
-
case "inherit":
|
|
246
|
-
console.error("width property's value is support number only, value:", value);
|
|
247
|
-
break;
|
|
248
|
-
default:
|
|
249
|
-
if (value.indexOf("%") >= 0) {
|
|
250
|
-
console.error("width property's value is support number only, value:", value);
|
|
251
|
-
}
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
static _backfaceVisibility(name, value) {
|
|
257
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
switch(value) {
|
|
261
|
-
case "visible":
|
|
262
|
-
case "hidden":
|
|
263
|
-
break;
|
|
264
|
-
default:
|
|
265
|
-
console.error("backfaceVisibility property's value is support visible/hidden only, value: ", value);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
static _perspectiveCheck(name, value) {
|
|
270
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
static _WebkitTextStroke(name, value) {
|
|
276
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
const split_value = value.split(" ");
|
|
280
|
-
if (split_value.length < 2) {
|
|
281
|
-
console.error("Error: WebkitTextStroke should format of(width color) such as: '1px rgba(255,255,255,1.0)'")
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
static _zIndexCheck(name, value) {
|
|
286
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
if (isNaN(value)) {
|
|
290
|
-
console.error("zIndex property's value is support number only, value: ", value);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
static _fontSizeCheck(name, value) {
|
|
295
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
if (typeof value == "number") {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
switch(value) {
|
|
304
|
-
case "smaller":
|
|
305
|
-
case "larger":
|
|
306
|
-
case "inherit":
|
|
307
|
-
case "x-small":
|
|
308
|
-
case "xx-small":
|
|
309
|
-
case "small":
|
|
310
|
-
case "large":
|
|
311
|
-
case "medium":
|
|
312
|
-
case "x-large":
|
|
313
|
-
case "xx-large":
|
|
314
|
-
console.error("fontSize property's value is support number only, value:", value);
|
|
315
|
-
break;
|
|
316
|
-
default:
|
|
317
|
-
if (value.indexOf("%") >= 0) {
|
|
318
|
-
console.error("fontSize property's value is support number only, value:", value);
|
|
319
|
-
}
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
static _fontWeightCheck(name ,value) {
|
|
326
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
if (value !== "bold") {
|
|
330
|
-
console.error("fontWeight property's value is support bold only, value:", value);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
static _fontStyleCheck(name, value) {
|
|
335
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
if (value !== "italic") {
|
|
339
|
-
console.error("fontWeight property's value is support italic only, value:", value);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
static _borderRadiusCheck(name, value) {
|
|
344
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
let radius = value.split(" ");
|
|
348
|
-
if (radius.length > 4) {
|
|
349
|
-
console.error("borderRadius property's value is not support, value:", value);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
static _borderImageWidthCheck(name, value) {
|
|
354
|
-
if (StyleFormat._isUndefinedOrNumber(name, value)) {
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
static _borderImageOutsetCheck(name, value) {
|
|
359
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
let outset = value.split(" ");
|
|
363
|
-
if (outset.length > 4) {
|
|
364
|
-
console.error("borderImageOutsetCheck property's value is not support, value:", value);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
static _borderImageCheck(name, value) {
|
|
369
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
370
|
-
return;
|
|
371
|
-
}
|
|
372
|
-
if (value.indexOf("fill") < 0) {
|
|
373
|
-
console.error("borderImage property's value is not contain fill, e.g. source slice, but value:", value);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
static _backgroundOtherCheck(name,value) {
|
|
378
|
-
console.error(name+" property not support, you can use backgroundImage property, e.g. backgroundImage=`url(${iconImgPath})`");
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
static _backgroundImageCheck(name, value) {
|
|
382
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
if (value == "inherit") {
|
|
386
|
-
console.error("backgroundImage property's value is not support, value:", value);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
static _backgroundColorCheck(name, value) {
|
|
391
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
392
|
-
return;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
return StyleFormat._checkColorFormat("backgroundColor", value);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
static _animationCheck(name, value) {
|
|
399
|
-
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
static _animationOtherNotSupport(name, value) {
|
|
403
|
-
console.error(name+" property is not support, you can use animation property, e.g. animation='mymove 5s infinite'");
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
static _transformStyleCheck(name, value) {
|
|
407
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
switch(value) {
|
|
411
|
-
case "flat":
|
|
412
|
-
case "preserve-3d":
|
|
413
|
-
break;
|
|
414
|
-
default:
|
|
415
|
-
console.error("transformStyle property value is not valid", value)
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
static _perspectiveOriginCheck(name, value) {
|
|
420
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
if (value.length > 0
|
|
424
|
-
&& value.indexOf("%") < 0
|
|
425
|
-
&& value.indexOf("left") < 0
|
|
426
|
-
&& value.indexOf("center") < 0
|
|
427
|
-
&& value.indexOf("top") < 0
|
|
428
|
-
&& value.indexOf("right") < 0
|
|
429
|
-
&& value.indexOf("bottom") < 0) {
|
|
430
|
-
console.error("perspectiveOrigin property's value only support XX%、left、top、right, bottom:", value);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
static _textShadowCheck(name, value) {
|
|
435
|
-
if (StyleFormat._isUndefined(name, value)) {
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
if (value.length > 0) {
|
|
440
|
-
let shadow_set_parts = value.replace(/\(.*\)/g, "").split(","); // 去除所有内容括号后检查
|
|
441
|
-
if (shadow_set_parts.length > 1) {
|
|
442
|
-
console.error("textShadow: NOT support more than one part settings");
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
const shadow_set = value.split(" ");
|
|
447
|
-
if (
|
|
448
|
-
(shadow_set.length === 4 || (shadow_set.length === 5 && shadow_set[4].length === 0)) // 设定分段个数校验
|
|
449
|
-
&& !(isNaN(parseInt(shadow_set[0]))) // offset x设定值校验
|
|
450
|
-
&& !(isNaN(parseInt(shadow_set[1]))) // offset y设定值校验
|
|
451
|
-
) {
|
|
452
|
-
// blur设定值校验, Native对于blur为0的配置不进行描画
|
|
453
|
-
if (!(parseFloat(shadow_set[2]) > 0)) {
|
|
454
|
-
console.error(`textShadow: blur shadow above 0(now=${value})`);
|
|
455
|
-
return;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
// 对颜色格式进行校验
|
|
459
|
-
if (!StyleFormat._checkColorFormat("textShadow", shadow_set[3])) {
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
} else {
|
|
463
|
-
console.error(`textShadow: format should be "offsetX offsetY blurSize color"(0 0 1 rgba(100,100,100,1)), !NOT space in rgba()`);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
static _checkColorFormat(method_name, color_value) {
|
|
469
|
-
if (color_value.indexOf("rgba(") === 0 || color_value.indexOf("rgb(") === 0) {
|
|
470
|
-
// format is good
|
|
471
|
-
} else if (color_value.indexOf("#") === 0) {
|
|
472
|
-
if (color_value.length !== 7) {
|
|
473
|
-
console.error(`${method_name} color value's length is not valid, value:${color_value}`);
|
|
474
|
-
return false;
|
|
475
|
-
}
|
|
476
|
-
} else {
|
|
477
|
-
console.error(`${method_name} color value is not valid, need startwith rgba or #, value:[${color_value}]`);
|
|
478
|
-
return false;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
return true;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
static _directionCheck(method_name, value) {
|
|
485
|
-
if (value !== "rtl" || value !== "ltr") {
|
|
486
|
-
console.error(`${method_name} direction value is not valid, need rtl or ltr, value:[${value}]`);
|
|
487
|
-
return false;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
return true;
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
static _JsvVideoRotationCheck(method_name, value) {
|
|
494
|
-
if (isNaN(parseInt(value))) {
|
|
495
|
-
console.error(`${method_name} value is not valid, value:${value}`);
|
|
496
|
-
return false;
|
|
497
|
-
}
|
|
498
|
-
return true;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
static get(name) {
|
|
502
|
-
return StyleFormat.ValidStyleMap[name];
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
StyleFormat.ValidStyleMap = {
|
|
507
|
-
"animation": {check: StyleFormat._animationCheck},
|
|
508
|
-
"animationName": {check: StyleFormat._animationOtherNotSupport},
|
|
509
|
-
"animationDuration": {check: StyleFormat._animationOtherNotSupport},
|
|
510
|
-
"animationTimingFunction": {check: StyleFormat._animationOtherNotSupport},
|
|
511
|
-
"animationDelay": {check: StyleFormat._animationOtherNotSupport},
|
|
512
|
-
"animationIterationCount": {check: StyleFormat._animationOtherNotSupport},
|
|
513
|
-
"animationDirection": {check: StyleFormat._animationOtherNotSupport},
|
|
514
|
-
"animationPlayState": {check: StyleFormat._animationOtherNotSupport},
|
|
515
|
-
"animationFillMode": {check: StyleFormat._animationOtherNotSupport},
|
|
516
|
-
"background": {check: StyleFormat._backgroundOtherCheck},
|
|
517
|
-
"backgroundColor": {check: StyleFormat._backgroundColorCheck},
|
|
518
|
-
"backgroundImage": {check: StyleFormat._backgroundImageCheck},
|
|
519
|
-
"borderImage": {check: StyleFormat._borderImageCheck},
|
|
520
|
-
"borderImageOutset": {check: StyleFormat._borderImageOutsetCheck},
|
|
521
|
-
"borderImageWidth": {check: StyleFormat._borderImageWidthCheck},
|
|
522
|
-
"borderRadius": {check: StyleFormat._borderRadiusCheck},
|
|
523
|
-
"height":{check: StyleFormat._heightCheck},
|
|
524
|
-
"width": {check: StyleFormat._widthCheck},
|
|
525
|
-
"zIndex": {check: StyleFormat._zIndexCheck},
|
|
526
|
-
"fontFamily": {check: null},
|
|
527
|
-
"fontSize": {check: StyleFormat._fontSizeCheck},
|
|
528
|
-
"fontStyle": {check: StyleFormat._fontStyleCheck},
|
|
529
|
-
"fontWeight": {check: StyleFormat._fontWeightCheck},
|
|
530
|
-
"left": {check: StyleFormat._leftCheck},
|
|
531
|
-
"overflow": {check: StyleFormat._overflowCheck},
|
|
532
|
-
"top": {check: StyleFormat._topCheck},
|
|
533
|
-
"visibility":{check: StyleFormat._visibilityCheck},
|
|
534
|
-
"display":{check: StyleFormat._displayCheck},
|
|
535
|
-
"color":{check: StyleFormat._colorCheck},
|
|
536
|
-
"lineHeight":{check: StyleFormat._lineHeightCheck},
|
|
537
|
-
"textAlign":{check: StyleFormat._textAlignCheck},
|
|
538
|
-
"whiteSpace":{check: StyleFormat._whiteSpaceCheck},
|
|
539
|
-
"textOverflow":{check: StyleFormat._textOverflowCheck},
|
|
540
|
-
"transform":{check: StyleFormat._transformCheck},
|
|
541
|
-
"transformOrigin":{check: StyleFormat._transformOriginCheck},
|
|
542
|
-
"transition":{check: StyleFormat._transitionCheck},
|
|
543
|
-
"transitionProperty":{check: StyleFormat._transitionOtherCheck},
|
|
544
|
-
"transitionDuration":{check: StyleFormat._transitionOtherCheck},
|
|
545
|
-
"transitionTimingFunction":{check: StyleFormat._transitionOtherCheck},
|
|
546
|
-
"transitionDelay":{check: StyleFormat._transitionOtherCheck},
|
|
547
|
-
"clipPath":{check: StyleFormat._clipPathCheck},
|
|
548
|
-
"keyframes": {check:StyleFormat._keyframesCheck},
|
|
549
|
-
"objectFit": {check:StyleFormat._objectFit},
|
|
550
|
-
"perspective": {check: StyleFormat._perspectiveCheck},
|
|
551
|
-
"backfaceVisibility": {check: StyleFormat._backfaceVisibility},
|
|
552
|
-
"transformStyle": {check: StyleFormat._transformStyleCheck},
|
|
553
|
-
"perspectiveOrigin": {check: StyleFormat._perspectiveCheck},
|
|
554
|
-
"WebkitTextStroke": {check: StyleFormat._WebkitTextStroke},
|
|
555
|
-
"textShadow": {check: StyleFormat._textShadowCheck},
|
|
556
|
-
"JsvVideoRotation": {check: StyleFormat._JsvVideoRotationCheck},
|
|
557
|
-
"direction": {check: StyleFormat._directoinCheck}
|
|
558
|
-
};
|
|
559
|
-
export default StyleFormat;
|