vue-i18n-routing
Advanced tools
Comparing version 0.10.3 to 0.11.0-263c65a
@@ -21,2 +21,5 @@ import type { Composer } from '@intlify/vue-i18n-bridge'; | ||
/** | ||
* @public | ||
*/ | ||
export declare type BaseUrlResolveHandler<Context = unknown> = (context: Context) => string; | ||
@@ -57,5 +60,17 @@ | ||
/** | ||
* @public | ||
*/ | ||
export declare interface ComposableOptions { | ||
/** | ||
* vue-router route instance, which is returned with `useRoute`. | ||
*/ | ||
route?: ReturnType<typeof useRoute>; | ||
/** | ||
* vue-router router instance, which is returned with `useRouter`. | ||
*/ | ||
router?: ReturnType<typeof useRouter>; | ||
/** | ||
* vue-i18n Composer instance. | ||
*/ | ||
i18n?: Composer; | ||
@@ -69,2 +84,4 @@ } | ||
* The route options that is compute the route to be localized on {@link localizeRoutes} | ||
* | ||
* @public | ||
*/ | ||
@@ -86,3 +103,3 @@ export declare interface ComputedRouteOptions { | ||
* | ||
* @remakrs | ||
* @remarks | ||
* You can create a vue router instance to be used by the Vue app. | ||
@@ -98,16 +115,24 @@ * | ||
/** @internal */ | ||
export declare const DEFAULT_BASE_URL = ""; | ||
/** @internal */ | ||
export declare const DEFAULT_DETECTION_DIRECTION = "ltr"; | ||
/** @internal */ | ||
export declare const DEFAULT_DYNAMIC_PARAMS_KEY = ""; | ||
/** @internal */ | ||
export declare const DEFAULT_LOCALE = ""; | ||
/** @internal */ | ||
export declare const DEFAULT_LOCALE_ROUTE_NAME_SUFFIX = "default"; | ||
/** @internal */ | ||
export declare const DEFAULT_ROUTES_NAME_SEPARATOR = "___"; | ||
/** @internal */ | ||
export declare const DEFAULT_STRATEGY: "prefix_except_default"; | ||
/** @internal */ | ||
export declare const DEFAULT_TRAILING_SLASH = false; | ||
@@ -123,2 +148,4 @@ | ||
* Direction | ||
* | ||
* @public | ||
*/ | ||
@@ -190,10 +217,31 @@ export declare type Directions = 'ltr' | 'rtl' | 'auto'; | ||
/** | ||
* Returns base name of current (if argument not provided) or passed in route. | ||
* | ||
* @remarks | ||
* Base name is name of the route without locale suffix and other metadata added by nuxt i18n module | ||
* @param this - A {@link RoutingProxy} instance. | ||
* @param givenRoute - A route. | ||
* | ||
* @returns The route base name. if cannot get, `undefined` is returned. | ||
* | ||
* @public | ||
*/ | ||
export declare function getRouteBaseName(this: RoutingProxy, givenRoute?: Route | RouteLocationNormalizedLoaded): string | undefined; | ||
/** | ||
* @public | ||
*/ | ||
export declare type I18nCommonRoutingOptions = Pick<I18nRoutingOptions, 'defaultLocale' | 'strategy' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'locales' | 'routesNameSeparator'>; | ||
/** | ||
* @public | ||
*/ | ||
export declare type I18nCommonRoutingOptionsWithComposable = I18nCommonRoutingOptions & ComposableOptions; | ||
/** | ||
* I18n header meta info | ||
* I18n header meta info. | ||
* | ||
* @public | ||
*/ | ||
@@ -207,3 +255,5 @@ export declare interface I18nHeadMetaInfo { | ||
/** | ||
* Options for {@link localeHead} function | ||
* Options for {@link localeHead} function. | ||
* | ||
* @public | ||
*/ | ||
@@ -233,2 +283,4 @@ export declare interface I18nHeadOptions { | ||
* Route config for vue-i18n-routing | ||
* | ||
* @public | ||
*/ | ||
@@ -251,2 +303,4 @@ export declare type I18nRoute = Route_2 & RouteLegacy & { | ||
* This options is extended from Vue Router `RouterOptioins`, so you can specify those options. | ||
* | ||
* @public | ||
*/ | ||
@@ -381,15 +435,44 @@ export declare type I18nRoutingOptions<Context = unknown> = { | ||
/** | ||
* Returns localized head properties for locale-related aspects. | ||
* | ||
* @param this - A {@link RoutingProxy} instance. | ||
* @param options - An options, see about details {@link I18nHeadOptions}. | ||
* | ||
* @returns The localized {@link I18nHeadMetaInfo | head properties}. | ||
* | ||
* @public | ||
*/ | ||
export declare function localeHead(this: RoutingProxy, { addDirAttribute, addSeoAttributes, identifierAttribute }?: I18nHeadOptions): I18nHeadMetaInfo; | ||
/** | ||
* Returns localized location for passed in route parameters. | ||
* | ||
* @remarks | ||
* If `locale` is not specified, uses current locale. | ||
* | ||
* @param this - A {@link RoutingProxy} instance. | ||
* @param route - A route. | ||
* @param locale - A locale, optional. | ||
* | ||
* @returns A route location. if cannot resolve, `undefined` is returned. | ||
* | ||
* @public | ||
*/ | ||
export declare function localeLocation(this: RoutingProxy, route: RawLocation | RouteLocationRaw, locale?: Locale): Location | RouteLocation | undefined; | ||
/** | ||
* Resolve locale location function | ||
* The function that resolve locale location. | ||
* | ||
* @param route - A route location. The path or name of the route or an object for more complex routes | ||
* @param locale - A locale code, if not specified, uses the current locale | ||
* @remarks | ||
* The parameter sygnatures of this function is same as {@link localeLocation}. | ||
* | ||
* @returns Returns the location object for a given route, the location object is resolved by vue-router rather than just a full route path. | ||
* @param route - A route location. The path or name of the route or an object for more complex routes. | ||
* @param locale - A locale optional, if not specified, uses the current locale. | ||
* | ||
* @returns the location object for a given route, the location object is resolved by vue-router rather than just a full route path. | ||
* | ||
* @see {@link useLocaleLocation} | ||
* | ||
* @public | ||
*/ | ||
@@ -400,2 +483,4 @@ export declare type LocaleLocationFunction = (route: RawLocation | RouteLocationRaw, locale?: Locale) => Location | RouteLocation | undefined; | ||
* Locale object | ||
* | ||
* @public | ||
*/ | ||
@@ -412,27 +497,65 @@ export declare interface LocaleObject extends Record<string, any> { | ||
/** | ||
* Returns localized path for passed in route. | ||
* | ||
* @remarks | ||
* If locale is not specified, uses current locale. | ||
* | ||
* @param this - A {@link RoutingProxy} instance. | ||
* @param route - A route. | ||
* @param locale - A locale, optional. | ||
* | ||
* @returns A path of the current route. | ||
* | ||
* @public | ||
*/ | ||
export declare function localePath(this: RoutingProxy, route: RawLocation | RouteLocationRaw, locale?: Locale): string; | ||
/** | ||
* Resolve locale path function | ||
* The function that resolve locale path. | ||
* | ||
* @param route - A route location. The path or name of the route or an object for more complex routes | ||
* @param locale - A locale code, if not specified, uses the current locale | ||
* @remarks | ||
* The parameter sygnatures of this function is same as {@link localePath}. | ||
* | ||
* @returns Returns the localized URL for a given route | ||
* @param route - A route location. The path or name of the route or an object for more complex routes. | ||
* @param locale - A locale optional, if not specified, uses the current locale. | ||
* | ||
* @returns Returns the localized URL for a given route. | ||
* | ||
* @see {@link useLocalePath} | ||
* | ||
* @public | ||
*/ | ||
export declare type LocalePathFunction = (route: RawLocation | RouteLocation, locale?: Locale) => string; | ||
/** | ||
* Returns localized route for passed in `route` parameters. | ||
* | ||
* @remarks | ||
* If `locale` is not specified, uses current locale. | ||
* | ||
* @param this - A {@link RoutingProxy} instance. | ||
* @param route - A route. | ||
* @param locale - A locale, optional. | ||
* | ||
* @returns A route. if cannot resolve, `undefined` is returned. | ||
* | ||
* @public | ||
*/ | ||
export declare function localeRoute(this: RoutingProxy, route: RawLocation | RouteLocationRaw, locale?: Locale): Route | ReturnType<Router['resolve']> | undefined; | ||
/** | ||
* Resolve route fucntion | ||
* The function that resolve route. | ||
* | ||
* @param route - A route location. The path or name of the route or an object for more complex routes | ||
* @param locale - A locale code, if not specified, uses the current locale | ||
* @remarks | ||
* The parameter sygnatures of this function is same as {@link localeRoute}. | ||
* | ||
* @returns Returns the route object for a given route, the route object is resolved by vue-router rather than just a full route path. | ||
* @param route - A route location. The path or name of the route or an object for more complex routes. | ||
* @param locale - A locale optinal, if not specified, uses the current locale. | ||
* | ||
* @returns the route object for a given route, the route object is resolved by vue-router rather than just a full route path. | ||
* | ||
* @see {@link useLocaleRoute} | ||
* | ||
* @public | ||
*/ | ||
@@ -458,2 +581,4 @@ export declare type LocaleRouteFunction = (route: RawLocation | RouteLocationRaw, locale?: Locale) => Route | ReturnType<Router['resolve']> | undefined; | ||
* Localize route path prefix judgment logic in {@link localizeRoutes} function | ||
* | ||
* @public | ||
*/ | ||
@@ -464,2 +589,4 @@ export declare type LocalizeRoutesPrefixable = (options: LocalizeRoutesPrefixableOptions) => boolean; | ||
* Localize route path prefix judgment options used in {@link LocalizeRoutesPrefixable} | ||
* | ||
* @public | ||
*/ | ||
@@ -489,2 +616,7 @@ export declare interface LocalizeRoutesPrefixableOptions { | ||
/** | ||
* Meta attributes for head properties. | ||
* | ||
* @public | ||
*/ | ||
export declare type MetaAttrs = Record<string, any>; | ||
@@ -534,2 +666,4 @@ | ||
* Route config for vue-router v4 | ||
* | ||
* @public | ||
*/ | ||
@@ -545,2 +679,4 @@ declare interface Route_2 { | ||
* Route config for lagacy vue-router v3 | ||
* | ||
* @public | ||
*/ | ||
@@ -560,2 +696,4 @@ export declare interface RouteLegacy extends Pick<_Route, Exclude<keyof _Route, 'children' | 'component'>> { | ||
* Resolver for route localizing options | ||
* | ||
* @public | ||
*/ | ||
@@ -591,3 +729,5 @@ export declare type RouteOptionsResolver = (route: I18nRoute, localeCodes: string[]) => ComputedRouteOptions | null; | ||
/** | ||
* SEO Attribute options | ||
* SEO Attribute options. | ||
* | ||
* @public | ||
*/ | ||
@@ -611,2 +751,3 @@ export declare interface SeoAttributesOptions { | ||
/** @internal */ | ||
export declare const STRATEGIES: { | ||
@@ -621,2 +762,4 @@ readonly PREFIX: "prefix"; | ||
* Routing strategy | ||
* | ||
* @public | ||
*/ | ||
@@ -626,8 +769,10 @@ export declare type Strategies = typeof STRATEGIES[keyof typeof STRATEGIES]; | ||
/** | ||
* Returns path of the current route for specified locale | ||
* Returns path of the current route for specified locale. | ||
* | ||
* @param this - A {@link RoutingProxy} instance | ||
* @param this - A {@link RoutingProxy} instance. | ||
* @param locale - A locale | ||
* | ||
* @returns A path of the current route | ||
* @returns A path of the current route. | ||
* | ||
* @public | ||
*/ | ||
@@ -637,9 +782,14 @@ export declare function switchLocalePath(this: RoutingProxy, locale: Locale): string; | ||
/** | ||
* Swtich locale path function | ||
* The functin that swtich locale path. | ||
* | ||
* @param locale - A locale code, if not specified, uses the current locale | ||
* @remarks | ||
* The parameter sygnatures of this function is same as {@link switchLocalePath}. | ||
* | ||
* @returns Returns a link to the current route in another language | ||
* @param locale - A locale optional, if not specified, uses the current locale. | ||
* | ||
* @returns A link to the current route in another language. | ||
* | ||
* @see {@link useSwitchLocalePath} | ||
* | ||
* @public | ||
*/ | ||
@@ -664,7 +814,9 @@ export declare type SwitchLocalePathFunction = (locale?: Locale) => string; | ||
/** | ||
* Use localize head meta | ||
* The `useLocaleHead` composable returns localized head properties for locale-related aspects. | ||
* | ||
* @param options - An options, see about details {@link I18nHeadOptions}, {@link ComposableOptions}, {@link I18nCommonRoutingOptions} | ||
* @param options - An options, see about details {@link I18nHeadOptions} and {@link I18nCommonRoutingOptionsWithComposable} | ||
* | ||
* @returns Genereated SEO head meta information | ||
* @returns The localized {@link I18nHeadMetaInfo | head properties} with Vue `ref`. | ||
* | ||
* @public | ||
*/ | ||
@@ -674,7 +826,12 @@ export declare function useLocaleHead({ addDirAttribute, addSeoAttributes, identifierAttribute, strategy, defaultLocale, route, router, i18n }?: Pick<I18nCommonRoutingOptionsWithComposable, 'strategy' | 'defaultLocale' | 'route' | 'router' | 'i18n'> & I18nHeadOptions): Ref<I18nHeadMetaInfo>; | ||
/** | ||
* Use resolve locale location | ||
* The `useLocaleLocation` composable returns function that resolve the locale location. | ||
* | ||
* @remarks | ||
* The function returned by `useLocaleLocation` is the wrapper function with the same signature as {@link localeLocation}. | ||
* | ||
* @param options - An options, see about details {@link I18nCommonRoutingOptionsWithComposable} | ||
* | ||
* @returns Returns a {@link LocaleLocationFunction} | ||
* @returns A {@link LocaleLocationFunction}. | ||
* | ||
* @public | ||
*/ | ||
@@ -684,7 +841,12 @@ export declare function useLocaleLocation({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptionsWithComposable): LocaleLocationFunction; | ||
/** | ||
* Use resolve locale path | ||
* The `useLocalePath` composable returns function that resolve the locale path. | ||
* | ||
* @param options - An options, see about details {@link I18nCommonRoutingOptionsWithComposable} | ||
* @remarks | ||
* The function returned by `useLocalePath` is the wrapper function with the same signature as {@link localePath}. | ||
* | ||
* @returns Returns a {@link LocalePathFunction} | ||
* @param options - An options, see about details {@link I18nCommonRoutingOptionsWithComposable}. | ||
* | ||
* @returns A {@link LocalePathFunction}. | ||
* | ||
* @public | ||
*/ | ||
@@ -694,7 +856,12 @@ export declare function useLocalePath({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptionsWithComposable): LocalePathFunction; | ||
/** | ||
* Use resolve locale route | ||
* The `useLocaleRoute` composable returns function that resolve the locale route. | ||
* | ||
* @remarks | ||
* The function returned by `useLocaleRoute` is the wrapper function with the same signature as {@link localeRoute}. | ||
* | ||
* @param options - An options, see about details {@link I18nCommonRoutingOptionsWithComposable} | ||
* | ||
* @returns Returns a {@link LocaleRouteFunction} | ||
* @returns A {@link LocaleRouteFunction}. | ||
* | ||
* @public | ||
*/ | ||
@@ -704,8 +871,15 @@ export declare function useLocaleRoute({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptionsWithComposable): LocaleRouteFunction; | ||
/** | ||
* Use route base name | ||
* The `useRouteBaseName` composable returns the route base name. | ||
* | ||
* @param givenRoute - A route object, if not provided, the route is returned with `useRoute` will be used | ||
* @param options - An options, see about details {@link I18nCommonRoutingOptionsWithComposable} | ||
* @remarks | ||
* The `useRouteBaseName` is the composable function which is {@link getRouteBaseName} wrapper. | ||
* | ||
* @returns The route base name, if route name is not defined, return null | ||
* @param givenRoute - A route object. if not provided, the route is returned with `useRoute` will be used internally | ||
* @param options - An options, which has `router` and `routesNameSeparator` fields. see about details {@link I18nCommonRoutingOptionsWithComposable} for these option fields. | ||
* | ||
* @returns The route base name, if route name is not defined, return `null`. | ||
* | ||
* @see {@link getRouteBaseName} | ||
* | ||
* @public | ||
*/ | ||
@@ -715,7 +889,12 @@ export declare function useRouteBaseName(givenRoute?: Route | RouteLocationNormalizedLoaded, { router, routesNameSeparator }?: I18nCommonRoutingOptionsWithComposable): string | undefined; | ||
/** | ||
* Use swtich locale path | ||
* The `useSwitchLocalePath` composable returns function that resolve the locale location. | ||
* | ||
* @remarks | ||
* The function returned by `useSwitchLocalePath` is the wrapper function with the same signature as {@link switchLocalePath}. | ||
* | ||
* @param options - An options, see about details {@link I18nCommonRoutingOptionsWithComposable} | ||
* | ||
* @returns Returns a {@link SwitchLocalePathFunction} | ||
* @returns A {@link SwitchLocalePathFunction}. | ||
* | ||
* @public | ||
*/ | ||
@@ -722,0 +901,0 @@ export declare function useSwitchLocalePath({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptionsWithComposable): SwitchLocalePathFunction; |
@@ -20,8 +20,7 @@ var VueI18nRouting = function(exports, VueRouter3, vueDemi, vueI18nBridge) { | ||
/*! | ||
* shared v9.3.0-beta.10 | ||
* (c) 2022 kazuya kawaguchi | ||
* shared v9.3.0-beta.16 | ||
* (c) 2023 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
const hasSymbol = typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol"; | ||
const makeSymbol = (name) => hasSymbol ? Symbol(name) : name; | ||
const makeSymbol = (name, shareable = false) => !shareable ? Symbol(name) : Symbol.for(name); | ||
const assign = Object.assign; | ||
@@ -1116,3 +1115,3 @@ const isArray = Array.isArray; | ||
} | ||
const VERSION = "0.10.3"; | ||
const VERSION = "0.11.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1119,0 +1118,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
@@ -23,8 +23,7 @@ "use strict"; | ||
/*! | ||
* shared v9.3.0-beta.10 | ||
* (c) 2022 kazuya kawaguchi | ||
* shared v9.3.0-beta.16 | ||
* (c) 2023 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/ | ||
const hasSymbol = typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol"; | ||
const makeSymbol = (name) => hasSymbol ? Symbol(name) : name; | ||
const makeSymbol = (name, shareable = false) => !shareable ? Symbol(name) : Symbol.for(name); | ||
const assign = Object.assign; | ||
@@ -1119,3 +1118,3 @@ const isArray = Array.isArray; | ||
} | ||
const VERSION = "0.10.3"; | ||
const VERSION = "0.11.0"; | ||
exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; | ||
@@ -1122,0 +1121,0 @@ exports.DEFAULT_DETECTION_DIRECTION = DEFAULT_DETECTION_DIRECTION; |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "0.10.3", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"typecheck": "tsc -p . --noEmit", | ||
"switch:2": "vue-demi-switch 2 vue2 && vue-router-switch 3 vue-router3 && vue-i18n-switch 8 vue-i18n-legacy", | ||
"switch:3": "vue-demi-switch 3 && vue-router-switch 4 && vue-i18n-switch 9", | ||
"test": "vitest run", | ||
"test:watch": "vitest", | ||
"test:cover": "vitest --coverage", | ||
"build:docs": "api-docs-gen ./temp/vue-i18n-routing.api.json -c ./docsgen.config.js -o ./ -g noprefix" | ||
}, | ||
"version": "0.11.0-263c65a", | ||
"dependencies": { | ||
@@ -120,3 +109,14 @@ "@intlify/shared": "next", | ||
}, | ||
"sideEffects": false | ||
} | ||
"sideEffects": false, | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"typecheck": "tsc -p . --noEmit", | ||
"switch:2": "vue-demi-switch 2 vue2 && vue-router-switch 3 vue-router3 && vue-i18n-switch 8 vue-i18n-legacy", | ||
"switch:3": "vue-demi-switch 3 && vue-router-switch 4 && vue-i18n-switch 9", | ||
"test": "vitest run", | ||
"test:watch": "vitest", | ||
"test:cover": "vitest --coverage", | ||
"build:docs": "api-docs-gen ./temp/vue-i18n-routing.api.json -c ./docsgen.config.js -o ./ -g noprefix" | ||
} | ||
} |
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
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
162400
4444