localize-react 1.6.0 → 2.0.0-next.0
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 +141 -240
- package/dist/index.cjs +133 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +138 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.mjs +127 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +143 -30
- package/.babelrc +0 -20
- package/dist/localize-react.js +0 -1
- package/index.d.ts +0 -39
- package/rollup.config.js +0 -24
package/index.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Context, ComponentType, Consumer, PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
type Translate = (
|
|
4
|
-
key: string,
|
|
5
|
-
values?: Record<string, unknown>,
|
|
6
|
-
defaultMessage?: string
|
|
7
|
-
) => string;
|
|
8
|
-
|
|
9
|
-
interface LocalizationContextValue {
|
|
10
|
-
locale: string;
|
|
11
|
-
translate: Translate;
|
|
12
|
-
translations: Record<string, unknown>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface LocalizationProviderProps {
|
|
16
|
-
locale: string;
|
|
17
|
-
disableCache?: boolean;
|
|
18
|
-
translations: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface MessageComponentProps {
|
|
22
|
-
descriptor: string;
|
|
23
|
-
values: Record<string, unknown>;
|
|
24
|
-
defaultMessage: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
type UseLocalizeHook = () => LocalizationContextValue;
|
|
28
|
-
|
|
29
|
-
type MessageComponent = ComponentType<MessageComponentProps>;
|
|
30
|
-
|
|
31
|
-
export const useLocalize: UseLocalizeHook;
|
|
32
|
-
|
|
33
|
-
export const Message: MessageComponent;
|
|
34
|
-
|
|
35
|
-
export const LocalizationContext: Context<LocalizationContextValue>;
|
|
36
|
-
|
|
37
|
-
export const LocalizationProvider: ComponentType<PropsWithChildren<LocalizationProviderProps>>;
|
|
38
|
-
|
|
39
|
-
export const LocalizationConsumer: Consumer<LocalizationContextValue>;
|
package/rollup.config.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import babel from 'rollup-plugin-babel';
|
|
2
|
-
import resolve from 'rollup-plugin-node-resolve';
|
|
3
|
-
import { uglify } from 'rollup-plugin-uglify';
|
|
4
|
-
import autoExternal from 'rollup-plugin-auto-external';
|
|
5
|
-
import replace from 'rollup-plugin-replace';
|
|
6
|
-
|
|
7
|
-
const config = {
|
|
8
|
-
input: 'src/index.js',
|
|
9
|
-
output: {
|
|
10
|
-
file: './dist/localize-react.js',
|
|
11
|
-
format: 'umd',
|
|
12
|
-
name: 'localize-react',
|
|
13
|
-
globals: { 'react': 'React' },
|
|
14
|
-
},
|
|
15
|
-
plugins: [
|
|
16
|
-
autoExternal(),
|
|
17
|
-
replace({ NODE_ENV: process.env.API_KEY }),
|
|
18
|
-
resolve(),
|
|
19
|
-
babel({ exclude: 'node_modules/**' }),
|
|
20
|
-
uglify(),
|
|
21
|
-
]
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default config;
|