infinity-forge 1.4.3 → 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.
|
@@ -10,48 +10,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
14
|
exports.useI18n = exports.I18nProvider = void 0;
|
|
51
15
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
52
16
|
var react_1 = require("react");
|
|
53
17
|
var router_1 = require("next/router");
|
|
54
|
-
var ui_1 = require("../../../ui/index.js");
|
|
55
18
|
var system_1 = require("../../../system/index.js");
|
|
56
19
|
var I18nContext = (0, react_1.createContext)({
|
|
57
20
|
language: 'pt-BR',
|
|
@@ -62,7 +25,6 @@ var I18nContext = (0, react_1.createContext)({
|
|
|
62
25
|
findWordByLanguage: function () { return undefined; },
|
|
63
26
|
});
|
|
64
27
|
function I18nProvider(props) {
|
|
65
|
-
var _this = this;
|
|
66
28
|
var router = (0, router_1.useRouter)();
|
|
67
29
|
var pathname = router.pathname, asPath = router.asPath, query = router.query;
|
|
68
30
|
function findWordByLanguage(languageSymbol, referenceID) {
|
|
@@ -70,24 +32,10 @@ function I18nProvider(props) {
|
|
|
70
32
|
var translation = (_b = (_a = props === null || props === void 0 ? void 0 : props.words) === null || _a === void 0 ? void 0 : _a.find(function (word) { return word.referenceCode === referenceID; })) === null || _b === void 0 ? void 0 : _b.items.find(function (language) { return language.symbol === languageSymbol; });
|
|
71
33
|
return translation;
|
|
72
34
|
}
|
|
73
|
-
var languages = (0, ui_1.useQuery)({
|
|
74
|
-
queryKey: 'Languages',
|
|
75
|
-
queryFn: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
76
|
-
var result;
|
|
77
|
-
return __generator(this, function (_a) {
|
|
78
|
-
switch (_a.label) {
|
|
79
|
-
case 0: return [4 /*yield*/, fetch(process.env.api + 'language').then(function (r) { return r.json(); })];
|
|
80
|
-
case 1:
|
|
81
|
-
result = _a.sent();
|
|
82
|
-
return [2 /*return*/, result];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}); },
|
|
86
|
-
});
|
|
87
35
|
function changeLanguage(locale) {
|
|
88
36
|
router.push({ pathname: pathname, query: query }, asPath, { locale: locale });
|
|
89
37
|
}
|
|
90
|
-
return ((0, jsx_runtime_1.jsx)(I18nContext.Provider, { value: __assign(__assign({}, props), {
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)(I18nContext.Provider, { value: __assign(__assign({}, props), { changeLanguage: changeLanguage, findWordByLanguage: findWordByLanguage }), children: router.query.editMode ? ((0, jsx_runtime_1.jsx)(system_1.PrivatePage, { roles: props.roleToEditLanguage, children: props.children })) : (props.children) }));
|
|
91
39
|
}
|
|
92
40
|
exports.I18nProvider = I18nProvider;
|
|
93
41
|
function useI18n() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/ui/contexts/i18n/context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/ui/contexts/i18n/context.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAiD;AA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AC,kBAAkB,YAAG,KAAK,CAAC,QAAQ,GAAe,CAC7E,CAAC,CAAC,CAAC,CACF,KAAK,CAAC,QAAQ,CACf,GACoB,CACxB,CAAA;AACH,CAAC;AAQQ,oCAAY;AANrB,SAAS,OAAO;IACd,IAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,WAAW,CAAC,CAAA;IAEvC,OAAO,OAAO,CAAA;AAChB,CAAC;AAEsB,0BAAO"}
|
|
@@ -40,11 +40,11 @@ exports.i18nGetInitialProps = void 0;
|
|
|
40
40
|
var sites_1 = require("../../../sites/index.js");
|
|
41
41
|
function i18nGetInitialProps(context, roleToEditLanguage) {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
43
|
-
var path_1, words, _a;
|
|
43
|
+
var path_1, words, languages, _a;
|
|
44
44
|
return __generator(this, function (_b) {
|
|
45
45
|
switch (_b.label) {
|
|
46
46
|
case 0:
|
|
47
|
-
_b.trys.push([0,
|
|
47
|
+
_b.trys.push([0, 3, , 4]);
|
|
48
48
|
path_1 = context.router.asPath;
|
|
49
49
|
if (path_1 === '/404') {
|
|
50
50
|
return [2 /*return*/];
|
|
@@ -52,20 +52,24 @@ function i18nGetInitialProps(context, roleToEditLanguage) {
|
|
|
52
52
|
return [4 /*yield*/, (0, sites_1.api)({ method: 'get', url: 'word' })];
|
|
53
53
|
case 1:
|
|
54
54
|
words = _b.sent();
|
|
55
|
+
return [4 /*yield*/, fetch(process.env.api + 'language').then(function (r) { return r.json(); })];
|
|
56
|
+
case 2:
|
|
57
|
+
languages = _b.sent();
|
|
55
58
|
return [2 /*return*/, {
|
|
56
59
|
i18n: {
|
|
57
60
|
words: words,
|
|
58
61
|
roleToEditLanguage: roleToEditLanguage,
|
|
62
|
+
languages: languages,
|
|
59
63
|
language: context.router.locale,
|
|
60
64
|
languagesNext: context.router.locales,
|
|
61
65
|
},
|
|
62
66
|
}];
|
|
63
|
-
case
|
|
67
|
+
case 3:
|
|
64
68
|
_a = _b.sent();
|
|
65
69
|
return [2 /*return*/, {
|
|
66
70
|
i18n: null,
|
|
67
71
|
}];
|
|
68
|
-
case
|
|
72
|
+
case 4: return [2 /*return*/];
|
|
69
73
|
}
|
|
70
74
|
});
|
|
71
75
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-initial-props.js","sourceRoot":"","sources":["../../../../src/ui/contexts/i18n/get-initial-props.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA6B;AAI7B,SAAsB,mBAAmB,CAAC,OAAmB,EAAE,kBAA0D;;;;;;;oBAE/G,SAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAA;oBAElC,IAAI,MAAI,KAAK,MAAM,EAAE,CAAC;wBACpB,sBAAM;oBACR,CAAC;oBAEa,qBAAM,IAAA,WAAG,EAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAA;;oBAAjD,KAAK,GAAG,SAAyC;
|
|
1
|
+
{"version":3,"file":"get-initial-props.js","sourceRoot":"","sources":["../../../../src/ui/contexts/i18n/get-initial-props.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA6B;AAI7B,SAAsB,mBAAmB,CAAC,OAAmB,EAAE,kBAA0D;;;;;;;oBAE/G,SAAO,OAAO,CAAC,MAAM,CAAC,MAAM,CAAA;oBAElC,IAAI,MAAI,KAAK,MAAM,EAAE,CAAC;wBACpB,sBAAM;oBACR,CAAC;oBAEa,qBAAM,IAAA,WAAG,EAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAA;;oBAAjD,KAAK,GAAG,SAAyC;oBACrC,qBAAM,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,UAAU,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,EA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