@lingui/react
Advanced tools
Comparing version 4.8.0 to 4.10.0
@@ -1,20 +0,9 @@ | ||
import React, { ComponentType, FunctionComponent } from 'react'; | ||
import { I18n } from '@lingui/core'; | ||
import { TransRenderProps, TransProps } from './server.js'; | ||
export { TransRenderCallbackOrComponent } from './server.js'; | ||
export { b as I18nContext, I as I18nProvider, a as I18nProviderProps, L as LinguiContext, u as useLingui } from './shared/react.80f80298.js'; | ||
import React from 'react'; | ||
import { T as TransProps } from './shared/react.a673be03.js'; | ||
export { b as TransRenderCallbackOrComponent, a as TransRenderProps } from './shared/react.a673be03.js'; | ||
import '@lingui/core'; | ||
type I18nContext = { | ||
i18n: I18n; | ||
_: I18n["_"]; | ||
defaultComponent?: ComponentType<TransRenderProps>; | ||
}; | ||
type I18nProviderProps = Omit<I18nContext, "_"> & { | ||
children?: React.ReactNode; | ||
}; | ||
declare const LinguiContext: React.Context<I18nContext | null>; | ||
declare function useLingui(): I18nContext; | ||
declare const I18nProvider: FunctionComponent<I18nProviderProps>; | ||
declare function Trans(props: TransProps): React.ReactElement<any, any> | null; | ||
export { type I18nContext, I18nProvider, type I18nProviderProps, LinguiContext, Trans, TransProps, TransRenderProps, useLingui }; | ||
export { Trans, TransProps }; |
@@ -1,45 +0,44 @@ | ||
import React, { ComponentType } from 'react'; | ||
import { MessageOptions, I18n } from '@lingui/core'; | ||
export { c as TransNoContext, T as TransProps, b as TransRenderCallbackOrComponent, a as TransRenderProps } from './shared/react.a673be03.js'; | ||
import { I18n } from '@lingui/core'; | ||
import 'react'; | ||
type TransRenderProps = { | ||
id: string; | ||
translation: React.ReactNode; | ||
children: React.ReactNode; | ||
message?: string | null; | ||
/** | ||
* @deprecated isTranslated prop is undocumented and buggy. It'll be removed in v5 release. | ||
* */ | ||
isTranslated: boolean; | ||
}; | ||
type TransRenderCallbackOrComponent = { | ||
component?: undefined; | ||
render?: ((props: TransRenderProps) => React.ReactElement<any, any>) | null; | ||
} | { | ||
component?: React.ComponentType<TransRenderProps> | null; | ||
render?: undefined; | ||
}; | ||
type TransProps = { | ||
id: string; | ||
message?: string; | ||
values?: Record<string, unknown>; | ||
components?: { | ||
[key: string]: React.ElementType | any; | ||
}; | ||
formats?: MessageOptions["formats"]; | ||
comment?: string; | ||
children?: React.ReactNode; | ||
} & TransRenderCallbackOrComponent; | ||
/** | ||
* Version of `<Trans>` component without using a Provider/Context React feature. | ||
* Primarily made for support React Server Components (RSC) | ||
* This is an entry point for React Server Components (RSC) | ||
* | ||
* @experimental the api of this component is not stabilized yet. | ||
* The RSC uses a static analysis to find any non-valid function calls in the import graph. | ||
* That means this entry point and it's children should not have any Provider/Context calls. | ||
*/ | ||
declare function TransNoContext(props: TransProps & { | ||
lingui: { | ||
i18n: I18n; | ||
defaultComponent?: ComponentType<TransRenderProps>; | ||
}; | ||
}): React.ReactElement<any, any> | null; | ||
export { TransNoContext, type TransProps, type TransRenderCallbackOrComponent, type TransRenderProps }; | ||
/** | ||
* Set Lingui's i18n instance for later use in RSC Components | ||
* | ||
* Example: | ||
* | ||
* ```js | ||
* import { setupI18n } from "@lingui/core"; | ||
* | ||
* const i18n = setupI18n({ | ||
* locale, | ||
* messages: { [locale]: messages }, | ||
* }) | ||
* | ||
* setI18n(i18n); | ||
* ``` | ||
*/ | ||
declare function setI18n(i18n: I18n): void; | ||
/** | ||
* Get Lingui's i18n instance saved for RSC | ||
* | ||
* ```js | ||
* export function generateMetadata() { | ||
* const i18n = getI18n() | ||
* | ||
* return { | ||
* title: t(i18n)`Translation Demo`, | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
declare function getI18n(): I18n | null; | ||
export { getI18n, setI18n }; |
{ | ||
"name": "@lingui/react", | ||
"version": "4.8.0", | ||
"version": "4.10.0", | ||
"sideEffects": false, | ||
@@ -47,2 +47,3 @@ "description": "React components for translations", | ||
"types": "./dist/index.d.cts", | ||
"react-server": "./dist/index-rsc.cjs", | ||
"default": "./dist/index.cjs" | ||
@@ -52,2 +53,3 @@ }, | ||
"types": "./dist/index.d.mts", | ||
"react-server": "./dist/index-rsc.mjs", | ||
"default": "./dist/index.mjs" | ||
@@ -78,3 +80,3 @@ } | ||
"@babel/runtime": "^7.20.13", | ||
"@lingui/core": "4.8.0" | ||
"@lingui/core": "4.10.0" | ||
}, | ||
@@ -91,3 +93,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "1b3a1209b06e9a6b6820ce54064da87052c21fa5" | ||
"gitHead": "5088feb92de2a669659e85067c2849331122e830" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35310
27
670
1
+ Added@lingui/core@4.10.0(transitive)
+ Added@lingui/message-utils@4.10.0(transitive)
- Removed@lingui/core@4.8.0(transitive)
- Removed@lingui/message-utils@4.8.0(transitive)
Updated@lingui/core@4.10.0