From d910737ae760943713504f1e5968c62edd61a3da Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Wed, 2 Jul 2025 18:19:52 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9A=82=E5=AE=9A=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E5=80=BC=E4=BB=A5ux=E5=BC=80=E5=A7=8B=E7=9A=84=E4=B8=8D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-compiler/src/style/validator.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/hap-compiler/src/style/validator.js b/packages/hap-compiler/src/style/validator.js index a4874cf..ee8f043 100755 --- a/packages/hap-compiler/src/style/validator.js +++ b/packages/hap-compiler/src/style/validator.js @@ -1734,7 +1734,8 @@ const validator = { */ enum: function (list, v) { const index = list.indexOf(v) - if (index > 0) { + if (index > 0 || v.indexOf('ux') > -1) { + // 能找到或者以ux开头的都不校验 return { value: v } } if (index === 0) { From a62d49a1c28b602551b0346ba0c1623db0328af4 Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Thu, 3 Jul 2025 10:04:14 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=81=B5=E6=84=9F=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E4=B8=8D=E5=9C=A8=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E5=86=85=E7=9A=84=E4=B9=9F=E8=83=BD=E7=BC=96=E8=AF=91=E8=BF=9B?= =?UTF-8?q?=E5=8E=BB=E4=BB=A5=E5=8F=8AminCardPlatformVersion=E9=9D=9E?= =?UTF-8?q?=E5=BF=85=E5=A1=AB=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-compiler/src/style/validator.js | 28 +++++++++++++++++--- packages/hap-packager/src/common/shared.js | 5 ++-- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/packages/hap-compiler/src/style/validator.js b/packages/hap-compiler/src/style/validator.js index ee8f043..df9221b 100755 --- a/packages/hap-compiler/src/style/validator.js +++ b/packages/hap-compiler/src/style/validator.js @@ -403,13 +403,15 @@ const validateTime = function (v) { const themeColors = [ 'uxCardColorBackground', 'uxCardColorAccent', + 'uxCardColorTheme', 'uxCardColorContainer', - 'uxCardColorHue', - 'uxCardColorHueSecondary', 'uxCardColorPrimary', 'uxCardColorQuaternary', + 'uxCardColorSecondary', 'uxCardColorSecondaryVariant', - 'uxCardColorTertiary' + 'uxCardColorTertiary', + 'uxCardColorHue', + 'uxCardColorHueSecondary' ] const validator = { /** @@ -1734,8 +1736,26 @@ const validator = { */ enum: function (list, v) { const index = list.indexOf(v) - if (index > 0 || v.indexOf('ux') > -1) { + if (index > 0 || v.startsWith('ux')) { // 能找到或者以ux开头的都不校验 + if(index < 0) { + // 如果ux开头的不在列表内给出黄色警告 + return { + value: v, + reason: function reason(k, v) { + return ( + 'WARN: 属性`' + + camelCaseToHyphened(k) + + '` 的值 `' + + v + + '` 无效 ` (有效枚举值为: `' + + list.join('`|`') + + '`)' + ) + } + } + + } return { value: v } } if (index === 0) { diff --git a/packages/hap-packager/src/common/shared.js b/packages/hap-packager/src/common/shared.js index a91973f..f9a55b1 100644 --- a/packages/hap-packager/src/common/shared.js +++ b/packages/hap-packager/src/common/shared.js @@ -234,9 +234,10 @@ function populateWidgetFields(widgetsObj) { conf.minPlatformVersion = conf.minCardPlatformVersion } else if (!conf.minPlatformVersion) { // 没写 minCardPlatformVersion 和 minPlatformVersion 字段 - colorconsole.throw( + // 不填minCardPlatformVersion也能编译 + /* colorconsole.throw( `manifest.json 文件 widgets 字段下,${routePath} 缺少 minCardPlatformVersion 字段` - ) + ) */ } } if (conf.type === 'lite' && !conf.minCardPlatformVersion) { From b2da66298169b3830c119402c5826c2c1b6df4ed Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Thu, 3 Jul 2025 10:06:18 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E7=81=B5=E6=84=9F=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E4=B8=8D=E5=9C=A8=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E5=86=85=E7=9A=84=E4=B9=9F=E8=83=BD=E7=BC=96=E8=AF=91=E8=BF=9B?= =?UTF-8?q?=E5=8E=BB=E4=BB=A5=E5=8F=8AminCardPlatformVersion=E9=9D=9E?= =?UTF-8?q?=E5=BF=85=E5=A1=AB=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-compiler/src/style/validator.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/hap-compiler/src/style/validator.js b/packages/hap-compiler/src/style/validator.js index df9221b..3e8a4c9 100755 --- a/packages/hap-compiler/src/style/validator.js +++ b/packages/hap-compiler/src/style/validator.js @@ -1738,7 +1738,7 @@ const validator = { const index = list.indexOf(v) if (index > 0 || v.startsWith('ux')) { // 能找到或者以ux开头的都不校验 - if(index < 0) { + if (index < 0) { // 如果ux开头的不在列表内给出黄色警告 return { value: v, @@ -1754,7 +1754,6 @@ const validator = { ) } } - } return { value: v } } From 14a4e006a6ba8fb81071770bad8bdc053d6e0ff3 Mon Sep 17 00:00:00 2001 From: yucongshuang Date: Thu, 3 Jul 2025 14:04:36 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=B0=86=E7=81=B5=E6=84=9F=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=A0=B7=E5=BC=8F=E4=BB=8E=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E7=A7=BB=E9=99=A4=E4=B8=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hap-compiler/src/style/validator.js | 24 +++----------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/packages/hap-compiler/src/style/validator.js b/packages/hap-compiler/src/style/validator.js index 3e8a4c9..6ac08f7 100755 --- a/packages/hap-compiler/src/style/validator.js +++ b/packages/hap-compiler/src/style/validator.js @@ -1736,25 +1736,7 @@ const validator = { */ enum: function (list, v) { const index = list.indexOf(v) - if (index > 0 || v.startsWith('ux')) { - // 能找到或者以ux开头的都不校验 - if (index < 0) { - // 如果ux开头的不在列表内给出黄色警告 - return { - value: v, - reason: function reason(k, v) { - return ( - 'WARN: 属性`' + - camelCaseToHyphened(k) + - '` 的值 `' + - v + - '` 无效 ` (有效枚举值为: `' + - list.join('`|`') + - '`)' - ) - } - } - } + if (index > 0) { return { value: v } } if (index === 0) { @@ -2722,12 +2704,12 @@ const validatorMap = { // font fontSrc: validator.fontSrc, fontFamily: validator.fontFamily, - themeColor: makeEnumValidator(themeColors), + /* themeColor: makeEnumValidator(themeColors), themeBackgroundColor: makeEnumValidator(themeColors), themeLayerColor: makeEnumValidator(themeColors), themeTrackColor: makeEnumValidator(themeColors), themeSelectedColor: makeEnumValidator(themeColors), - themeBlockColor: makeEnumValidator(themeColors), + themeBlockColor: makeEnumValidator(themeColors), */ letterSpacing: validator.letterSpacing }