svelte-intlayer 9.0.2 → 9.1.1

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.
@@ -1,5 +1,5 @@
1
1
  import type { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from '@intlayer/types/dictionary';
2
- import type { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from '@intlayer/types/module_augmentation';
2
+ import type { DeclaredLocales, ExtractSelectorLocale } from '@intlayer/types/module_augmentation';
3
3
  import { type Readable } from 'svelte/store';
4
4
  import type { DeepTransformContent } from '../plugins';
5
5
  /**
@@ -10,4 +10,4 @@ import type { DeepTransformContent } from '../plugins';
10
10
  * @param localeOrSelector The target locale or selector (optional)
11
11
  * @returns Reactive store with transformed dictionary content
12
12
  */
13
- export declare const useDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => Readable<DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>>;
13
+ export declare const useDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends DeclaredLocales | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => Readable<DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>>;
@@ -1,6 +1,6 @@
1
1
  import { type QualifiedDynamicLoaderMap } from '@intlayer/core/dictionaryManipulator';
2
2
  import type { Dictionary } from '@intlayer/types/dictionary';
3
- import type { DictionaryKeys, DictionarySelectorForKey, LocalesValues, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
3
+ import type { DeclaredLocales, DictionaryKeys, DictionarySelectorForKey, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
4
4
  import { type Readable } from 'svelte/store';
5
5
  import type { DeepTransformContent } from '../plugins';
6
6
  /**
@@ -15,7 +15,7 @@ import type { DeepTransformContent } from '../plugins';
15
15
  * @param localeOrSelector - Optional fixed locale or selector.
16
16
  * @returns Readable store with the loaded dictionary content.
17
17
  */
18
- export declare function useDictionaryDynamic<const T extends Dictionary, const K extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<K> = LocalesValues>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>> | QualifiedDynamicLoaderMap, key: K, localeOrSelector?: A): Readable<DeepTransformContent<T['content']> & {
18
+ export declare function useDictionaryDynamic<const T extends Dictionary, const K extends DictionaryKeys, const A extends DeclaredLocales | DictionarySelectorForKey<K> = DeclaredLocales>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>> | QualifiedDynamicLoaderMap, key: K, localeOrSelector?: A): Readable<DeepTransformContent<T['content']> & {
19
19
  isLoading: boolean;
20
20
  error: Error | null;
21
21
  }>;
@@ -1,4 +1,4 @@
1
- import type { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySelectorForKey, ExtractSelectorLocale, LocalesValues } from '@intlayer/types/module_augmentation';
1
+ import type { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySelectorForKey, ExtractSelectorLocale } from '@intlayer/types/module_augmentation';
2
2
  import { type Readable } from 'svelte/store';
3
3
  import type { DeepTransformContent } from '../plugins';
4
4
  /**
@@ -26,4 +26,4 @@ import type { DeepTransformContent } from '../plugins';
26
26
  * <div>{$content.myField.value}</div>
27
27
  * ```
28
28
  */
29
- export declare const useIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => Readable<DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>>;
29
+ export declare const useIntlayer: <const T extends DictionaryKeys, const A extends DeclaredLocales | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => Readable<DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>>;
@@ -1,5 +1,5 @@
1
1
  import type { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from '@intlayer/types/dictionary';
2
- import type { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from '@intlayer/types/module_augmentation';
2
+ import type { DeclaredLocales, ExtractSelectorLocale } from '@intlayer/types/module_augmentation';
3
3
  import { type DeepTransformContent } from './plugins';
4
4
  /**
5
5
  * Get content for a dictionary (or qualified dictionary group) in Svelte
@@ -10,4 +10,4 @@ import { type DeepTransformContent } from './plugins';
10
10
  * @param localeOrSelector The target locale or selector (optional)
11
11
  * @returns Transformed dictionary content optimized for Svelte
12
12
  */
13
- export declare const getDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>;
13
+ export declare const getDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends DeclaredLocales | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>;
@@ -1,4 +1,4 @@
1
- import type { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySelectorForKey, ExtractSelectorLocale, LocalesValues } from '@intlayer/types/module_augmentation';
1
+ import type { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySelectorForKey, ExtractSelectorLocale } from '@intlayer/types/module_augmentation';
2
2
  import { type DeepTransformContent } from './plugins';
3
3
  /**
4
4
  * Get dictionary content by key for Svelte applications.
@@ -10,4 +10,4 @@ import { type DeepTransformContent } from './plugins';
10
10
  * @param localeOrSelector The target locale or selector (optional)
11
11
  * @returns Transformed dictionary content optimized for Svelte
12
12
  */
13
- export declare const getIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>;
13
+ export declare const getIntlayer: <const T extends DictionaryKeys, const A extends DeclaredLocales | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>;
package/dist/plugins.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { editor, internationalization } from '@intlayer/config/built';
2
- import { conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, isInterpolableWrapperNode, nestedPlugin, pluralPlugin, transformInterpolableNode, translationPlugin, } from '@intlayer/core/interpreter';
2
+ import { conditionPlugin, enumerationPlugin, fallbackPlugin, filePlugin, genderPlugin, isInterpolableWrapperNode, nestedPlugin, pluralPlugin, selectPlugin, transformInterpolableNode, translationPlugin, } from '@intlayer/core/interpreter';
3
3
  import * as NodeTypes from '@intlayer/types/nodeType';
4
4
  import { reportExposure } from './analytics/exposureSink';
5
5
  import { default as ContentSelector } from './editor/ContentSelector.svelte';
@@ -134,7 +134,7 @@ const splitAndJoinInsertion = (template, values) => {
134
134
  parts.push(template.substring(lastIndex, match.index));
135
135
  }
136
136
  // Add the replaced value
137
- const key = match[1].trim();
137
+ const key = match[1]?.trim();
138
138
  const value = values[key];
139
139
  if (value !== undefined && value !== null) {
140
140
  parts.push(value);
@@ -347,6 +347,7 @@ export const getPlugins = (locale, fallback = true) => {
347
347
  nestedPlugin(locale ?? internationalization.defaultLocale),
348
348
  filePlugin,
349
349
  genderPlugin,
350
+ selectPlugin,
350
351
  intlayerNodePlugins,
351
352
  svelteNodePlugins,
352
353
  insertionPlugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-intlayer",
3
- "version": "9.0.2",
3
+ "version": "9.1.1",
4
4
  "description": "Easily internationalize i18n your Svelte applications with type-safe multilingual content management.",
5
5
  "keywords": [
6
6
  "intlayer",
@@ -82,33 +82,33 @@
82
82
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
83
83
  },
84
84
  "dependencies": {
85
- "@intlayer/api": "9.0.2",
86
- "@intlayer/config": "9.0.2",
87
- "@intlayer/core": "9.0.2",
88
- "@intlayer/editor": "9.0.2",
89
- "@intlayer/types": "9.0.2"
85
+ "@intlayer/api": "9.1.1",
86
+ "@intlayer/config": "9.1.1",
87
+ "@intlayer/core": "9.1.1",
88
+ "@intlayer/editor": "9.1.1",
89
+ "@intlayer/types": "9.1.1"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@sveltejs/adapter-auto": "7.0.1",
93
93
  "@sveltejs/package": "2.5.8",
94
94
  "@sveltejs/vite-plugin-svelte": "7.2.0",
95
- "@types/node": "26.1.1",
95
+ "@types/node": "26.1.2",
96
96
  "@utils/ts-config": "1.0.4",
97
97
  "@utils/ts-config-types": "1.0.4",
98
98
  "@utils/tsdown-config": "1.0.4",
99
99
  "rimraf": "6.1.3",
100
- "svelte": "5.56.7",
101
- "svelte-check": "4.7.3",
100
+ "svelte": "5.56.8",
101
+ "svelte-check": "4.7.4",
102
102
  "tsdown": "0.22.14",
103
103
  "typescript": "5.9.3",
104
- "vite": "8.1.5",
104
+ "vite": "8.2.0",
105
105
  "vitest": "4.1.10"
106
106
  },
107
107
  "peerDependencies": {
108
108
  "svelte": ">=5.0.0"
109
109
  },
110
110
  "optionalDependencies": {
111
- "@intlayer/analytics": "9.0.2"
111
+ "@intlayer/analytics": "9.1.1"
112
112
  },
113
113
  "engines": {
114
114
  "node": ">=14.18"