svelte-intlayer 8.7.11 → 8.7.13
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/README.md +27 -1
- package/dist/client/useLocale.d.ts +2 -2
- package/dist/client/useLocaleStorage.d.ts +2 -2
- package/dist/editor/useEditor.js +1 -2
- package/dist/format/useCompact.d.ts +1 -1
- package/dist/format/useCurrency.d.ts +1 -1
- package/dist/format/useDate.d.ts +1 -1
- package/dist/format/useList.d.ts +1 -1
- package/dist/format/useNumber.d.ts +1 -1
- package/dist/format/usePercentage.d.ts +1 -1
- package/dist/format/useRelativeTime.d.ts +1 -1
- package/dist/format/useUnit.d.ts +1 -1
- package/dist/plugins.js +27 -46
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -190,7 +190,22 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
190
190
|
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React</a></li>
|
|
191
191
|
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React using Compiler</a></li>
|
|
192
192
|
<li><a href="https://intlayer.org/doc/environment/vite-and-react/compiler" rel=''>React-router-v7</a></li>
|
|
193
|
-
<li><a href="https://intlayer.org/doc/environment/
|
|
193
|
+
<li><a href="https://intlayer.org/doc/environment/tanstack-start" rel=''>Tanstack start</a>
|
|
194
|
+
<ul>
|
|
195
|
+
<li><a href="https://intlayer.org/doc/environment/tanstack-start/solid" rel=''>Solid</a></li>
|
|
196
|
+
</ul>
|
|
197
|
+
</li>
|
|
198
|
+
<li><a href="https://intlayer.org/doc/environment/astro" rel=''>Astro</a>
|
|
199
|
+
<ul>
|
|
200
|
+
<li><a href="https://intlayer.org/doc/environment/astro/react" rel=''>React</a></li>
|
|
201
|
+
<li><a href="https://intlayer.org/doc/environment/astro/vue" rel=''>Vue</a></li>
|
|
202
|
+
<li><a href="https://intlayer.org/doc/environment/astro/svelte" rel=''>Svelte</a></li>
|
|
203
|
+
<li><a href="https://intlayer.org/doc/environment/astro/solid" rel=''>Solid</a></li>
|
|
204
|
+
<li><a href="https://intlayer.org/doc/environment/astro/vanilla" rel=''>Vanilla JS</a></li>
|
|
205
|
+
<li><a href="https://intlayer.org/doc/environment/astro/lit" rel=''>Lit</a></li>
|
|
206
|
+
</ul>
|
|
207
|
+
</li>
|
|
208
|
+
|
|
194
209
|
<li><a href="https://intlayer.org/doc/environment/react-native-and-expo" rel=''>React Native</a></li>
|
|
195
210
|
<li><a href="https://intlayer.org/doc/environment/vite-and-svelte" rel=''>Vite + Svelte</a></li>
|
|
196
211
|
<li><a href="https://intlayer.org/doc/environment/sveltekit" rel=''>SvelteKit</a></li>
|
|
@@ -212,6 +227,17 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
212
227
|
</ul>
|
|
213
228
|
</details>
|
|
214
229
|
|
|
230
|
+
<details>
|
|
231
|
+
<summary style="font-size:16px; font-weight:bold;">📊 Benchmark</summary>
|
|
232
|
+
<ul>
|
|
233
|
+
<li><a href="https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/benchmark/nextjs.md" rel=''>Next.js</a></li>
|
|
234
|
+
<li><a href="https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/benchmark/tanstack.md" rel=''>TanStack Start</a></li>
|
|
235
|
+
<li><a href="https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/benchmark/vue.md" rel=''>Vue</a></li>
|
|
236
|
+
<li><a href="https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/benchmark/solid.md" rel=''>Solid</a></li>
|
|
237
|
+
<li><a href="https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/benchmark/svelte.md" rel=''>Svelte</a></li>
|
|
238
|
+
</ul>
|
|
239
|
+
</details>
|
|
240
|
+
|
|
215
241
|
<details>
|
|
216
242
|
<summary style="font-size:16px; font-weight:bold;">📰 Blog</summary>
|
|
217
243
|
<ul>
|
|
@@ -26,7 +26,7 @@ type useLocaleProps = {
|
|
|
26
26
|
export declare const useLocale: ({ isCookieEnabled, onLocaleChange, }?: useLocaleProps) => {
|
|
27
27
|
locale: import("svelte/store").Readable<LocalesValues>;
|
|
28
28
|
setLocale: (locale: LocalesValues) => void;
|
|
29
|
-
defaultLocale: import("intlayer").Locale;
|
|
30
|
-
availableLocales: import("intlayer").Locale[];
|
|
29
|
+
defaultLocale: import("@intlayer/types/allLocales").Locale;
|
|
30
|
+
availableLocales: import("@intlayer/types/allLocales").Locale[];
|
|
31
31
|
};
|
|
32
32
|
export {};
|
|
@@ -2,13 +2,13 @@ import type { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
|
2
2
|
/**
|
|
3
3
|
* Get the locale cookie
|
|
4
4
|
*/
|
|
5
|
-
export declare const localeInStorage: import("intlayer").Locale | undefined;
|
|
5
|
+
export declare const localeInStorage: import("@intlayer/types/allLocales").Locale | undefined;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use localeInStorage instead
|
|
8
8
|
*
|
|
9
9
|
* Get the locale cookie
|
|
10
10
|
*/
|
|
11
|
-
export declare const localeCookie: import("intlayer").Locale | undefined;
|
|
11
|
+
export declare const localeCookie: import("@intlayer/types/allLocales").Locale | undefined;
|
|
12
12
|
/**
|
|
13
13
|
* Set the locale cookie
|
|
14
14
|
*/
|
package/dist/editor/useEditor.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isEnabled } from '@intlayer/editor/isEnabled';
|
|
2
2
|
import { onDestroy, onMount } from 'svelte';
|
|
3
3
|
import { intlayerStore } from '../client/intlayerStore';
|
|
4
|
-
const TREE_SHAKE_EDITOR = process.env['INTLAYER_EDITOR_ENABLED'] === 'false';
|
|
5
4
|
/**
|
|
6
5
|
* Initialises the Intlayer editor client singleton when the editor is enabled.
|
|
7
6
|
* Syncs the current locale from intlayerStore into the editor manager so the
|
|
@@ -12,7 +11,7 @@ const TREE_SHAKE_EDITOR = process.env['INTLAYER_EDITOR_ENABLED'] === 'false';
|
|
|
12
11
|
* direct access to the Svelte 5 rune state.
|
|
13
12
|
*/
|
|
14
13
|
export const useEditor = () => {
|
|
15
|
-
if (
|
|
14
|
+
if (process.env['INTLAYER_EDITOR_ENABLED'] === 'false' || !isEnabled)
|
|
16
15
|
return;
|
|
17
16
|
let unsubscribeLocale = null;
|
|
18
17
|
onMount(() => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const useCompact: () => import("svelte/store").Readable<(value: string | number, options?: (Intl.NumberFormatOptions & {
|
|
2
|
-
locale?: import("intlayer").LocalesValues;
|
|
2
|
+
locale?: import("@intlayer/types/module_augmentation").LocalesValues;
|
|
3
3
|
}) | undefined) => string>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const useCurrency: () => import("svelte/store").Readable<(value: string | number, options?: (Intl.NumberFormatOptions & {
|
|
2
|
-
locale?: import("intlayer").LocalesValues;
|
|
2
|
+
locale?: import("@intlayer/types/module_augmentation").LocalesValues;
|
|
3
3
|
}) | undefined) => string>;
|
package/dist/format/useDate.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* A store containing a date/time formatting function bound to the active locale.
|
|
6
6
|
*/
|
|
7
7
|
export declare const useDate: () => import("svelte/store").Readable<(date: string | number | Date, options?: import("@intlayer/core/formatters").DateTimePreset | (Intl.DateTimeFormatOptions & {
|
|
8
|
-
locale?: import("intlayer").LocalesValues;
|
|
8
|
+
locale?: import("@intlayer/types/module_augmentation").LocalesValues;
|
|
9
9
|
}) | undefined) => string>;
|
package/dist/format/useList.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export declare const useList: () => import("svelte/store").Readable<(values: (st
|
|
|
3
3
|
type?: "conjunction" | "disjunction" | "unit";
|
|
4
4
|
style?: "long" | "short" | "narrow";
|
|
5
5
|
} & {
|
|
6
|
-
locale?: import("intlayer").LocalesValues;
|
|
6
|
+
locale?: import("@intlayer/types/module_augmentation").LocalesValues;
|
|
7
7
|
}) | undefined) => string>;
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* A store containing a number formatting function bound to the active locale.
|
|
6
6
|
*/
|
|
7
7
|
export declare const useNumber: () => import("svelte/store").Readable<(value: string | number, args_1?: (Intl.NumberFormatOptions & {
|
|
8
|
-
locale?: import("intlayer").LocalesValues;
|
|
8
|
+
locale?: import("@intlayer/types/module_augmentation").LocalesValues;
|
|
9
9
|
}) | undefined) => string>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const usePercentage: () => import("svelte/store").Readable<(value: string | number, args_1?: (Intl.NumberFormatOptions & {
|
|
2
|
-
locale?: import("intlayer").LocalesValues;
|
|
2
|
+
locale?: import("@intlayer/types/module_augmentation").LocalesValues;
|
|
3
3
|
}) | undefined) => string>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const useRelativeTime: () => import("svelte/store").Readable<(from: string | number | Date, to?: string | number | Date | undefined, options?: (Intl.RelativeTimeFormatOptions & {
|
|
2
|
-
locale?: import("intlayer").LocalesValues;
|
|
2
|
+
locale?: import("@intlayer/types/module_augmentation").LocalesValues;
|
|
3
3
|
unit?: Intl.RelativeTimeFormatUnit;
|
|
4
4
|
}) | undefined) => string>;
|
package/dist/format/useUnit.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const useUnit: () => import("svelte/store").Readable<(value: string | number, options?: (Intl.NumberFormatOptions & {
|
|
2
|
-
locale?: import("intlayer").LocalesValues;
|
|
2
|
+
locale?: import("@intlayer/types/module_augmentation").LocalesValues;
|
|
3
3
|
}) | undefined) => string>;
|
package/dist/plugins.js
CHANGED
|
@@ -4,29 +4,6 @@ import * as NodeTypes from '@intlayer/types/nodeType';
|
|
|
4
4
|
import { default as ContentSelector } from './editor/ContentSelector.svelte';
|
|
5
5
|
import { HTMLRenderer } from './html/index';
|
|
6
6
|
import { renderIntlayerNode } from './renderIntlayerNode';
|
|
7
|
-
// ── Tree-shake constants ──────────────────────────────────────────────────────
|
|
8
|
-
// When these env vars are injected at build time, bundlers eliminate the
|
|
9
|
-
// branches guarded by these constants.
|
|
10
|
-
/**
|
|
11
|
-
* True when the intlayer node type is explicitly disabled at build time.
|
|
12
|
-
*/
|
|
13
|
-
const TREE_SHAKE_INTLAYER_NODE = process.env['INTLAYER_NODE_TYPE_INTLAYER_NODE'] === 'false';
|
|
14
|
-
/**
|
|
15
|
-
* True when the markdown node type is explicitly disabled at build time.
|
|
16
|
-
*/
|
|
17
|
-
const TREE_SHAKE_MARKDOWN = process.env['INTLAYER_NODE_TYPE_MARKDOWN'] === 'false';
|
|
18
|
-
/**
|
|
19
|
-
* True when the HTML node type is explicitly disabled at build time.
|
|
20
|
-
*/
|
|
21
|
-
const TREE_SHAKE_HTML = process.env['INTLAYER_NODE_TYPE_HTML'] === 'false';
|
|
22
|
-
/**
|
|
23
|
-
* True when the insertion node type is explicitly disabled at build time.
|
|
24
|
-
*/
|
|
25
|
-
const TREE_SHAKE_INSERTION = process.env['INTLAYER_NODE_TYPE_INSERTION'] === 'false';
|
|
26
|
-
/**
|
|
27
|
-
* True when the editor is explicitly disabled at build time.
|
|
28
|
-
*/
|
|
29
|
-
const TREE_SHAKE_EDITOR = process.env['INTLAYER_EDITOR_ENABLED'] === 'false';
|
|
30
7
|
// Lazy pre-load heavy modules — creates separate code-split chunks.
|
|
31
8
|
// Guarded by tree-shake constants so bundlers can eliminate the dynamic import()
|
|
32
9
|
// entirely when the feature is disabled at build time.
|
|
@@ -38,7 +15,7 @@ let _MarkdownRenderer = null;
|
|
|
38
15
|
let _MarkdownWithSelector = null;
|
|
39
16
|
let _svelteHtmlRuntime = null;
|
|
40
17
|
let _HTMLWithSelector = null;
|
|
41
|
-
if (
|
|
18
|
+
if (process.env['INTLAYER_NODE_TYPE_MARKDOWN'] !== 'false') {
|
|
42
19
|
void import('@intlayer/core/markdown').then((m) => {
|
|
43
20
|
_getMarkdownMetadata = m.getMarkdownMetadata;
|
|
44
21
|
_compile = m.compile;
|
|
@@ -51,26 +28,26 @@ if (!TREE_SHAKE_MARKDOWN) {
|
|
|
51
28
|
import('./markdown/runtime').then((m) => (_svelteHtmlRuntime = m.svelteHtmlRuntime)),
|
|
52
29
|
]);
|
|
53
30
|
}
|
|
54
|
-
if (
|
|
31
|
+
if (process.env['INTLAYER_NODE_TYPE_HTML'] !== 'false') {
|
|
55
32
|
void import('./html/HTMLWithSelector.svelte').then((m) => (_HTMLWithSelector = m.default));
|
|
56
33
|
}
|
|
57
34
|
/**
|
|
58
35
|
* Basic Intlayer node plugins for content handling
|
|
59
36
|
* These handle the core content transformation logic
|
|
60
37
|
*/
|
|
61
|
-
export const intlayerNodePlugins =
|
|
62
|
-
|
|
63
|
-
:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
38
|
+
export const intlayerNodePlugins = {
|
|
39
|
+
id: 'intlayer-node-plugin',
|
|
40
|
+
canHandle: (node) => typeof node === 'bigint' ||
|
|
41
|
+
typeof node === 'string' ||
|
|
42
|
+
typeof node === 'number',
|
|
43
|
+
transform: (node, { children, ...rest }) => renderIntlayerNode({
|
|
44
|
+
value: children ?? node,
|
|
45
|
+
component: process.env['INTLAYER_EDITOR_ENABLED'] !== 'false' && editor.enabled
|
|
46
|
+
? ContentSelector
|
|
47
|
+
: undefined,
|
|
48
|
+
props: rest,
|
|
49
|
+
}),
|
|
50
|
+
};
|
|
74
51
|
/**
|
|
75
52
|
* Svelte-specific node plugins for handling basic content types
|
|
76
53
|
* These plugins handle strings, numbers, and bigints in Svelte applications
|
|
@@ -126,7 +103,7 @@ const splitAndJoinInsertion = (template, values) => {
|
|
|
126
103
|
return parts;
|
|
127
104
|
};
|
|
128
105
|
/** Insertion plugin for Svelte. Handles component insertion. */
|
|
129
|
-
export const insertionPlugin =
|
|
106
|
+
export const insertionPlugin = process.env['INTLAYER_NODE_TYPE_INSERTION'] === 'false'
|
|
130
107
|
? fallbackPlugin
|
|
131
108
|
: {
|
|
132
109
|
id: 'insertion-plugin',
|
|
@@ -184,7 +161,7 @@ export const insertionPlugin = TREE_SHAKE_INSERTION
|
|
|
184
161
|
},
|
|
185
162
|
};
|
|
186
163
|
/** Markdown string plugin. Replaces string node with a component that render the markdown. */
|
|
187
|
-
export const markdownStringPlugin =
|
|
164
|
+
export const markdownStringPlugin = process.env['INTLAYER_NODE_TYPE_MARKDOWN'] === 'false'
|
|
188
165
|
? fallbackPlugin
|
|
189
166
|
: {
|
|
190
167
|
id: 'markdown-string-plugin',
|
|
@@ -200,8 +177,10 @@ export const markdownStringPlugin = TREE_SHAKE_MARKDOWN
|
|
|
200
177
|
!metadataNode,
|
|
201
178
|
transform: (metadataNode, props) => renderIntlayerNode({
|
|
202
179
|
value: metadataNode,
|
|
203
|
-
component:
|
|
204
|
-
|
|
180
|
+
component: process.env['INTLAYER_EDITOR_ENABLED'] !== 'false' &&
|
|
181
|
+
editor.enabled
|
|
182
|
+
? (_MarkdownMetadataWithSelector ??
|
|
183
|
+
_MarkdownMetadataRenderer)
|
|
205
184
|
: _MarkdownMetadataRenderer,
|
|
206
185
|
props: {
|
|
207
186
|
...rest,
|
|
@@ -219,7 +198,8 @@ export const markdownStringPlugin = TREE_SHAKE_MARKDOWN
|
|
|
219
198
|
const render = (components) => {
|
|
220
199
|
const nodeResult = renderIntlayerNode({
|
|
221
200
|
value: node,
|
|
222
|
-
component:
|
|
201
|
+
component: process.env['INTLAYER_EDITOR_ENABLED'] !== 'false' &&
|
|
202
|
+
editor.enabled
|
|
223
203
|
? (_MarkdownWithSelector ?? _MarkdownRenderer)
|
|
224
204
|
: _MarkdownRenderer,
|
|
225
205
|
props: {
|
|
@@ -252,7 +232,7 @@ export const markdownStringPlugin = TREE_SHAKE_MARKDOWN
|
|
|
252
232
|
return render();
|
|
253
233
|
},
|
|
254
234
|
};
|
|
255
|
-
export const markdownPlugin =
|
|
235
|
+
export const markdownPlugin = process.env['INTLAYER_NODE_TYPE_MARKDOWN'] === 'false'
|
|
256
236
|
? fallbackPlugin
|
|
257
237
|
: {
|
|
258
238
|
id: 'markdown-plugin',
|
|
@@ -274,7 +254,7 @@ export const markdownPlugin = TREE_SHAKE_MARKDOWN
|
|
|
274
254
|
},
|
|
275
255
|
};
|
|
276
256
|
/** HTML plugin. Replaces node with a function that takes components => HTMLElement[]. */
|
|
277
|
-
export const htmlPlugin =
|
|
257
|
+
export const htmlPlugin = process.env['INTLAYER_NODE_TYPE_HTML'] === 'false'
|
|
278
258
|
? fallbackPlugin
|
|
279
259
|
: {
|
|
280
260
|
id: 'html-plugin',
|
|
@@ -286,7 +266,8 @@ export const htmlPlugin = TREE_SHAKE_HTML
|
|
|
286
266
|
const render = (userComponents = {}) => renderIntlayerNode({
|
|
287
267
|
...props,
|
|
288
268
|
value: htmlString,
|
|
289
|
-
component:
|
|
269
|
+
component: process.env['INTLAYER_EDITOR_ENABLED'] !== 'false' &&
|
|
270
|
+
editor.enabled
|
|
290
271
|
? (_HTMLWithSelector ?? HTMLRenderer)
|
|
291
272
|
: HTMLRenderer,
|
|
292
273
|
props: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-intlayer",
|
|
3
|
-
"version": "8.7.
|
|
3
|
+
"version": "8.7.13",
|
|
4
4
|
"description": "Easily internationalize i18n your Svelte applications with type-safe multilingual content management.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intlayer",
|
|
@@ -82,11 +82,11 @@
|
|
|
82
82
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@intlayer/api": "8.7.
|
|
86
|
-
"@intlayer/config": "8.7.
|
|
87
|
-
"@intlayer/core": "8.7.
|
|
88
|
-
"@intlayer/editor": "8.7.
|
|
89
|
-
"@intlayer/types": "8.7.
|
|
85
|
+
"@intlayer/api": "8.7.13",
|
|
86
|
+
"@intlayer/config": "8.7.13",
|
|
87
|
+
"@intlayer/core": "8.7.13",
|
|
88
|
+
"@intlayer/editor": "8.7.13",
|
|
89
|
+
"@intlayer/types": "8.7.13"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
92
|
"@sveltejs/adapter-auto": "7.0.1",
|