svelte-intlayer 7.1.7 → 7.1.8
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/ContentSelectorWrapper-Ct4vOl_g.js +163 -0
- package/dist/ContentSelectorWrapper-DMEqv3vE.cjs +10 -0
- package/dist/MarkdownRenderer-BFrmuaFN.js +47 -0
- package/dist/MarkdownRenderer-DyK7SeHa.cjs +1 -0
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useLocaleStorage.cjs +1 -0
- package/dist/cjs/editor/communicator.cjs +1 -0
- package/dist/cjs/editor/dictionariesRecord.cjs +1 -0
- package/dist/cjs/editor/editorEnabled.cjs +1 -0
- package/dist/cjs/editor/focusDictionary.cjs +1 -0
- package/dist/cjs/editor/index.cjs +1 -0
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -0
- package/dist/cjs/editor/useCrossFrameState.cjs +1 -0
- package/dist/cjs/editor/useEditor.cjs +1 -0
- package/dist/cjs/editor/useIframeClickInterceptor.cjs +1 -0
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/markdown/context.cjs +1 -0
- package/dist/cjs/markdown/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/cjs/renderIntlayerNode.cjs +1 -0
- package/dist/cjs/setIntlayerMarkdown.cjs +1 -0
- package/dist/esm/client/useLocale.mjs +27 -16
- package/dist/esm/client/useLocaleStorage.mjs +29 -0
- package/dist/esm/editor/communicator.mjs +31 -0
- package/dist/esm/editor/dictionariesRecord.mjs +20 -0
- package/dist/esm/editor/editorEnabled.mjs +28 -0
- package/dist/esm/editor/focusDictionary.mjs +21 -0
- package/dist/esm/editor/index.mjs +23 -0
- package/dist/esm/editor/useCrossFrameMessageListener.mjs +37 -0
- package/dist/esm/editor/useCrossFrameState.mjs +53 -0
- package/dist/esm/editor/useEditor.mjs +38 -0
- package/dist/esm/editor/useIframeClickInterceptor.mjs +26 -0
- package/dist/esm/index.mjs +34 -27
- package/dist/esm/markdown/context.mjs +11 -0
- package/dist/esm/markdown/index.mjs +19 -8
- package/dist/esm/plugins.mjs +128 -13
- package/dist/esm/renderIntlayerNode.mjs +51 -0
- package/dist/esm/setIntlayerMarkdown.mjs +5 -0
- package/dist/types/IntlayerNodeWrapper.svelte.d.ts +1 -0
- package/dist/types/client/intlayerContext.d.ts +1 -0
- package/dist/types/client/useLocale.d.ts +9 -8
- package/dist/types/client/useLocaleStorage.d.ts +39 -0
- package/dist/types/editor/ContentSelector.svelte.d.ts +1 -0
- package/dist/types/editor/ContentSelectorWrapper.svelte.d.ts +1 -0
- package/dist/types/editor/communicator.d.ts +9 -0
- package/dist/types/editor/dictionariesRecord.d.ts +5 -0
- package/dist/types/editor/editorEnabled.d.ts +14 -0
- package/dist/types/editor/focusDictionary.d.ts +15 -0
- package/dist/types/editor/index.d.ts +9 -0
- package/dist/types/editor/useCrossFrameMessageListener.d.ts +2 -0
- package/dist/types/editor/useCrossFrameState.d.ts +7 -0
- package/dist/types/editor/useEditor.d.ts +1 -0
- package/dist/types/editor/useIframeClickInterceptor.d.ts +2 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/markdown/MarkdownMetadataRenderer.svelte.d.ts +1 -0
- package/dist/types/markdown/MarkdownMetadataWithSelector.svelte.d.ts +1 -0
- package/dist/types/markdown/MarkdownProvider.svelte.d.ts +1 -0
- package/dist/types/markdown/MarkdownRenderer.svelte.d.ts +1 -0
- package/dist/types/markdown/MarkdownWithSelector.svelte.d.ts +1 -0
- package/dist/types/markdown/context.d.ts +6 -0
- package/dist/types/markdown/index.d.ts +4 -27
- package/dist/types/plugins.d.ts +25 -14
- package/dist/types/renderIntlayerNode.d.ts +13 -0
- package/dist/types/setIntlayerMarkdown.d.ts +1 -0
- package/package.json +7 -6
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { MessageKey as o } from "@intlayer/editor";
|
|
2
|
+
import { onDestroy as l } from "svelte";
|
|
3
|
+
import { get as n } from "svelte/store";
|
|
4
|
+
import { useDictionariesRecord as E } from "./dictionariesRecord.mjs";
|
|
5
|
+
import { useEditorEnabled as d } from "./editorEnabled.mjs";
|
|
6
|
+
import { useCrossFrameMessageListener as a } from "./useCrossFrameMessageListener.mjs";
|
|
7
|
+
import { useIframeClickMerger as u } from "./useIframeClickInterceptor.mjs";
|
|
8
|
+
let i = !1, s = null;
|
|
9
|
+
const R = () => {
|
|
10
|
+
if (typeof window > "u" || i) return;
|
|
11
|
+
i = !0;
|
|
12
|
+
const e = d();
|
|
13
|
+
E(), u(), a(
|
|
14
|
+
`${o.INTLAYER_EDITOR_ENABLED}/post`,
|
|
15
|
+
(r) => {
|
|
16
|
+
e.wrapperEnabled.set(r);
|
|
17
|
+
},
|
|
18
|
+
!1
|
|
19
|
+
);
|
|
20
|
+
const f = a(
|
|
21
|
+
`${o.INTLAYER_EDITOR_ENABLED}/get`,
|
|
22
|
+
(r) => {
|
|
23
|
+
e.wrapperEnabled.set(r);
|
|
24
|
+
},
|
|
25
|
+
!1
|
|
26
|
+
), t = () => {
|
|
27
|
+
const r = n(e.isInIframe), m = n(e.settingEnabled);
|
|
28
|
+
r && m && f();
|
|
29
|
+
};
|
|
30
|
+
t(), e.isInIframe.subscribe(() => t()), s = e.isInIframe.subscribe(
|
|
31
|
+
() => t()
|
|
32
|
+
), l(() => {
|
|
33
|
+
i = !1, s && (s(), s = null);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
R as useEditor
|
|
38
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MessageKey as n, mergeIframeClick as s } from "@intlayer/editor";
|
|
2
|
+
import { onMount as t, onDestroy as i } from "svelte";
|
|
3
|
+
import { useCrossFrameMessageListener as r } from "./useCrossFrameMessageListener.mjs";
|
|
4
|
+
const m = () => {
|
|
5
|
+
const e = r(
|
|
6
|
+
n.INTLAYER_IFRAME_CLICKED
|
|
7
|
+
), o = () => {
|
|
8
|
+
e();
|
|
9
|
+
};
|
|
10
|
+
t(() => {
|
|
11
|
+
typeof window < "u" && window.addEventListener("mousedown", o);
|
|
12
|
+
}), i(() => {
|
|
13
|
+
typeof window < "u" && window.removeEventListener("mousedown", o);
|
|
14
|
+
});
|
|
15
|
+
}, I = () => {
|
|
16
|
+
m(), r(
|
|
17
|
+
n.INTLAYER_IFRAME_CLICKED,
|
|
18
|
+
(e) => {
|
|
19
|
+
s(e);
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
m as useIframeClickInterceptor,
|
|
25
|
+
I as useIframeClickMerger
|
|
26
|
+
};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
import { getBrowserLocale as
|
|
2
|
-
import { getIntlayerContext as
|
|
3
|
-
import { intlayerStore as
|
|
4
|
-
import { useDictionary as
|
|
5
|
-
import { useDictionaryAsync as
|
|
6
|
-
import { useDictionaryDynamic as
|
|
7
|
-
import { useIntlayer as
|
|
8
|
-
import { useLocale as
|
|
9
|
-
import { getDictionary as
|
|
10
|
-
import { getIntlayer as
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
1
|
+
import { getBrowserLocale as m } from "./client/getBrowserLocale.mjs";
|
|
2
|
+
import { getIntlayerContext as s, setIntlayerContext as x } from "./client/intlayerContext.mjs";
|
|
3
|
+
import { intlayerStore as y } from "./client/intlayerStore.mjs";
|
|
4
|
+
import { useDictionary as u } from "./client/useDictionary.mjs";
|
|
5
|
+
import { useDictionaryAsync as c } from "./client/useDictionaryAsync.mjs";
|
|
6
|
+
import { useDictionaryDynamic as I } from "./client/useDictionaryDynamic.mjs";
|
|
7
|
+
import { useIntlayer as D } from "./client/useIntlayer.mjs";
|
|
8
|
+
import { useLocale as P } from "./client/useLocale.mjs";
|
|
9
|
+
import { getDictionary as E } from "./getDictionary.mjs";
|
|
10
|
+
import { getIntlayer as M } from "./getIntlayer.mjs";
|
|
11
|
+
import { intlayerNodePlugins as S, markdownPlugin as v, markdownStringPlugin as A, svelteNodePlugins as B } from "./plugins.mjs";
|
|
12
|
+
import "./editor/communicator.mjs";
|
|
13
|
+
import "@intlayer/config/built";
|
|
14
|
+
import "svelte";
|
|
15
|
+
import "svelte/store";
|
|
16
|
+
import "@intlayer/editor";
|
|
17
|
+
import { useEditor as h } from "./editor/useEditor.mjs";
|
|
18
|
+
import { setMarkdownContext as q } from "./markdown/context.mjs";
|
|
13
19
|
export {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
m as intlayerStore,
|
|
20
|
+
m as getBrowserLocale,
|
|
21
|
+
E as getDictionary,
|
|
22
|
+
M as getIntlayer,
|
|
23
|
+
s as getIntlayerContext,
|
|
24
|
+
S as intlayerNodePlugins,
|
|
25
|
+
y as intlayerStore,
|
|
21
26
|
v as markdownPlugin,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
A as markdownStringPlugin,
|
|
28
|
+
x as setIntlayerContext,
|
|
29
|
+
q as setIntlayerMarkdown,
|
|
30
|
+
B as svelteNodePlugins,
|
|
31
|
+
u as useDictionary,
|
|
32
|
+
c as useDictionaryAsync,
|
|
33
|
+
I as useDictionaryDynamic,
|
|
34
|
+
D as useIntlayer,
|
|
35
|
+
h as useIntlayerEditor,
|
|
36
|
+
P as useLocale
|
|
30
37
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { setContext as e, getContext as n } from "svelte";
|
|
2
|
+
const o = Symbol("INTLAYER_MARKDOWN_CONTEXT"), C = () => n(o) || {
|
|
3
|
+
renderMarkdown: (t) => t
|
|
4
|
+
}, s = (t) => {
|
|
5
|
+
e(o, t);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
o as MARKDOWN_CONTEXT_KEY,
|
|
9
|
+
C as getMarkdownContext,
|
|
10
|
+
s as setMarkdownContext
|
|
11
|
+
};
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { setMarkdownContext as m } from "./context.mjs";
|
|
2
|
+
import { MARKDOWN_CONTEXT_KEY as l, getMarkdownContext as s } from "./context.mjs";
|
|
3
|
+
import { M as u, a as c } from "../../MarkdownRenderer-BFrmuaFN.js";
|
|
4
|
+
import "svelte/internal/disclose-version";
|
|
5
|
+
import "svelte/internal/flags/legacy";
|
|
6
|
+
import * as r from "svelte/internal/client";
|
|
7
|
+
function f(n, e) {
|
|
8
|
+
r.push(e, !1);
|
|
9
|
+
let t = r.prop(e, "renderMarkdown", 8, (d) => d);
|
|
10
|
+
m({ renderMarkdown: t() }), r.init();
|
|
11
|
+
var o = r.comment(), a = r.first_child(o);
|
|
12
|
+
r.slot(a, e, "default", {}, null), r.append(n, o), r.pop();
|
|
13
|
+
}
|
|
7
14
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
l as MARKDOWN_CONTEXT_KEY,
|
|
16
|
+
u as MarkdownMetadataRenderer,
|
|
17
|
+
f as MarkdownProvider,
|
|
18
|
+
c as MarkdownRenderer,
|
|
19
|
+
s as getMarkdownContext,
|
|
20
|
+
m as setMarkdownContext
|
|
10
21
|
};
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,18 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { getMarkdownMetadata as s } from "@intlayer/core";
|
|
2
|
+
import { NodeType as d } from "@intlayer/types";
|
|
3
|
+
import { a as u } from "../ContentSelectorWrapper-Ct4vOl_g.js";
|
|
4
|
+
import "./editor/communicator.mjs";
|
|
5
|
+
import "@intlayer/config/built";
|
|
6
|
+
import "svelte";
|
|
7
|
+
import "svelte/store";
|
|
8
|
+
import "@intlayer/editor";
|
|
9
|
+
import "@intlayer/unmerged-dictionaries-entry";
|
|
10
|
+
import "svelte/internal/disclose-version";
|
|
11
|
+
import "svelte/internal/flags/legacy";
|
|
12
|
+
import * as i from "svelte/internal/client";
|
|
13
|
+
import { M as c, a as g } from "../MarkdownRenderer-BFrmuaFN.js";
|
|
14
|
+
import { renderIntlayerNode as p } from "./renderIntlayerNode.mjs";
|
|
15
|
+
function P(t, e) {
|
|
16
|
+
let r = i.prop(e, "dictionaryKey", 8), a = i.prop(e, "keyPath", 8), n = i.prop(e, "value", 8), l = i.prop(e, "metadataKeyPath", 8);
|
|
17
|
+
u(t, {
|
|
18
|
+
get dictionaryKey() {
|
|
19
|
+
return r();
|
|
20
|
+
},
|
|
21
|
+
get keyPath() {
|
|
22
|
+
return a();
|
|
23
|
+
},
|
|
24
|
+
children: (y, o) => {
|
|
25
|
+
c(y, {
|
|
26
|
+
get dictionaryKey() {
|
|
27
|
+
return r();
|
|
28
|
+
},
|
|
29
|
+
get keyPath() {
|
|
30
|
+
return a();
|
|
31
|
+
},
|
|
32
|
+
get value() {
|
|
33
|
+
return n();
|
|
34
|
+
},
|
|
35
|
+
get metadataKeyPath() {
|
|
36
|
+
return l();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
$$slots: { default: !0 }
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function k(t, e) {
|
|
44
|
+
let r = i.prop(e, "dictionaryKey", 8), a = i.prop(e, "keyPath", 8), n = i.prop(e, "value", 8);
|
|
45
|
+
u(t, {
|
|
46
|
+
get dictionaryKey() {
|
|
47
|
+
return r();
|
|
48
|
+
},
|
|
49
|
+
get keyPath() {
|
|
50
|
+
return a();
|
|
51
|
+
},
|
|
52
|
+
children: (l, y) => {
|
|
53
|
+
g(l, {
|
|
54
|
+
get dictionaryKey() {
|
|
55
|
+
return r();
|
|
56
|
+
},
|
|
57
|
+
get keyPath() {
|
|
58
|
+
return a();
|
|
59
|
+
},
|
|
60
|
+
get value() {
|
|
61
|
+
return n();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
$$slots: { default: !0 }
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const f = {
|
|
6
69
|
id: "intlayer-node-plugin",
|
|
7
|
-
canHandle: (
|
|
8
|
-
transform: (
|
|
9
|
-
|
|
70
|
+
canHandle: (t) => typeof t == "bigint" || typeof t == "string" || typeof t == "number",
|
|
71
|
+
transform: (t, { children: e, ...r }) => p({
|
|
72
|
+
value: e ?? t,
|
|
73
|
+
component: u,
|
|
74
|
+
props: r
|
|
75
|
+
})
|
|
76
|
+
}, C = f, h = {
|
|
77
|
+
id: "markdown-string-plugin",
|
|
78
|
+
canHandle: (t) => typeof t == "string",
|
|
79
|
+
transform: (t, e, r) => {
|
|
80
|
+
const { ...a } = e, n = s(t) ?? {}, y = r(n, {
|
|
81
|
+
plugins: [{
|
|
82
|
+
id: "markdown-metadata-plugin",
|
|
83
|
+
canHandle: (o) => typeof o == "string" || typeof o == "number" || typeof o == "boolean" || !o,
|
|
84
|
+
transform: (o, m) => p({
|
|
85
|
+
value: o,
|
|
86
|
+
component: P,
|
|
87
|
+
props: {
|
|
88
|
+
...a,
|
|
89
|
+
value: t,
|
|
90
|
+
// The full markdown string
|
|
91
|
+
metadataKeyPath: m.keyPath
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
}],
|
|
95
|
+
dictionaryKey: a.dictionaryKey,
|
|
96
|
+
keyPath: []
|
|
97
|
+
}) ?? {};
|
|
98
|
+
return p({
|
|
99
|
+
value: t,
|
|
100
|
+
component: k,
|
|
101
|
+
props: {
|
|
102
|
+
...a,
|
|
103
|
+
value: t
|
|
104
|
+
},
|
|
105
|
+
additionalProps: {
|
|
106
|
+
metadata: y
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, I = {
|
|
10
111
|
id: "markdown-plugin",
|
|
11
|
-
canHandle: (
|
|
12
|
-
transform: (
|
|
112
|
+
canHandle: (t) => typeof t == "object" && t?.nodeType === d.Markdown,
|
|
113
|
+
transform: (t, e, r) => {
|
|
114
|
+
const a = [
|
|
115
|
+
...e.keyPath,
|
|
116
|
+
{
|
|
117
|
+
type: d.Markdown
|
|
118
|
+
}
|
|
119
|
+
], n = t[d.Markdown];
|
|
120
|
+
return r(n, {
|
|
121
|
+
...e,
|
|
122
|
+
children: n,
|
|
123
|
+
keyPath: a,
|
|
124
|
+
plugins: [h, ...e.plugins ?? []]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
13
127
|
};
|
|
14
128
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
129
|
+
f as intlayerNodePlugins,
|
|
130
|
+
I as markdownPlugin,
|
|
131
|
+
h as markdownStringPlugin,
|
|
132
|
+
C as svelteNodePlugins
|
|
18
133
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "svelte/internal/disclose-version";
|
|
2
|
+
import "svelte/internal/flags/legacy";
|
|
3
|
+
import * as e from "svelte/internal/client";
|
|
4
|
+
function d(r, n) {
|
|
5
|
+
let t = e.prop(n, "Renderer", 8), o = e.prop(n, "rendererProps", 8), l = e.prop(n, "value", 8);
|
|
6
|
+
var p = e.comment(), s = e.first_child(p);
|
|
7
|
+
e.component(s, t, (i, u) => {
|
|
8
|
+
u(i, e.spread_props(o, {
|
|
9
|
+
children: (c, v) => {
|
|
10
|
+
e.next();
|
|
11
|
+
var a = e.text();
|
|
12
|
+
e.template_effect(() => e.set_text(a, l())), e.append(c, a);
|
|
13
|
+
},
|
|
14
|
+
$$slots: { default: !0 }
|
|
15
|
+
}));
|
|
16
|
+
}), e.append(r, p);
|
|
17
|
+
}
|
|
18
|
+
const P = (r) => {
|
|
19
|
+
const n = !!d.prototype?.$destroy;
|
|
20
|
+
let t;
|
|
21
|
+
return n ? t = class extends d {
|
|
22
|
+
constructor(o) {
|
|
23
|
+
super({
|
|
24
|
+
...o,
|
|
25
|
+
props: {
|
|
26
|
+
...o.props,
|
|
27
|
+
Renderer: r.component,
|
|
28
|
+
rendererProps: r.props,
|
|
29
|
+
value: r.value
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
} : t = (o, l) => {
|
|
34
|
+
const p = {
|
|
35
|
+
...l,
|
|
36
|
+
Renderer: r.component,
|
|
37
|
+
rendererProps: r.props,
|
|
38
|
+
value: r.value
|
|
39
|
+
};
|
|
40
|
+
return d(o, p);
|
|
41
|
+
}, Object.defineProperty(t, "value", {
|
|
42
|
+
value: r.value,
|
|
43
|
+
writable: !1
|
|
44
|
+
}), Object.defineProperty(t, "toString", {
|
|
45
|
+
value: () => r.value?.toString() ?? "",
|
|
46
|
+
writable: !1
|
|
47
|
+
}), r.additionalProps && Object.assign(t, r.additionalProps), t;
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
P as renderIntlayerNode
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -2,6 +2,7 @@ import { LocalesValues } from '@intlayer/types';
|
|
|
2
2
|
export interface IntlayerContextType {
|
|
3
3
|
locale: LocalesValues;
|
|
4
4
|
setLocale: (locale: LocalesValues) => void;
|
|
5
|
+
isCookieEnabled?: boolean;
|
|
5
6
|
}
|
|
6
7
|
export declare const setIntlayerContext: (context: IntlayerContextType) => void;
|
|
7
8
|
export declare const getIntlayerContext: () => IntlayerContextType | undefined;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { LocalesValues } from '@intlayer/types';
|
|
2
|
+
type useLocaleProps = {
|
|
3
|
+
isCookieEnabled?: boolean;
|
|
4
|
+
onLocaleChange?: (locale: LocalesValues) => void;
|
|
5
|
+
};
|
|
1
6
|
/**
|
|
2
7
|
* Hook to get and set the current locale in Svelte applications
|
|
3
8
|
* @returns Readable store with current locale and setter function
|
|
4
9
|
*/
|
|
5
|
-
export declare const useLocale: () => {
|
|
6
|
-
locale: import('svelte/store').Readable<
|
|
7
|
-
setLocale: (locale:
|
|
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;
|
|
10
|
+
export declare const useLocale: ({ isCookieEnabled, onLocaleChange, }?: useLocaleProps) => {
|
|
11
|
+
locale: import('svelte/store').Readable<LocalesValues>;
|
|
12
|
+
setLocale: (locale: LocalesValues) => void;
|
|
13
13
|
defaultLocale: import('@intlayer/types').Locale;
|
|
14
14
|
availableLocales: import('@intlayer/types').Locale[];
|
|
15
15
|
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { LocalesValues } from '@intlayer/types';
|
|
2
|
+
/**
|
|
3
|
+
* Get the locale cookie
|
|
4
|
+
*/
|
|
5
|
+
export declare const localeInStorage: import('@intlayer/types').Locale | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use localeInStorage instead
|
|
8
|
+
*
|
|
9
|
+
* Get the locale cookie
|
|
10
|
+
*/
|
|
11
|
+
export declare const localeCookie: import('@intlayer/types').Locale | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Set the locale cookie
|
|
14
|
+
*/
|
|
15
|
+
export declare const setLocaleInStorage: (locale: LocalesValues, isCookieEnabled: boolean) => void;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use setLocaleInStorage instead
|
|
18
|
+
*
|
|
19
|
+
* Set the locale cookie
|
|
20
|
+
*/
|
|
21
|
+
export declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: boolean) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Composable that provides the locale storage and a function to set it
|
|
24
|
+
*/
|
|
25
|
+
export declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
26
|
+
localeStorage: import('svelte/store').Readable<"af" | "af-ZA" | "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-OM" | "ar-QA" | "ar-SA" | "ar-SY" | "ar-TN" | "ar-YE" | "az" | "az-AZ" | "be" | "be-BY" | "bg" | "bg-BG" | "bs" | "bs-BA" | "ca" | "ca-ES" | "cs" | "cs-CZ" | "cy" | "cy-GB" | "da" | "da-DK" | "de" | "de-AT" | "de-CH" | "de-DE" | "de-LI" | "de-LU" | "dv" | "dv-MV" | "el" | "el-GR" | "en" | "en-AU" | "en-BZ" | "en-CA" | "en-CB" | "en-GB" | "en-IE" | "en-JM" | "en-NZ" | "en-PH" | "en-TT" | "en-US" | "en-ZA" | "en-ZW" | "eo" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-DO" | "es-EC" | "es-ES" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PE" | "es-PR" | "es-PY" | "es-SV" | "es-UY" | "es-VE" | "et" | "et-EE" | "eu" | "eu-ES" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fo" | "fo-FO" | "fr" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "fr-LU" | "fr-MC" | "gl" | "gl-ES" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hr" | "hr-BA" | "hr-HR" | "hu" | "hu-HU" | "hy" | "hy-AM" | "id" | "id-ID" | "is" | "is-IS" | "it" | "it-CH" | "it-IT" | "ja" | "ja-JP" | "ka" | "ka-GE" | "kk" | "kk-KZ" | "kn" | "kn-IN" | "ko" | "ko-KR" | "kok" | "kok-IN" | "ky" | "ky-KG" | "lt" | "lt-LT" | "lv" | "lv-LV" | "mi" | "mi-NZ" | "mk" | "mk-MK" | "mn" | "mn-MN" | "mr" | "mr-IN" | "ms" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "nb" | "nb-NO" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "ns" | "ns-ZA" | "pa" | "pa-IN" | "pl" | "pl-PL" | "ps" | "ps-AR" | "pt" | "pt-BR" | "pt-PT" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-RO" | "ru" | "ru-RU" | "sa" | "sa-IN" | "se" | "se-FI" | "se-NO" | "se-SE" | "sk" | "sk-SK" | "sl" | "sl-SI" | "sq" | "sq-AL" | "sr" | "sr-BA" | "sr-SP" | "sv" | "sv-FI" | "sv-SE" | "sw" | "sw-KE" | "syr" | "syr-SY" | "ta" | "ta-IN" | "te" | "te-IN" | "th" | "th-TH" | "tl" | "tl-PH" | "tn" | "tn-ZA" | "tr" | "tr-TR" | "tt" | "tt-RU" | "ts" | "uk" | "uk-UA" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "vi" | "vi-VN" | "xh" | "xh-ZA" | "zh" | "zh-Hans" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-SG" | "zh-Hant" | "zu" | "zu-ZA" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "my" | "my-MM" | "km" | "km-KH" | "lo" | "lo-LA" | "yo" | "yo-NG" | "am" | "am-ET" | "ne" | "ne-NP" | "si" | "si-LK" | "sr-Cyrl" | "sr-RS" | "en-IN" | "en-SG" | "en-HK" | "en-NG" | "en-PK" | "en-MY" | "en-BW" | "en-KE" | "en-TZ" | "en-GH" | "en-UG" | "es-CU" | "es-US" | "pt-GW" | "pt-MZ" | "pt-ST" | "pt-CV" | "pt-TL" | "pt-MO" | "zh-TW" | "ar-MR" | "ar-PS" | "ar-SD" | "ar-DJ" | "ar-SO" | "ar-TD" | "ar-KM">;
|
|
27
|
+
setLocaleStorage: (locale: LocalesValues) => void;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated Use useLocaleStorage instead
|
|
31
|
+
*
|
|
32
|
+
* For GDPR compliance, use useLocaleStorage instead
|
|
33
|
+
*
|
|
34
|
+
* Composable that provides the locale cookie and a function to set it
|
|
35
|
+
*/
|
|
36
|
+
export declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
37
|
+
localeCookie: import('svelte/store').Readable<"af" | "af-ZA" | "ar" | "ar-AE" | "ar-BH" | "ar-DZ" | "ar-EG" | "ar-IQ" | "ar-JO" | "ar-KW" | "ar-LB" | "ar-LY" | "ar-MA" | "ar-OM" | "ar-QA" | "ar-SA" | "ar-SY" | "ar-TN" | "ar-YE" | "az" | "az-AZ" | "be" | "be-BY" | "bg" | "bg-BG" | "bs" | "bs-BA" | "ca" | "ca-ES" | "cs" | "cs-CZ" | "cy" | "cy-GB" | "da" | "da-DK" | "de" | "de-AT" | "de-CH" | "de-DE" | "de-LI" | "de-LU" | "dv" | "dv-MV" | "el" | "el-GR" | "en" | "en-AU" | "en-BZ" | "en-CA" | "en-CB" | "en-GB" | "en-IE" | "en-JM" | "en-NZ" | "en-PH" | "en-TT" | "en-US" | "en-ZA" | "en-ZW" | "eo" | "es" | "es-AR" | "es-BO" | "es-CL" | "es-CO" | "es-CR" | "es-DO" | "es-EC" | "es-ES" | "es-GT" | "es-HN" | "es-MX" | "es-NI" | "es-PA" | "es-PE" | "es-PR" | "es-PY" | "es-SV" | "es-UY" | "es-VE" | "et" | "et-EE" | "eu" | "eu-ES" | "fa" | "fa-IR" | "fi" | "fi-FI" | "fo" | "fo-FO" | "fr" | "fr-BE" | "fr-CA" | "fr-CH" | "fr-FR" | "fr-LU" | "fr-MC" | "gl" | "gl-ES" | "gu" | "gu-IN" | "he" | "he-IL" | "hi" | "hi-IN" | "hr" | "hr-BA" | "hr-HR" | "hu" | "hu-HU" | "hy" | "hy-AM" | "id" | "id-ID" | "is" | "is-IS" | "it" | "it-CH" | "it-IT" | "ja" | "ja-JP" | "ka" | "ka-GE" | "kk" | "kk-KZ" | "kn" | "kn-IN" | "ko" | "ko-KR" | "kok" | "kok-IN" | "ky" | "ky-KG" | "lt" | "lt-LT" | "lv" | "lv-LV" | "mi" | "mi-NZ" | "mk" | "mk-MK" | "mn" | "mn-MN" | "mr" | "mr-IN" | "ms" | "ms-BN" | "ms-MY" | "mt" | "mt-MT" | "nb" | "nb-NO" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "ns" | "ns-ZA" | "pa" | "pa-IN" | "pl" | "pl-PL" | "ps" | "ps-AR" | "pt" | "pt-BR" | "pt-PT" | "qu" | "qu-BO" | "qu-EC" | "qu-PE" | "ro" | "ro-RO" | "ru" | "ru-RU" | "sa" | "sa-IN" | "se" | "se-FI" | "se-NO" | "se-SE" | "sk" | "sk-SK" | "sl" | "sl-SI" | "sq" | "sq-AL" | "sr" | "sr-BA" | "sr-SP" | "sv" | "sv-FI" | "sv-SE" | "sw" | "sw-KE" | "syr" | "syr-SY" | "ta" | "ta-IN" | "te" | "te-IN" | "th" | "th-TH" | "tl" | "tl-PH" | "tn" | "tn-ZA" | "tr" | "tr-TR" | "tt" | "tt-RU" | "ts" | "uk" | "uk-UA" | "ur" | "ur-PK" | "uz" | "uz-UZ" | "vi" | "vi-VN" | "xh" | "xh-ZA" | "zh" | "zh-Hans" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-SG" | "zh-Hant" | "zu" | "zu-ZA" | "bn" | "bn-BD" | "bn-IN" | "bn-MM" | "my" | "my-MM" | "km" | "km-KH" | "lo" | "lo-LA" | "yo" | "yo-NG" | "am" | "am-ET" | "ne" | "ne-NP" | "si" | "si-LK" | "sr-Cyrl" | "sr-RS" | "en-IN" | "en-SG" | "en-HK" | "en-NG" | "en-PK" | "en-MY" | "en-BW" | "en-KE" | "en-TZ" | "en-GH" | "en-UG" | "es-CU" | "es-US" | "pt-GW" | "pt-MZ" | "pt-ST" | "pt-CV" | "pt-TL" | "pt-MO" | "zh-TW" | "ar-MR" | "ar-PS" | "ar-SD" | "ar-DJ" | "ar-SO" | "ar-TD" | "ar-KM">;
|
|
38
|
+
setLocaleCookie: (locale: LocalesValues) => void;
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Writable } from 'svelte/store';
|
|
2
|
+
export type Communicator = {
|
|
3
|
+
postMessage: typeof window.postMessage;
|
|
4
|
+
allowedOrigins?: string[];
|
|
5
|
+
senderId: string;
|
|
6
|
+
};
|
|
7
|
+
export type CommunicatorOptions = Omit<Communicator, 'senderId'>;
|
|
8
|
+
export declare const createCommunicator: (options?: Partial<CommunicatorOptions>) => Writable<Communicator>;
|
|
9
|
+
export declare const useCommunicator: () => Writable<Communicator>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Dictionary, LocalDictionaryId } from '@intlayer/types';
|
|
2
|
+
export type DictionaryContent = Record<LocalDictionaryId, Dictionary>;
|
|
3
|
+
export declare const useDictionariesRecord: () => {
|
|
4
|
+
dictionariesRecord: import('svelte/store').Writable<DictionaryContent | undefined>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Readable, Writable } from 'svelte/store';
|
|
2
|
+
export type EditorEnabledStateProps = {
|
|
3
|
+
settingEnabled: Writable<boolean>;
|
|
4
|
+
wrapperEnabled: Writable<boolean>;
|
|
5
|
+
isInIframe: Writable<boolean>;
|
|
6
|
+
enabled: Readable<boolean>;
|
|
7
|
+
};
|
|
8
|
+
export declare const createEditorEnabledClient: () => {
|
|
9
|
+
settingEnabled: Writable<boolean>;
|
|
10
|
+
wrapperEnabled: Writable<boolean>;
|
|
11
|
+
isInIframe: Writable<boolean>;
|
|
12
|
+
enabled: Readable<boolean>;
|
|
13
|
+
};
|
|
14
|
+
export declare const useEditorEnabled: () => EditorEnabledStateProps;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DictionaryKeys, KeyPath } from '@intlayer/types';
|
|
2
|
+
import { Writable } from 'svelte/store';
|
|
3
|
+
export type FocusedContent = {
|
|
4
|
+
dictionaryKey: DictionaryKeys;
|
|
5
|
+
keyPath: KeyPath[];
|
|
6
|
+
} | null;
|
|
7
|
+
export type FocusDictionaryStateProps = {
|
|
8
|
+
focusedContent?: Writable<FocusedContent | undefined>;
|
|
9
|
+
setFocusedContent: (content: FocusedContent) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const createFocusDictionaryClient: () => {
|
|
12
|
+
focusedContent: Writable<FocusedContent | undefined>;
|
|
13
|
+
setFocusedContent: (v: FocusedContent | ((prev: FocusedContent | undefined) => FocusedContent)) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const useFocusDictionary: () => FocusDictionaryStateProps;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as ContentSelector } from './ContentSelector.svelte';
|
|
2
|
+
export { default as ContentSelectorWrapper } from './ContentSelectorWrapper.svelte';
|
|
3
|
+
export * from './communicator';
|
|
4
|
+
export * from './editorEnabled';
|
|
5
|
+
export * from './focusDictionary';
|
|
6
|
+
export * from './useCrossFrameMessageListener';
|
|
7
|
+
export * from './useCrossFrameState';
|
|
8
|
+
export * from './useEditor';
|
|
9
|
+
export * from './useIframeClickInterceptor';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MessageKey } from '@intlayer/editor';
|
|
2
|
+
import { Writable } from 'svelte/store';
|
|
3
|
+
export type CrossFrameStateOptions = {
|
|
4
|
+
emit?: boolean;
|
|
5
|
+
receive?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const useCrossFrameState: <S>(key: `${MessageKey}`, initialState?: S | (() => S), options?: CrossFrameStateOptions) => [Writable<S | undefined>, (v: S | ((prev: S | undefined) => S)) => void];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useEditor: () => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IInterpreterPluginSvelte } from './plugins';
|
|
2
|
+
import { useEditor } from './editor';
|
|
3
|
+
import { setMarkdownContext } from './markdown';
|
|
2
4
|
declare module '@intlayer/core' {
|
|
3
5
|
interface IInterpreterPlugin<T, S, L> extends IInterpreterPluginSvelte<T> {
|
|
4
6
|
}
|
|
@@ -6,5 +8,5 @@ declare module '@intlayer/core' {
|
|
|
6
8
|
export * from './client';
|
|
7
9
|
export * from './getDictionary';
|
|
8
10
|
export * from './getIntlayer';
|
|
9
|
-
export * from './markdown';
|
|
10
11
|
export * from './plugins';
|
|
12
|
+
export { useEditor as useIntlayerEditor, setMarkdownContext as setIntlayerMarkdown, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SvelteComponent as default } from 'svelte';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const MARKDOWN_CONTEXT_KEY: unique symbol;
|
|
2
|
+
export interface MarkdownContext {
|
|
3
|
+
renderMarkdown: (markdown: string) => string;
|
|
4
|
+
}
|
|
5
|
+
export declare const getMarkdownContext: () => MarkdownContext;
|
|
6
|
+
export declare const setMarkdownContext: (context: MarkdownContext) => void;
|
|
@@ -1,27 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
1
|
+
export * from './context';
|
|
2
|
+
export { default as MarkdownMetadataRenderer } from './MarkdownMetadataRenderer.svelte';
|
|
3
|
+
export { default as MarkdownProvider } from './MarkdownProvider.svelte';
|
|
4
|
+
export { default as MarkdownRenderer } from './MarkdownRenderer.svelte';
|