intor 1.0.31 → 1.0.33

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.
@@ -770,11 +770,13 @@ var Link = (_a) => {
770
770
  var _b = _a, {
771
771
  href,
772
772
  locale,
773
- children
773
+ children,
774
+ onClick
774
775
  } = _b, props = __objRest(_b, [
775
776
  "href",
776
777
  "locale",
777
- "children"
778
+ "children",
779
+ "onClick"
778
780
  ]);
779
781
  const { config } = useIntorConfig();
780
782
  const { locale: currentLocale, setLocale } = useIntorLocale();
@@ -787,12 +789,7 @@ var Link = (_a) => {
787
789
  });
788
790
  href = localePrefixedPathname;
789
791
  const handleClick = (e) => {
790
- if (props.onClick) {
791
- props.onClick(e);
792
- }
793
- if (e.defaultPrevented) {
794
- return;
795
- }
792
+ onClick == null ? void 0 : onClick(e);
796
793
  if (shouldUseFullReload(config.loaderOptions)) {
797
794
  setLocaleCookieClient({ cookie: config.cookie, locale: targetLocale });
798
795
  window.location.href = href;
@@ -181,7 +181,8 @@ type LinkProps = {
181
181
  href?: string;
182
182
  locale?: string;
183
183
  children: React.ReactNode;
184
- } & Omit<LinkProps$1, "href" | "locale" | "children"> & React.AnchorHTMLAttributes<HTMLAnchorElement>;
184
+ onClick?: React.AnchorHTMLAttributes<HTMLAnchorElement>["onClick"];
185
+ } & Omit<LinkProps$1, "href" | "locale" | "children"> & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "onClick">;
185
186
  /**
186
187
  * Localized Link component wrapping Next.js Link.
187
188
  *
@@ -195,7 +196,7 @@ type LinkProps = {
195
196
  * @param {LinkProps} props - Props including href, optional locale, children and other anchor/link attributes.
196
197
  * @returns {JSX.Element} A localized link component.
197
198
  */
198
- declare const Link: ({ href, locale, children, ...props }: LinkProps) => React.JSX.Element;
199
+ declare const Link: ({ href, locale, children, onClick, ...props }: LinkProps) => React.JSX.Element;
199
200
 
200
201
  /**
201
202
  * Custom hook to get the localized pathname.
@@ -181,7 +181,8 @@ type LinkProps = {
181
181
  href?: string;
182
182
  locale?: string;
183
183
  children: React.ReactNode;
184
- } & Omit<LinkProps$1, "href" | "locale" | "children"> & React.AnchorHTMLAttributes<HTMLAnchorElement>;
184
+ onClick?: React.AnchorHTMLAttributes<HTMLAnchorElement>["onClick"];
185
+ } & Omit<LinkProps$1, "href" | "locale" | "children"> & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "onClick">;
185
186
  /**
186
187
  * Localized Link component wrapping Next.js Link.
187
188
  *
@@ -195,7 +196,7 @@ type LinkProps = {
195
196
  * @param {LinkProps} props - Props including href, optional locale, children and other anchor/link attributes.
196
197
  * @returns {JSX.Element} A localized link component.
197
198
  */
198
- declare const Link: ({ href, locale, children, ...props }: LinkProps) => React.JSX.Element;
199
+ declare const Link: ({ href, locale, children, onClick, ...props }: LinkProps) => React.JSX.Element;
199
200
 
200
201
  /**
201
202
  * Custom hook to get the localized pathname.
@@ -745,11 +745,13 @@ var Link = (_a) => {
745
745
  var _b = _a, {
746
746
  href,
747
747
  locale,
748
- children
748
+ children,
749
+ onClick
749
750
  } = _b, props = __objRest(_b, [
750
751
  "href",
751
752
  "locale",
752
- "children"
753
+ "children",
754
+ "onClick"
753
755
  ]);
754
756
  const { config } = useIntorConfig();
755
757
  const { locale: currentLocale, setLocale } = useIntorLocale();
@@ -762,12 +764,7 @@ var Link = (_a) => {
762
764
  });
763
765
  href = localePrefixedPathname;
764
766
  const handleClick = (e) => {
765
- if (props.onClick) {
766
- props.onClick(e);
767
- }
768
- if (e.defaultPrevented) {
769
- return;
770
- }
767
+ onClick == null ? void 0 : onClick(e);
771
768
  if (shouldUseFullReload(config.loaderOptions)) {
772
769
  setLocaleCookieClient({ cookie: config.cookie, locale: targetLocale });
773
770
  window.location.href = href;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intor",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "A modular and extensible i18n core designed for TypeScript and JavaScript projects. Intor enables custom translation logic with support for both frontend and backend environments, featuring runtime configuration, caching, adapters, and message loaders.",
5
5
  "author": "Yiming Liao",
6
6
  "license": "MIT",