use-intl 3.0.0-beta.1 → 3.0.0-beta.3
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/_IntlProvider.d.ts +1 -0
- package/_useLocale.d.ts +1 -0
- package/core.d.ts +1 -1
- package/dist/_IntlProvider.js +7 -0
- package/dist/_useLocale.js +7 -0
- package/dist/core.js +3 -4
- package/dist/development/IntlContext-b5cc6be8.js +8 -0
- package/dist/development/_IntlProvider.js +27 -0
- package/dist/development/_useLocale-321e619f.js +19 -0
- package/dist/development/_useLocale.js +11 -0
- package/dist/development/core.js +92 -0
- package/dist/development/createIntl-dfba4462.js +421 -0
- package/dist/development/index.js +31 -0
- package/dist/development/initializeConfig-cde42612.js +119 -0
- package/dist/development/react.js +160 -0
- package/dist/esm/IntlContext-381f3ce4.js +1 -0
- package/dist/esm/_IntlProvider.js +1 -0
- package/dist/esm/_useLocale-89b32eb9.js +1 -0
- package/dist/esm/_useLocale.js +1 -0
- package/dist/esm/core.js +1 -0
- package/dist/esm/createIntl-164a7766.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/initializeConfig-c316f266.js +1 -0
- package/dist/esm/react.js +1 -0
- package/dist/index.js +3 -4
- package/dist/production/IntlContext-381f3ce4.js +1 -0
- package/dist/production/_IntlProvider.js +1 -0
- package/dist/production/_useLocale-8e23751a.js +1 -0
- package/dist/production/_useLocale.js +1 -0
- package/dist/production/core.js +1 -0
- package/dist/production/createIntl-e408cd5c.js +1 -0
- package/dist/production/index.js +1 -0
- package/dist/production/initializeConfig-984a566d.js +1 -0
- package/dist/production/react.js +1 -0
- package/dist/react.js +3 -4
- package/dist/types/src/_IntlProvider.d.ts +1 -0
- package/dist/types/src/_useLocale.d.ts +1 -0
- package/dist/{core → types/src/core}/AbstractIntlMessages.d.ts +9 -9
- package/dist/{core → types/src/core}/DateTimeFormatOptions.d.ts +73 -73
- package/dist/{core → types/src/core}/Formats.d.ts +8 -8
- package/dist/{core → types/src/core}/IntlConfig.d.ts +54 -54
- package/dist/{core → types/src/core}/IntlError.d.ts +13 -13
- package/dist/types/src/core/MessageFormatCache.d.ts +5 -0
- package/dist/{core → types/src/core}/NumberFormatOptions.d.ts +2 -2
- package/dist/{core → types/src/core}/TimeZone.d.ts +2 -2
- package/dist/{core → types/src/core}/TranslationValues.d.ts +6 -6
- package/dist/{core → types/src/core}/convertFormatsToIntlMessageFormat.d.ts +11 -11
- package/dist/{core → types/src/core}/createBaseTranslator.d.ts +21 -21
- package/dist/{core → types/src/core}/createFormatter.d.ts +19 -19
- package/dist/{core → types/src/core}/createIntl.d.ts +7 -7
- package/dist/{core → types/src/core}/createTranslator.d.ts +47 -47
- package/dist/{core → types/src/core}/createTranslatorImpl.d.ts +13 -13
- package/dist/{core → types/src/core}/defaults.d.ts +11 -11
- package/dist/{core → types/src/core}/index.d.ts +16 -16
- package/dist/{core → types/src/core}/initializeConfig.d.ts +14 -13
- package/dist/{core → types/src/core}/resolveNamespace.d.ts +5 -5
- package/dist/{core → types/src/core}/utils/MessageKeys.d.ts +5 -5
- package/dist/{core → types/src/core}/utils/NamespaceKeys.d.ts +5 -5
- package/dist/{core → types/src/core}/utils/NestedKeyOf.d.ts +4 -4
- package/dist/{core → types/src/core}/utils/NestedValueOf.d.ts +2 -2
- package/dist/{core → types/src/core}/validateMessages.d.ts +3 -3
- package/dist/{core.d.ts → types/src/core.d.ts} +1 -1
- package/dist/{index.d.ts → types/src/index.d.ts} +2 -2
- package/dist/types/src/react/IntlContext.d.ts +13 -0
- package/dist/{react → types/src/react}/IntlProvider.d.ts +7 -7
- package/dist/{react → types/src/react}/getInitializedConfig.d.ts +1 -1
- package/dist/{react → types/src/react}/index.d.ts +8 -8
- package/dist/{react → types/src/react}/useFormatter.d.ts +6 -6
- package/dist/{react → types/src/react}/useIntl.d.ts +6 -6
- package/dist/types/src/react/useIntlContext.d.ts +10 -0
- package/dist/{react → types/src/react}/useLocale.d.ts +1 -1
- package/dist/{react → types/src/react}/useMessages.d.ts +1 -1
- package/dist/{react → types/src/react}/useNow.d.ts +23 -23
- package/dist/{react → types/src/react}/useTimeZone.d.ts +1 -1
- package/dist/{react → types/src/react}/useTranslations.d.ts +44 -44
- package/dist/{react → types/src/react}/useTranslationsImpl.d.ts +8 -8
- package/dist/{react.d.ts → types/src/react.d.ts} +1 -1
- package/dist/types/test/core/createFormatter.test.d.ts +1 -0
- package/dist/types/test/core/createIntl.test.d.ts +1 -0
- package/dist/types/test/core/createTranslator.test.d.ts +1 -0
- package/dist/types/test/react/useFormatter.test.d.ts +1 -0
- package/dist/types/test/react/useIntl.test.d.ts +1 -0
- package/dist/types/test/react/useLocale.test.d.ts +1 -0
- package/dist/types/test/react/useMessages.test.d.ts +1 -0
- package/dist/types/test/react/useNow.test.d.ts +1 -0
- package/dist/types/test/react/useTimeZone.test.d.ts +1 -0
- package/dist/types/test/react/useTranslations.test.d.ts +1 -0
- package/dist/{test → types/test}/setup.d.ts +1 -1
- package/package.json +33 -21
- package/react.d.ts +1 -1
- package/dist/_virtual/_rollupPluginBabelHelpers.esm.js +0 -102
- package/dist/_virtual/_rollupPluginBabelHelpers.esm.js.map +0 -1
- package/dist/_virtual/use-intl.esm.js +0 -102
- package/dist/_virtual/use-intl.esm.js.map +0 -1
- package/dist/core/IntlError.esm.js +0 -33
- package/dist/core/IntlError.esm.js.map +0 -1
- package/dist/core/convertFormatsToIntlMessageFormat.esm.js +0 -32
- package/dist/core/convertFormatsToIntlMessageFormat.esm.js.map +0 -1
- package/dist/core/createBaseTranslator.esm.js +0 -201
- package/dist/core/createBaseTranslator.esm.js.map +0 -1
- package/dist/core/createFormatter.esm.js +0 -138
- package/dist/core/createFormatter.esm.js.map +0 -1
- package/dist/core/createIntl.esm.js +0 -14
- package/dist/core/createIntl.esm.js.map +0 -1
- package/dist/core/createTranslator.esm.js +0 -37
- package/dist/core/createTranslator.esm.js.map +0 -1
- package/dist/core/createTranslatorImpl.esm.js +0 -50
- package/dist/core/createTranslatorImpl.esm.js.map +0 -1
- package/dist/core/defaults.esm.js +0 -15
- package/dist/core/defaults.esm.js.map +0 -1
- package/dist/core/initializeConfig.esm.js +0 -29
- package/dist/core/initializeConfig.esm.js.map +0 -1
- package/dist/core/resolveNamespace.esm.js +0 -10
- package/dist/core/resolveNamespace.esm.js.map +0 -1
- package/dist/core/use-intl.esm.js +0 -37
- package/dist/core/use-intl.esm.js.map +0 -1
- package/dist/core/use-intl.esm10.js +0 -28
- package/dist/core/use-intl.esm10.js.map +0 -1
- package/dist/core/use-intl.esm11.js +0 -10
- package/dist/core/use-intl.esm11.js.map +0 -1
- package/dist/core/use-intl.esm2.js +0 -33
- package/dist/core/use-intl.esm2.js.map +0 -1
- package/dist/core/use-intl.esm3.js +0 -14
- package/dist/core/use-intl.esm3.js.map +0 -1
- package/dist/core/use-intl.esm4.js +0 -201
- package/dist/core/use-intl.esm4.js.map +0 -1
- package/dist/core/use-intl.esm5.js +0 -29
- package/dist/core/use-intl.esm5.js.map +0 -1
- package/dist/core/use-intl.esm6.js +0 -138
- package/dist/core/use-intl.esm6.js.map +0 -1
- package/dist/core/use-intl.esm7.js +0 -15
- package/dist/core/use-intl.esm7.js.map +0 -1
- package/dist/core/use-intl.esm8.js +0 -50
- package/dist/core/use-intl.esm8.js.map +0 -1
- package/dist/core/use-intl.esm9.js +0 -32
- package/dist/core/use-intl.esm9.js.map +0 -1
- package/dist/core/validateMessages.esm.js +0 -28
- package/dist/core/validateMessages.esm.js.map +0 -1
- package/dist/core.cjs.development.js +0 -93
- package/dist/core.cjs.development.js.map +0 -1
- package/dist/core.cjs.production.min.js +0 -2
- package/dist/core.cjs.production.min.js.map +0 -1
- package/dist/core.esm.js +0 -7
- package/dist/core.esm.js.map +0 -1
- package/dist/createIntl-8a2b87eb.js +0 -579
- package/dist/createIntl-8a2b87eb.js.map +0 -1
- package/dist/createIntl-f7979de1.js +0 -2
- package/dist/createIntl-f7979de1.js.map +0 -1
- package/dist/react/IntlContext.d.ts +0 -4
- package/dist/react/IntlContext.esm.js +0 -6
- package/dist/react/IntlContext.esm.js.map +0 -1
- package/dist/react/IntlProvider.esm.js +0 -16
- package/dist/react/IntlProvider.esm.js.map +0 -1
- package/dist/react/use-intl.esm.js +0 -26
- package/dist/react/use-intl.esm.js.map +0 -1
- package/dist/react/use-intl.esm10.js +0 -13
- package/dist/react/use-intl.esm10.js.map +0 -1
- package/dist/react/use-intl.esm11.js +0 -6
- package/dist/react/use-intl.esm11.js.map +0 -1
- package/dist/react/use-intl.esm2.js +0 -24
- package/dist/react/use-intl.esm2.js.map +0 -1
- package/dist/react/use-intl.esm3.js +0 -45
- package/dist/react/use-intl.esm3.js.map +0 -1
- package/dist/react/use-intl.esm4.js +0 -16
- package/dist/react/use-intl.esm4.js.map +0 -1
- package/dist/react/use-intl.esm5.js +0 -8
- package/dist/react/use-intl.esm5.js.map +0 -1
- package/dist/react/use-intl.esm6.js +0 -8
- package/dist/react/use-intl.esm6.js.map +0 -1
- package/dist/react/use-intl.esm7.js +0 -30
- package/dist/react/use-intl.esm7.js.map +0 -1
- package/dist/react/use-intl.esm8.js +0 -8
- package/dist/react/use-intl.esm8.js.map +0 -1
- package/dist/react/use-intl.esm9.js +0 -36
- package/dist/react/use-intl.esm9.js.map +0 -1
- package/dist/react/useFormatter.esm.js +0 -24
- package/dist/react/useFormatter.esm.js.map +0 -1
- package/dist/react/useIntl.esm.js +0 -30
- package/dist/react/useIntl.esm.js.map +0 -1
- package/dist/react/useIntlContext.d.ts +0 -1
- package/dist/react/useIntlContext.esm.js +0 -13
- package/dist/react/useIntlContext.esm.js.map +0 -1
- package/dist/react/useLocale.esm.js +0 -8
- package/dist/react/useLocale.esm.js.map +0 -1
- package/dist/react/useMessages.esm.js +0 -8
- package/dist/react/useMessages.esm.js.map +0 -1
- package/dist/react/useNow.esm.js +0 -45
- package/dist/react/useNow.esm.js.map +0 -1
- package/dist/react/useTimeZone.esm.js +0 -8
- package/dist/react/useTimeZone.esm.js.map +0 -1
- package/dist/react/useTranslations.esm.js +0 -26
- package/dist/react/useTranslations.esm.js.map +0 -1
- package/dist/react/useTranslationsImpl.esm.js +0 -36
- package/dist/react/useTranslationsImpl.esm.js.map +0 -1
- package/dist/react.cjs.development.js +0 -184
- package/dist/react.cjs.development.js.map +0 -1
- package/dist/react.cjs.production.min.js +0 -2
- package/dist/react.cjs.production.min.js.map +0 -1
- package/dist/react.esm.js +0 -9
- package/dist/react.esm.js.map +0 -1
- package/dist/use-intl.cjs.development.js +0 -823
- package/dist/use-intl.cjs.development.js.map +0 -1
- package/dist/use-intl.cjs.production.min.js +0 -2
- package/dist/use-intl.cjs.production.min.js.map +0 -1
- package/dist/use-intl.esm.js +0 -15
- package/dist/use-intl.esm.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type NestedKeyOf<ObjectType> = ObjectType extends object ? {
|
|
2
|
-
[Key in keyof ObjectType]: `${Key & string}` | `${Key & string}.${NestedKeyOf<ObjectType[Key]>}`;
|
|
3
|
-
}[keyof ObjectType] : never;
|
|
4
|
-
export default NestedKeyOf;
|
|
1
|
+
type NestedKeyOf<ObjectType> = ObjectType extends object ? {
|
|
2
|
+
[Key in keyof ObjectType]: `${Key & string}` | `${Key & string}.${NestedKeyOf<ObjectType[Key]>}`;
|
|
3
|
+
}[keyof ObjectType] : never;
|
|
4
|
+
export default NestedKeyOf;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
type NestedValueOf<ObjectType, Property extends string> = Property extends `${infer Key}.${infer Rest}` ? Key extends keyof ObjectType ? NestedValueOf<ObjectType[Key], Rest> : never : Property extends keyof ObjectType ? ObjectType[Property] : never;
|
|
2
|
-
export default NestedValueOf;
|
|
1
|
+
type NestedValueOf<ObjectType, Property extends string> = Property extends `${infer Key}.${infer Rest}` ? Key extends keyof ObjectType ? NestedValueOf<ObjectType[Key], Rest> : never : Property extends keyof ObjectType ? ObjectType[Property] : never;
|
|
2
|
+
export default NestedValueOf;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import AbstractIntlMessages from './AbstractIntlMessages';
|
|
2
|
-
import IntlError from './IntlError';
|
|
3
|
-
export default function validateMessages(messages: AbstractIntlMessages, onError: (error: IntlError) => void): void;
|
|
1
|
+
import AbstractIntlMessages from './AbstractIntlMessages';
|
|
2
|
+
import IntlError from './IntlError';
|
|
3
|
+
export default function validateMessages(messages: AbstractIntlMessages, onError: (error: IntlError) => void): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './core/index';
|
|
1
|
+
export * from './core/index';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './core';
|
|
2
|
-
export * from './react';
|
|
1
|
+
export * from './core';
|
|
2
|
+
export * from './react';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import MessageFormatCache from '../core/MessageFormatCache';
|
|
3
|
+
declare const IntlContext: import("react").Context<(import("../core/IntlConfig").default<import("../core/AbstractIntlMessages").default> & {
|
|
4
|
+
onError: (error: import("..").IntlError) => void;
|
|
5
|
+
getMessageFallback: (info: {
|
|
6
|
+
error: import("..").IntlError;
|
|
7
|
+
key: string;
|
|
8
|
+
namespace?: string | undefined;
|
|
9
|
+
}) => string;
|
|
10
|
+
} & {
|
|
11
|
+
messageFormatCache?: MessageFormatCache | undefined;
|
|
12
|
+
}) | undefined>;
|
|
13
|
+
export default IntlContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import IntlConfig from '../core/IntlConfig';
|
|
3
|
-
type Props = IntlConfig & {
|
|
4
|
-
children: ReactNode;
|
|
5
|
-
};
|
|
6
|
-
export default function IntlProvider({ children, ...config }: Props): JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import IntlConfig from '../core/IntlConfig';
|
|
3
|
+
type Props = IntlConfig & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export default function IntlProvider({ children, ...config }: Props): JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '../core/initializeConfig';
|
|
1
|
+
export { default } from '../core/initializeConfig';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { default as IntlProvider } from './IntlProvider';
|
|
2
|
-
export { default as useTranslations } from './useTranslations';
|
|
3
|
-
export { default as useLocale } from './useLocale';
|
|
4
|
-
export { default as useNow } from './useNow';
|
|
5
|
-
export { default as useTimeZone } from './useTimeZone';
|
|
6
|
-
export { default as useMessages } from './useMessages';
|
|
7
|
-
export { default as useFormatter } from './useFormatter';
|
|
8
|
-
export { default as useIntl } from './useIntl';
|
|
1
|
+
export { default as IntlProvider } from './IntlProvider';
|
|
2
|
+
export { default as useTranslations } from './useTranslations';
|
|
3
|
+
export { default as useLocale } from './useLocale';
|
|
4
|
+
export { default as useNow } from './useNow';
|
|
5
|
+
export { default as useTimeZone } from './useTimeZone';
|
|
6
|
+
export { default as useMessages } from './useMessages';
|
|
7
|
+
export { default as useFormatter } from './useFormatter';
|
|
8
|
+
export { default as useIntl } from './useIntl';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export default function useFormatter(): {
|
|
2
|
-
dateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
3
|
-
number: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
4
|
-
relativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
5
|
-
list: (value: Iterable<string>, formatOrOptions?: string | Intl.ListFormatOptions | undefined) => string;
|
|
6
|
-
};
|
|
1
|
+
export default function useFormatter(): {
|
|
2
|
+
dateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
3
|
+
number: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
4
|
+
relativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
5
|
+
list: (value: Iterable<string>, formatOrOptions?: string | Intl.ListFormatOptions | undefined) => string;
|
|
6
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** @deprecated Switch to `useFormatter` instead. */
|
|
2
|
-
export default function useIntl(): {
|
|
3
|
-
formatDateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
4
|
-
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
5
|
-
formatRelativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
6
|
-
};
|
|
1
|
+
/** @deprecated Switch to `useFormatter` instead. */
|
|
2
|
+
export default function useIntl(): {
|
|
3
|
+
formatDateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
|
|
4
|
+
formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
|
|
5
|
+
formatRelativeTime: (date: number | Date, now?: number | Date | undefined) => string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export default function useIntlContext(): import("../core/IntlConfig").default<import("../core/AbstractIntlMessages").default> & {
|
|
2
|
+
onError: (error: import("..").IntlError) => void;
|
|
3
|
+
getMessageFallback: (info: {
|
|
4
|
+
error: import("..").IntlError;
|
|
5
|
+
key: string;
|
|
6
|
+
namespace?: string | undefined;
|
|
7
|
+
}) => string;
|
|
8
|
+
} & {
|
|
9
|
+
messageFormatCache?: import("../core/MessageFormatCache").default | undefined;
|
|
10
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useLocale(): string;
|
|
1
|
+
export default function useLocale(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useMessages(): import("../core/AbstractIntlMessages").default | undefined;
|
|
1
|
+
export default function useMessages(): import("../core/AbstractIntlMessages").default | undefined;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
type Options = {
|
|
2
|
-
updateInterval?: number;
|
|
3
|
-
};
|
|
4
|
-
/**
|
|
5
|
-
* Reading the current date via `new Date()` in components should be avoided, as
|
|
6
|
-
* it causes components to be impure and can lead to flaky tests. Instead, this
|
|
7
|
-
* hook can be used.
|
|
8
|
-
*
|
|
9
|
-
* By default, it returns the time when the component mounts. If `updateInterval`
|
|
10
|
-
* is specified, the value will be updated based on the interval.
|
|
11
|
-
*
|
|
12
|
-
* You can however also return a static value from this hook, if you
|
|
13
|
-
* configure the `now` parameter on the context provider. Note however,
|
|
14
|
-
* that if `updateInterval` is configured in this case, the component
|
|
15
|
-
* will initialize with the global value, but will afterwards update
|
|
16
|
-
* continuously based on the interval.
|
|
17
|
-
*
|
|
18
|
-
* For unit tests, this can be mocked to a constant value. For end-to-end
|
|
19
|
-
* testing, an environment parameter can be passed to the `now` parameter
|
|
20
|
-
* of the provider to mock this to a static value.
|
|
21
|
-
*/
|
|
22
|
-
export default function useNow(options?: Options): Date;
|
|
23
|
-
export {};
|
|
1
|
+
type Options = {
|
|
2
|
+
updateInterval?: number;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Reading the current date via `new Date()` in components should be avoided, as
|
|
6
|
+
* it causes components to be impure and can lead to flaky tests. Instead, this
|
|
7
|
+
* hook can be used.
|
|
8
|
+
*
|
|
9
|
+
* By default, it returns the time when the component mounts. If `updateInterval`
|
|
10
|
+
* is specified, the value will be updated based on the interval.
|
|
11
|
+
*
|
|
12
|
+
* You can however also return a static value from this hook, if you
|
|
13
|
+
* configure the `now` parameter on the context provider. Note however,
|
|
14
|
+
* that if `updateInterval` is configured in this case, the component
|
|
15
|
+
* will initialize with the global value, but will afterwards update
|
|
16
|
+
* continuously based on the interval.
|
|
17
|
+
*
|
|
18
|
+
* For unit tests, this can be mocked to a constant value. For end-to-end
|
|
19
|
+
* testing, an environment parameter can be passed to the `now` parameter
|
|
20
|
+
* of the provider to mock this to a static value.
|
|
21
|
+
*/
|
|
22
|
+
export default function useNow(options?: Options): Date;
|
|
23
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useTimeZone(): import("../core/TimeZone").default | undefined;
|
|
1
|
+
export default function useTimeZone(): import("../core/TimeZone").default | undefined;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { ReactElement, ReactNodeArray } from 'react';
|
|
2
|
-
import Formats from '../core/Formats';
|
|
3
|
-
import TranslationValues, { RichTranslationValues } from '../core/TranslationValues';
|
|
4
|
-
import MessageKeys from '../core/utils/MessageKeys';
|
|
5
|
-
import NamespaceKeys from '../core/utils/NamespaceKeys';
|
|
6
|
-
import NestedKeyOf from '../core/utils/NestedKeyOf';
|
|
7
|
-
import NestedValueOf from '../core/utils/NestedValueOf';
|
|
8
|
-
/**
|
|
9
|
-
* Translates messages from the given namespace by using the ICU syntax.
|
|
10
|
-
* See https://formatjs.io/docs/core-concepts/icu-syntax.
|
|
11
|
-
*
|
|
12
|
-
* If no namespace is provided, all available messages are returned.
|
|
13
|
-
* The namespace can also indicate nesting by using a dot
|
|
14
|
-
* (e.g. `namespace.Component`).
|
|
15
|
-
*/
|
|
16
|
-
export default function useTranslations<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>(namespace?: NestedKey): {
|
|
17
|
-
<TargetKey extends MessageKeys<NestedValueOf<{
|
|
18
|
-
'!': IntlMessages;
|
|
19
|
-
}, [
|
|
20
|
-
NestedKey
|
|
21
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
22
|
-
'!': IntlMessages;
|
|
23
|
-
}, [
|
|
24
|
-
NestedKey
|
|
25
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
|
|
26
|
-
rich<TargetKey extends MessageKeys<NestedValueOf<{
|
|
27
|
-
'!': IntlMessages;
|
|
28
|
-
}, [
|
|
29
|
-
NestedKey
|
|
30
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
31
|
-
'!': IntlMessages;
|
|
32
|
-
}, [
|
|
33
|
-
NestedKey
|
|
34
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValues, formats?: Partial<Formats>): string | ReactElement | ReactNodeArray;
|
|
35
|
-
raw<TargetKey extends MessageKeys<NestedValueOf<{
|
|
36
|
-
'!': IntlMessages;
|
|
37
|
-
}, [
|
|
38
|
-
NestedKey
|
|
39
|
-
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
40
|
-
'!': IntlMessages;
|
|
41
|
-
}, [
|
|
42
|
-
NestedKey
|
|
43
|
-
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
|
|
44
|
-
};
|
|
1
|
+
import { ReactElement, ReactNodeArray } from 'react';
|
|
2
|
+
import Formats from '../core/Formats';
|
|
3
|
+
import TranslationValues, { RichTranslationValues } from '../core/TranslationValues';
|
|
4
|
+
import MessageKeys from '../core/utils/MessageKeys';
|
|
5
|
+
import NamespaceKeys from '../core/utils/NamespaceKeys';
|
|
6
|
+
import NestedKeyOf from '../core/utils/NestedKeyOf';
|
|
7
|
+
import NestedValueOf from '../core/utils/NestedValueOf';
|
|
8
|
+
/**
|
|
9
|
+
* Translates messages from the given namespace by using the ICU syntax.
|
|
10
|
+
* See https://formatjs.io/docs/core-concepts/icu-syntax.
|
|
11
|
+
*
|
|
12
|
+
* If no namespace is provided, all available messages are returned.
|
|
13
|
+
* The namespace can also indicate nesting by using a dot
|
|
14
|
+
* (e.g. `namespace.Component`).
|
|
15
|
+
*/
|
|
16
|
+
export default function useTranslations<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>(namespace?: NestedKey): {
|
|
17
|
+
<TargetKey extends MessageKeys<NestedValueOf<{
|
|
18
|
+
'!': IntlMessages;
|
|
19
|
+
}, [
|
|
20
|
+
NestedKey
|
|
21
|
+
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
22
|
+
'!': IntlMessages;
|
|
23
|
+
}, [
|
|
24
|
+
NestedKey
|
|
25
|
+
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: TranslationValues, formats?: Partial<Formats>): string;
|
|
26
|
+
rich<TargetKey extends MessageKeys<NestedValueOf<{
|
|
27
|
+
'!': IntlMessages;
|
|
28
|
+
}, [
|
|
29
|
+
NestedKey
|
|
30
|
+
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
31
|
+
'!': IntlMessages;
|
|
32
|
+
}, [
|
|
33
|
+
NestedKey
|
|
34
|
+
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValues, formats?: Partial<Formats>): string | ReactElement | ReactNodeArray;
|
|
35
|
+
raw<TargetKey extends MessageKeys<NestedValueOf<{
|
|
36
|
+
'!': IntlMessages;
|
|
37
|
+
}, [
|
|
38
|
+
NestedKey
|
|
39
|
+
] extends [never] ? '!' : `!.${NestedKey}`>, NestedKeyOf<NestedValueOf<{
|
|
40
|
+
'!': IntlMessages;
|
|
41
|
+
}, [
|
|
42
|
+
NestedKey
|
|
43
|
+
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey): any;
|
|
44
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import AbstractIntlMessages from '../core/AbstractIntlMessages';
|
|
3
|
-
import NestedKeyOf from '../core/utils/NestedKeyOf';
|
|
4
|
-
export default function useTranslationsImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>(allMessages: Messages, namespace: NestedKey, namespacePrefix: string): {
|
|
5
|
-
<TargetKey extends unknown>(key: TargetKey, values?: import("../core/TranslationValues").default | undefined, formats?: Partial<import("../core/Formats").default> | undefined): string;
|
|
6
|
-
rich: (key: string, values?: import("..").RichTranslationValues | undefined, formats?: Partial<import("../core/Formats").default> | undefined) => string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray;
|
|
7
|
-
raw(key: string): any;
|
|
8
|
-
};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import AbstractIntlMessages from '../core/AbstractIntlMessages';
|
|
3
|
+
import NestedKeyOf from '../core/utils/NestedKeyOf';
|
|
4
|
+
export default function useTranslationsImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>(allMessages: Messages, namespace: NestedKey, namespacePrefix: string): {
|
|
5
|
+
<TargetKey extends unknown>(key: TargetKey, values?: import("../core/TranslationValues").default | undefined, formats?: Partial<import("../core/Formats").default> | undefined): string;
|
|
6
|
+
rich: (key: string, values?: import("..").RichTranslationValues | undefined, formats?: Partial<import("../core/Formats").default> | undefined) => string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray;
|
|
7
|
+
raw(key: string): any;
|
|
8
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './react/index';
|
|
1
|
+
export * from './react/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-intl",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.3",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"description": "Minimal, but complete solution for managing internationalization in React apps.",
|
|
@@ -10,18 +10,37 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/amannn/next-intl/tree/main/packages/use-intl"
|
|
12
12
|
},
|
|
13
|
-
"main": "dist/index.js",
|
|
14
|
-
"module": "dist/
|
|
15
|
-
"typings": "dist/index.d.ts",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"module": "dist/esm/index.js",
|
|
15
|
+
"typings": "./dist/types/src/index.d.ts",
|
|
16
16
|
"exports": {
|
|
17
|
-
".":
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/types/src/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./core": {
|
|
22
|
+
"types": "./core.d.ts",
|
|
23
|
+
"default": "./dist/core.js"
|
|
24
|
+
},
|
|
25
|
+
"./react": {
|
|
26
|
+
"types": "./react.d.ts",
|
|
27
|
+
"default": "./dist/react.js"
|
|
28
|
+
},
|
|
29
|
+
"./_useLocale": {
|
|
30
|
+
"types": "./_useLocale.d.ts",
|
|
31
|
+
"default": "./dist/_useLocale.js"
|
|
32
|
+
},
|
|
33
|
+
"./_IntlProvider": {
|
|
34
|
+
"types": "./_IntlProvider.d.ts",
|
|
35
|
+
"default": "./dist/_IntlProvider.js"
|
|
36
|
+
}
|
|
20
37
|
},
|
|
21
38
|
"files": [
|
|
22
39
|
"dist",
|
|
23
40
|
"core.d.ts",
|
|
24
|
-
"react.d.ts"
|
|
41
|
+
"react.d.ts",
|
|
42
|
+
"_useLocale.d.ts",
|
|
43
|
+
"_IntlProvider.d.ts"
|
|
25
44
|
],
|
|
26
45
|
"keywords": [
|
|
27
46
|
"react",
|
|
@@ -47,30 +66,23 @@
|
|
|
47
66
|
"@types/node": "^17.0.23",
|
|
48
67
|
"@types/react": "^18.2.5",
|
|
49
68
|
"date-fns": "^2.16.1",
|
|
50
|
-
"
|
|
51
|
-
"eslint": "
|
|
52
|
-
"eslint-config-molindo": "^6.0.0",
|
|
69
|
+
"eslint": "^8.46.0",
|
|
70
|
+
"eslint-config-molindo": "7.0.0-alpha.7",
|
|
53
71
|
"react": "^18.2.0",
|
|
54
72
|
"react-dom": "^18.2.0",
|
|
73
|
+
"rollup": "^3.28.1",
|
|
55
74
|
"size-limit": "^8.2.6",
|
|
56
75
|
"typescript": "^5.0.0",
|
|
57
76
|
"vitest": "^0.32.2"
|
|
58
77
|
},
|
|
59
78
|
"size-limit": [
|
|
60
79
|
{
|
|
61
|
-
"path": "dist/
|
|
62
|
-
"limit": "
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"path": "dist/use-intl.cjs.development.js",
|
|
66
|
-
"limit": "10.30 kB"
|
|
80
|
+
"path": "dist/production/index.js",
|
|
81
|
+
"limit": "12.25 kB"
|
|
67
82
|
}
|
|
68
83
|
],
|
|
69
|
-
"engines": {
|
|
70
|
-
"node": ">=10"
|
|
71
|
-
},
|
|
72
84
|
"scripts": {
|
|
73
|
-
"build": "
|
|
85
|
+
"build": "rm -rf dist && rollup -c",
|
|
74
86
|
"test": "TZ=Europe/Berlin vitest",
|
|
75
87
|
"lint": "eslint src test && tsc --noEmit",
|
|
76
88
|
"size": "size-limit"
|
package/react.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './dist/react';
|
|
1
|
+
export * from './dist/types/src/react';
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
function _extends() {
|
|
2
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
3
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
4
|
-
var source = arguments[i];
|
|
5
|
-
for (var key in source) {
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7
|
-
target[key] = source[key];
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
return _extends.apply(this, arguments);
|
|
14
|
-
}
|
|
15
|
-
function _inheritsLoose(subClass, superClass) {
|
|
16
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
17
|
-
subClass.prototype.constructor = subClass;
|
|
18
|
-
_setPrototypeOf(subClass, superClass);
|
|
19
|
-
}
|
|
20
|
-
function _getPrototypeOf(o) {
|
|
21
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
22
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
23
|
-
};
|
|
24
|
-
return _getPrototypeOf(o);
|
|
25
|
-
}
|
|
26
|
-
function _setPrototypeOf(o, p) {
|
|
27
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
28
|
-
o.__proto__ = p;
|
|
29
|
-
return o;
|
|
30
|
-
};
|
|
31
|
-
return _setPrototypeOf(o, p);
|
|
32
|
-
}
|
|
33
|
-
function _isNativeReflectConstruct() {
|
|
34
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
35
|
-
if (Reflect.construct.sham) return false;
|
|
36
|
-
if (typeof Proxy === "function") return true;
|
|
37
|
-
try {
|
|
38
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
39
|
-
return true;
|
|
40
|
-
} catch (e) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function _construct(Parent, args, Class) {
|
|
45
|
-
if (_isNativeReflectConstruct()) {
|
|
46
|
-
_construct = Reflect.construct.bind();
|
|
47
|
-
} else {
|
|
48
|
-
_construct = function _construct(Parent, args, Class) {
|
|
49
|
-
var a = [null];
|
|
50
|
-
a.push.apply(a, args);
|
|
51
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
52
|
-
var instance = new Constructor();
|
|
53
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
54
|
-
return instance;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return _construct.apply(null, arguments);
|
|
58
|
-
}
|
|
59
|
-
function _isNativeFunction(fn) {
|
|
60
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
61
|
-
}
|
|
62
|
-
function _wrapNativeSuper(Class) {
|
|
63
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
64
|
-
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
65
|
-
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
66
|
-
if (typeof Class !== "function") {
|
|
67
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
68
|
-
}
|
|
69
|
-
if (typeof _cache !== "undefined") {
|
|
70
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
71
|
-
_cache.set(Class, Wrapper);
|
|
72
|
-
}
|
|
73
|
-
function Wrapper() {
|
|
74
|
-
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
75
|
-
}
|
|
76
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
77
|
-
constructor: {
|
|
78
|
-
value: Wrapper,
|
|
79
|
-
enumerable: false,
|
|
80
|
-
writable: true,
|
|
81
|
-
configurable: true
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
return _setPrototypeOf(Wrapper, Class);
|
|
85
|
-
};
|
|
86
|
-
return _wrapNativeSuper(Class);
|
|
87
|
-
}
|
|
88
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
89
|
-
if (source == null) return {};
|
|
90
|
-
var target = {};
|
|
91
|
-
var sourceKeys = Object.keys(source);
|
|
92
|
-
var key, i;
|
|
93
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
94
|
-
key = sourceKeys[i];
|
|
95
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
96
|
-
target[key] = source[key];
|
|
97
|
-
}
|
|
98
|
-
return target;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export { _construct as construct, _extends as extends, _getPrototypeOf as getPrototypeOf, _inheritsLoose as inheritsLoose, _isNativeFunction as isNativeFunction, _isNativeReflectConstruct as isNativeReflectConstruct, _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose, _setPrototypeOf as setPrototypeOf, _wrapNativeSuper as wrapNativeSuper };
|
|
102
|
-
//# sourceMappingURL=_rollupPluginBabelHelpers.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
function _extends() {
|
|
2
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
3
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
4
|
-
var source = arguments[i];
|
|
5
|
-
for (var key in source) {
|
|
6
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7
|
-
target[key] = source[key];
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return target;
|
|
12
|
-
};
|
|
13
|
-
return _extends.apply(this, arguments);
|
|
14
|
-
}
|
|
15
|
-
function _inheritsLoose(subClass, superClass) {
|
|
16
|
-
subClass.prototype = Object.create(superClass.prototype);
|
|
17
|
-
subClass.prototype.constructor = subClass;
|
|
18
|
-
_setPrototypeOf(subClass, superClass);
|
|
19
|
-
}
|
|
20
|
-
function _getPrototypeOf(o) {
|
|
21
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
22
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
23
|
-
};
|
|
24
|
-
return _getPrototypeOf(o);
|
|
25
|
-
}
|
|
26
|
-
function _setPrototypeOf(o, p) {
|
|
27
|
-
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
28
|
-
o.__proto__ = p;
|
|
29
|
-
return o;
|
|
30
|
-
};
|
|
31
|
-
return _setPrototypeOf(o, p);
|
|
32
|
-
}
|
|
33
|
-
function _isNativeReflectConstruct() {
|
|
34
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
35
|
-
if (Reflect.construct.sham) return false;
|
|
36
|
-
if (typeof Proxy === "function") return true;
|
|
37
|
-
try {
|
|
38
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
39
|
-
return true;
|
|
40
|
-
} catch (e) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function _construct(Parent, args, Class) {
|
|
45
|
-
if (_isNativeReflectConstruct()) {
|
|
46
|
-
_construct = Reflect.construct.bind();
|
|
47
|
-
} else {
|
|
48
|
-
_construct = function _construct(Parent, args, Class) {
|
|
49
|
-
var a = [null];
|
|
50
|
-
a.push.apply(a, args);
|
|
51
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
52
|
-
var instance = new Constructor();
|
|
53
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
54
|
-
return instance;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return _construct.apply(null, arguments);
|
|
58
|
-
}
|
|
59
|
-
function _isNativeFunction(fn) {
|
|
60
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
61
|
-
}
|
|
62
|
-
function _wrapNativeSuper(Class) {
|
|
63
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
64
|
-
_wrapNativeSuper = function _wrapNativeSuper(Class) {
|
|
65
|
-
if (Class === null || !_isNativeFunction(Class)) return Class;
|
|
66
|
-
if (typeof Class !== "function") {
|
|
67
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
68
|
-
}
|
|
69
|
-
if (typeof _cache !== "undefined") {
|
|
70
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
71
|
-
_cache.set(Class, Wrapper);
|
|
72
|
-
}
|
|
73
|
-
function Wrapper() {
|
|
74
|
-
return _construct(Class, arguments, _getPrototypeOf(this).constructor);
|
|
75
|
-
}
|
|
76
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
77
|
-
constructor: {
|
|
78
|
-
value: Wrapper,
|
|
79
|
-
enumerable: false,
|
|
80
|
-
writable: true,
|
|
81
|
-
configurable: true
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
return _setPrototypeOf(Wrapper, Class);
|
|
85
|
-
};
|
|
86
|
-
return _wrapNativeSuper(Class);
|
|
87
|
-
}
|
|
88
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
89
|
-
if (source == null) return {};
|
|
90
|
-
var target = {};
|
|
91
|
-
var sourceKeys = Object.keys(source);
|
|
92
|
-
var key, i;
|
|
93
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
94
|
-
key = sourceKeys[i];
|
|
95
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
96
|
-
target[key] = source[key];
|
|
97
|
-
}
|
|
98
|
-
return target;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export { _construct as construct, _extends as extends, _getPrototypeOf as getPrototypeOf, _inheritsLoose as inheritsLoose, _isNativeFunction as isNativeFunction, _isNativeReflectConstruct as isNativeReflectConstruct, _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose, _setPrototypeOf as setPrototypeOf, _wrapNativeSuper as wrapNativeSuper };
|
|
102
|
-
//# sourceMappingURL=use-intl.esm.js.map
|