@galacean/effects-threejs 1.4.2 → 1.4.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/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +24 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v1.4.
|
|
6
|
+
* Version: v1.4.4
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -704,6 +704,18 @@ function asserts(condition, msg) {
|
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
706
|
|
|
707
|
+
/**
|
|
708
|
+
* 判断是否为可解析的字体
|
|
709
|
+
* - 首字母不能为数字或 `.`
|
|
710
|
+
* - 不能包含特殊字符,`_-` 是被允许的
|
|
711
|
+
* @param fontFamily - 字体名称
|
|
712
|
+
* @returns
|
|
713
|
+
*/
|
|
714
|
+
function isValidFontFamily(fontFamily) {
|
|
715
|
+
// iOS 11/12 不支持自定义字体开头为数字的名称,特殊字符也有风险
|
|
716
|
+
return /^[^\d.][\w-]*$/.test(fontFamily);
|
|
717
|
+
}
|
|
718
|
+
|
|
707
719
|
/*!
|
|
708
720
|
* Name: @galacean/effects-specification
|
|
709
721
|
* Description: Galacean Effects JSON Specification
|
|
@@ -20398,7 +20410,8 @@ var TextItem = /** @class */ (function (_super) {
|
|
|
20398
20410
|
* @returns
|
|
20399
20411
|
*/
|
|
20400
20412
|
TextItem.prototype.setFontFamily = function (value) {
|
|
20401
|
-
if (this.textStyle.fontFamily === value) {
|
|
20413
|
+
if (this.textStyle.fontFamily === value && !isValidFontFamily(value)) {
|
|
20414
|
+
console.warn('The font is either the current font or an risky font family.');
|
|
20402
20415
|
return;
|
|
20403
20416
|
}
|
|
20404
20417
|
this.textStyle.fontFamily = value;
|
|
@@ -24228,11 +24241,15 @@ var AssetManager = /** @class */ (function () {
|
|
|
24228
24241
|
switch (_b.label) {
|
|
24229
24242
|
case 0:
|
|
24230
24243
|
if (!(font.fontURL && !AssetManager.fonts.has(font.fontFamily))) return [3 /*break*/, 4];
|
|
24231
|
-
|
|
24232
|
-
|
|
24244
|
+
if (!isValidFontFamily(font.fontFamily)) {
|
|
24245
|
+
// 在所有设备上提醒开发者
|
|
24246
|
+
console.warn("Risky font family: ".concat(font.fontFamily));
|
|
24247
|
+
}
|
|
24233
24248
|
_b.label = 1;
|
|
24234
24249
|
case 1:
|
|
24235
24250
|
_b.trys.push([1, 3, , 4]);
|
|
24251
|
+
url = new URL(font.fontURL, this.baseUrl).href;
|
|
24252
|
+
fontFace = new FontFace((_a = font.fontFamily) !== null && _a !== void 0 ? _a : '', 'url(' + url + ')');
|
|
24236
24253
|
return [4 /*yield*/, fontFace.load()];
|
|
24237
24254
|
case 2:
|
|
24238
24255
|
_b.sent();
|
|
@@ -24242,7 +24259,7 @@ var AssetManager = /** @class */ (function () {
|
|
|
24242
24259
|
return [3 /*break*/, 4];
|
|
24243
24260
|
case 3:
|
|
24244
24261
|
_b.sent();
|
|
24245
|
-
logger.warn("Invalid
|
|
24262
|
+
logger.warn("Invalid font family or font source: ".concat(JSON.stringify(font.fontURL)));
|
|
24246
24263
|
return [3 /*break*/, 4];
|
|
24247
24264
|
case 4: return [2 /*return*/];
|
|
24248
24265
|
}
|
|
@@ -27401,7 +27418,7 @@ Geometry.create = function (engine, options) {
|
|
|
27401
27418
|
Mesh.create = function (engine, props) {
|
|
27402
27419
|
return new ThreeMesh(engine, props);
|
|
27403
27420
|
};
|
|
27404
|
-
var version = "1.4.
|
|
27421
|
+
var version = "1.4.4";
|
|
27405
27422
|
logger.info('THREEJS plugin version: ' + version);
|
|
27406
27423
|
|
|
27407
27424
|
exports.AbstractPlugin = AbstractPlugin;
|
|
@@ -27599,6 +27616,7 @@ exports.isSimulatorCellPhone = isSimulatorCellPhone;
|
|
|
27599
27616
|
exports.isString = isString;
|
|
27600
27617
|
exports.isUniformStruct = isUniformStruct;
|
|
27601
27618
|
exports.isUniformStructArray = isUniformStructArray;
|
|
27619
|
+
exports.isValidFontFamily = isValidFontFamily;
|
|
27602
27620
|
exports.isWebGL2 = isWebGL2;
|
|
27603
27621
|
exports.itemFrag = itemFrag;
|
|
27604
27622
|
exports.itemFrameFrag = itemFrameFrag;
|