gt-react 2.0.120
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/README.md +7 -0
- package/dist/client/ClientProvider.d.ts +11 -0
- package/dist/client/ClientProvider.d.ts.map +1 -0
- package/dist/client/ClientProvider.js +17 -0
- package/dist/client/ClientProvider.js.map +1 -0
- package/dist/client/GTProvider.d.ts +12 -0
- package/dist/client/GTProvider.d.ts.map +1 -0
- package/dist/client/GTProvider.js +56 -0
- package/dist/client/GTProvider.js.map +1 -0
- package/dist/client/t.d.ts +2 -0
- package/dist/client/t.d.ts.map +1 -0
- package/dist/client/t.js +14 -0
- package/dist/client/t.js.map +1 -0
- package/dist/client.d.ts +7 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +17 -0
- package/dist/client.js.map +1 -0
- package/dist/config/I18NConfig.d.ts +90 -0
- package/dist/config/I18NConfig.d.ts.map +1 -0
- package/dist/config/I18NConfig.js +219 -0
- package/dist/config/I18NConfig.js.map +1 -0
- package/dist/config/PageManager.d.ts +16 -0
- package/dist/config/PageManager.d.ts.map +1 -0
- package/dist/config/PageManager.js +66 -0
- package/dist/config/PageManager.js.map +1 -0
- package/dist/config/local/getConfigData.d.ts +8 -0
- package/dist/config/local/getConfigData.d.ts.map +1 -0
- package/dist/config/local/getConfigData.js +29 -0
- package/dist/config/local/getConfigData.js.map +1 -0
- package/dist/config/local/getDefaultFromEnv.d.ts +12 -0
- package/dist/config/local/getDefaultFromEnv.d.ts.map +1 -0
- package/dist/config/local/getDefaultFromEnv.js +21 -0
- package/dist/config/local/getDefaultFromEnv.js.map +1 -0
- package/dist/config/local/getI18NPage.d.ts +10 -0
- package/dist/config/local/getI18NPage.d.ts.map +1 -0
- package/dist/config/local/getI18NPage.js +34 -0
- package/dist/config/local/getI18NPage.js.map +1 -0
- package/dist/config/placeholderCache.d.ts +8 -0
- package/dist/config/placeholderCache.d.ts.map +1 -0
- package/dist/config/placeholderCache.js +71 -0
- package/dist/config/placeholderCache.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/intl/intl.d.ts +14 -0
- package/dist/intl/intl.d.ts.map +1 -0
- package/dist/intl/intl.js +38 -0
- package/dist/intl/intl.js.map +1 -0
- package/dist/next/NextGTProvider.d.ts +15 -0
- package/dist/next/NextGTProvider.d.ts.map +1 -0
- package/dist/next/NextGTProvider.js +48 -0
- package/dist/next/NextGTProvider.js.map +1 -0
- package/dist/next/NextI18N.d.ts +15 -0
- package/dist/next/NextI18N.d.ts.map +1 -0
- package/dist/next/NextI18N.js +48 -0
- package/dist/next/NextI18N.js.map +1 -0
- package/dist/next/headerFunctions.d.ts +21 -0
- package/dist/next/headerFunctions.d.ts.map +1 -0
- package/dist/next/headerFunctions.js +77 -0
- package/dist/next/headerFunctions.js.map +1 -0
- package/dist/next/intl.d.ts +8 -0
- package/dist/next/intl.d.ts.map +1 -0
- package/dist/next/intl.js +47 -0
- package/dist/next/intl.js.map +1 -0
- package/dist/next.d.ts +9 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +21 -0
- package/dist/next.js.map +1 -0
- package/dist/primitives/numeric/Numeric.d.ts +23 -0
- package/dist/primitives/numeric/Numeric.d.ts.map +1 -0
- package/dist/primitives/numeric/Numeric.js +42 -0
- package/dist/primitives/numeric/Numeric.js.map +1 -0
- package/dist/primitives/numeric/client/ClientNumeric.d.ts +23 -0
- package/dist/primitives/numeric/client/ClientNumeric.d.ts.map +1 -0
- package/dist/primitives/numeric/client/ClientNumeric.js +43 -0
- package/dist/primitives/numeric/client/ClientNumeric.js.map +1 -0
- package/dist/primitives/numeric/getNumericBranch.d.ts +14 -0
- package/dist/primitives/numeric/getNumericBranch.d.ts.map +1 -0
- package/dist/primitives/numeric/getNumericBranch.js +84 -0
- package/dist/primitives/numeric/getNumericBranch.js.map +1 -0
- package/dist/primitives/private/Private.d.ts +19 -0
- package/dist/primitives/private/Private.d.ts.map +1 -0
- package/dist/primitives/private/Private.js +29 -0
- package/dist/primitives/private/Private.js.map +1 -0
- package/dist/primitives/value/Value.d.ts +21 -0
- package/dist/primitives/value/Value.d.ts.map +1 -0
- package/dist/primitives/value/Value.js +42 -0
- package/dist/primitives/value/Value.js.map +1 -0
- package/dist/primitives/value/client/ClientValue.d.ts +21 -0
- package/dist/primitives/value/client/ClientValue.d.ts.map +1 -0
- package/dist/primitives/value/client/ClientValue.js +43 -0
- package/dist/primitives/value/client/ClientValue.js.map +1 -0
- package/dist/primitives/value/client/renderClientVariable.d.ts +9 -0
- package/dist/primitives/value/client/renderClientVariable.d.ts.map +1 -0
- package/dist/primitives/value/client/renderClientVariable.js +60 -0
- package/dist/primitives/value/client/renderClientVariable.js.map +1 -0
- package/dist/primitives/value/getValueBranch.d.ts +9 -0
- package/dist/primitives/value/getValueBranch.d.ts.map +1 -0
- package/dist/primitives/value/getValueBranch.js +64 -0
- package/dist/primitives/value/getValueBranch.js.map +1 -0
- package/dist/primitives/value/isValidReactNode.d.ts +15 -0
- package/dist/primitives/value/isValidReactNode.d.ts.map +1 -0
- package/dist/primitives/value/isValidReactNode.js +27 -0
- package/dist/primitives/value/isValidReactNode.js.map +1 -0
- package/dist/primitives/value/processBranches.d.ts +9 -0
- package/dist/primitives/value/processBranches.d.ts.map +1 -0
- package/dist/primitives/value/processBranches.js +44 -0
- package/dist/primitives/value/processBranches.js.map +1 -0
- package/dist/primitives/value/renderVariable.d.ts +8 -0
- package/dist/primitives/value/renderVariable.d.ts.map +1 -0
- package/dist/primitives/value/renderVariable.js +57 -0
- package/dist/primitives/value/renderVariable.js.map +1 -0
- package/dist/primitives/variable/Variable.d.ts +13 -0
- package/dist/primitives/variable/Variable.d.ts.map +1 -0
- package/dist/primitives/variable/Variable.js +24 -0
- package/dist/primitives/variable/Variable.js.map +1 -0
- package/dist/server/ServerI18N.d.ts +18 -0
- package/dist/server/ServerI18N.d.ts.map +1 -0
- package/dist/server/ServerI18N.js +81 -0
- package/dist/server/ServerI18N.js.map +1 -0
- package/dist/server/helpers/addGTIdentifier.d.ts +11 -0
- package/dist/server/helpers/addGTIdentifier.d.ts.map +1 -0
- package/dist/server/helpers/addGTIdentifier.js +152 -0
- package/dist/server/helpers/addGTIdentifier.js.map +1 -0
- package/dist/server/helpers/generateHash.d.ts +12 -0
- package/dist/server/helpers/generateHash.d.ts.map +1 -0
- package/dist/server/helpers/generateHash.js +34 -0
- package/dist/server/helpers/generateHash.js.map +1 -0
- package/dist/server/helpers/writeChildrenAsObjects.d.ts +11 -0
- package/dist/server/helpers/writeChildrenAsObjects.d.ts.map +1 -0
- package/dist/server/helpers/writeChildrenAsObjects.js +129 -0
- package/dist/server/helpers/writeChildrenAsObjects.js.map +1 -0
- package/dist/server/renderChildren.d.ts +19 -0
- package/dist/server/renderChildren.d.ts.map +1 -0
- package/dist/server/renderChildren.js +153 -0
- package/dist/server/renderChildren.js.map +1 -0
- package/dist/server/resolvers/I18NResolver.d.ts +13 -0
- package/dist/server/resolvers/I18NResolver.d.ts.map +1 -0
- package/dist/server/resolvers/I18NResolver.js +41 -0
- package/dist/server/resolvers/I18NResolver.js.map +1 -0
- package/dist/server/resolvers/renderResolvedChildren.d.ts +19 -0
- package/dist/server/resolvers/renderResolvedChildren.d.ts.map +1 -0
- package/dist/server/resolvers/renderResolvedChildren.js +157 -0
- package/dist/server/resolvers/renderResolvedChildren.js.map +1 -0
- package/package.json +39 -0
- package/scratchpad.js +33 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
+
var t = {};
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
+
t[p] = s[p];
|
|
15
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
+
t[p[i]] = s[p[i]];
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.default = nextIntl;
|
|
27
|
+
const I18NConfig_1 = __importDefault(require("../config/I18NConfig"));
|
|
28
|
+
const intl_1 = __importDefault(require("../intl/intl"));
|
|
29
|
+
const headerFunctions_1 = require("./headerFunctions");
|
|
30
|
+
function nextIntl(content, options) {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
let currentMetadata = {};
|
|
33
|
+
let currentLanguage = '';
|
|
34
|
+
if (options) {
|
|
35
|
+
const { language } = options, metadata = __rest(options, ["language"]);
|
|
36
|
+
currentLanguage = language || '';
|
|
37
|
+
currentMetadata = metadata;
|
|
38
|
+
}
|
|
39
|
+
const userLanguage = currentLanguage || (yield (0, headerFunctions_1.getUserLanguageNext)()) || I18NConfig_1.default.getDefaultLanguage();
|
|
40
|
+
const domain = (currentMetadata === null || currentMetadata === void 0 ? void 0 : currentMetadata.domain) || (yield (0, headerFunctions_1.getDomainNext)()) || '';
|
|
41
|
+
if (domain) {
|
|
42
|
+
currentMetadata.domain = domain;
|
|
43
|
+
}
|
|
44
|
+
return yield (0, intl_1.default)(content, userLanguage, currentMetadata);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=intl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intl.js","sourceRoot":"","sources":["../../src/next/intl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAmBC;AAvBD,sEAA8C;AAC9C,wDAAgC;AAChC,uDAAuE;AAEvE,SAA8B,QAAQ,CAAC,OAAY,EAAE,OAA+F;;QAEhJ,IAAI,eAAe,GAAQ,EAAE,CAAC;QAC9B,IAAI,eAAe,GAAW,EAAE,CAAC;QAEjC,IAAI,OAAO,EAAE,CAAC;YACV,MAAM,EAAE,QAAQ,KAAkB,OAAO,EAApB,QAAQ,UAAK,OAAO,EAAnC,YAAyB,CAAU,CAAC;YAC1C,eAAe,GAAG,QAAQ,IAAI,EAAE,CAAC;YACjC,eAAe,GAAG,QAAQ,CAAC;QAC/B,CAAC;QAED,MAAM,YAAY,GAAW,eAAe,IAAI,CAAC,MAAM,IAAA,qCAAmB,GAAE,CAAC,IAAI,oBAAU,CAAC,kBAAkB,EAAE,CAAC;QACjH,MAAM,MAAM,GAAW,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,KAAI,CAAC,MAAM,IAAA,+BAAa,GAAE,CAAC,IAAI,EAAE,CAAC;QAEhF,IAAI,MAAM,EAAE,CAAC;YACT,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC;QACpC,CAAC;QAED,OAAO,MAAM,IAAA,cAAI,EAAC,OAAO,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;IAC9D,CAAC;CAAA"}
|
package/dist/next.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import NextI18N from "./next/NextI18N";
|
|
2
|
+
import nextIntl from "./next/intl";
|
|
3
|
+
import NextGTProvider from "./next/NextGTProvider";
|
|
4
|
+
import Numeric from "./primitives/numeric/Numeric";
|
|
5
|
+
import Value from "./primitives/value/Value";
|
|
6
|
+
import Private from "./primitives/private/Private";
|
|
7
|
+
import Variable from "./primitives/variable/Variable";
|
|
8
|
+
export { NextI18N as I18N, nextIntl as intl, NextGTProvider as GTProvider, Numeric, Value, Private, Variable };
|
|
9
|
+
//# sourceMappingURL=next.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,KAAK,MAAM,0BAA0B,CAAC;AAC7C,OAAO,OAAO,MAAM,8BAA8B,CAAC;AACnD,OAAO,QAAQ,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACH,QAAQ,IAAI,IAAI,EAChB,QAAQ,IAAI,IAAI,EAChB,cAAc,IAAI,UAAU,EAC5B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EACpC,CAAC"}
|
package/dist/next.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Variable = exports.Private = exports.Value = exports.Numeric = exports.GTProvider = exports.intl = exports.I18N = void 0;
|
|
7
|
+
const NextI18N_1 = __importDefault(require("./next/NextI18N"));
|
|
8
|
+
exports.I18N = NextI18N_1.default;
|
|
9
|
+
const intl_1 = __importDefault(require("./next/intl"));
|
|
10
|
+
exports.intl = intl_1.default;
|
|
11
|
+
const NextGTProvider_1 = __importDefault(require("./next/NextGTProvider"));
|
|
12
|
+
exports.GTProvider = NextGTProvider_1.default;
|
|
13
|
+
const Numeric_1 = __importDefault(require("./primitives/numeric/Numeric"));
|
|
14
|
+
exports.Numeric = Numeric_1.default;
|
|
15
|
+
const Value_1 = __importDefault(require("./primitives/value/Value"));
|
|
16
|
+
exports.Value = Value_1.default;
|
|
17
|
+
const Private_1 = __importDefault(require("./primitives/private/Private"));
|
|
18
|
+
exports.Private = Private_1.default;
|
|
19
|
+
const Variable_1 = __importDefault(require("./primitives/variable/Variable"));
|
|
20
|
+
exports.Variable = Variable_1.default;
|
|
21
|
+
//# sourceMappingURL=next.js.map
|
package/dist/next.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.js","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAuC;AAQvB,eART,kBAAQ,CAQK;AAPpB,uDAAmC;AAQnB,eART,cAAQ,CAQK;AAPpB,2EAAmD;AAQ7B,qBARf,wBAAc,CAQW;AAPhC,2EAAmD;AAQ/C,kBARG,iBAAO,CAQH;AAPX,qEAA6C;AAOhC,gBAPN,eAAK,CAOM;AANlB,2EAAmD;AAM/B,kBANb,iBAAO,CAMa;AAL3B,8EAAsD;AAKzB,mBALtB,kBAAQ,CAKsB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Range } from './getNumericBranch';
|
|
3
|
+
type NumericProps = {
|
|
4
|
+
n?: number;
|
|
5
|
+
children?: any;
|
|
6
|
+
ranges?: Range[];
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Numeric component that processes a given number and renders the appropriate branch or children.
|
|
11
|
+
*
|
|
12
|
+
* @param {ReactNode} children - Default children.
|
|
13
|
+
* @param {number} n - Number to branch based on.
|
|
14
|
+
* @param {Range[]} ranges - Array of range objects used for branch selection.
|
|
15
|
+
* @param {Record<string, any>} ...branches - Named branches, e.g. "singular", "plural" and their associated branches.
|
|
16
|
+
* @returns {ReactNode}
|
|
17
|
+
*/
|
|
18
|
+
declare const Numeric: {
|
|
19
|
+
({ children, n, ranges, ...branches }: NumericProps): ReactNode;
|
|
20
|
+
gtTransformation: string;
|
|
21
|
+
};
|
|
22
|
+
export default Numeric;
|
|
23
|
+
//# sourceMappingURL=Numeric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Numeric.d.ts","sourceRoot":"","sources":["../../../src/primitives/numeric/Numeric.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAyB,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE7D,KAAK,YAAY,GAAG;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAA;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,OAAO;2CAA0C,YAAY,GAAG,SAAS;;CAoB9E,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
const renderVariable_1 = __importDefault(require("../value/renderVariable"));
|
|
19
|
+
const getNumericBranch_1 = __importDefault(require("./getNumericBranch"));
|
|
20
|
+
/**
|
|
21
|
+
* Numeric component that processes a given number and renders the appropriate branch or children.
|
|
22
|
+
*
|
|
23
|
+
* @param {ReactNode} children - Default children.
|
|
24
|
+
* @param {number} n - Number to branch based on.
|
|
25
|
+
* @param {Range[]} ranges - Array of range objects used for branch selection.
|
|
26
|
+
* @param {Record<string, any>} ...branches - Named branches, e.g. "singular", "plural" and their associated branches.
|
|
27
|
+
* @returns {ReactNode}
|
|
28
|
+
*/
|
|
29
|
+
const Numeric = (_a) => {
|
|
30
|
+
var { children, n, ranges } = _a, branches = __rest(_a, ["children", "n", "ranges"]);
|
|
31
|
+
if (typeof n !== 'number') {
|
|
32
|
+
console.warn(`WARNING: No values provided to <Numeric> component with children ${JSON.stringify(children)}.`);
|
|
33
|
+
}
|
|
34
|
+
const { 'data-generaltranslation': generaltranslation } = branches, otherParams = __rest(branches, ['data-generaltranslation']);
|
|
35
|
+
branches = Object.assign(Object.assign({}, otherParams), { ranges: ranges });
|
|
36
|
+
let branch = ((typeof n === 'number' && branches) ? (0, getNumericBranch_1.default)(n, branches) : null) || children;
|
|
37
|
+
const renderedChildren = (0, renderVariable_1.default)(branch, (typeof n === 'number') ? { n } : undefined);
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)("span", { "data-n": n, "data-unrendered-branches": branches, "data-generaltranslation": generaltranslation, children: renderedChildren }));
|
|
39
|
+
};
|
|
40
|
+
Numeric.gtTransformation = "numeric";
|
|
41
|
+
exports.default = Numeric;
|
|
42
|
+
//# sourceMappingURL=Numeric.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Numeric.js","sourceRoot":"","sources":["../../../src/primitives/numeric/Numeric.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,6EAAoD;AACpD,0EAA6D;AAS7D;;;;;;;;GAQG;AACH,MAAM,OAAO,GAAG,CAAC,EAAkD,EAAa,EAAE;QAAjE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,OAA6B,EAAxB,QAAQ,cAAlC,2BAAoC,CAAF;IAE/C,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,oEAAoE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IACjH,CAAC;IAED,MAAM,EAAE,yBAAyB,EAAE,kBAAkB,KAA0B,QAAQ,EAA7B,WAAW,UAAU,QAAQ,EAAjF,2BAAiE,CAAgB,CAAC;IAExF,QAAQ,mCAAQ,WAAW,KAAE,MAAM,EAAE,MAAM,GAAE,CAAC;IAE9C,IAAI,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAA,0BAAgB,EAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC;IAEtG,MAAM,gBAAgB,GAAG,IAAA,wBAAa,EAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAE5F,OAAO,CACH,2CAAc,CAAC,8BAA4B,QAAQ,6BAA2B,kBAAkB,YAC3F,gBAAgB,GACd,CACV,CAAC;AAEN,CAAC,CAAC;AAEF,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;AAErC,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Range } from '../getNumericBranch';
|
|
3
|
+
type NumericProps = {
|
|
4
|
+
n?: number;
|
|
5
|
+
children?: any;
|
|
6
|
+
ranges?: Range[];
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Numeric component that processes a given number and renders the appropriate branch or children.
|
|
11
|
+
*
|
|
12
|
+
* @param {ReactNode} children - Default children.
|
|
13
|
+
* @param {number} n - Number to branch based on.
|
|
14
|
+
* @param {Range[]} ranges - Array of range objects used for branch selection.
|
|
15
|
+
* @param {Record<string, any>} ...branches - Named branches, e.g. "singular", "plural" and their associated branches.
|
|
16
|
+
* @returns {ReactNode}
|
|
17
|
+
*/
|
|
18
|
+
declare const Numeric: {
|
|
19
|
+
({ children, n, ranges, ...branches }: NumericProps): ReactNode;
|
|
20
|
+
gtTransformation: string;
|
|
21
|
+
};
|
|
22
|
+
export default Numeric;
|
|
23
|
+
//# sourceMappingURL=ClientNumeric.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientNumeric.d.ts","sourceRoot":"","sources":["../../../../src/primitives/numeric/client/ClientNumeric.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAyB,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE9D,KAAK,YAAY,GAAG;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAA;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,OAAO;2CAA0C,YAAY,GAAG,SAAS;;CAoB9E,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
8
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
10
|
+
t[p[i]] = s[p[i]];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const renderClientVariable_1 = __importDefault(require("../../value/client/renderClientVariable"));
|
|
20
|
+
const getNumericBranch_1 = __importDefault(require("../getNumericBranch"));
|
|
21
|
+
/**
|
|
22
|
+
* Numeric component that processes a given number and renders the appropriate branch or children.
|
|
23
|
+
*
|
|
24
|
+
* @param {ReactNode} children - Default children.
|
|
25
|
+
* @param {number} n - Number to branch based on.
|
|
26
|
+
* @param {Range[]} ranges - Array of range objects used for branch selection.
|
|
27
|
+
* @param {Record<string, any>} ...branches - Named branches, e.g. "singular", "plural" and their associated branches.
|
|
28
|
+
* @returns {ReactNode}
|
|
29
|
+
*/
|
|
30
|
+
const Numeric = (_a) => {
|
|
31
|
+
var { children, n, ranges } = _a, branches = __rest(_a, ["children", "n", "ranges"]);
|
|
32
|
+
if (typeof n !== 'number') {
|
|
33
|
+
console.warn(`WARNING: No values provided to <Numeric> component with children ${JSON.stringify(children)}.`);
|
|
34
|
+
}
|
|
35
|
+
const { 'data-generaltranslation': generaltranslation } = branches, otherParams = __rest(branches, ['data-generaltranslation']);
|
|
36
|
+
branches = Object.assign(Object.assign({}, otherParams), { ranges: ranges });
|
|
37
|
+
let branch = ((typeof n === 'number' && branches) ? (0, getNumericBranch_1.default)(n, branches) : null) || children;
|
|
38
|
+
const renderedChildren = (0, renderClientVariable_1.default)(branch, (typeof n === 'number') ? { n } : undefined);
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)("span", { "data-n": n, "data-unrendered-branches": branches, "data-generaltranslation": generaltranslation, children: renderedChildren }));
|
|
40
|
+
};
|
|
41
|
+
Numeric.gtTransformation = "numeric";
|
|
42
|
+
exports.default = Numeric;
|
|
43
|
+
//# sourceMappingURL=ClientNumeric.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientNumeric.js","sourceRoot":"","sources":["../../../../src/primitives/numeric/client/ClientNumeric.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;;;;;;;;;;;;AAGZ,mGAAoE;AACpE,2EAA8D;AAS9D;;;;;;;;GAQG;AACH,MAAM,OAAO,GAAG,CAAC,EAAkD,EAAa,EAAE;QAAjE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,OAA6B,EAAxB,QAAQ,cAAlC,2BAAoC,CAAF;IAE/C,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QACxB,OAAO,CAAC,IAAI,CAAC,oEAAoE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IACjH,CAAC;IAED,MAAM,EAAE,yBAAyB,EAAE,kBAAkB,KAA0B,QAAQ,EAA7B,WAAW,UAAU,QAAQ,EAAjF,2BAAiE,CAAgB,CAAC;IAExF,QAAQ,mCAAQ,WAAW,KAAE,MAAM,EAAE,MAAM,GAAE,CAAC;IAE9C,IAAI,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAA,0BAAgB,EAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC;IAEtG,MAAM,gBAAgB,GAAG,IAAA,8BAAa,EAAC,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAE5F,OAAO,CACH,2CAAc,CAAC,8BAA4B,QAAQ,6BAA2B,kBAAkB,YAC3F,gBAAgB,GACd,CACV,CAAC;AAEN,CAAC,CAAC;AAEF,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;AAErC,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type Range = {
|
|
2
|
+
max: number;
|
|
3
|
+
min: number;
|
|
4
|
+
children: any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Main function to get the appropriate branch based on the provided number and branches.
|
|
8
|
+
*
|
|
9
|
+
* @param {number} n - The number to determine the branch for.
|
|
10
|
+
* @param {any} branches - The object containing possible branches and their corresponding ranges and options.
|
|
11
|
+
* @returns {any} The determined branch.
|
|
12
|
+
*/
|
|
13
|
+
export default function getNumericBranch(n: number, branches: any): any;
|
|
14
|
+
//# sourceMappingURL=getNumericBranch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNumericBranch.d.ts","sourceRoot":"","sources":["../../../src/primitives/numeric/getNumericBranch.ts"],"names":[],"mappings":"AAqCA,MAAM,MAAM,KAAK,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,GAAG,CAAC;CACjB,CAAA;AAgBD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAUhE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = getNumericBranch;
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to get the branch name from a number based on provided options.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} n - The number to determine the branch name for.
|
|
8
|
+
* @param {Record<string, any>} options - The options containing possible branch names.
|
|
9
|
+
* @returns {string} The determined branch name.
|
|
10
|
+
*/
|
|
11
|
+
function getBranchNameFromNumber(n, options) {
|
|
12
|
+
if (n === 0) {
|
|
13
|
+
if (options["0"])
|
|
14
|
+
return "0";
|
|
15
|
+
if (options.zero)
|
|
16
|
+
return "zero";
|
|
17
|
+
}
|
|
18
|
+
if (n === 1) {
|
|
19
|
+
if (options["1"])
|
|
20
|
+
return "1";
|
|
21
|
+
if (options.one)
|
|
22
|
+
return "one";
|
|
23
|
+
if (options.singular)
|
|
24
|
+
return "singular";
|
|
25
|
+
}
|
|
26
|
+
if (n === 2) {
|
|
27
|
+
if (options["2"])
|
|
28
|
+
return "2";
|
|
29
|
+
if (options.two)
|
|
30
|
+
return "two";
|
|
31
|
+
if (options.dual)
|
|
32
|
+
return "dual";
|
|
33
|
+
}
|
|
34
|
+
if (n === 3) {
|
|
35
|
+
if (options["3"])
|
|
36
|
+
return "3";
|
|
37
|
+
if (options.three)
|
|
38
|
+
return "three";
|
|
39
|
+
if (options.trial)
|
|
40
|
+
return "trial";
|
|
41
|
+
}
|
|
42
|
+
if (n >= 3 && n <= 7) {
|
|
43
|
+
if (options.few)
|
|
44
|
+
return "few";
|
|
45
|
+
if (options.paucal)
|
|
46
|
+
return "paucal";
|
|
47
|
+
}
|
|
48
|
+
if (n !== 1 && options.plural)
|
|
49
|
+
return "plural";
|
|
50
|
+
return '';
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Helper function to get the branch from a list of ranges.
|
|
54
|
+
*
|
|
55
|
+
* @param {number} n - The number to determine the branch for.
|
|
56
|
+
* @param {Range[]} ranges - The list of ranges containing possible branches.
|
|
57
|
+
* @returns {any | undefined} The determined branch or undefined if no matching range is found.
|
|
58
|
+
*/
|
|
59
|
+
function getBranchFromRanges(n, ranges) {
|
|
60
|
+
for (const range of ranges) {
|
|
61
|
+
if (range.min <= n && range.max >= n)
|
|
62
|
+
return range.children;
|
|
63
|
+
}
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Main function to get the appropriate branch based on the provided number and branches.
|
|
68
|
+
*
|
|
69
|
+
* @param {number} n - The number to determine the branch for.
|
|
70
|
+
* @param {any} branches - The object containing possible branches and their corresponding ranges and options.
|
|
71
|
+
* @returns {any} The determined branch.
|
|
72
|
+
*/
|
|
73
|
+
function getNumericBranch(n, branches) {
|
|
74
|
+
let branchName = '';
|
|
75
|
+
let branch = null;
|
|
76
|
+
if (typeof n === 'number' && (branches === null || branches === void 0 ? void 0 : branches.ranges))
|
|
77
|
+
branch = getBranchFromRanges(n, branches.ranges);
|
|
78
|
+
if (typeof n === 'number' && !branch && branches)
|
|
79
|
+
branchName = getBranchNameFromNumber(n, branches);
|
|
80
|
+
if (branchName && !branch)
|
|
81
|
+
branch = branches[branchName];
|
|
82
|
+
return branch;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=getNumericBranch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNumericBranch.js","sourceRoot":"","sources":["../../../src/primitives/numeric/getNumericBranch.ts"],"names":[],"mappings":";;AAgEA,mCAUC;AA1ED;;;;;;GAMG;AACH,SAAS,uBAAuB,CAAC,CAAS,EAAE,OAA4B;IACpE,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,IAAI,OAAO,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC;QAC7B,IAAI,OAAO,CAAC,IAAI;YAAE,OAAO,MAAM,CAAC;IACpC,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,IAAI,OAAO,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC;QAC7B,IAAI,OAAO,CAAC,GAAG;YAAE,OAAO,KAAK,CAAC;QAC9B,IAAI,OAAO,CAAC,QAAQ;YAAE,OAAO,UAAU,CAAC;IAC5C,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,IAAI,OAAO,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC;QAC7B,IAAI,OAAO,CAAC,GAAG;YAAE,OAAO,KAAK,CAAC;QAC9B,IAAI,OAAO,CAAC,IAAI;YAAE,OAAO,MAAM,CAAC;IACpC,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACV,IAAI,OAAO,CAAC,GAAG,CAAC;YAAE,OAAO,GAAG,CAAC;QAC7B,IAAI,OAAO,CAAC,KAAK;YAAE,OAAO,OAAO,CAAC;QAClC,IAAI,OAAO,CAAC,KAAK;YAAE,OAAO,OAAO,CAAC;IACtC,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnB,IAAI,OAAO,CAAC,GAAG;YAAE,OAAO,KAAK,CAAC;QAC9B,IAAI,OAAO,CAAC,MAAM;YAAE,OAAO,QAAQ,CAAC;IACxC,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IAC/C,OAAO,EAAE,CAAC;AACd,CAAC;AASD;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,CAAS,EAAE,MAAe;IACnD,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,CAAC,GAAG,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC,QAAQ,CAAC;IAChE,CAAC;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;;;;GAMG;AACH,SAAwB,gBAAgB,CAAC,CAAS,EAAE,QAAa;IAC7D,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,OAAO,CAAC,KAAK,QAAQ,KAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAA;QAAE,MAAM,GAAG,mBAAmB,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEhG,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,MAAM,IAAI,QAAQ;QAAE,UAAU,GAAG,uBAAuB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpG,IAAI,UAAU,IAAI,CAAC,MAAM;QAAE,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAEzD,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type PrivateProps = {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
label?: string;
|
|
5
|
+
'data-generaltranslation': any;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Marks any children as private, excluding them from translation.
|
|
9
|
+
*
|
|
10
|
+
* @param {ReactNode} children
|
|
11
|
+
* @param {string} label - used as a translation aid, as children are not sent to server.
|
|
12
|
+
* @returns {ReactNode}
|
|
13
|
+
*/
|
|
14
|
+
declare const Private: {
|
|
15
|
+
({ children, label, ...params }: PrivateProps): any;
|
|
16
|
+
gtTransformation: string;
|
|
17
|
+
};
|
|
18
|
+
export default Private;
|
|
19
|
+
//# sourceMappingURL=Private.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Private.d.ts","sourceRoot":"","sources":["../../../src/primitives/private/Private.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,KAAK,YAAY,GAAG;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB,EAAE,GAAG,CAAC;CAClC,CAAA;AAED;;;;;;GAMG;AACH,QAAA,MAAM,OAAO;qCAAyC,YAAY,GAAG,GAAG;;CASvE,CAAA;AAID,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
/**
|
|
16
|
+
* Marks any children as private, excluding them from translation.
|
|
17
|
+
*
|
|
18
|
+
* @param {ReactNode} children
|
|
19
|
+
* @param {string} label - used as a translation aid, as children are not sent to server.
|
|
20
|
+
* @returns {ReactNode}
|
|
21
|
+
*/
|
|
22
|
+
const Private = (_a) => {
|
|
23
|
+
var { children, label = '' } = _a, params = __rest(_a, ["children", "label"]);
|
|
24
|
+
const { 'data-generaltranslation': generaltranslation } = params;
|
|
25
|
+
return ((0, jsx_runtime_1.jsx)("span", { "data-label": label, "data-generaltranslation": generaltranslation, children: children }));
|
|
26
|
+
};
|
|
27
|
+
Private.gtTransformation = "private";
|
|
28
|
+
exports.default = Private;
|
|
29
|
+
//# sourceMappingURL=Private.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Private.js","sourceRoot":"","sources":["../../../src/primitives/private/Private.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAQA;;;;;;GAMG;AACH,MAAM,OAAO,GAAG,CAAC,EAAiD,EAAO,EAAE;QAA1D,EAAE,QAAQ,EAAE,KAAK,GAAG,EAAE,OAA2B,EAAtB,MAAM,cAAjC,qBAAmC,CAAF;IAE9C,MAAM,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,GAAQ,MAAM,CAAC;IAEtE,OAAO,CACH,+CAAkB,KAAK,6BAA2B,kBAAkB,YAC/D,QAAQ,GACN,CACV,CAAC;AACN,CAAC,CAAA;AAED,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;AAErC,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type ValueProps = {
|
|
3
|
+
children?: any;
|
|
4
|
+
branches?: Record<string, any>;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Value variable component that processes the given values and branches,
|
|
9
|
+
* and renders the appropriate content based on the branch logic.
|
|
10
|
+
*
|
|
11
|
+
* @param {any} children - Default children to render if no branches match.
|
|
12
|
+
* @param {Record<string, any>} branches - Object containing conditionally rendered branches.
|
|
13
|
+
* @param {Record<string, any>} ...values - Values to branch and translate around.
|
|
14
|
+
* @returns {ReactNode}
|
|
15
|
+
*/
|
|
16
|
+
declare const Value: {
|
|
17
|
+
({ children, branches, ...values }: ValueProps): ReactNode;
|
|
18
|
+
gtTransformation: string;
|
|
19
|
+
};
|
|
20
|
+
export default Value;
|
|
21
|
+
//# sourceMappingURL=Value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Value.d.ts","sourceRoot":"","sources":["../../../src/primitives/value/Value.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC,KAAK,UAAU,GAAG;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAA;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,KAAK;wCAAuC,UAAU,GAAG,SAAS;;CAmBvE,CAAC;AAIF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
const renderVariable_1 = __importDefault(require("./renderVariable"));
|
|
19
|
+
const getValueBranch_1 = __importDefault(require("./getValueBranch"));
|
|
20
|
+
/**
|
|
21
|
+
* Value variable component that processes the given values and branches,
|
|
22
|
+
* and renders the appropriate content based on the branch logic.
|
|
23
|
+
*
|
|
24
|
+
* @param {any} children - Default children to render if no branches match.
|
|
25
|
+
* @param {Record<string, any>} branches - Object containing conditionally rendered branches.
|
|
26
|
+
* @param {Record<string, any>} ...values - Values to branch and translate around.
|
|
27
|
+
* @returns {ReactNode}
|
|
28
|
+
*/
|
|
29
|
+
const Value = (_a) => {
|
|
30
|
+
var { children, branches } = _a, values = __rest(_a, ["children", "branches"]);
|
|
31
|
+
let { 'data-generaltranslation': generaltranslation } = values, otherParams = __rest(values, ['data-generaltranslation']);
|
|
32
|
+
values = otherParams;
|
|
33
|
+
if (!values || Object.keys(values).length < 1) {
|
|
34
|
+
console.warn(`WARNING: No values provided to <Variable> component with children ${JSON.stringify(children)}.`);
|
|
35
|
+
}
|
|
36
|
+
let branch = ((typeof values !== 'undefined' && typeof branches !== 'undefined') ? (0, getValueBranch_1.default)(values, branches) : null) || children;
|
|
37
|
+
let renderedChildren = (0, renderVariable_1.default)(branch, values ? values : undefined);
|
|
38
|
+
return ((0, jsx_runtime_1.jsx)("span", { "data-values": values, "data-unrendered-branches": branches, "data-generaltranslation": generaltranslation, children: renderedChildren }));
|
|
39
|
+
};
|
|
40
|
+
Value.gtTransformation = "value";
|
|
41
|
+
exports.default = Value;
|
|
42
|
+
//# sourceMappingURL=Value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Value.js","sourceRoot":"","sources":["../../../src/primitives/value/Value.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,sEAA8C;AAC9C,sEAA8C;AAS9C;;;;;;;;GAQG;AACH,MAAM,KAAK,GAAG,CAAC,EAA6C,EAAa,EAAE;QAA5D,EAAE,QAAQ,EAAE,QAAQ,OAAyB,EAApB,MAAM,cAA/B,wBAAiC,CAAF;IAE1C,IAAI,EAAE,yBAAyB,EAAE,kBAAkB,KAA0B,MAAM,EAA3B,WAAW,UAAU,MAAM,EAA/E,2BAAiE,CAAc,CAAC;IACpF,MAAM,GAAG,WAAW,CAAC;IAErB,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,qEAAqE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAClH,CAAC;IAED,IAAI,MAAM,GAAG,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,IAAA,wBAAc,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC;IAExI,IAAI,gBAAgB,GAAG,IAAA,wBAAc,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAE3E,OAAO,CACH,gDAAmB,MAAM,8BAA4B,QAAQ,6BAA2B,kBAAkB,YACrG,gBAAgB,GACd,CACV,CAAA;AAEL,CAAC,CAAC;AAEF,KAAK,CAAC,gBAAgB,GAAG,OAAO,CAAC;AAEjC,kBAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type ValueProps = {
|
|
3
|
+
children?: any;
|
|
4
|
+
branches?: Record<string, any>;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Value variable component that processes the given values and branches,
|
|
9
|
+
* and renders the appropriate content based on the branch logic.
|
|
10
|
+
*
|
|
11
|
+
* @param {any} children - Default children to render if no branches match.
|
|
12
|
+
* @param {Record<string, any>} branches - Object containing conditionally rendered branches.
|
|
13
|
+
* @param {Record<string, any>} ...values - Values to branch and translate around.
|
|
14
|
+
* @returns {ReactNode}
|
|
15
|
+
*/
|
|
16
|
+
declare const Value: {
|
|
17
|
+
({ children, branches, ...values }: ValueProps): ReactNode;
|
|
18
|
+
gtTransformation: string;
|
|
19
|
+
};
|
|
20
|
+
export default Value;
|
|
21
|
+
//# sourceMappingURL=ClientValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientValue.d.ts","sourceRoot":"","sources":["../../../../src/primitives/value/client/ClientValue.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC,KAAK,UAAU,GAAG;IACd,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB,CAAA;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,KAAK;wCAAuC,UAAU,GAAG,SAAS;;CAmBvE,CAAC;AAIF,eAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
8
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
10
|
+
t[p[i]] = s[p[i]];
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const renderClientVariable_1 = __importDefault(require("./renderClientVariable"));
|
|
20
|
+
const getValueBranch_1 = __importDefault(require("../getValueBranch"));
|
|
21
|
+
/**
|
|
22
|
+
* Value variable component that processes the given values and branches,
|
|
23
|
+
* and renders the appropriate content based on the branch logic.
|
|
24
|
+
*
|
|
25
|
+
* @param {any} children - Default children to render if no branches match.
|
|
26
|
+
* @param {Record<string, any>} branches - Object containing conditionally rendered branches.
|
|
27
|
+
* @param {Record<string, any>} ...values - Values to branch and translate around.
|
|
28
|
+
* @returns {ReactNode}
|
|
29
|
+
*/
|
|
30
|
+
const Value = (_a) => {
|
|
31
|
+
var { children, branches } = _a, values = __rest(_a, ["children", "branches"]);
|
|
32
|
+
let { 'data-generaltranslation': generaltranslation } = values, otherParams = __rest(values, ['data-generaltranslation']);
|
|
33
|
+
values = otherParams;
|
|
34
|
+
if (!values || Object.keys(values).length < 1) {
|
|
35
|
+
console.warn(`WARNING: No values provided to <Variable> component with children ${JSON.stringify(children)}.`);
|
|
36
|
+
}
|
|
37
|
+
let branch = ((typeof values !== 'undefined' && typeof branches !== 'undefined') ? (0, getValueBranch_1.default)(values, branches) : null) || children;
|
|
38
|
+
let renderedChildren = (0, renderClientVariable_1.default)(branch, values ? values : undefined);
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)("span", { "data-values": values, "data-unrendered-branches": branches, "data-generaltranslation": generaltranslation, children: renderedChildren }));
|
|
40
|
+
};
|
|
41
|
+
Value.gtTransformation = "value";
|
|
42
|
+
exports.default = Value;
|
|
43
|
+
//# sourceMappingURL=ClientValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientValue.js","sourceRoot":"","sources":["../../../../src/primitives/value/client/ClientValue.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;;;;;;;;;;;;;;;AAGZ,kFAA0D;AAC1D,uEAA+C;AAS/C;;;;;;;;GAQG;AACH,MAAM,KAAK,GAAG,CAAC,EAA6C,EAAa,EAAE;QAA5D,EAAE,QAAQ,EAAE,QAAQ,OAAyB,EAApB,MAAM,cAA/B,wBAAiC,CAAF;IAE1C,IAAI,EAAE,yBAAyB,EAAE,kBAAkB,KAA0B,MAAM,EAA3B,WAAW,UAAU,MAAM,EAA/E,2BAAiE,CAAc,CAAC;IACpF,MAAM,GAAG,WAAW,CAAC;IAErB,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,qEAAqE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;IAClH,CAAC;IAED,IAAI,MAAM,GAAG,CAAC,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,IAAA,wBAAc,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC;IAExI,IAAI,gBAAgB,GAAG,IAAA,8BAAoB,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAEjF,OAAO,CACH,gDAAmB,MAAM,8BAA4B,QAAQ,6BAA2B,kBAAkB,YACrG,gBAAgB,GACd,CACV,CAAA;AAEL,CAAC,CAAC;AAEF,KAAK,CAAC,gBAAgB,GAAG,OAAO,CAAC;AAEjC,kBAAe,KAAK,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Recursively renders a variable structure of children, handling arrays of children and single child elements.
|
|
4
|
+
*
|
|
5
|
+
* @param {any} children - The children elements to render.
|
|
6
|
+
* @returns {any} The rendered children elements.
|
|
7
|
+
*/
|
|
8
|
+
export default function renderClientVariable(children: any, variables?: Record<string, any>): ReactNode;
|
|
9
|
+
//# sourceMappingURL=renderClientVariable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderClientVariable.d.ts","sourceRoot":"","sources":["../../../../src/primitives/value/client/renderClientVariable.tsx"],"names":[],"mappings":"AAEA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AA2CxC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAGtG"}
|