@team-monolith/cds 1.129.2-alpha.2 → 1.130.0-alpha

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.
Files changed (105) hide show
  1. package/dist/emotion.d.ts +185 -0
  2. package/dist/index.d.ts +8 -1
  3. package/dist/patterns/LexicalEditor/LexicalCustomConfigContext.d.ts +1 -0
  4. package/dist/patterns/LexicalEditor/LexicalCustomConfigContext.js +2 -1
  5. package/dist/patterns/LexicalEditor/LexicalEditor.d.ts +4 -0
  6. package/dist/patterns/LexicalEditor/LexicalEditor.js +9 -7
  7. package/dist/patterns/LexicalEditor/Plugins.d.ts +1 -0
  8. package/dist/patterns/LexicalEditor/Plugins.js +65 -61
  9. package/dist/patterns/LexicalEditor/components/FileSelectInput.js +24 -23
  10. package/dist/patterns/LexicalEditor/components/UploadFileDialog/UploadFileDialog.js +2 -1
  11. package/dist/patterns/LexicalEditor/nodes/FileNode/CompactFileView.d.ts +7 -0
  12. package/dist/patterns/LexicalEditor/nodes/FileNode/CompactFileView.js +53 -0
  13. package/dist/patterns/LexicalEditor/nodes/FileNode/FileComponent.d.ts +0 -27
  14. package/dist/patterns/LexicalEditor/nodes/FileNode/FileComponent.js +44 -115
  15. package/dist/patterns/LexicalEditor/nodes/FileNode/FileDownloadButton.js +1 -1
  16. package/dist/patterns/LexicalEditor/nodes/FileNode/fileStyles.d.ts +27 -0
  17. package/dist/patterns/LexicalEditor/nodes/FileNode/fileStyles.js +85 -0
  18. package/dist/patterns/LexicalEditor/nodes/ImageNode/CompactImageView.d.ts +6 -0
  19. package/dist/patterns/LexicalEditor/nodes/ImageNode/CompactImageView.js +91 -0
  20. package/dist/patterns/LexicalEditor/nodes/ImageNode/ImageComponent.js +108 -102
  21. package/dist/patterns/LexicalEditor/nodes/ProblemInputNode/InputComponent.js +7 -7
  22. package/dist/patterns/LexicalEditor/nodes/ProblemSelectNode/SelectComponent.js +4 -4
  23. package/dist/patterns/LexicalEditor/nodes/SheetInputNode/InputComponent.js +4 -4
  24. package/dist/patterns/LexicalEditor/nodes/SheetSelectNode/SelectComponent/SelectComponent.js +4 -4
  25. package/dist/patterns/LexicalEditor/plugins/CompactToolbarPlugin/CompactToolbarPlugin.d.ts +1 -0
  26. package/dist/patterns/LexicalEditor/plugins/CompactToolbarPlugin/CompactToolbarPlugin.js +106 -0
  27. package/dist/patterns/LexicalEditor/plugins/CompactToolbarPlugin/compactAttachmentNodes.d.ts +8 -0
  28. package/dist/patterns/LexicalEditor/plugins/CompactToolbarPlugin/compactAttachmentNodes.js +6 -0
  29. package/dist/patterns/LexicalEditor/plugins/CompactToolbarPlugin/index.d.ts +1 -0
  30. package/dist/patterns/LexicalEditor/plugins/DragDropPastePlugin/index.js +15 -14
  31. package/dist/patterns/LexicalEditor/uploadConstants.d.ts +6 -0
  32. package/dist/patterns/LexicalEditor/uploadConstants.js +4 -0
  33. package/package.json +3 -7
  34. package/@types/emotion.d.ts +0 -197
  35. package/node_modules/react-i18next/.eslintrc.json +0 -74
  36. package/node_modules/react-i18next/.husky/pre-commit +0 -1
  37. package/node_modules/react-i18next/.prettierignore +0 -4
  38. package/node_modules/react-i18next/CHANGELOG.md +0 -1433
  39. package/node_modules/react-i18next/LICENSE +0 -22
  40. package/node_modules/react-i18next/README.md +0 -181
  41. package/node_modules/react-i18next/TransWithoutContext.d.mts +0 -1
  42. package/node_modules/react-i18next/TransWithoutContext.d.ts +0 -129
  43. package/node_modules/react-i18next/dist/amd/react-i18next.js +0 -867
  44. package/node_modules/react-i18next/dist/amd/react-i18next.min.js +0 -1
  45. package/node_modules/react-i18next/dist/commonjs/I18nextProvider.js +0 -21
  46. package/node_modules/react-i18next/dist/commonjs/Trans.js +0 -54
  47. package/node_modules/react-i18next/dist/commonjs/TransWithoutContext.js +0 -330
  48. package/node_modules/react-i18next/dist/commonjs/Translation.js +0 -19
  49. package/node_modules/react-i18next/dist/commonjs/context.js +0 -81
  50. package/node_modules/react-i18next/dist/commonjs/defaults.js +0 -26
  51. package/node_modules/react-i18next/dist/commonjs/i18nInstance.js +0 -13
  52. package/node_modules/react-i18next/dist/commonjs/index.js +0 -128
  53. package/node_modules/react-i18next/dist/commonjs/initReactI18next.js +0 -15
  54. package/node_modules/react-i18next/dist/commonjs/unescape.js +0 -32
  55. package/node_modules/react-i18next/dist/commonjs/useSSR.js +0 -34
  56. package/node_modules/react-i18next/dist/commonjs/useTranslation.js +0 -114
  57. package/node_modules/react-i18next/dist/commonjs/utils.js +0 -76
  58. package/node_modules/react-i18next/dist/commonjs/withSSR.js +0 -27
  59. package/node_modules/react-i18next/dist/commonjs/withTranslation.js +0 -39
  60. package/node_modules/react-i18next/dist/es/I18nextProvider.js +0 -15
  61. package/node_modules/react-i18next/dist/es/Trans.js +0 -43
  62. package/node_modules/react-i18next/dist/es/TransWithoutContext.js +0 -321
  63. package/node_modules/react-i18next/dist/es/Translation.js +0 -12
  64. package/node_modules/react-i18next/dist/es/context.js +0 -42
  65. package/node_modules/react-i18next/dist/es/defaults.js +0 -18
  66. package/node_modules/react-i18next/dist/es/i18nInstance.js +0 -5
  67. package/node_modules/react-i18next/dist/es/index.js +0 -18
  68. package/node_modules/react-i18next/dist/es/initReactI18next.js +0 -9
  69. package/node_modules/react-i18next/dist/es/package.json +0 -1
  70. package/node_modules/react-i18next/dist/es/unescape.js +0 -25
  71. package/node_modules/react-i18next/dist/es/useSSR.js +0 -27
  72. package/node_modules/react-i18next/dist/es/useTranslation.js +0 -107
  73. package/node_modules/react-i18next/dist/es/utils.js +0 -62
  74. package/node_modules/react-i18next/dist/es/withSSR.js +0 -20
  75. package/node_modules/react-i18next/dist/es/withTranslation.js +0 -32
  76. package/node_modules/react-i18next/dist/umd/react-i18next.js +0 -871
  77. package/node_modules/react-i18next/dist/umd/react-i18next.min.js +0 -1
  78. package/node_modules/react-i18next/helpers.d.ts +0 -3
  79. package/node_modules/react-i18next/icu.macro.d.mts +0 -1
  80. package/node_modules/react-i18next/icu.macro.d.ts +0 -103
  81. package/node_modules/react-i18next/icu.macro.js +0 -729
  82. package/node_modules/react-i18next/index.d.mts +0 -1
  83. package/node_modules/react-i18next/index.d.ts +0 -209
  84. package/node_modules/react-i18next/initReactI18next.d.mts +0 -1
  85. package/node_modules/react-i18next/initReactI18next.d.ts +0 -3
  86. package/node_modules/react-i18next/lint-staged.config.mjs +0 -4
  87. package/node_modules/react-i18next/package.json +0 -167
  88. package/node_modules/react-i18next/react-i18next.js +0 -871
  89. package/node_modules/react-i18next/react-i18next.min.js +0 -1
  90. package/node_modules/react-i18next/src/I18nextProvider.js +0 -7
  91. package/node_modules/react-i18next/src/Trans.js +0 -45
  92. package/node_modules/react-i18next/src/TransWithoutContext.js +0 -479
  93. package/node_modules/react-i18next/src/Translation.js +0 -14
  94. package/node_modules/react-i18next/src/context.js +0 -54
  95. package/node_modules/react-i18next/src/defaults.js +0 -20
  96. package/node_modules/react-i18next/src/i18nInstance.js +0 -7
  97. package/node_modules/react-i18next/src/index.js +0 -22
  98. package/node_modules/react-i18next/src/initReactI18next.js +0 -11
  99. package/node_modules/react-i18next/src/unescape.js +0 -31
  100. package/node_modules/react-i18next/src/useSSR.js +0 -33
  101. package/node_modules/react-i18next/src/useTranslation.js +0 -171
  102. package/node_modules/react-i18next/src/utils.js +0 -93
  103. package/node_modules/react-i18next/src/withSSR.js +0 -21
  104. package/node_modules/react-i18next/src/withTranslation.js +0 -35
  105. package/node_modules/react-i18next/vitest.workspace.typescript.mts +0 -52
@@ -1,128 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "I18nContext", {
7
- enumerable: true,
8
- get: function () {
9
- return _context.I18nContext;
10
- }
11
- });
12
- Object.defineProperty(exports, "I18nextProvider", {
13
- enumerable: true,
14
- get: function () {
15
- return _I18nextProvider.I18nextProvider;
16
- }
17
- });
18
- Object.defineProperty(exports, "Trans", {
19
- enumerable: true,
20
- get: function () {
21
- return _Trans.Trans;
22
- }
23
- });
24
- Object.defineProperty(exports, "TransWithoutContext", {
25
- enumerable: true,
26
- get: function () {
27
- return _TransWithoutContext.Trans;
28
- }
29
- });
30
- Object.defineProperty(exports, "Translation", {
31
- enumerable: true,
32
- get: function () {
33
- return _Translation.Translation;
34
- }
35
- });
36
- Object.defineProperty(exports, "composeInitialProps", {
37
- enumerable: true,
38
- get: function () {
39
- return _context.composeInitialProps;
40
- }
41
- });
42
- exports.date = void 0;
43
- Object.defineProperty(exports, "getDefaults", {
44
- enumerable: true,
45
- get: function () {
46
- return _defaults.getDefaults;
47
- }
48
- });
49
- Object.defineProperty(exports, "getI18n", {
50
- enumerable: true,
51
- get: function () {
52
- return _i18nInstance.getI18n;
53
- }
54
- });
55
- Object.defineProperty(exports, "getInitialProps", {
56
- enumerable: true,
57
- get: function () {
58
- return _context.getInitialProps;
59
- }
60
- });
61
- Object.defineProperty(exports, "initReactI18next", {
62
- enumerable: true,
63
- get: function () {
64
- return _initReactI18next.initReactI18next;
65
- }
66
- });
67
- exports.selectOrdinal = exports.select = exports.plural = exports.number = void 0;
68
- Object.defineProperty(exports, "setDefaults", {
69
- enumerable: true,
70
- get: function () {
71
- return _defaults.setDefaults;
72
- }
73
- });
74
- Object.defineProperty(exports, "setI18n", {
75
- enumerable: true,
76
- get: function () {
77
- return _i18nInstance.setI18n;
78
- }
79
- });
80
- exports.time = void 0;
81
- Object.defineProperty(exports, "useSSR", {
82
- enumerable: true,
83
- get: function () {
84
- return _useSSR.useSSR;
85
- }
86
- });
87
- Object.defineProperty(exports, "useTranslation", {
88
- enumerable: true,
89
- get: function () {
90
- return _useTranslation.useTranslation;
91
- }
92
- });
93
- Object.defineProperty(exports, "withSSR", {
94
- enumerable: true,
95
- get: function () {
96
- return _withSSR.withSSR;
97
- }
98
- });
99
- Object.defineProperty(exports, "withTranslation", {
100
- enumerable: true,
101
- get: function () {
102
- return _withTranslation.withTranslation;
103
- }
104
- });
105
- var _Trans = require("./Trans.js");
106
- var _TransWithoutContext = require("./TransWithoutContext.js");
107
- var _useTranslation = require("./useTranslation.js");
108
- var _withTranslation = require("./withTranslation.js");
109
- var _Translation = require("./Translation.js");
110
- var _I18nextProvider = require("./I18nextProvider.js");
111
- var _withSSR = require("./withSSR.js");
112
- var _useSSR = require("./useSSR.js");
113
- var _initReactI18next = require("./initReactI18next.js");
114
- var _defaults = require("./defaults.js");
115
- var _i18nInstance = require("./i18nInstance.js");
116
- var _context = require("./context.js");
117
- const date = () => '';
118
- exports.date = date;
119
- const time = () => '';
120
- exports.time = time;
121
- const number = () => '';
122
- exports.number = number;
123
- const select = () => '';
124
- exports.select = select;
125
- const plural = () => '';
126
- exports.plural = plural;
127
- const selectOrdinal = () => '';
128
- exports.selectOrdinal = selectOrdinal;
@@ -1,15 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.initReactI18next = void 0;
7
- var _defaults = require("./defaults.js");
8
- var _i18nInstance = require("./i18nInstance.js");
9
- const initReactI18next = exports.initReactI18next = {
10
- type: '3rdParty',
11
- init(instance) {
12
- (0, _defaults.setDefaults)(instance.options.react);
13
- (0, _i18nInstance.setI18n)(instance);
14
- }
15
- };
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.unescape = void 0;
7
- const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
8
- const htmlEntities = {
9
- '&': '&',
10
- '&': '&',
11
- '&lt;': '<',
12
- '&#60;': '<',
13
- '&gt;': '>',
14
- '&#62;': '>',
15
- '&apos;': "'",
16
- '&#39;': "'",
17
- '&quot;': '"',
18
- '&#34;': '"',
19
- '&nbsp;': ' ',
20
- '&#160;': ' ',
21
- '&copy;': '©',
22
- '&#169;': '©',
23
- '&reg;': '®',
24
- '&#174;': '®',
25
- '&hellip;': '…',
26
- '&#8230;': '…',
27
- '&#x2F;': '/',
28
- '&#47;': '/'
29
- };
30
- const unescapeHtmlEntity = m => htmlEntities[m];
31
- const unescape = text => text.replace(matchHtmlEntity, unescapeHtmlEntity);
32
- exports.unescape = unescape;
@@ -1,34 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useSSR = void 0;
7
- var _react = require("react");
8
- var _context = require("./context.js");
9
- const useSSR = (initialI18nStore, initialLanguage, props = {}) => {
10
- const {
11
- i18n: i18nFromProps
12
- } = props;
13
- const {
14
- i18n: i18nFromContext
15
- } = (0, _react.useContext)(_context.I18nContext) || {};
16
- const i18n = i18nFromProps || i18nFromContext || (0, _context.getI18n)();
17
- if (i18n.options?.isClone) return;
18
- if (initialI18nStore && !i18n.initializedStoreOnce) {
19
- i18n.services.resourceStore.data = initialI18nStore;
20
- i18n.options.ns = Object.values(initialI18nStore).reduce((mem, lngResources) => {
21
- Object.keys(lngResources).forEach(ns => {
22
- if (mem.indexOf(ns) < 0) mem.push(ns);
23
- });
24
- return mem;
25
- }, i18n.options.ns);
26
- i18n.initializedStoreOnce = true;
27
- i18n.isInitialized = true;
28
- }
29
- if (initialLanguage && !i18n.initializedLanguageOnce) {
30
- i18n.changeLanguage(initialLanguage);
31
- i18n.initializedLanguageOnce = true;
32
- }
33
- };
34
- exports.useSSR = useSSR;
@@ -1,114 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useTranslation = void 0;
7
- var _react = require("react");
8
- var _context = require("./context.js");
9
- var _utils = require("./utils.js");
10
- const usePrevious = (value, ignore) => {
11
- const ref = (0, _react.useRef)();
12
- (0, _react.useEffect)(() => {
13
- ref.current = ignore ? ref.current : value;
14
- }, [value, ignore]);
15
- return ref.current;
16
- };
17
- const alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix);
18
- const useMemoizedT = (i18n, language, namespace, keyPrefix) => (0, _react.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
19
- const useTranslation = (ns, props = {}) => {
20
- const {
21
- i18n: i18nFromProps
22
- } = props;
23
- const {
24
- i18n: i18nFromContext,
25
- defaultNS: defaultNSFromContext
26
- } = (0, _react.useContext)(_context.I18nContext) || {};
27
- const i18n = i18nFromProps || i18nFromContext || (0, _context.getI18n)();
28
- if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new _context.ReportNamespaces();
29
- if (!i18n) {
30
- (0, _utils.warnOnce)(i18n, 'NO_I18NEXT_INSTANCE', 'useTranslation: You will need to pass in an i18next instance by using initReactI18next');
31
- const notReadyT = (k, optsOrDefaultValue) => {
32
- if ((0, _utils.isString)(optsOrDefaultValue)) return optsOrDefaultValue;
33
- if ((0, _utils.isObject)(optsOrDefaultValue) && (0, _utils.isString)(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue;
34
- return Array.isArray(k) ? k[k.length - 1] : k;
35
- };
36
- const retNotReady = [notReadyT, {}, false];
37
- retNotReady.t = notReadyT;
38
- retNotReady.i18n = {};
39
- retNotReady.ready = false;
40
- return retNotReady;
41
- }
42
- if (i18n.options.react?.wait) (0, _utils.warnOnce)(i18n, 'DEPRECATED_OPTION', 'useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.');
43
- const i18nOptions = {
44
- ...(0, _context.getDefaults)(),
45
- ...i18n.options.react,
46
- ...props
47
- };
48
- const {
49
- useSuspense,
50
- keyPrefix
51
- } = i18nOptions;
52
- let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS;
53
- namespaces = (0, _utils.isString)(namespaces) ? [namespaces] : namespaces || ['translation'];
54
- i18n.reportNamespaces.addUsedNamespaces?.(namespaces);
55
- const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => (0, _utils.hasLoadedNamespace)(n, i18n, i18nOptions));
56
- const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
57
- const getT = () => memoGetT;
58
- const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix);
59
- const [t, setT] = (0, _react.useState)(getT);
60
- let joinedNS = namespaces.join();
61
- if (props.lng) joinedNS = `${props.lng}${joinedNS}`;
62
- const previousJoinedNS = usePrevious(joinedNS);
63
- const isMounted = (0, _react.useRef)(true);
64
- (0, _react.useEffect)(() => {
65
- const {
66
- bindI18n,
67
- bindI18nStore
68
- } = i18nOptions;
69
- isMounted.current = true;
70
- if (!ready && !useSuspense) {
71
- if (props.lng) {
72
- (0, _utils.loadLanguages)(i18n, props.lng, namespaces, () => {
73
- if (isMounted.current) setT(getNewT);
74
- });
75
- } else {
76
- (0, _utils.loadNamespaces)(i18n, namespaces, () => {
77
- if (isMounted.current) setT(getNewT);
78
- });
79
- }
80
- }
81
- if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
82
- setT(getNewT);
83
- }
84
- const boundReset = () => {
85
- if (isMounted.current) setT(getNewT);
86
- };
87
- if (bindI18n) i18n?.on(bindI18n, boundReset);
88
- if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset);
89
- return () => {
90
- isMounted.current = false;
91
- if (i18n && bindI18n) bindI18n?.split(' ').forEach(e => i18n.off(e, boundReset));
92
- if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset));
93
- };
94
- }, [i18n, joinedNS]);
95
- (0, _react.useEffect)(() => {
96
- if (isMounted.current && ready) {
97
- setT(getT);
98
- }
99
- }, [i18n, keyPrefix, ready]);
100
- const ret = [t, i18n, ready];
101
- ret.t = t;
102
- ret.i18n = i18n;
103
- ret.ready = ready;
104
- if (ready) return ret;
105
- if (!ready && !useSuspense) return ret;
106
- throw new Promise(resolve => {
107
- if (props.lng) {
108
- (0, _utils.loadLanguages)(i18n, props.lng, namespaces, () => resolve());
109
- } else {
110
- (0, _utils.loadNamespaces)(i18n, namespaces, () => resolve());
111
- }
112
- });
113
- };
114
- exports.useTranslation = useTranslation;
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.warnOnce = exports.warn = exports.loadNamespaces = exports.loadLanguages = exports.isString = exports.isObject = exports.hasLoadedNamespace = exports.getDisplayName = void 0;
7
- const warn = (i18n, code, msg, rest) => {
8
- const args = [msg, {
9
- code,
10
- ...(rest || {})
11
- }];
12
- if (i18n?.services?.logger?.forward) {
13
- return i18n.services.logger.forward(args, 'warn', 'react-i18next::', true);
14
- }
15
- if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
16
- if (i18n?.services?.logger?.warn) {
17
- i18n.services.logger.warn(...args);
18
- } else if (console?.warn) {
19
- console.warn(...args);
20
- }
21
- };
22
- exports.warn = warn;
23
- const alreadyWarned = {};
24
- const warnOnce = (i18n, code, msg, rest) => {
25
- if (isString(msg) && alreadyWarned[msg]) return;
26
- if (isString(msg)) alreadyWarned[msg] = new Date();
27
- warn(i18n, code, msg, rest);
28
- };
29
- exports.warnOnce = warnOnce;
30
- const loadedClb = (i18n, cb) => () => {
31
- if (i18n.isInitialized) {
32
- cb();
33
- } else {
34
- const initialized = () => {
35
- setTimeout(() => {
36
- i18n.off('initialized', initialized);
37
- }, 0);
38
- cb();
39
- };
40
- i18n.on('initialized', initialized);
41
- }
42
- };
43
- const loadNamespaces = (i18n, ns, cb) => {
44
- i18n.loadNamespaces(ns, loadedClb(i18n, cb));
45
- };
46
- exports.loadNamespaces = loadNamespaces;
47
- const loadLanguages = (i18n, lng, ns, cb) => {
48
- if (isString(ns)) ns = [ns];
49
- if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb);
50
- ns.forEach(n => {
51
- if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n);
52
- });
53
- i18n.loadLanguages(lng, loadedClb(i18n, cb));
54
- };
55
- exports.loadLanguages = loadLanguages;
56
- const hasLoadedNamespace = (ns, i18n, options = {}) => {
57
- if (!i18n.languages || !i18n.languages.length) {
58
- warnOnce(i18n, 'NO_LANGUAGES', 'i18n.languages were undefined or empty', {
59
- languages: i18n.languages
60
- });
61
- return true;
62
- }
63
- return i18n.hasLoadedNamespace(ns, {
64
- lng: options.lng,
65
- precheck: (i18nInstance, loadNotPending) => {
66
- if (options.bindI18n && options.bindI18n.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false;
67
- }
68
- });
69
- };
70
- exports.hasLoadedNamespace = hasLoadedNamespace;
71
- const getDisplayName = Component => Component.displayName || Component.name || (isString(Component) && Component.length > 0 ? Component : 'Unknown');
72
- exports.getDisplayName = getDisplayName;
73
- const isString = obj => typeof obj === 'string';
74
- exports.isString = isString;
75
- const isObject = obj => typeof obj === 'object' && obj !== null;
76
- exports.isObject = isObject;
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.withSSR = void 0;
7
- var _react = require("react");
8
- var _useSSR = require("./useSSR.js");
9
- var _context = require("./context.js");
10
- var _utils = require("./utils.js");
11
- const withSSR = () => function Extend(WrappedComponent) {
12
- function I18nextWithSSR({
13
- initialI18nStore,
14
- initialLanguage,
15
- ...rest
16
- }) {
17
- (0, _useSSR.useSSR)(initialI18nStore, initialLanguage);
18
- return (0, _react.createElement)(WrappedComponent, {
19
- ...rest
20
- });
21
- }
22
- I18nextWithSSR.getInitialProps = (0, _context.composeInitialProps)(WrappedComponent);
23
- I18nextWithSSR.displayName = `withI18nextSSR(${(0, _utils.getDisplayName)(WrappedComponent)})`;
24
- I18nextWithSSR.WrappedComponent = WrappedComponent;
25
- return I18nextWithSSR;
26
- };
27
- exports.withSSR = withSSR;
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.withTranslation = void 0;
7
- var _react = require("react");
8
- var _useTranslation = require("./useTranslation.js");
9
- var _utils = require("./utils.js");
10
- const withTranslation = (ns, options = {}) => function Extend(WrappedComponent) {
11
- function I18nextWithTranslation({
12
- forwardedRef,
13
- ...rest
14
- }) {
15
- const [t, i18n, ready] = (0, _useTranslation.useTranslation)(ns, {
16
- ...rest,
17
- keyPrefix: options.keyPrefix
18
- });
19
- const passDownProps = {
20
- ...rest,
21
- t,
22
- i18n,
23
- tReady: ready
24
- };
25
- if (options.withRef && forwardedRef) {
26
- passDownProps.ref = forwardedRef;
27
- } else if (!options.withRef && forwardedRef) {
28
- passDownProps.forwardedRef = forwardedRef;
29
- }
30
- return (0, _react.createElement)(WrappedComponent, passDownProps);
31
- }
32
- I18nextWithTranslation.displayName = `withI18nextTranslation(${(0, _utils.getDisplayName)(WrappedComponent)})`;
33
- I18nextWithTranslation.WrappedComponent = WrappedComponent;
34
- const forwardRef = (props, ref) => (0, _react.createElement)(I18nextWithTranslation, Object.assign({}, props, {
35
- forwardedRef: ref
36
- }));
37
- return options.withRef ? (0, _react.forwardRef)(forwardRef) : I18nextWithTranslation;
38
- };
39
- exports.withTranslation = withTranslation;
@@ -1,15 +0,0 @@
1
- import { createElement, useMemo } from 'react';
2
- import { I18nContext } from './context.js';
3
- export function I18nextProvider({
4
- i18n,
5
- defaultNS,
6
- children
7
- }) {
8
- const value = useMemo(() => ({
9
- i18n,
10
- defaultNS
11
- }), [i18n, defaultNS]);
12
- return createElement(I18nContext.Provider, {
13
- value
14
- }, children);
15
- }
@@ -1,43 +0,0 @@
1
- import { useContext } from 'react';
2
- import { nodesToString, Trans as TransWithoutContext } from './TransWithoutContext.js';
3
- import { getI18n, I18nContext } from './context.js';
4
- export { nodesToString };
5
- export function Trans({
6
- children,
7
- count,
8
- parent,
9
- i18nKey,
10
- context,
11
- tOptions = {},
12
- values,
13
- defaults,
14
- components,
15
- ns,
16
- i18n: i18nFromProps,
17
- t: tFromProps,
18
- shouldUnescape,
19
- ...additionalProps
20
- }) {
21
- const {
22
- i18n: i18nFromContext,
23
- defaultNS: defaultNSFromContext
24
- } = useContext(I18nContext) || {};
25
- const i18n = i18nFromProps || i18nFromContext || getI18n();
26
- const t = tFromProps || i18n?.t.bind(i18n);
27
- return TransWithoutContext({
28
- children,
29
- count,
30
- parent,
31
- i18nKey,
32
- context,
33
- tOptions,
34
- values,
35
- defaults,
36
- components,
37
- ns: ns || t?.ns || defaultNSFromContext || i18n?.options?.defaultNS,
38
- i18n,
39
- t: tFromProps,
40
- shouldUnescape,
41
- ...additionalProps
42
- });
43
- }