@mpxjs/webpack-plugin 2.10.17-beta.2 → 2.10.17-beta.4
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/lib/config.js +60 -0
- package/lib/file-loader.js +4 -1
- package/lib/global.d.ts +16 -0
- package/lib/index.js +22 -2
- package/lib/json-compiler/index.js +13 -4
- package/lib/platform/json/wx/index.js +6 -0
- package/lib/platform/style/wx/index.js +57 -33
- package/lib/platform/template/wx/component-config/ad.js +5 -0
- package/lib/platform/template/wx/component-config/button.js +9 -2
- package/lib/platform/template/wx/component-config/camera.js +25 -3
- package/lib/platform/template/wx/component-config/canvas.js +8 -1
- package/lib/platform/template/wx/component-config/cover-image.js +7 -2
- package/lib/platform/template/wx/component-config/cover-view.js +3 -1
- package/lib/platform/template/wx/component-config/form.js +27 -2
- package/lib/platform/template/wx/component-config/image.js +5 -0
- package/lib/platform/template/wx/component-config/input.js +10 -0
- package/lib/platform/template/wx/component-config/label.js +10 -2
- package/lib/platform/template/wx/component-config/map.js +11 -0
- package/lib/platform/template/wx/component-config/movable-area.js +4 -1
- package/lib/platform/template/wx/component-config/movable-view.js +17 -2
- package/lib/platform/template/wx/component-config/navigator.js +26 -0
- package/lib/platform/template/wx/component-config/picker-view.js +12 -0
- package/lib/platform/template/wx/component-config/picker.js +3 -1
- package/lib/platform/template/wx/component-config/progress.js +11 -1
- package/lib/platform/template/wx/component-config/rich-text.js +5 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +12 -1
- package/lib/platform/template/wx/component-config/slider.js +8 -0
- package/lib/platform/template/wx/component-config/swiper-item.js +5 -2
- package/lib/platform/template/wx/component-config/swiper.js +10 -0
- package/lib/platform/template/wx/component-config/text.js +5 -0
- package/lib/platform/template/wx/component-config/textarea.js +19 -2
- package/lib/platform/template/wx/component-config/unsupported.js +10 -1
- package/lib/platform/template/wx/component-config/video.js +10 -0
- package/lib/platform/template/wx/index.js +21 -1
- package/lib/react/LoadAsyncChunkModule.js +1 -1
- package/lib/react/processStyles.js +21 -9
- package/lib/react/style-helper.js +76 -13
- package/lib/resolver/AddModePlugin.js +23 -8
- package/lib/runtime/components/react/animationHooks/index.ts +75 -0
- package/lib/runtime/components/react/animationHooks/useAnimationAPIHooks.ts +198 -0
- package/lib/runtime/components/react/animationHooks/useTransitionHooks.ts +297 -0
- package/lib/runtime/components/react/animationHooks/utils.ts +196 -0
- package/lib/runtime/components/react/context.ts +7 -1
- package/lib/runtime/components/react/dist/animationHooks/index.d.ts +16 -0
- package/lib/runtime/components/react/dist/animationHooks/index.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/animationHooks/index.js +67 -0
- package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts +4 -0
- package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.js +182 -0
- package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts +4 -0
- package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.js +274 -0
- package/lib/runtime/components/react/dist/animationHooks/utils.d.ts +110 -0
- package/lib/runtime/components/react/dist/animationHooks/utils.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/animationHooks/utils.js +150 -0
- package/lib/runtime/components/react/dist/context.d.ts +6 -1
- package/lib/runtime/components/react/dist/context.d.ts.map +1 -1
- package/lib/runtime/components/react/dist/mpx-camera.d.ts +32 -0
- package/lib/runtime/components/react/dist/mpx-camera.d.ts.map +1 -0
- package/lib/runtime/components/react/dist/mpx-camera.jsx +236 -0
- package/lib/runtime/components/react/dist/mpx-input.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-input.d.ts.map +1 -1
- package/lib/runtime/components/react/dist/mpx-input.jsx +21 -10
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +1 -1
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +3 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +10 -0
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +1 -1
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +28 -16
- package/lib/runtime/components/react/dist/mpx-view.d.ts +3 -2
- package/lib/runtime/components/react/dist/mpx-view.d.ts.map +1 -1
- package/lib/runtime/components/react/dist/mpx-view.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +1 -1
- package/lib/runtime/components/react/dist/utils.d.ts +1 -0
- package/lib/runtime/components/react/dist/utils.d.ts.map +1 -1
- package/lib/runtime/components/react/dist/utils.jsx +34 -13
- package/lib/runtime/components/react/mpx-camera.tsx +327 -0
- package/lib/runtime/components/react/mpx-input.tsx +26 -10
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +3 -0
- package/lib/runtime/components/react/mpx-portal/portal-manager.tsx +2 -2
- package/lib/runtime/components/react/mpx-swiper.tsx +43 -15
- package/lib/runtime/components/react/mpx-view.tsx +4 -5
- package/lib/runtime/components/react/mpx-web-view.tsx +1 -1
- package/lib/runtime/components/react/types/global.d.ts +1 -0
- package/lib/runtime/components/react/utils.tsx +34 -16
- package/lib/runtime/optionProcessor.js +5 -0
- package/lib/runtime/optionProcessorReact.js +7 -0
- package/lib/runtime/stringify.wxs +2 -2
- package/lib/style-compiler/strip-conditional-loader/rebaseUrl.js +225 -0
- package/lib/style-compiler/strip-conditional-loader.js +55 -180
- package/lib/template-compiler/compiler.js +1 -3
- package/lib/utils/dom-tag-config.js +1 -1
- package/lib/utils/string.js +25 -1
- package/package.json +2 -1
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +0 -33
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts.map +0 -1
- package/lib/runtime/components/react/dist/useAnimationHooks.js +0 -289
- package/lib/runtime/components/react/useAnimationHooks.ts +0 -320
package/lib/config.js
CHANGED
|
@@ -553,6 +553,66 @@ module.exports = {
|
|
|
553
553
|
show: 'dd:show'
|
|
554
554
|
}
|
|
555
555
|
},
|
|
556
|
+
ks: {
|
|
557
|
+
typeExtMap: {
|
|
558
|
+
json: '.json',
|
|
559
|
+
script: '.js',
|
|
560
|
+
template: '.ksml',
|
|
561
|
+
styles: '.css'
|
|
562
|
+
},
|
|
563
|
+
tabBar: {
|
|
564
|
+
itemKey: 'list',
|
|
565
|
+
iconKey: 'iconPath',
|
|
566
|
+
activeIconKey: 'selectedIconPath'
|
|
567
|
+
},
|
|
568
|
+
event: {
|
|
569
|
+
parseEvent (attr) {
|
|
570
|
+
const match = /^(bind|catch|capture-bind|capture-catch):?(.*?)(?:\.(.*))?$/.exec(attr)
|
|
571
|
+
if (match) {
|
|
572
|
+
return {
|
|
573
|
+
prefix: match[1],
|
|
574
|
+
eventName: match[2],
|
|
575
|
+
modifier: match[3]
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
getEvent (eventName, prefix = 'bind') {
|
|
580
|
+
if (eventName.includes('-')) {
|
|
581
|
+
return `${prefix}:${eventName}`
|
|
582
|
+
} else {
|
|
583
|
+
return prefix + eventName
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
defaultModelProp: 'value',
|
|
587
|
+
defaultModelEvent: 'input',
|
|
588
|
+
defaultModelValuePath: 'value'
|
|
589
|
+
},
|
|
590
|
+
wxs: {
|
|
591
|
+
tag: 'ks',
|
|
592
|
+
module: 'module',
|
|
593
|
+
src: 'src',
|
|
594
|
+
ext: '.ks',
|
|
595
|
+
templatePrefix: 'module.exports = \n'
|
|
596
|
+
},
|
|
597
|
+
directive: {
|
|
598
|
+
if: 'ks:if',
|
|
599
|
+
elseif: 'ks:elif',
|
|
600
|
+
else: 'ks:else',
|
|
601
|
+
for: 'ks:for',
|
|
602
|
+
forIndex: 'ks:for-index',
|
|
603
|
+
forItem: 'ks:for-item',
|
|
604
|
+
key: 'ks:key',
|
|
605
|
+
dynamicClass: 'ks:class',
|
|
606
|
+
dynamicStyle: 'ks:style',
|
|
607
|
+
ref: 'ks:ref',
|
|
608
|
+
show: 'ks:show',
|
|
609
|
+
model: 'ks:model',
|
|
610
|
+
modelProp: 'ks:model-prop',
|
|
611
|
+
modelEvent: 'ks:model-event',
|
|
612
|
+
modelValuePath: 'ks:model-value-path',
|
|
613
|
+
modelFilter: 'ks:model-filter'
|
|
614
|
+
}
|
|
615
|
+
},
|
|
556
616
|
ios: reactConfig,
|
|
557
617
|
android: reactConfig,
|
|
558
618
|
harmony: reactConfig
|
package/lib/file-loader.js
CHANGED
|
@@ -8,7 +8,9 @@ module.exports = function loader (content, prevOptions) {
|
|
|
8
8
|
const options = prevOptions || loaderUtils.getOptions(this) || {}
|
|
9
9
|
const context = options.context || this.rootContext
|
|
10
10
|
const mpx = this.getMpx()
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
const { mode } = mpx
|
|
13
|
+
const isRN = ['ios', 'android', 'harmony'].includes(mode)
|
|
12
14
|
|
|
13
15
|
let url = loaderUtils.interpolateName(this, options.name, {
|
|
14
16
|
context,
|
|
@@ -47,6 +49,7 @@ module.exports = function loader (content, prevOptions) {
|
|
|
47
49
|
? options.publicPath
|
|
48
50
|
: `${options.publicPath}/`}${url}`
|
|
49
51
|
}
|
|
52
|
+
|
|
50
53
|
publicPath = JSON.stringify(publicPath)
|
|
51
54
|
}
|
|
52
55
|
|
package/lib/global.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
declare global {
|
|
3
|
+
interface MpxWebpackPluginOptions {
|
|
4
|
+
style: {
|
|
5
|
+
cssCondition?: {
|
|
6
|
+
before?: boolean;
|
|
7
|
+
after?: boolean;
|
|
8
|
+
beforeExclude?: (string | RegExp)[];
|
|
9
|
+
afterExclude?: (string | RegExp)[];
|
|
10
|
+
legacy?: boolean;
|
|
11
|
+
afterLegacy?: boolean;
|
|
12
|
+
beforeLegacy?: boolean;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -79,7 +79,8 @@ const LoadAsyncChunkModule = require('./react/LoadAsyncChunkModule')
|
|
|
79
79
|
const ExternalModule = require('webpack/lib/ExternalModule')
|
|
80
80
|
const { RetryRuntimeModule, RetryRuntimeGlobal } = require('./dependencies/RetryRuntimeModule')
|
|
81
81
|
const checkVersionCompatibility = require('./utils/check-core-version-match')
|
|
82
|
-
|
|
82
|
+
const { rewriteFSForCss, startFSStripForCss } = require('./style-compiler/strip-conditional-loader')
|
|
83
|
+
rewriteFSForCss()
|
|
83
84
|
checkVersionCompatibility()
|
|
84
85
|
|
|
85
86
|
const isProductionLikeMode = options => {
|
|
@@ -323,6 +324,9 @@ class MpxWebpackPlugin {
|
|
|
323
324
|
}
|
|
324
325
|
|
|
325
326
|
apply (compiler) {
|
|
327
|
+
// 注入 fs 代理
|
|
328
|
+
startFSStripForCss(this.options.defs)
|
|
329
|
+
|
|
326
330
|
if (!compiler.__mpx__) {
|
|
327
331
|
compiler.__mpx__ = true
|
|
328
332
|
} else {
|
|
@@ -1729,7 +1733,14 @@ class MpxWebpackPlugin {
|
|
|
1729
1733
|
|
|
1730
1734
|
if (isReact(mpx.mode)) {
|
|
1731
1735
|
// 添加 @refresh reset 注释用于在 React HMR 时刷新组件
|
|
1732
|
-
|
|
1736
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1737
|
+
source.add(`/* @refresh reset */
|
|
1738
|
+
if (module.hot) {
|
|
1739
|
+
module.hot.accept(() => {
|
|
1740
|
+
require("react-native").DevSettings.reload();
|
|
1741
|
+
});
|
|
1742
|
+
}\n`)
|
|
1743
|
+
}
|
|
1733
1744
|
// 注入页面的配置,供screen前置设置导航情况
|
|
1734
1745
|
if (isRuntime) {
|
|
1735
1746
|
source.add('// inject pageconfigmap for screen\n' +
|
|
@@ -2087,3 +2098,12 @@ try {
|
|
|
2087
2098
|
}
|
|
2088
2099
|
|
|
2089
2100
|
module.exports = MpxWebpackPlugin
|
|
2101
|
+
|
|
2102
|
+
/**
|
|
2103
|
+
* 定义 MpxWebpackPlugin 的配置
|
|
2104
|
+
* @param {MpxWebpackPluginOptions} options - 插件选项
|
|
2105
|
+
* @returns {MpxWebpackPluginOptions}
|
|
2106
|
+
*/
|
|
2107
|
+
module.exports.defineConfig = function defineConfig(options) {
|
|
2108
|
+
return options
|
|
2109
|
+
}
|
|
@@ -472,6 +472,11 @@ module.exports = function (content) {
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
|
|
475
|
+
const wrapTabBarAsset = (expr) => {
|
|
476
|
+
if (mode !== 'ks') return expr
|
|
477
|
+
return `(function(p){return typeof p === "string" && p.charAt(0) === "/" ? p.slice(1) : p})(${expr})`
|
|
478
|
+
}
|
|
479
|
+
|
|
475
480
|
const processTabBar = (output) => {
|
|
476
481
|
const tabBarCfg = config[mode].tabBar
|
|
477
482
|
const itemKey = tabBarCfg.itemKey
|
|
@@ -480,11 +485,15 @@ module.exports = function (content) {
|
|
|
480
485
|
|
|
481
486
|
if (json.tabBar && json.tabBar[itemKey]) {
|
|
482
487
|
json.tabBar[itemKey].forEach((item, index) => {
|
|
483
|
-
|
|
484
|
-
|
|
488
|
+
const iconPath = item[iconKey]
|
|
489
|
+
if (iconPath && isUrlRequest(iconPath)) {
|
|
490
|
+
const iconRequire = wrapTabBarAsset(`require("${addQuery(urlToRequest(iconPath), { useLocal: true })}")`)
|
|
491
|
+
output += `json.tabBar.${itemKey}[${index}].${iconKey} = ${iconRequire};\n`
|
|
485
492
|
}
|
|
486
|
-
|
|
487
|
-
|
|
493
|
+
const activeIconPath = item[activeIconKey]
|
|
494
|
+
if (activeIconPath && isUrlRequest(activeIconPath)) {
|
|
495
|
+
const activeIconRequire = wrapTabBarAsset(`require("${addQuery(urlToRequest(activeIconPath), { useLocal: true })}")`)
|
|
496
|
+
output += `json.tabBar.${itemKey}[${index}].${activeIconKey} = ${activeIconRequire};\n`
|
|
488
497
|
}
|
|
489
498
|
})
|
|
490
499
|
}
|
|
@@ -179,6 +179,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
179
179
|
swan: addGlobalComponents,
|
|
180
180
|
qq: addGlobalComponents,
|
|
181
181
|
tt: addGlobalComponents,
|
|
182
|
+
ks: addGlobalComponents,
|
|
182
183
|
jd: addGlobalComponents,
|
|
183
184
|
web: fixComponentName,
|
|
184
185
|
ios: fixComponentName,
|
|
@@ -284,6 +285,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
284
285
|
'swan',
|
|
285
286
|
'qq',
|
|
286
287
|
'tt',
|
|
288
|
+
'ks',
|
|
287
289
|
'jd',
|
|
288
290
|
'qa',
|
|
289
291
|
'dd',
|
|
@@ -401,6 +403,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
401
403
|
qq: fillGlobalComponents,
|
|
402
404
|
swan: fillGlobalComponents,
|
|
403
405
|
tt: fillGlobalComponents,
|
|
406
|
+
ks: fillGlobalComponents,
|
|
404
407
|
jd: fillGlobalComponents
|
|
405
408
|
},
|
|
406
409
|
{
|
|
@@ -408,6 +411,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
408
411
|
qq: deletePath({ noLog: true }),
|
|
409
412
|
swan: deletePath({ noLog: true }),
|
|
410
413
|
tt: deletePath({ noLog: true }),
|
|
414
|
+
ks: deletePath({ noLog: true }),
|
|
411
415
|
jd: deletePath({ noLog: true })
|
|
412
416
|
},
|
|
413
417
|
{
|
|
@@ -446,6 +450,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
446
450
|
qq: getTabBarRule(),
|
|
447
451
|
swan: getTabBarRule(),
|
|
448
452
|
tt: getTabBarRule(),
|
|
453
|
+
ks: getTabBarRule(),
|
|
449
454
|
jd: getTabBarRule()
|
|
450
455
|
},
|
|
451
456
|
{
|
|
@@ -454,6 +459,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
454
459
|
qq: getWindowRule(),
|
|
455
460
|
swan: getWindowRule(),
|
|
456
461
|
tt: getWindowRule(),
|
|
462
|
+
ks: getWindowRule(),
|
|
457
463
|
jd: getWindowRule()
|
|
458
464
|
}
|
|
459
465
|
]
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const { hump2dash } = require('../../../utils/hump-dash')
|
|
2
|
+
const { parseValues } = require('../../../utils/string')
|
|
2
3
|
|
|
3
4
|
module.exports = function getSpec ({ warn, error }) {
|
|
4
5
|
// React Native 双端都不支持的 CSS property
|
|
5
|
-
const unsupportedPropExp = /^(white-space|text-overflow|animation|
|
|
6
|
+
const unsupportedPropExp = /^(white-space|text-overflow|animation|font-variant-caps|font-variant-numeric|font-variant-east-asian|font-variant-alternates|font-variant-ligatures|background-position|caret-color)$/
|
|
6
7
|
const unsupportedPropMode = {
|
|
7
8
|
// React Native ios 不支持的 CSS property
|
|
8
9
|
ios: /^(vertical-align)$/,
|
|
@@ -38,7 +39,7 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
38
39
|
}
|
|
39
40
|
// React 属性支持的枚举值
|
|
40
41
|
const SUPPORTED_PROP_VAL_ARR = {
|
|
41
|
-
'box-sizing': ['border-box'],
|
|
42
|
+
'box-sizing': ['border-box', 'content-box'],
|
|
42
43
|
'backface-visibility': ['visible', 'hidden'],
|
|
43
44
|
overflow: ['visible', 'hidden', 'scroll'],
|
|
44
45
|
'border-style': ['solid', 'dotted', 'dashed'],
|
|
@@ -88,42 +89,48 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
88
89
|
if (rule[1].test(prop)) return rule[0]
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
temp = ''
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return result
|
|
92
|
+
|
|
93
|
+
// 从 CSS 变量中提取 fallback 值进行验证
|
|
94
|
+
// 返回值:fallback 值 | null(没有 fallback)| undefined(循环引用)
|
|
95
|
+
const getDefaultValueFromVar = (str, visited = new Set()) => {
|
|
96
|
+
const totalVarExp = /^var\((.+)\)$/
|
|
97
|
+
if (!totalVarExp.test(str)) return str
|
|
98
|
+
|
|
99
|
+
// 防止循环引用 - 返回 undefined 表示检测到循环
|
|
100
|
+
if (visited.has(str)) return undefined
|
|
101
|
+
visited.add(str)
|
|
102
|
+
|
|
103
|
+
const newVal = parseValues((str.match(totalVarExp)?.[1] || ''), ',')
|
|
104
|
+
if (newVal.length <= 1) return null // 没有 fallback
|
|
105
|
+
const fallback = newVal[1].trim()
|
|
106
|
+
// 如果 fallback 也是 var(),递归提取
|
|
107
|
+
if (totalVarExp.test(fallback)) return getDefaultValueFromVar(fallback, visited)
|
|
108
|
+
return fallback
|
|
112
109
|
}
|
|
113
|
-
|
|
114
|
-
// const totalVarExp = /^var\((.+)\)$/
|
|
115
|
-
// if (!totalVarExp.test(str)) return str
|
|
116
|
-
// const newVal = parseValues((str.match(totalVarExp)?.[1] || ''), ',')
|
|
117
|
-
// if (newVal.length <= 1) return ''
|
|
118
|
-
// if (!totalVarExp.test(newVal[1])) return newVal[1]
|
|
119
|
-
// return getDefaultValueFromVar(newVal[1])
|
|
120
|
-
// }
|
|
121
|
-
// 属性值校验
|
|
110
|
+
|
|
122
111
|
const verifyValues = ({ prop, value, selector }, isError = true) => {
|
|
123
112
|
prop = prop.trim()
|
|
124
113
|
value = value.trim()
|
|
125
114
|
const tips = isError ? error : warn
|
|
126
|
-
|
|
115
|
+
|
|
116
|
+
// 对于包含 CSS 变量的值,提取 fallback 值进行验证
|
|
117
|
+
if (cssVariableExp.test(value)) {
|
|
118
|
+
const fallback = getDefaultValueFromVar(value)
|
|
119
|
+
// undefined 表示检测到循环引用
|
|
120
|
+
if (fallback === undefined) {
|
|
121
|
+
tips(`CSS variable circular reference in fallback chain detected in ${selector} for property ${prop}, value: ${value}`)
|
|
122
|
+
return false
|
|
123
|
+
}
|
|
124
|
+
// null 表示没有 fallback,CSS 变量本身是合法的(运行时会解析)
|
|
125
|
+
if (fallback === null) {
|
|
126
|
+
return true
|
|
127
|
+
}
|
|
128
|
+
// 有 fallback 值,将 fallback 作为新的 value 继续后续验证流程
|
|
129
|
+
value = fallback
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// calc() 和 env() 跳过验证
|
|
133
|
+
if (calcExp.test(value) || envExp.test(value)) return true
|
|
127
134
|
const namedColor = ['transparent', 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige', 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown', 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral', 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan', 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki', 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred', 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue', 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite', 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod', 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred', 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen', 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey', 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightslategrey', 'lightsteelblue', 'lightyellow', 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine', 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen', 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise', 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin', 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange', 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise', 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum', 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue', 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna', 'silver', 'skyblue', 'slateblue', 'slategray', 'snow', 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise', 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen']
|
|
128
135
|
const valueExp = {
|
|
129
136
|
number: /^((-?(\d+(\.\d+)?|\.\d+))(rpx|px|%|vw|vh)?|hairlineWidth)$/,
|
|
@@ -393,6 +400,8 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
393
400
|
// css var & 数组直接返回
|
|
394
401
|
if (Array.isArray(value) || cssVariableExp.test(value)) return { prop, value }
|
|
395
402
|
const values = parseValues(value)
|
|
403
|
+
// Todo transform 排序不一致时,transform动画会闪烁,故这里同样的排序输出 transform
|
|
404
|
+
values.sort()
|
|
396
405
|
const transform = []
|
|
397
406
|
values.forEach(item => {
|
|
398
407
|
const match = item.match(/([/\w]+)\((.+)\)/)
|
|
@@ -540,6 +549,15 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
540
549
|
return { prop, value: values[0].trim() }
|
|
541
550
|
}
|
|
542
551
|
|
|
552
|
+
const formatZIndex = ({ prop, value, selector }, { mode }) => {
|
|
553
|
+
// z-index auto 报错
|
|
554
|
+
if (value === 'auto') {
|
|
555
|
+
error(`Property [${prop}] does not supported [${value}] on ${selector} in ${mode} environment, please check again!`)
|
|
556
|
+
return { prop, value: 0 }
|
|
557
|
+
}
|
|
558
|
+
return { prop, value: value }
|
|
559
|
+
}
|
|
560
|
+
|
|
543
561
|
// const formatBoxShadow = ({ prop, value, selector }, { mode }) => {
|
|
544
562
|
// value = value.trim()
|
|
545
563
|
// if (value === 'none') {
|
|
@@ -605,6 +623,12 @@ module.exports = function getSpec ({ warn, error }) {
|
|
|
605
623
|
android: formatFontFamily,
|
|
606
624
|
harmony: formatFontFamily
|
|
607
625
|
},
|
|
626
|
+
{
|
|
627
|
+
test: 'z-index',
|
|
628
|
+
ios: formatZIndex,
|
|
629
|
+
android: formatZIndex,
|
|
630
|
+
harmony: formatZIndex
|
|
631
|
+
},
|
|
608
632
|
// {
|
|
609
633
|
// test: 'box-shadow',
|
|
610
634
|
// ios: formatBoxShadow,
|
|
@@ -8,6 +8,7 @@ module.exports = function ({ print }) {
|
|
|
8
8
|
const qqValueWarningLog = print({ platform: 'qq', type: 'value', tag: TAG_NAME, isError: false })
|
|
9
9
|
const qqPropLog = print({ platform: 'qq', tag: TAG_NAME, isError: false })
|
|
10
10
|
const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' })
|
|
11
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
11
12
|
return {
|
|
12
13
|
test: TAG_NAME,
|
|
13
14
|
props: [
|
|
@@ -43,6 +44,10 @@ module.exports = function ({ print }) {
|
|
|
43
44
|
test: /^(ad-intervals|ad-theme)$/,
|
|
44
45
|
qq: qqPropLog,
|
|
45
46
|
swan: baiduPropLog
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
test: /^(ad-intervals|ad-type|ad-params)$/,
|
|
50
|
+
ks: ksPropLog
|
|
46
51
|
}
|
|
47
52
|
],
|
|
48
53
|
event: [
|
|
@@ -29,6 +29,8 @@ module.exports = function ({ print }) {
|
|
|
29
29
|
const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false })
|
|
30
30
|
const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' })
|
|
31
31
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
32
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
33
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
32
34
|
const wxPropValueLog = print({ platform: 'wx', tag: TAG_NAME, isError: false, type: 'value' })
|
|
33
35
|
const iosValueLogError = print({ platform: 'ios', tag: TAG_NAME, isError: true, type: 'value' })
|
|
34
36
|
const iosValueLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'value' })
|
|
@@ -199,6 +201,10 @@ module.exports = function ({ print }) {
|
|
|
199
201
|
ios: iosPropLog,
|
|
200
202
|
android: androidPropLog,
|
|
201
203
|
harmony: harmonyPropLog
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
test: /^(hover-stop-propagation|session-from|send-message-title|send-message-path|send-message-img|app-parameter|show-message-card|app-parameter|phone-number-no-quota-toast|need-show-entrance|entrance-path)$/,
|
|
207
|
+
ks: ksPropLog
|
|
202
208
|
}
|
|
203
209
|
],
|
|
204
210
|
event: [
|
|
@@ -233,10 +239,11 @@ module.exports = function ({ print }) {
|
|
|
233
239
|
web: webEventLog
|
|
234
240
|
},
|
|
235
241
|
{
|
|
236
|
-
test: /^(getuserinfo|contact|getphonenumber|
|
|
242
|
+
test: /^(getuserinfo|contact|getphonenumber|getrealtimephonenumber|error|opensetting|launchapp|chooseavatar|agreeprivacyauthorization)$/,
|
|
237
243
|
ios: iosEventLog,
|
|
238
244
|
android: androidEventLog,
|
|
239
|
-
harmony: harmonyEventLog
|
|
245
|
+
harmony: harmonyEventLog,
|
|
246
|
+
ks: ksEventLog
|
|
240
247
|
}
|
|
241
248
|
]
|
|
242
249
|
}
|
|
@@ -13,8 +13,23 @@ module.exports = function ({ print }) {
|
|
|
13
13
|
const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' })
|
|
14
14
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
15
15
|
const qaEventLog = print({ platform: 'qa', tag: TAG_NAME, isError: false, type: 'event' })
|
|
16
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
17
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
18
|
+
|
|
16
19
|
return {
|
|
17
20
|
test: TAG_NAME,
|
|
21
|
+
ios (tag, { el }) {
|
|
22
|
+
el.isBuiltIn = true
|
|
23
|
+
return 'mpx-camera'
|
|
24
|
+
},
|
|
25
|
+
android (tag, { el }) {
|
|
26
|
+
el.isBuiltIn = true
|
|
27
|
+
return 'mpx-camera'
|
|
28
|
+
},
|
|
29
|
+
harmony (tag, { el }) {
|
|
30
|
+
el.isBuiltIn = true
|
|
31
|
+
return 'mpx-camera'
|
|
32
|
+
},
|
|
18
33
|
props: [
|
|
19
34
|
{
|
|
20
35
|
test: 'mode',
|
|
@@ -46,7 +61,8 @@ module.exports = function ({ print }) {
|
|
|
46
61
|
},
|
|
47
62
|
{
|
|
48
63
|
test: /^(resolution|frame-size)$/,
|
|
49
|
-
qq: qqPropLog
|
|
64
|
+
qq: qqPropLog,
|
|
65
|
+
ks: ksPropLog
|
|
50
66
|
},
|
|
51
67
|
{
|
|
52
68
|
test: /^(frame-size|device-position)$/,
|
|
@@ -73,11 +89,17 @@ module.exports = function ({ print }) {
|
|
|
73
89
|
test: /^(scancode)$/,
|
|
74
90
|
swan: baiduEventLog,
|
|
75
91
|
tt: ttEventLog,
|
|
76
|
-
qa: qaEventLog
|
|
92
|
+
qa: qaEventLog,
|
|
93
|
+
ks: ksEventLog
|
|
77
94
|
},
|
|
78
95
|
{
|
|
79
96
|
test: /^(initdone)$/,
|
|
80
|
-
qq: qqEventLog
|
|
97
|
+
qq: qqEventLog,
|
|
98
|
+
ks: ksEventLog
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
test: /^(stop|error)$/,
|
|
102
|
+
ks: ksEventLog
|
|
81
103
|
}
|
|
82
104
|
]
|
|
83
105
|
}
|
|
@@ -6,6 +6,8 @@ module.exports = function ({ print }) {
|
|
|
6
6
|
const ttEventLog = print({ platform: 'bytedance', tag: TAG_NAME, isError: false, type: 'event' })
|
|
7
7
|
const jdPropLog = print({ platform: 'jd', tag: TAG_NAME, isError: false })
|
|
8
8
|
const qaEventLog = print({ platform: 'qa', tag: TAG_NAME, isError: false, type: 'event' })
|
|
9
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
10
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
9
11
|
return {
|
|
10
12
|
test: TAG_NAME,
|
|
11
13
|
android (tag, { el }) {
|
|
@@ -37,6 +39,10 @@ module.exports = function ({ print }) {
|
|
|
37
39
|
{
|
|
38
40
|
test: 'type',
|
|
39
41
|
jd: jdPropLog
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
test: /^(type|disable-scroll)$/,
|
|
45
|
+
ks: ksPropLog
|
|
40
46
|
}
|
|
41
47
|
],
|
|
42
48
|
// 组件事件中的差异部分
|
|
@@ -63,7 +69,8 @@ module.exports = function ({ print }) {
|
|
|
63
69
|
{
|
|
64
70
|
test: /^(longtap|error)$/,
|
|
65
71
|
tt: ttEventLog,
|
|
66
|
-
qa: qaEventLog
|
|
72
|
+
qa: qaEventLog,
|
|
73
|
+
ks: ksEventLog
|
|
67
74
|
}
|
|
68
75
|
]
|
|
69
76
|
}
|
|
@@ -2,9 +2,12 @@ const TAG_NAME = 'cover-image'
|
|
|
2
2
|
|
|
3
3
|
module.exports = function ({ print }) {
|
|
4
4
|
const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' })
|
|
5
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
5
6
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
6
7
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
7
8
|
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
9
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
10
|
+
|
|
8
11
|
return {
|
|
9
12
|
test: TAG_NAME,
|
|
10
13
|
web (tag, { el }) {
|
|
@@ -37,13 +40,15 @@ module.exports = function ({ print }) {
|
|
|
37
40
|
test: /^(referrer-policy)$/,
|
|
38
41
|
ios: iosPropLog,
|
|
39
42
|
android: androidPropLog,
|
|
40
|
-
harmony: harmonyPropLog
|
|
43
|
+
harmony: harmonyPropLog,
|
|
44
|
+
ks: ksPropLog
|
|
41
45
|
}
|
|
42
46
|
],
|
|
43
47
|
event: [
|
|
44
48
|
{
|
|
45
49
|
test: /^(load|error)$/,
|
|
46
|
-
ali: aliEventLog
|
|
50
|
+
ali: aliEventLog,
|
|
51
|
+
ks: ksEventLog
|
|
47
52
|
}
|
|
48
53
|
]
|
|
49
54
|
}
|
|
@@ -4,6 +4,7 @@ module.exports = function ({ print }) {
|
|
|
4
4
|
const aliPropLog = print({ platform: 'ali', tag: TAG_NAME, isError: false })
|
|
5
5
|
const baiduValueLogError = print({ platform: 'baidu', tag: TAG_NAME, isError: true, type: 'value' })
|
|
6
6
|
const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false })
|
|
7
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
7
8
|
|
|
8
9
|
return {
|
|
9
10
|
test: TAG_NAME,
|
|
@@ -41,7 +42,8 @@ module.exports = function ({ print }) {
|
|
|
41
42
|
baiduValueLogError({ name, value })
|
|
42
43
|
}
|
|
43
44
|
},
|
|
44
|
-
web: webPropLog
|
|
45
|
+
web: webPropLog,
|
|
46
|
+
ks: ksPropLog
|
|
45
47
|
},
|
|
46
48
|
{
|
|
47
49
|
test: 'use-built-in',
|
|
@@ -10,6 +10,16 @@ module.exports = function ({ print }) {
|
|
|
10
10
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
11
11
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
12
12
|
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
13
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
14
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
15
|
+
const iosEventLog = print({ platform: 'ios', tag: TAG_NAME, isError: false, type: 'event' })
|
|
16
|
+
const androidEventLog = print({ platform: 'android', tag: TAG_NAME, isError: false, type: 'event' })
|
|
17
|
+
const harmonyEventLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false, type: 'event' })
|
|
18
|
+
const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' })
|
|
19
|
+
const aliEventLog = print({ platform: 'ali', tag: TAG_NAME, isError: false, type: 'event' })
|
|
20
|
+
const qaEventLog = print({ platform: 'qa', tag: TAG_NAME, isError: false, type: 'event' })
|
|
21
|
+
const qqEventLog = print({ platform: 'qq', tag: TAG_NAME, isError: false, type: 'event' })
|
|
22
|
+
const jdEventLog = print({ platform: 'jd', tag: TAG_NAME, isError: false, type: 'event' })
|
|
13
23
|
|
|
14
24
|
return {
|
|
15
25
|
test: TAG_NAME,
|
|
@@ -39,12 +49,27 @@ module.exports = function ({ print }) {
|
|
|
39
49
|
qq: qqPropLog
|
|
40
50
|
},
|
|
41
51
|
{
|
|
42
|
-
test: /^(report-submit|report-submit-timeout)$/,
|
|
52
|
+
test: /^(report-submit|report-submit-timeout|submitToGroup)$/,
|
|
43
53
|
web: webPropLog,
|
|
44
54
|
qa: qaPropLog,
|
|
45
55
|
ios: iosPropLog,
|
|
46
56
|
android: androidPropLog,
|
|
47
|
-
harmony: harmonyPropLog
|
|
57
|
+
harmony: harmonyPropLog,
|
|
58
|
+
ks: ksPropLog
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
event: [
|
|
62
|
+
{
|
|
63
|
+
test: /^(submitToGroup)$/,
|
|
64
|
+
ks: ksEventLog,
|
|
65
|
+
ios: iosEventLog,
|
|
66
|
+
android: androidEventLog,
|
|
67
|
+
harmony: harmonyEventLog,
|
|
68
|
+
web: webEventLog,
|
|
69
|
+
ali: aliEventLog,
|
|
70
|
+
qa: qaEventLog,
|
|
71
|
+
qq: qqEventLog,
|
|
72
|
+
jd: jdEventLog
|
|
48
73
|
}
|
|
49
74
|
]
|
|
50
75
|
}
|
|
@@ -9,6 +9,7 @@ module.exports = function ({ print }) {
|
|
|
9
9
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
10
10
|
const androidPropLog = print({ platform: 'android', tag: TAG_NAME, isError: false })
|
|
11
11
|
const harmonyPropLog = print({ platform: 'harmony', tag: TAG_NAME, isError: false })
|
|
12
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
12
13
|
|
|
13
14
|
return {
|
|
14
15
|
test: TAG_NAME,
|
|
@@ -55,6 +56,10 @@ module.exports = function ({ print }) {
|
|
|
55
56
|
ios: iosPropLog,
|
|
56
57
|
android: androidPropLog,
|
|
57
58
|
harmony: harmonyPropLog
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
test: /^(webp|forceHttps|show-menu-by-longpress|fade-in)$/,
|
|
62
|
+
ks: ksPropLog
|
|
58
63
|
}
|
|
59
64
|
]
|
|
60
65
|
}
|
|
@@ -12,6 +12,8 @@ module.exports = function ({ print }) {
|
|
|
12
12
|
const webPropLog = print({ platform: 'web', tag: TAG_NAME, isError: false })
|
|
13
13
|
const webEventLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'event' })
|
|
14
14
|
const webValueLog = print({ platform: 'web', tag: TAG_NAME, isError: false, type: 'value' })
|
|
15
|
+
const ksPropLog = print({ platform: 'ks', tag: TAG_NAME, isError: false })
|
|
16
|
+
const ksEventLog = print({ platform: 'ks', tag: TAG_NAME, isError: false, type: 'event' })
|
|
15
17
|
const qaPropLog = print({ platform: 'qa', tag: TAG_NAME, isError: false })
|
|
16
18
|
const iosValueLogError = print({ platform: 'ios', tag: TAG_NAME, isError: true, type: 'value' })
|
|
17
19
|
const iosPropLog = print({ platform: 'ios', tag: TAG_NAME, isError: false })
|
|
@@ -109,6 +111,10 @@ module.exports = function ({ print }) {
|
|
|
109
111
|
ios: iosPropLog,
|
|
110
112
|
android: androidPropLog,
|
|
111
113
|
harmony: harmonyPropLog
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
test: /^(cursor-spacing|always-embed|cursor|selection-start|selection-end|adjust-position|hold-keyboard|safe-password-cert-path|safe-password-length|safe-password-time-stamp|safe-password-nonce|safe-password-salt|safe-password-custom-hash|placeholder-class)$/,
|
|
117
|
+
ks: ksPropLog
|
|
112
118
|
}
|
|
113
119
|
],
|
|
114
120
|
event: [
|
|
@@ -129,6 +135,10 @@ module.exports = function ({ print }) {
|
|
|
129
135
|
ios: iosEventLog,
|
|
130
136
|
android: androidEventLog,
|
|
131
137
|
harmony: harmonyEventLog
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
test: /^(change|nicknamereview|selectionchange|keyboardcompositionstart|keyboardcompositionupdate|keyboardcompositionend|onkeyboardheightchange)$/,
|
|
141
|
+
ks: ksEventLog
|
|
132
142
|
}
|
|
133
143
|
]
|
|
134
144
|
}
|