x4js 1.5.32 → 1.5.34
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/cjs/index.js +9 -9
- package/lib/cjs/index.js.map +3 -3
- package/lib/esm/index.mjs +57 -28
- package/lib/esm/index.mjs.map +2 -2
- package/lib/src/i18n.ts +63 -34
- package/lib/src/i18n.ts.bak +347 -0
- package/lib/src/icon.ts +19 -0
- package/lib/src/svgcomponent.ts +6 -6
- package/lib/src/version.ts +1 -1
- package/lib/types/icon.d.ts +7 -0
- package/lib/types/svgcomponent.d.ts +6 -6
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/esm/index.mjs
CHANGED
|
@@ -402,23 +402,57 @@ function addTranslation(name, ...parts) {
|
|
|
402
402
|
}
|
|
403
403
|
const lang = languages[name];
|
|
404
404
|
parts.forEach((p) => {
|
|
405
|
-
_patch(lang.src_translations, p
|
|
405
|
+
_patch(lang.src_translations, p);
|
|
406
406
|
});
|
|
407
|
-
lang.translations =
|
|
407
|
+
lang.translations = _proxyfy(lang.src_translations, lang.base, true);
|
|
408
408
|
}
|
|
409
409
|
__name(addTranslation, "addTranslation");
|
|
410
|
-
function _patch(obj, by
|
|
410
|
+
function _patch(obj, by) {
|
|
411
411
|
for (let n in by) {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
obj[n]
|
|
412
|
+
const src = by[n];
|
|
413
|
+
if (typeof src === "string") {
|
|
414
|
+
obj[n] = src;
|
|
415
|
+
} else {
|
|
416
|
+
if (Array.isArray(src) && (!obj[n] || !Array.isArray(obj[n]))) {
|
|
417
|
+
obj[n] = [...src];
|
|
418
|
+
} else if (!obj[n] || typeof obj[n] !== "object") {
|
|
419
|
+
obj[n] = { ...src };
|
|
420
|
+
} else {
|
|
421
|
+
_patch(obj[n], by[n]);
|
|
422
|
+
}
|
|
417
423
|
}
|
|
418
424
|
}
|
|
419
|
-
return obj;
|
|
420
425
|
}
|
|
421
426
|
__name(_patch, "_patch");
|
|
427
|
+
function _proxyfy(obj, base, root) {
|
|
428
|
+
const result = {};
|
|
429
|
+
for (const n in obj) {
|
|
430
|
+
if (typeof obj[n] !== "string" && !Array.isArray(obj[n])) {
|
|
431
|
+
result[n] = _proxyfy(obj[n], base, false);
|
|
432
|
+
} else {
|
|
433
|
+
result[n] = obj[n];
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return _mk_proxy(result, base, root);
|
|
437
|
+
}
|
|
438
|
+
__name(_proxyfy, "_proxyfy");
|
|
439
|
+
function _mk_proxy(obj, base, root) {
|
|
440
|
+
return new Proxy(obj, {
|
|
441
|
+
get: (target, prop) => {
|
|
442
|
+
if (root) {
|
|
443
|
+
req_path = [prop];
|
|
444
|
+
} else {
|
|
445
|
+
req_path.push(prop);
|
|
446
|
+
}
|
|
447
|
+
let value = target[prop];
|
|
448
|
+
if (value === void 0 && base) {
|
|
449
|
+
value = _findBaseTrans(base);
|
|
450
|
+
}
|
|
451
|
+
return value;
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
__name(_mk_proxy, "_mk_proxy");
|
|
422
456
|
var req_path;
|
|
423
457
|
function _findBaseTrans(base) {
|
|
424
458
|
while (base) {
|
|
@@ -441,24 +475,6 @@ function _findBaseTrans(base) {
|
|
|
441
475
|
return void 0;
|
|
442
476
|
}
|
|
443
477
|
__name(_findBaseTrans, "_findBaseTrans");
|
|
444
|
-
function _mk_proxy(obj, base, root) {
|
|
445
|
-
return new Proxy(obj, {
|
|
446
|
-
get: (target, prop) => {
|
|
447
|
-
if (root) {
|
|
448
|
-
req_path = [prop];
|
|
449
|
-
} else {
|
|
450
|
-
req_path.push(prop);
|
|
451
|
-
}
|
|
452
|
-
let value = target[prop];
|
|
453
|
-
if (value === void 0 && base) {
|
|
454
|
-
value = _findBaseTrans(base);
|
|
455
|
-
target[prop] = value;
|
|
456
|
-
}
|
|
457
|
-
return value;
|
|
458
|
-
}
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
__name(_mk_proxy, "_mk_proxy");
|
|
462
478
|
var _tr = {};
|
|
463
479
|
function selectLanguage(name) {
|
|
464
480
|
if (!isLanguage(name)) {
|
|
@@ -4488,6 +4504,13 @@ var _Icon = class extends Component {
|
|
|
4488
4504
|
url = url.replaceAll("\\", "");
|
|
4489
4505
|
this._setSVG(url);
|
|
4490
4506
|
return;
|
|
4507
|
+
}
|
|
4508
|
+
const reChar = /\s*font-char\s*\(\s*(.+)\s*\)\s*/gi;
|
|
4509
|
+
let match_char = reChar.exec(icon);
|
|
4510
|
+
if (match_char) {
|
|
4511
|
+
this.removeClass("@svg-icon");
|
|
4512
|
+
this.setContent(match_char[1], false);
|
|
4513
|
+
return;
|
|
4491
4514
|
} else {
|
|
4492
4515
|
console.error("deprecation error: invalid icon name");
|
|
4493
4516
|
name = icon;
|
|
@@ -15704,7 +15727,7 @@ function setupWSMessaging(closeCB) {
|
|
|
15704
15727
|
__name(setupWSMessaging, "setupWSMessaging");
|
|
15705
15728
|
|
|
15706
15729
|
// src/version.ts
|
|
15707
|
-
var x4js_version = "1.5.
|
|
15730
|
+
var x4js_version = "1.5.34";
|
|
15708
15731
|
export {
|
|
15709
15732
|
AbsLayout,
|
|
15710
15733
|
Application,
|
|
@@ -15790,7 +15813,13 @@ export {
|
|
|
15790
15813
|
Rect,
|
|
15791
15814
|
Router,
|
|
15792
15815
|
SVGComponent,
|
|
15816
|
+
SVGGradient,
|
|
15817
|
+
SVGGroup,
|
|
15818
|
+
SVGItem,
|
|
15819
|
+
SVGPath,
|
|
15793
15820
|
SVGPathBuilder,
|
|
15821
|
+
SVGShape,
|
|
15822
|
+
SVGText,
|
|
15794
15823
|
ScrollView,
|
|
15795
15824
|
Separator,
|
|
15796
15825
|
Settings,
|