@panneau/intl 4.0.41 → 4.0.45

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/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
+ import { IntlConfig } from 'react-intl';
3
4
  import { Resource, ResourceValues } from '@panneau/core';
4
5
 
5
6
  declare class IntlManager {
@@ -10,14 +11,14 @@ declare class IntlManager {
10
11
  getMessages(locale: any): any;
11
12
  }
12
13
 
13
- interface IntlProviderProps {
14
+ interface IntlProviderProps extends Omit<IntlConfig, 'locale' | 'messages'> {
14
15
  intlManager?: IntlManager;
15
16
  locale?: string | null;
16
17
  locales?: string[] | null;
17
18
  extraMessages?: Record<string, string> | null;
18
19
  children?: ReactNode;
19
20
  }
20
- declare function IntlProvider({ intlManager, locale, locales, children, extraMessages, }: IntlProviderProps): react_jsx_runtime.JSX.Element;
21
+ declare function IntlProvider({ intlManager, locale, locales, children, extraMessages, ...props }: IntlProviderProps): react_jsx_runtime.JSX.Element;
21
22
 
22
23
  interface ResourceIntlConfig {
23
24
  values?: Record<string, unknown>;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { c } from 'react/compiler-runtime';
2
- import { useContext } from 'react';
2
+ import { use } from 'react';
3
3
  import { IntlContext, IntlProvider as IntlProvider$1, useIntl, FormattedMessage } from 'react-intl';
4
4
  import { useLocales, LocalesProvider, useResource } from '@panneau/core/contexts';
5
5
  import { jsx } from 'react/jsx-runtime';
@@ -35,14 +35,37 @@ class IntlManager {
35
35
  const intlManager = new IntlManager();
36
36
 
37
37
  function IntlProvider(t0) {
38
- const $ = c(14);
39
- const {
40
- intlManager: t1,
41
- locale: t2,
42
- locales: t3,
43
- children: t4,
44
- extraMessages: t5
45
- } = t0;
38
+ const $ = c(22);
39
+ let props;
40
+ let t1;
41
+ let t2;
42
+ let t3;
43
+ let t4;
44
+ let t5;
45
+ if ($[0] !== t0) {
46
+ ({
47
+ intlManager: t1,
48
+ locale: t2,
49
+ locales: t3,
50
+ children: t4,
51
+ extraMessages: t5,
52
+ ...props
53
+ } = t0);
54
+ $[0] = t0;
55
+ $[1] = props;
56
+ $[2] = t1;
57
+ $[3] = t2;
58
+ $[4] = t3;
59
+ $[5] = t4;
60
+ $[6] = t5;
61
+ } else {
62
+ props = $[1];
63
+ t1 = $[2];
64
+ t2 = $[3];
65
+ t3 = $[4];
66
+ t4 = $[5];
67
+ t5 = $[6];
68
+ }
46
69
  const intlManager$1 = t1 === undefined ? intlManager : t1;
47
70
  const locale = t2 === undefined ? null : t2;
48
71
  const locales = t3 === undefined ? null : t3;
@@ -52,63 +75,66 @@ function IntlProvider(t0) {
52
75
  const {
53
76
  locale: t6,
54
77
  messages: t7
55
- } = useContext(IntlContext) || {};
78
+ } = use(IntlContext) || {};
56
79
  const previousLocale = t6 === undefined ? null : t6;
57
80
  const previousMessages = t7 === undefined ? null : t7;
58
81
  let t8;
59
- if ($[0] !== intlManager$1 || $[1] !== locale) {
82
+ if ($[7] !== intlManager$1 || $[8] !== locale) {
60
83
  t8 = intlManager$1 !== null ? intlManager$1.getMessages(locale) : null;
61
- $[0] = intlManager$1;
62
- $[1] = locale;
63
- $[2] = t8;
84
+ $[7] = intlManager$1;
85
+ $[8] = locale;
86
+ $[9] = t8;
64
87
  } else {
65
- t8 = $[2];
88
+ t8 = $[9];
66
89
  }
67
90
  const managerMessages = t8;
68
- const t9 = previousLocale === locale ? previousMessages : null;
91
+ const t9 = previousLocale === locale || locale === null ? previousMessages : null;
69
92
  let t10;
70
- if ($[3] !== extraMessages || $[4] !== managerMessages || $[5] !== t9) {
93
+ if ($[10] !== extraMessages || $[11] !== managerMessages || $[12] !== t9) {
71
94
  t10 = {
72
95
  ...t9,
73
96
  ...managerMessages,
74
97
  ...extraMessages
75
98
  };
76
- $[3] = extraMessages;
77
- $[4] = managerMessages;
78
- $[5] = t9;
79
- $[6] = t10;
99
+ $[10] = extraMessages;
100
+ $[11] = managerMessages;
101
+ $[12] = t9;
102
+ $[13] = t10;
80
103
  } else {
81
- t10 = $[6];
104
+ t10 = $[13];
82
105
  }
83
106
  const messages = t10;
84
- const t11 = locales || previousLocales;
85
- let t12;
86
- if ($[7] !== children || $[8] !== t11) {
87
- t12 = /*#__PURE__*/jsx(LocalesProvider, {
88
- locales: t11,
107
+ const t11 = locale || previousLocale;
108
+ const t12 = locales || previousLocales;
109
+ let t13;
110
+ if ($[14] !== children || $[15] !== t12) {
111
+ t13 = /*#__PURE__*/jsx(LocalesProvider, {
112
+ locales: t12,
89
113
  children: children
90
114
  });
91
- $[7] = children;
92
- $[8] = t11;
93
- $[9] = t12;
115
+ $[14] = children;
116
+ $[15] = t12;
117
+ $[16] = t13;
94
118
  } else {
95
- t12 = $[9];
119
+ t13 = $[16];
96
120
  }
97
- let t13;
98
- if ($[10] !== locale || $[11] !== messages || $[12] !== t12) {
99
- t13 = /*#__PURE__*/jsx(IntlProvider$1, {
100
- locale: locale,
121
+ let t14;
122
+ if ($[17] !== messages || $[18] !== props || $[19] !== t11 || $[20] !== t13) {
123
+ t14 = /*#__PURE__*/jsx(IntlProvider$1, {
124
+ locale: t11,
101
125
  messages: messages,
102
- children: t12
126
+ ...props,
127
+ children: t13
103
128
  });
104
- $[10] = locale;
105
- $[11] = messages;
106
- $[12] = t12;
107
- $[13] = t13;
129
+ $[17] = messages;
130
+ $[18] = props;
131
+ $[19] = t11;
132
+ $[20] = t13;
133
+ $[21] = t14;
108
134
  } else {
109
- t13 = $[13];
135
+ t14 = $[21];
110
136
  }
111
- return t13;
137
+ return t14;
112
138
  }
113
139
 
114
140
  function ResourceMessage(t0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@panneau/intl",
3
- "version": "4.0.41",
3
+ "version": "4.0.45",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "javascript"
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "a61617e40bef47e494f069697896191ce578a909"
85
+ "gitHead": "33c9c717de67f2a018289e91ea16daa2d5925cd2"
86
86
  }