@tstdl/base 0.85.6 → 0.85.8
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/package.json +2 -2
- package/signals/implementation/effect.js +1 -1
- package/signals/index.d.ts +1 -0
- package/signals/index.js +1 -0
- package/signals/types.d.ts +5 -0
- package/signals/types.js +16 -0
- package/text/localization.service.js +7 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.85.
|
|
3
|
+
"version": "0.85.8",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"koa": "^2.14",
|
|
59
59
|
"minio": "^7.1",
|
|
60
60
|
"mjml": "^4.14",
|
|
61
|
-
"mongodb": "^5.
|
|
61
|
+
"mongodb": "^5.7",
|
|
62
62
|
"nodemailer": "^6.9",
|
|
63
63
|
"playwright": "^1.35",
|
|
64
64
|
"preact": "^10.15",
|
package/signals/index.d.ts
CHANGED
package/signals/index.js
CHANGED
|
@@ -19,3 +19,4 @@ __reExport(signals_exports, require("./api.js"), module.exports);
|
|
|
19
19
|
__reExport(signals_exports, require("./computed-with-dependencies.js"), module.exports);
|
|
20
20
|
__reExport(signals_exports, require("./effect-with-dependencies.js"), module.exports);
|
|
21
21
|
__reExport(signals_exports, require("./pipe.js"), module.exports);
|
|
22
|
+
__reExport(signals_exports, require("./types.js"), module.exports);
|
package/signals/types.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -34,7 +34,6 @@ var import_container = require("../container/index.js");
|
|
|
34
34
|
var import_details_error = require("../error/details.error.js");
|
|
35
35
|
var import_logger = require("../logger/index.js");
|
|
36
36
|
var import_api = require("../signals/api.js");
|
|
37
|
-
var import_computed_with_dependencies = require("../signals/computed-with-dependencies.js");
|
|
38
37
|
var import_enum = require("../utils/enum.js");
|
|
39
38
|
var import_memoize = require("../utils/function/memoize.js");
|
|
40
39
|
var import_object = require("../utils/object/object.js");
|
|
@@ -89,7 +88,7 @@ let LocalizationService = class LocalizationService2 {
|
|
|
89
88
|
#activeLanguage = (0, import_api.signal)(null);
|
|
90
89
|
#availableLanguages = (0, import_api.signal)([]);
|
|
91
90
|
#activeLocalization = (0, import_api.computed)(() => {
|
|
92
|
-
const language = this
|
|
91
|
+
const language = this.#activeLanguage();
|
|
93
92
|
if ((0, import_type_guards.isNull)(language)) {
|
|
94
93
|
return null;
|
|
95
94
|
}
|
|
@@ -112,11 +111,11 @@ let LocalizationService = class LocalizationService2 {
|
|
|
112
111
|
} else {
|
|
113
112
|
this.#localizations.set(localization.language.code, mappedLocalization);
|
|
114
113
|
}
|
|
115
|
-
if ((0, import_type_guards.isUndefined)(this.activeLanguage)) {
|
|
116
|
-
this.setLocalization(localization);
|
|
117
|
-
}
|
|
118
114
|
const availableLanguages = [...this.#localizations].map(([, loc]) => loc.language);
|
|
119
115
|
this.#availableLanguages.set(availableLanguages);
|
|
116
|
+
if ((0, import_type_guards.isNullOrUndefined)(this.#activeLanguage())) {
|
|
117
|
+
this.setLanguage(localization.language.code);
|
|
118
|
+
}
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
121
|
hasLanguage(languageCode) {
|
|
@@ -133,7 +132,7 @@ let LocalizationService = class LocalizationService2 {
|
|
|
133
132
|
this.#activeLanguage.set(language);
|
|
134
133
|
}
|
|
135
134
|
setLocalization(localization) {
|
|
136
|
-
this.setLanguage(localization.language);
|
|
135
|
+
this.setLanguage(localization.language.code);
|
|
137
136
|
}
|
|
138
137
|
tryGetItem(keyOrData) {
|
|
139
138
|
const activeLanguageCode = this.#activeLanguage()?.code;
|
|
@@ -181,10 +180,10 @@ let LocalizationService = class LocalizationService2 {
|
|
|
181
180
|
return this.localizeItem(key, item, parameters);
|
|
182
181
|
}
|
|
183
182
|
localize(data) {
|
|
184
|
-
return (0,
|
|
183
|
+
return (0, import_api.computed)(() => this.localizeOnce(data));
|
|
185
184
|
}
|
|
186
185
|
localizeEnum(enumeration, value, parameters) {
|
|
187
|
-
return (0,
|
|
186
|
+
return (0, import_api.computed)(() => this.localizeEnumOnce(enumeration, value, parameters));
|
|
188
187
|
}
|
|
189
188
|
localize$(data) {
|
|
190
189
|
return (0, import_api.toObservable)(this.localize(data));
|