svelte-intlayer 7.1.8-canary.0 → 7.1.9-canary.0
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/IntlayerNodeWrapper.svelte +10 -0
- package/dist/IntlayerNodeWrapper.svelte.d.ts +22 -0
- package/dist/client/IntlayerProvider.svelte +24 -0
- package/dist/client/IntlayerProvider.svelte.d.ts +30 -0
- package/dist/{types/client → client}/getBrowserLocale.d.ts +1 -1
- package/dist/client/getBrowserLocale.js +17 -0
- package/dist/client/index.js +12 -0
- package/dist/{types/client → client}/intlayerContext.d.ts +2 -1
- package/dist/client/intlayerContext.js +8 -0
- package/dist/client/intlayerStore.d.ts +11 -0
- package/dist/client/intlayerStore.js +19 -0
- package/dist/{types/client → client}/useDictionary.d.ts +3 -3
- package/dist/client/useDictionary.js +18 -0
- package/dist/{types/client → client}/useDictionaryAsync.d.ts +2 -2
- package/dist/client/useDictionaryAsync.js +38 -0
- package/dist/{types/client → client}/useDictionaryDynamic.d.ts +2 -2
- package/dist/client/useDictionaryDynamic.js +38 -0
- package/dist/{types/client → client}/useIntlayer.d.ts +4 -3
- package/dist/client/useIntlayer.js +18 -0
- package/dist/client/useLocale.d.ts +16 -0
- package/dist/client/useLocale.js +33 -0
- package/dist/client/useLocaleStorage.d.ts +39 -0
- package/dist/client/useLocaleStorage.js +52 -0
- package/dist/editor/ContentSelector.svelte +125 -0
- package/dist/editor/ContentSelector.svelte.d.ts +35 -0
- package/dist/editor/ContentSelectorWrapper.svelte +69 -0
- package/dist/editor/ContentSelectorWrapper.svelte.d.ts +31 -0
- package/dist/editor/communicator.d.ts +9 -0
- package/dist/editor/communicator.js +54 -0
- package/dist/editor/dictionariesRecord.d.ts +5 -0
- package/dist/editor/dictionariesRecord.js +16 -0
- package/dist/editor/editorEnabled.d.ts +14 -0
- package/dist/editor/editorEnabled.js +41 -0
- package/dist/editor/focusDictionary.d.ts +15 -0
- package/dist/editor/focusDictionary.js +22 -0
- package/dist/editor/index.d.ts +9 -0
- package/dist/editor/index.js +9 -0
- package/dist/editor/useCrossFrameMessageListener.d.ts +2 -0
- package/dist/editor/useCrossFrameMessageListener.js +65 -0
- package/dist/editor/useCrossFrameState.d.ts +7 -0
- package/dist/editor/useCrossFrameState.js +82 -0
- package/dist/editor/useEditor.d.ts +1 -0
- package/dist/editor/useEditor.js +46 -0
- package/dist/editor/useIframeClickInterceptor.d.ts +2 -0
- package/dist/editor/useIframeClickInterceptor.js +29 -0
- package/dist/{types/getDictionary.d.ts → getDictionary.d.ts} +3 -3
- package/dist/getDictionary.js +18 -0
- package/dist/{types/getIntlayer.d.ts → getIntlayer.d.ts} +3 -3
- package/dist/getIntlayer.js +18 -0
- package/dist/{types/index.d.ts → index.d.ts} +4 -2
- package/dist/index.js +7 -0
- package/dist/index.test.d.ts +1 -0
- package/dist/index.test.js +6 -0
- package/dist/markdown/MarkdownMetadataRenderer.svelte +21 -0
- package/dist/markdown/MarkdownMetadataRenderer.svelte.d.ts +25 -0
- package/dist/markdown/MarkdownMetadataWithSelector.svelte +21 -0
- package/dist/markdown/MarkdownMetadataWithSelector.svelte.d.ts +24 -0
- package/dist/markdown/MarkdownProvider.svelte +9 -0
- package/dist/markdown/MarkdownProvider.svelte.d.ts +29 -0
- package/dist/markdown/MarkdownRenderer.svelte +11 -0
- package/dist/markdown/MarkdownRenderer.svelte.d.ts +20 -0
- package/dist/markdown/MarkdownWithSelector.svelte +15 -0
- package/dist/markdown/MarkdownWithSelector.svelte.d.ts +23 -0
- package/dist/markdown/context.d.ts +6 -0
- package/dist/markdown/context.js +10 -0
- package/dist/markdown/index.d.ts +4 -0
- package/dist/markdown/index.js +4 -0
- package/dist/plugins.d.ts +42 -0
- package/dist/plugins.js +87 -0
- package/dist/renderIntlayerNode.d.ts +13 -0
- package/dist/renderIntlayerNode.js +44 -0
- package/dist/setIntlayerMarkdown.d.ts +1 -0
- package/dist/setIntlayerMarkdown.js +2 -0
- package/package.json +22 -29
- package/dist/cjs/client/getBrowserLocale.cjs +0 -1
- package/dist/cjs/client/index.cjs +0 -1
- package/dist/cjs/client/intlayerContext.cjs +0 -1
- package/dist/cjs/client/intlayerStore.cjs +0 -1
- package/dist/cjs/client/useDictionary.cjs +0 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +0 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +0 -1
- package/dist/cjs/client/useIntlayer.cjs +0 -1
- package/dist/cjs/client/useLocale.cjs +0 -1
- package/dist/cjs/getDictionary.cjs +0 -1
- package/dist/cjs/getIntlayer.cjs +0 -1
- package/dist/cjs/index.cjs +0 -1
- package/dist/cjs/markdown/index.cjs +0 -1
- package/dist/cjs/plugins.cjs +0 -1
- package/dist/esm/client/getBrowserLocale.mjs +0 -9
- package/dist/esm/client/index.mjs +0 -19
- package/dist/esm/client/intlayerContext.mjs +0 -8
- package/dist/esm/client/intlayerStore.mjs +0 -16
- package/dist/esm/client/useDictionary.mjs +0 -14
- package/dist/esm/client/useDictionaryAsync.mjs +0 -27
- package/dist/esm/client/useDictionaryDynamic.mjs +0 -27
- package/dist/esm/client/useIntlayer.mjs +0 -14
- package/dist/esm/client/useLocale.mjs +0 -22
- package/dist/esm/getDictionary.mjs +0 -18
- package/dist/esm/getIntlayer.mjs +0 -14
- package/dist/esm/index.mjs +0 -30
- package/dist/esm/markdown/index.mjs +0 -10
- package/dist/esm/plugins.mjs +0 -18
- package/dist/types/client/intlayerStore.d.ts +0 -11
- package/dist/types/client/useLocale.d.ts +0 -15
- package/dist/types/markdown/index.d.ts +0 -27
- package/dist/types/plugins.d.ts +0 -27
- /package/dist/{types/client → client}/index.d.ts +0 -0
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { getBrowserLocale as o } from "./getBrowserLocale.mjs";
|
|
2
|
-
import { getIntlayerContext as n, setIntlayerContext as a } from "./intlayerContext.mjs";
|
|
3
|
-
import { intlayerStore as m } from "./intlayerStore.mjs";
|
|
4
|
-
import { useDictionary as f } from "./useDictionary.mjs";
|
|
5
|
-
import { useDictionaryAsync as p } from "./useDictionaryAsync.mjs";
|
|
6
|
-
import { useDictionaryDynamic as c } from "./useDictionaryDynamic.mjs";
|
|
7
|
-
import { useIntlayer as u } from "./useIntlayer.mjs";
|
|
8
|
-
import { useLocale as I } from "./useLocale.mjs";
|
|
9
|
-
export {
|
|
10
|
-
o as getBrowserLocale,
|
|
11
|
-
n as getIntlayerContext,
|
|
12
|
-
m as intlayerStore,
|
|
13
|
-
a as setIntlayerContext,
|
|
14
|
-
f as useDictionary,
|
|
15
|
-
p as useDictionaryAsync,
|
|
16
|
-
c as useDictionaryDynamic,
|
|
17
|
-
u as useIntlayer,
|
|
18
|
-
I as useLocale
|
|
19
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { writable as a, derived as c } from "svelte/store";
|
|
2
|
-
const n = () => {
|
|
3
|
-
const { subscribe: t, set: r, update: o } = a({
|
|
4
|
-
locale: "en"
|
|
5
|
-
// Default locale
|
|
6
|
-
});
|
|
7
|
-
return {
|
|
8
|
-
subscribe: t,
|
|
9
|
-
setLocale: (e) => o((l) => ({ ...l, locale: e })),
|
|
10
|
-
getLocale: () => c({ subscribe: t }, (e) => e.locale),
|
|
11
|
-
reset: () => r({ locale: "en" })
|
|
12
|
-
};
|
|
13
|
-
}, i = n();
|
|
14
|
-
export {
|
|
15
|
-
i as intlayerStore
|
|
16
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { derived as i } from "svelte/store";
|
|
2
|
-
import { getDictionary as c } from "../getDictionary.mjs";
|
|
3
|
-
import { getIntlayerContext as a } from "./intlayerContext.mjs";
|
|
4
|
-
import { intlayerStore as m } from "./intlayerStore.mjs";
|
|
5
|
-
const y = (t, o) => {
|
|
6
|
-
const r = a();
|
|
7
|
-
return i([m], ([e]) => {
|
|
8
|
-
const n = o ?? r?.locale ?? e.locale;
|
|
9
|
-
return c(t, n);
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
y as useDictionary
|
|
14
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { writable as l, derived as s } from "svelte/store";
|
|
2
|
-
import { getIntlayerContext as y } from "./intlayerContext.mjs";
|
|
3
|
-
import { intlayerStore as d } from "./intlayerStore.mjs";
|
|
4
|
-
const D = async (e, n) => {
|
|
5
|
-
const a = y(), o = l(null);
|
|
6
|
-
return s([d], ([c]) => {
|
|
7
|
-
const r = n ?? a?.locale ?? c.locale;
|
|
8
|
-
return (async () => {
|
|
9
|
-
try {
|
|
10
|
-
const t = e[r];
|
|
11
|
-
if (t) {
|
|
12
|
-
const i = await t();
|
|
13
|
-
o.set(i);
|
|
14
|
-
} else
|
|
15
|
-
o.set(null);
|
|
16
|
-
} catch (t) {
|
|
17
|
-
console.error(
|
|
18
|
-
`Failed to load dictionary for key: ${String(r)}`,
|
|
19
|
-
t
|
|
20
|
-
), o.set(null);
|
|
21
|
-
}
|
|
22
|
-
})(), null;
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
D as useDictionaryAsync
|
|
27
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { writable as s, derived as y } from "svelte/store";
|
|
2
|
-
import { getIntlayerContext as d } from "./intlayerContext.mjs";
|
|
3
|
-
import { intlayerStore as m } from "./intlayerStore.mjs";
|
|
4
|
-
const g = (r, e, n) => {
|
|
5
|
-
const a = d(), o = s(null);
|
|
6
|
-
return y([m], ([i]) => {
|
|
7
|
-
const c = n ?? a?.locale ?? i.locale;
|
|
8
|
-
return (async () => {
|
|
9
|
-
try {
|
|
10
|
-
const t = r[c];
|
|
11
|
-
if (t) {
|
|
12
|
-
const l = await t();
|
|
13
|
-
o.set(l);
|
|
14
|
-
} else
|
|
15
|
-
o.set(null);
|
|
16
|
-
} catch (t) {
|
|
17
|
-
console.error(
|
|
18
|
-
`Failed to load dictionary for key: ${String(e)}`,
|
|
19
|
-
t
|
|
20
|
-
), o.set(null);
|
|
21
|
-
}
|
|
22
|
-
})(), null;
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
g as useDictionaryDynamic
|
|
27
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { derived as l } from "svelte/store";
|
|
2
|
-
import { getIntlayer as a } from "../getIntlayer.mjs";
|
|
3
|
-
import { getIntlayerContext as m } from "./intlayerContext.mjs";
|
|
4
|
-
import { intlayerStore as c } from "./intlayerStore.mjs";
|
|
5
|
-
const y = (t, r) => {
|
|
6
|
-
const e = m();
|
|
7
|
-
return l([c], ([o]) => {
|
|
8
|
-
const n = r ?? e?.locale ?? o.locale;
|
|
9
|
-
return a(t, n);
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
y as useIntlayer
|
|
14
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import r from "@intlayer/config/built";
|
|
2
|
-
import { derived as c } from "svelte/store";
|
|
3
|
-
import { getIntlayerContext as n } from "./intlayerContext.mjs";
|
|
4
|
-
import { intlayerStore as o } from "./intlayerStore.mjs";
|
|
5
|
-
const f = () => {
|
|
6
|
-
const e = n(), { defaultLocale: t, locales: l } = r?.internationalization ?? {};
|
|
7
|
-
return e ? {
|
|
8
|
-
locale: c(
|
|
9
|
-
[o],
|
|
10
|
-
([a]) => e.locale || a.locale
|
|
11
|
-
),
|
|
12
|
-
setLocale: e.setLocale
|
|
13
|
-
} : {
|
|
14
|
-
locale: o.getLocale(),
|
|
15
|
-
setLocale: o.setLocale,
|
|
16
|
-
defaultLocale: t,
|
|
17
|
-
availableLocales: l
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
f as useLocale
|
|
22
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { getDictionary as r } from "@intlayer/core";
|
|
2
|
-
import { intlayerNodePlugins as e, svelteNodePlugins as g, markdownPlugin as s } from "./plugins.mjs";
|
|
3
|
-
const c = (t, i, o) => {
|
|
4
|
-
const n = [
|
|
5
|
-
e,
|
|
6
|
-
g,
|
|
7
|
-
s,
|
|
8
|
-
...o ?? []
|
|
9
|
-
];
|
|
10
|
-
return r(
|
|
11
|
-
t,
|
|
12
|
-
i,
|
|
13
|
-
n
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
c as getDictionary
|
|
18
|
-
};
|
package/dist/esm/getIntlayer.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { getIntlayer as o } from "@intlayer/core";
|
|
2
|
-
import { intlayerNodePlugins as l, svelteNodePlugins as g, markdownPlugin as i } from "./plugins.mjs";
|
|
3
|
-
const m = (t, e, n) => {
|
|
4
|
-
const r = [
|
|
5
|
-
l,
|
|
6
|
-
g,
|
|
7
|
-
i,
|
|
8
|
-
...n ?? []
|
|
9
|
-
];
|
|
10
|
-
return o(t, e, r);
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
m as getIntlayer
|
|
14
|
-
};
|
package/dist/esm/index.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { getBrowserLocale as o } from "./client/getBrowserLocale.mjs";
|
|
2
|
-
import { getIntlayerContext as n, setIntlayerContext as a } from "./client/intlayerContext.mjs";
|
|
3
|
-
import { intlayerStore as m } from "./client/intlayerStore.mjs";
|
|
4
|
-
import { useDictionary as f } from "./client/useDictionary.mjs";
|
|
5
|
-
import { useDictionaryAsync as p } from "./client/useDictionaryAsync.mjs";
|
|
6
|
-
import { useDictionaryDynamic as y } from "./client/useDictionaryDynamic.mjs";
|
|
7
|
-
import { useIntlayer as u } from "./client/useIntlayer.mjs";
|
|
8
|
-
import { useLocale as g } from "./client/useLocale.mjs";
|
|
9
|
-
import { getDictionary as w } from "./getDictionary.mjs";
|
|
10
|
-
import { getIntlayer as k } from "./getIntlayer.mjs";
|
|
11
|
-
import { defaultMarkdownRenderer as C, processMarkdown as L } from "./markdown/index.mjs";
|
|
12
|
-
import { intlayerNodePlugins as N, markdownPlugin as v, svelteNodePlugins as A } from "./plugins.mjs";
|
|
13
|
-
export {
|
|
14
|
-
C as defaultMarkdownRenderer,
|
|
15
|
-
o as getBrowserLocale,
|
|
16
|
-
w as getDictionary,
|
|
17
|
-
k as getIntlayer,
|
|
18
|
-
n as getIntlayerContext,
|
|
19
|
-
N as intlayerNodePlugins,
|
|
20
|
-
m as intlayerStore,
|
|
21
|
-
v as markdownPlugin,
|
|
22
|
-
L as processMarkdown,
|
|
23
|
-
a as setIntlayerContext,
|
|
24
|
-
A as svelteNodePlugins,
|
|
25
|
-
f as useDictionary,
|
|
26
|
-
p as useDictionaryAsync,
|
|
27
|
-
y as useDictionaryDynamic,
|
|
28
|
-
u as useIntlayer,
|
|
29
|
-
g as useLocale
|
|
30
|
-
};
|
package/dist/esm/plugins.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const e = {
|
|
2
|
-
id: "svelte-node-plugin",
|
|
3
|
-
canHandle: (n) => typeof n == "bigint" || typeof n == "string" || typeof n == "number",
|
|
4
|
-
transform: (n, { children: t, ...r }) => t ?? n
|
|
5
|
-
}, i = {
|
|
6
|
-
id: "intlayer-node-plugin",
|
|
7
|
-
canHandle: (n) => typeof n == "bigint" || typeof n == "string" || typeof n == "number",
|
|
8
|
-
transform: (n, { children: t, ...r }) => t ?? n
|
|
9
|
-
}, o = {
|
|
10
|
-
id: "markdown-plugin",
|
|
11
|
-
canHandle: (n) => typeof n == "string",
|
|
12
|
-
transform: (n, t) => n
|
|
13
|
-
};
|
|
14
|
-
export {
|
|
15
|
-
i as intlayerNodePlugins,
|
|
16
|
-
o as markdownPlugin,
|
|
17
|
-
e as svelteNodePlugins
|
|
18
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { LocalesValues } from '@intlayer/types';
|
|
2
|
-
import { Readable } from 'svelte/store';
|
|
3
|
-
export interface IntlayerStoreType {
|
|
4
|
-
locale: LocalesValues;
|
|
5
|
-
}
|
|
6
|
-
export declare const intlayerStore: {
|
|
7
|
-
subscribe: (this: void, run: import('svelte/store').Subscriber<IntlayerStoreType>, invalidate?: () => void) => import('svelte/store').Unsubscriber;
|
|
8
|
-
setLocale: (locale: LocalesValues) => void;
|
|
9
|
-
getLocale: () => Readable<LocalesValues>;
|
|
10
|
-
reset: () => void;
|
|
11
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to get and set the current locale in Svelte applications
|
|
3
|
-
* @returns Readable store with current locale and setter function
|
|
4
|
-
*/
|
|
5
|
-
export declare const useLocale: () => {
|
|
6
|
-
locale: import('svelte/store').Readable<import('@intlayer/types').LocalesValues>;
|
|
7
|
-
setLocale: (locale: import('@intlayer/types').LocalesValues) => void;
|
|
8
|
-
defaultLocale?: undefined;
|
|
9
|
-
availableLocales?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
locale: import('svelte/store').Readable<import('@intlayer/types').LocalesValues>;
|
|
12
|
-
setLocale: (locale: import('@intlayer/types').LocalesValues) => void;
|
|
13
|
-
defaultLocale: import('@intlayer/types').Locale;
|
|
14
|
-
availableLocales: import('@intlayer/types').Locale[];
|
|
15
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Markdown support for Svelte Intlayer
|
|
3
|
-
* This module provides markdown rendering capabilities for Svelte applications
|
|
4
|
-
*/
|
|
5
|
-
export interface MarkdownProps {
|
|
6
|
-
children: string;
|
|
7
|
-
[key: string]: any;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Basic markdown processor for Svelte
|
|
11
|
-
* This can be extended to use more sophisticated markdown libraries
|
|
12
|
-
* @param content Markdown content to process
|
|
13
|
-
* @returns Processed content (for now, returns as-is)
|
|
14
|
-
*/
|
|
15
|
-
export declare const processMarkdown: (content: string) => string;
|
|
16
|
-
/**
|
|
17
|
-
* Markdown renderer component interface for Svelte
|
|
18
|
-
* This defines the expected interface for a markdown component
|
|
19
|
-
*/
|
|
20
|
-
export interface MarkdownRenderer {
|
|
21
|
-
render: (content: string) => string;
|
|
22
|
-
configure?: (options: any) => void;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Default markdown renderer implementation
|
|
26
|
-
*/
|
|
27
|
-
export declare const defaultMarkdownRenderer: MarkdownRenderer;
|
package/dist/types/plugins.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { DeepTransformContent as DeepTransformContentCore, IInterpreterPluginState as IInterpreterPluginStateCore, Plugins } from '@intlayer/core';
|
|
2
|
-
import { DeclaredLocales, LocalesValues } from '@intlayer/types';
|
|
3
|
-
/**
|
|
4
|
-
* Interface for Svelte-specific plugin functionality
|
|
5
|
-
* This interface can be augmented to add more Svelte-specific transformations
|
|
6
|
-
*/
|
|
7
|
-
export type IInterpreterPluginState = IInterpreterPluginStateCore & {};
|
|
8
|
-
/**
|
|
9
|
-
* Type that represents the deep transformation of content for Svelte
|
|
10
|
-
* This applies Svelte-specific transformations recursively to all content
|
|
11
|
-
*/
|
|
12
|
-
export type DeepTransformContent<T, L extends LocalesValues = DeclaredLocales> = DeepTransformContentCore<T, IInterpreterPluginState, L>;
|
|
13
|
-
/**
|
|
14
|
-
* Svelte-specific node plugins for handling basic content types
|
|
15
|
-
* These plugins handle strings, numbers, and bigints in Svelte applications
|
|
16
|
-
*/
|
|
17
|
-
export declare const svelteNodePlugins: Plugins;
|
|
18
|
-
/**
|
|
19
|
-
* Basic Intlayer node plugins for content handling
|
|
20
|
-
* These handle the core content transformation logic
|
|
21
|
-
*/
|
|
22
|
-
export declare const intlayerNodePlugins: Plugins;
|
|
23
|
-
/**
|
|
24
|
-
* Markdown plugin for handling markdown content in Svelte
|
|
25
|
-
* This can be extended to integrate with Svelte markdown processors
|
|
26
|
-
*/
|
|
27
|
-
export declare const markdownPlugin: Plugins;
|
|
File without changes
|