vue-intlayer 5.7.8 → 5.8.1-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/README.md +1 -1
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js +1 -0
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-pC3olEPG.mjs +73 -0
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CBP8x_i1.mjs +62 -0
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-kiSW4cfM.js +1 -0
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-CilQuo_6.js +1 -0
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-GmacOkG4.mjs +36 -0
- package/dist/cjs/UI/ContentSelector.cjs +1 -1
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/client/useLocale.cjs +1 -1
- package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
- package/dist/cjs/editor/EditedContentRenderer.cjs +1 -1
- package/dist/cjs/editor/EditorSelectorRenderer.cjs +1 -1
- package/dist/cjs/editor/communicator.cjs +1 -1
- package/dist/cjs/editor/createSharedComposable.cjs +1 -1
- package/dist/cjs/editor/editedContent.cjs +1 -1
- package/dist/cjs/editor/index.cjs +1 -1
- package/dist/cjs/editor/useCrossFrameMessageListener.cjs +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +1 -1
- package/dist/cjs/format/index.cjs +1 -0
- package/dist/cjs/format/useCompact.cjs +1 -0
- package/dist/cjs/format/useCurrency.cjs +1 -0
- package/dist/cjs/format/useDate.cjs +1 -0
- package/dist/cjs/format/useList.cjs +1 -0
- package/dist/cjs/format/useNumber.cjs +1 -0
- package/dist/cjs/format/usePercentage.cjs +1 -0
- package/dist/cjs/format/useRelativeTime.cjs +1 -0
- package/dist/cjs/format/useUnit.cjs +1 -0
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/UI/ContentSelector.mjs +1 -1
- package/dist/esm/client/useDictionary.mjs +22 -22
- package/dist/esm/client/useDictionaryAsync.mjs +10 -13
- package/dist/esm/client/useDictionaryDynamic.mjs +13 -16
- package/dist/esm/client/useIntlayer.mjs +22 -15
- package/dist/esm/client/useLocale.mjs +12 -16
- package/dist/esm/editor/ContentSelectorWrapper.mjs +1 -1
- package/dist/esm/editor/EditedContentRenderer.mjs +1 -1
- package/dist/esm/editor/EditorSelectorRenderer.mjs +2 -2
- package/dist/esm/editor/communicator.mjs +10 -10
- package/dist/esm/editor/createSharedComposable.mjs +1 -1
- package/dist/esm/editor/editedContent.mjs +22 -23
- package/dist/esm/editor/index.mjs +1 -1
- package/dist/esm/editor/useCrossFrameMessageListener.mjs +21 -22
- package/dist/esm/editor/useEditedContentRenderer.mjs +7 -7
- package/dist/esm/format/index.mjs +18 -0
- package/dist/esm/format/useCompact.mjs +16 -0
- package/dist/esm/format/useCurrency.mjs +16 -0
- package/dist/esm/format/useDate.mjs +16 -0
- package/dist/esm/format/useList.mjs +16 -0
- package/dist/esm/format/useNumber.mjs +16 -0
- package/dist/esm/format/usePercentage.mjs +16 -0
- package/dist/esm/format/useRelativeTime.mjs +16 -0
- package/dist/esm/format/useUnit.mjs +16 -0
- package/dist/esm/plugins.mjs +15 -15
- package/dist/types/client/useDictionary.d.ts +2 -1
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useIntlayer.d.ts +2 -2
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- package/dist/types/format/index.d.ts +9 -0
- package/dist/types/format/index.d.ts.map +1 -0
- package/dist/types/format/useCompact.d.ts +14 -0
- package/dist/types/format/useCompact.d.ts.map +1 -0
- package/dist/types/format/useCurrency.d.ts +25 -0
- package/dist/types/format/useCurrency.d.ts.map +1 -0
- package/dist/types/format/useDate.d.ts +23 -0
- package/dist/types/format/useDate.d.ts.map +1 -0
- package/dist/types/format/useList.d.ts +22 -0
- package/dist/types/format/useList.d.ts.map +1 -0
- package/dist/types/format/useNumber.d.ts +23 -0
- package/dist/types/format/useNumber.d.ts.map +1 -0
- package/dist/types/format/usePercentage.d.ts +17 -0
- package/dist/types/format/usePercentage.d.ts.map +1 -0
- package/dist/types/format/useRelativeTime.d.ts +21 -0
- package/dist/types/format/useRelativeTime.d.ts.map +1 -0
- package/dist/types/format/useUnit.d.ts +19 -0
- package/dist/types/format/useUnit.d.ts.map +1 -0
- package/package.json +25 -30
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-Df1Nt4x_.mjs +0 -75
- package/dist/ContentSelector.vue_vue_type_script_setup_true_lang-RwUsyBxL.js +0 -1
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CcDEyAOE.mjs +0 -68
- package/dist/ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-DJRF1I6m.js +0 -1
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-CvPgk7Z3.mjs +0 -39
- package/dist/EditedContentRenderer.vue_vue_type_script_setup_true_lang-Yqrgst_y.js +0 -1
- package/dist/cjs/server/IntlayerServerProvider.cjs +0 -1
- package/dist/cjs/server/index.cjs +0 -1
- package/dist/cjs/server/serverContext.cjs +0 -1
- package/dist/cjs/server/t.cjs +0 -1
- package/dist/cjs/server/useDictionary.cjs +0 -1
- package/dist/cjs/server/useIntlayer.cjs +0 -1
- package/dist/esm/server/IntlayerServerProvider.mjs +0 -12
- package/dist/esm/server/index.mjs +0 -16
- package/dist/esm/server/serverContext.mjs +0 -34
- package/dist/esm/server/t.mjs +0 -10
- package/dist/esm/server/useDictionary.mjs +0 -10
- package/dist/esm/server/useIntlayer.mjs +0 -10
- package/dist/types/server/IntlayerServerProvider.d.ts +0 -38
- package/dist/types/server/IntlayerServerProvider.d.ts.map +0 -1
- package/dist/types/server/index.d.ts +0 -6
- package/dist/types/server/index.d.ts.map +0 -1
- package/dist/types/server/serverContext.d.ts +0 -35
- package/dist/types/server/serverContext.d.ts.map +0 -1
- package/dist/types/server/t.d.ts +0 -24
- package/dist/types/server/t.d.ts.map +0 -1
- package/dist/types/server/useDictionary.d.ts +0 -19
- package/dist/types/server/useDictionary.d.ts.map +0 -1
- package/dist/types/server/useIntlayer.d.ts +0 -16
- package/dist/types/server/useIntlayer.d.ts.map +0 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { v4 as
|
|
3
|
-
import { inject as
|
|
4
|
-
const { editor: n } =
|
|
1
|
+
import i from "@intlayer/config/built";
|
|
2
|
+
import { v4 as a } from "uuid";
|
|
3
|
+
import { inject as u, reactive as l } from "vue";
|
|
4
|
+
const { editor: n } = i, o = {
|
|
5
5
|
postMessage: () => null,
|
|
6
6
|
allowedOrigins: [
|
|
7
|
-
n
|
|
8
|
-
n
|
|
9
|
-
n
|
|
7
|
+
n?.applicationURL,
|
|
8
|
+
n?.editorURL,
|
|
9
|
+
n?.cmsURL
|
|
10
10
|
],
|
|
11
11
|
senderId: ""
|
|
12
12
|
};
|
|
13
13
|
let t = null;
|
|
14
|
-
const r = Symbol("Communicator"), m = (e = { postMessage: () => null }) => t || (t =
|
|
14
|
+
const r = Symbol("Communicator"), m = (e = { postMessage: () => null }) => t || (t = l({
|
|
15
15
|
...o,
|
|
16
16
|
...e,
|
|
17
|
-
senderId:
|
|
17
|
+
senderId: a()
|
|
18
18
|
}), t), g = (e, s = { postMessage: () => null }) => {
|
|
19
19
|
const c = m(s);
|
|
20
20
|
e.provide(r, c);
|
|
21
21
|
}, C = () => {
|
|
22
22
|
try {
|
|
23
|
-
return
|
|
23
|
+
return u(r, o);
|
|
24
24
|
} catch {
|
|
25
25
|
return console.warn(
|
|
26
26
|
"useCommunicator: inject can only be used in setup(). Returning default communicator."
|
|
@@ -7,7 +7,7 @@ const a = (t) => {
|
|
|
7
7
|
const s = () => {
|
|
8
8
|
r -= 1, e && r <= 0 && (e.stop(), o = void 0, e = void 0);
|
|
9
9
|
};
|
|
10
|
-
return (...n) => (r += 1, e || (e = p(!0), o = e.run(() => t(...n))), u(s), o);
|
|
10
|
+
return ((...n) => (r += 1, e || (e = p(!0), o = e.run(() => t(...n))), u(s), o));
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
13
|
a as createSharedComposable,
|
|
@@ -1,43 +1,42 @@
|
|
|
1
|
-
import { getContentNodeByKeyPath as
|
|
2
|
-
import { MessageKey as
|
|
3
|
-
import { ref as
|
|
4
|
-
import { createSharedComposable as
|
|
5
|
-
import { useCrossFrameState as
|
|
1
|
+
import { getContentNodeByKeyPath as s } from "@intlayer/core";
|
|
2
|
+
import { MessageKey as a } from "@intlayer/editor";
|
|
3
|
+
import { ref as c, readonly as C, inject as E, watch as d } from "vue";
|
|
4
|
+
import { createSharedComposable as l } from "./createSharedComposable.mjs";
|
|
5
|
+
import { useCrossFrameState as u } from "./useCrossFrameState.mjs";
|
|
6
6
|
let o = null;
|
|
7
|
-
const
|
|
7
|
+
const i = Symbol("EditedContent"), m = () => {
|
|
8
8
|
if (o) return o;
|
|
9
|
-
const t =
|
|
9
|
+
const t = c({});
|
|
10
10
|
return o = {
|
|
11
|
-
editedContent:
|
|
11
|
+
editedContent: C(t),
|
|
12
12
|
getEditedContentValue: (e, r) => {
|
|
13
|
-
|
|
14
|
-
const n = (i = (d = t.value) == null ? void 0 : d[e]) == null ? void 0 : i.content;
|
|
13
|
+
const n = t.value?.[e]?.content;
|
|
15
14
|
if (n)
|
|
16
|
-
return
|
|
15
|
+
return s(n, r);
|
|
17
16
|
},
|
|
18
17
|
setEditedContent: (e) => {
|
|
19
18
|
t.value = e;
|
|
20
19
|
}
|
|
21
20
|
}, o;
|
|
22
|
-
},
|
|
23
|
-
const e =
|
|
24
|
-
t.provide(
|
|
25
|
-
},
|
|
26
|
-
const t =
|
|
21
|
+
}, _ = (t) => {
|
|
22
|
+
const e = m();
|
|
23
|
+
t.provide(i, e);
|
|
24
|
+
}, y = l(() => {
|
|
25
|
+
const t = E(i);
|
|
27
26
|
if (!t)
|
|
28
27
|
throw new Error("EditedContent state not found");
|
|
29
|
-
const [e, r] =
|
|
30
|
-
|
|
28
|
+
const [e, r] = u(
|
|
29
|
+
a.INTLAYER_EDITED_CONTENT_CHANGED,
|
|
31
30
|
{}
|
|
32
31
|
);
|
|
33
|
-
return
|
|
32
|
+
return d(e, (n) => {
|
|
34
33
|
t.editedContent.value = n ?? {};
|
|
35
|
-
}),
|
|
34
|
+
}), d(t, (n) => {
|
|
36
35
|
r(n.editedContent.value);
|
|
37
36
|
}), t;
|
|
38
37
|
});
|
|
39
38
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
m as createEditedContentClient,
|
|
40
|
+
_ as installEditedContent,
|
|
41
|
+
y as useEditedContent
|
|
43
42
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as e } from "../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { _ as e } from "../../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CBP8x_i1.mjs";
|
|
2
2
|
import { installIntlayerEditor as a } from "./installIntlayerEditor.mjs";
|
|
3
3
|
export {
|
|
4
4
|
e as ContentSelectorWrapper,
|
|
@@ -1,31 +1,30 @@
|
|
|
1
|
-
import { compareUrls as
|
|
2
|
-
import { onScopeDispose as
|
|
3
|
-
import { useCommunicator as
|
|
4
|
-
const
|
|
5
|
-
let
|
|
1
|
+
import { compareUrls as u } from "@intlayer/editor";
|
|
2
|
+
import { onScopeDispose as f, getCurrentInstance as d } from "vue";
|
|
3
|
+
import { useCommunicator as p } from "./communicator.mjs";
|
|
4
|
+
const o = /* @__PURE__ */ new Map();
|
|
5
|
+
let c = !1;
|
|
6
|
+
function m(e, t) {
|
|
7
|
+
let s = o.get(e);
|
|
8
|
+
s || (s = /* @__PURE__ */ new Set(), o.set(e, s)), s.add(t);
|
|
9
|
+
}
|
|
6
10
|
function l(e, t) {
|
|
7
|
-
|
|
8
|
-
s
|
|
11
|
+
const s = o.get(e);
|
|
12
|
+
s && (s.delete(t), s.size === 0 && o.delete(e));
|
|
9
13
|
}
|
|
10
14
|
function w(e, t) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
u || window && (window.addEventListener("message", (s) => {
|
|
16
|
-
var i;
|
|
17
|
-
const { type: o, data: n, senderId: c } = s.data ?? {};
|
|
18
|
-
o && c !== t && (!e || e.includes("*") || e.some((a) => f(a, s.origin))) && ((i = r.get(o)) == null || i.forEach((a) => a(n)));
|
|
19
|
-
}), u = !0);
|
|
15
|
+
c || window && (window.addEventListener("message", (s) => {
|
|
16
|
+
const { type: n, data: i, senderId: a } = s.data ?? {};
|
|
17
|
+
n && a !== t && (!e || e.includes("*") || e.some((r) => u(r, s.origin))) && o.get(n)?.forEach((r) => r(i));
|
|
18
|
+
}), c = !0);
|
|
20
19
|
}
|
|
21
|
-
const
|
|
22
|
-
const { allowedOrigins: s, postMessage:
|
|
23
|
-
return
|
|
20
|
+
const L = (e, t) => {
|
|
21
|
+
const { allowedOrigins: s, postMessage: n, senderId: i } = p();
|
|
22
|
+
return w(s, i), t ? (m(e, t), f(() => l(e, t))) : d() || console.warn(
|
|
24
23
|
"useCrossFrameMessageListener called outside a component without a callback; nothing to listen for."
|
|
25
|
-
), (
|
|
26
|
-
|
|
24
|
+
), (r) => {
|
|
25
|
+
n({ type: e, data: r, senderId: i });
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
28
|
export {
|
|
30
|
-
|
|
29
|
+
L as useCrossFrameMessageListener
|
|
31
30
|
};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { inject as
|
|
1
|
+
import { inject as d, computed as r } from "vue";
|
|
2
2
|
import { createSharedComposable as i } from "./createSharedComposable.mjs";
|
|
3
3
|
const u = i(
|
|
4
|
-
(
|
|
5
|
-
const
|
|
4
|
+
(e, t, n) => {
|
|
5
|
+
const o = d(
|
|
6
6
|
"editedContentActions",
|
|
7
7
|
null
|
|
8
8
|
);
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
)
|
|
9
|
+
return r(() => o?.getEditedContentValue(
|
|
10
|
+
e,
|
|
11
|
+
t
|
|
12
|
+
) ?? n);
|
|
13
13
|
}
|
|
14
14
|
);
|
|
15
15
|
export {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useCompact as o } from "./useCompact.mjs";
|
|
2
|
+
import { useCurrency as m } from "./useCurrency.mjs";
|
|
3
|
+
import { useDate as p } from "./useDate.mjs";
|
|
4
|
+
import { useList as f } from "./useList.mjs";
|
|
5
|
+
import { useNumber as a } from "./useNumber.mjs";
|
|
6
|
+
import { usePercentage as c } from "./usePercentage.mjs";
|
|
7
|
+
import { useRelativeTime as C } from "./useRelativeTime.mjs";
|
|
8
|
+
import { useUnit as g } from "./useUnit.mjs";
|
|
9
|
+
export {
|
|
10
|
+
o as useCompact,
|
|
11
|
+
m as useCurrency,
|
|
12
|
+
p as useDate,
|
|
13
|
+
f as useList,
|
|
14
|
+
a as useNumber,
|
|
15
|
+
c as usePercentage,
|
|
16
|
+
C as useRelativeTime,
|
|
17
|
+
g as useUnit
|
|
18
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { compact as e } from "@intlayer/core";
|
|
2
|
+
import { inject as l, computed as r } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as m } from "../client/installIntlayer.mjs";
|
|
4
|
+
const i = () => {
|
|
5
|
+
const t = l(m);
|
|
6
|
+
return r(() => {
|
|
7
|
+
const c = t.locale.value;
|
|
8
|
+
return (...o) => e(o[0], {
|
|
9
|
+
...o[1],
|
|
10
|
+
locale: o[1]?.locale ?? c
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
i as useCompact
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { currency as c } from "@intlayer/core";
|
|
2
|
+
import { inject as t, computed as l } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as n } from "../client/installIntlayer.mjs";
|
|
4
|
+
const p = () => {
|
|
5
|
+
const e = t(n);
|
|
6
|
+
return l(() => {
|
|
7
|
+
const r = e.locale.value;
|
|
8
|
+
return (...o) => c(o[0], {
|
|
9
|
+
...o[1],
|
|
10
|
+
locale: o[1]?.locale ?? r
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
p as useCurrency
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { date as l } from "@intlayer/core";
|
|
2
|
+
import { inject as r, computed as c } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as m } from "../client/installIntlayer.mjs";
|
|
4
|
+
const p = () => {
|
|
5
|
+
const e = r(m);
|
|
6
|
+
return c(() => {
|
|
7
|
+
const t = e.locale.value;
|
|
8
|
+
return (...o) => l(o[0], {
|
|
9
|
+
...o[1],
|
|
10
|
+
locale: o[1]?.locale ?? t
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
p as useDate
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { list as l } from "@intlayer/core";
|
|
2
|
+
import { inject as r, computed as c } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as i } from "../client/installIntlayer.mjs";
|
|
4
|
+
const u = () => {
|
|
5
|
+
const t = r(i);
|
|
6
|
+
return c(() => {
|
|
7
|
+
const e = t.locale.value;
|
|
8
|
+
return (...o) => l(o[0], {
|
|
9
|
+
...o[1],
|
|
10
|
+
locale: o[1]?.locale ?? e
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
u as useList
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { number as t } from "@intlayer/core";
|
|
2
|
+
import { inject as l, computed as c } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as m } from "../client/installIntlayer.mjs";
|
|
4
|
+
const p = () => {
|
|
5
|
+
const e = l(m);
|
|
6
|
+
return c(() => {
|
|
7
|
+
const r = e.locale.value;
|
|
8
|
+
return (...o) => t(o[0], {
|
|
9
|
+
...o[1],
|
|
10
|
+
locale: o[1]?.locale ?? r
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
p as useNumber
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { percentage as r } from "@intlayer/core";
|
|
2
|
+
import { inject as c, computed as l } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as n } from "../client/installIntlayer.mjs";
|
|
4
|
+
const i = () => {
|
|
5
|
+
const o = c(n);
|
|
6
|
+
return l(() => {
|
|
7
|
+
const t = o.locale.value;
|
|
8
|
+
return (...e) => r(e[0], {
|
|
9
|
+
...e[1],
|
|
10
|
+
locale: e[1]?.locale ?? t
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
i as usePercentage
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { relativeTime as l } from "@intlayer/core";
|
|
2
|
+
import { inject as r, computed as c } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as i } from "../client/installIntlayer.mjs";
|
|
4
|
+
const p = () => {
|
|
5
|
+
const o = r(i);
|
|
6
|
+
return c(() => {
|
|
7
|
+
const t = o.locale.value;
|
|
8
|
+
return (...e) => l(e[0], e[1], {
|
|
9
|
+
...e[2],
|
|
10
|
+
locale: e[2]?.locale ?? t
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
p as useRelativeTime
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { units as l } from "@intlayer/core";
|
|
2
|
+
import { inject as r, computed as c } from "vue";
|
|
3
|
+
import { INTLAYER_SYMBOL as n } from "../client/installIntlayer.mjs";
|
|
4
|
+
const p = () => {
|
|
5
|
+
const t = r(n);
|
|
6
|
+
return c(() => {
|
|
7
|
+
const e = t.locale.value;
|
|
8
|
+
return (...o) => l(o[0], {
|
|
9
|
+
...o[1],
|
|
10
|
+
locale: o[1]?.locale ?? e
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
p as useUnit
|
|
16
|
+
};
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { getMarkdownMetadata as u, NodeType as
|
|
2
|
-
import { h as
|
|
3
|
-
import { _ as l } from "../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import { getMarkdownMetadata as u, NodeType as o } from "@intlayer/core";
|
|
2
|
+
import { h as y } from "vue";
|
|
3
|
+
import { _ as l } from "../ContentSelectorWrapper.vue_vue_type_script_setup_true_lang-CBP8x_i1.mjs";
|
|
4
4
|
import "./editor/installIntlayerEditor.mjs";
|
|
5
5
|
import { useMarkdown as p } from "./markdown/installIntlayerMarkdown.mjs";
|
|
6
|
-
import { renderIntlayerNode as
|
|
6
|
+
import { renderIntlayerNode as i } from "./renderIntlayerNode.mjs";
|
|
7
7
|
const b = {
|
|
8
8
|
id: "intlayer-node-plugin",
|
|
9
9
|
canHandle: (n) => typeof n == "bigint" || typeof n == "string" || typeof n == "number",
|
|
10
|
-
transform: (n, { children: t, ...r }) =>
|
|
10
|
+
transform: (n, { children: t, ...r }) => i({
|
|
11
11
|
...r,
|
|
12
12
|
value: t,
|
|
13
|
-
children: () =>
|
|
13
|
+
children: () => y(
|
|
14
14
|
// EditorSelectorRenderer, // Maximum stack size exceeded
|
|
15
15
|
l,
|
|
16
16
|
{
|
|
@@ -27,14 +27,14 @@ const b = {
|
|
|
27
27
|
canHandle: (n) => typeof n == "string",
|
|
28
28
|
transform: (n, t, r) => {
|
|
29
29
|
const {
|
|
30
|
-
plugins:
|
|
30
|
+
plugins: d,
|
|
31
31
|
// Removed to avoid next error - Functions cannot be passed directly to Client Components
|
|
32
32
|
...e
|
|
33
33
|
} = t, m = u(n), s = r(m, {
|
|
34
34
|
plugins: [{
|
|
35
35
|
id: "markdown-metadata-plugin",
|
|
36
36
|
canHandle: (a) => typeof a == "string" || typeof a == "number" || typeof a == "boolean" || !a,
|
|
37
|
-
transform: (a, c) =>
|
|
37
|
+
transform: (a, c) => i({
|
|
38
38
|
...c,
|
|
39
39
|
value: a,
|
|
40
40
|
children: n
|
|
@@ -43,10 +43,10 @@ const b = {
|
|
|
43
43
|
dictionaryKey: e.dictionaryKey,
|
|
44
44
|
keyPath: []
|
|
45
45
|
});
|
|
46
|
-
return
|
|
46
|
+
return i({
|
|
47
47
|
...t,
|
|
48
48
|
value: n,
|
|
49
|
-
children: () =>
|
|
49
|
+
children: () => y(
|
|
50
50
|
// EditorSelectorRenderer, // Maximum stack size exceeded
|
|
51
51
|
l,
|
|
52
52
|
{
|
|
@@ -67,18 +67,18 @@ const b = {
|
|
|
67
67
|
}
|
|
68
68
|
}, H = {
|
|
69
69
|
id: "markdown-plugin",
|
|
70
|
-
canHandle: (n) => typeof n == "object" &&
|
|
70
|
+
canHandle: (n) => typeof n == "object" && n?.nodeType === o.Markdown,
|
|
71
71
|
transform: (n, t, r) => {
|
|
72
|
-
const
|
|
72
|
+
const d = [
|
|
73
73
|
...t.keyPath,
|
|
74
74
|
{
|
|
75
|
-
type:
|
|
75
|
+
type: o.Markdown
|
|
76
76
|
}
|
|
77
|
-
], e = n[
|
|
77
|
+
], e = n[o.Markdown];
|
|
78
78
|
return r(e, {
|
|
79
79
|
...t,
|
|
80
80
|
children: e,
|
|
81
|
-
keyPath:
|
|
81
|
+
keyPath: d,
|
|
82
82
|
plugins: [f, ...t.plugins ?? []]
|
|
83
83
|
});
|
|
84
84
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LocalesValues } from '@intlayer/config/client';
|
|
2
2
|
import { Dictionary } from '@intlayer/core';
|
|
3
|
+
import { ToRefs } from 'vue';
|
|
3
4
|
import { DeepTransformContent } from '../plugins';
|
|
4
|
-
export declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?: LocalesValues) => DeepTransformContent<T["content"]
|
|
5
|
+
export declare const useDictionary: <T extends Dictionary>(dictionary: T, locale?: LocalesValues) => ToRefs<DeepTransformContent<T["content"]>>;
|
|
5
6
|
//# sourceMappingURL=useDictionary.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EASL,KAAK,MAAM,EACZ,MAAM,KAAK,CAAC;AAEb,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGlD,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,UAAU,EAChD,YAAY,CAAC,EACb,SAAS,aAAa,KACrB,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CA0C3C,CAAC"}
|
|
@@ -5,5 +5,5 @@ import { Dictionary, DictionaryKeys, LanguageContent } from '@intlayer/core';
|
|
|
5
5
|
*
|
|
6
6
|
* If the locale is not provided, it will use the locale from the client context
|
|
7
7
|
*/
|
|
8
|
-
export declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: LanguageContent<() => Promise<T>>, key: K, locale?: LocalesValues) => import('@intlayer/core').DeepTransformContent<T["content"], import('..').IInterpreterPluginState
|
|
8
|
+
export declare const useDictionaryDynamic: <T extends Dictionary, K extends DictionaryKeys>(dictionaryPromise: LanguageContent<() => Promise<T>>, key: K, locale?: LocalesValues) => import('vue').ToRefs<import('@intlayer/core').DeepTransformContent<T["content"], import('..').IInterpreterPluginState>>;
|
|
9
9
|
//# sourceMappingURL=useDictionaryDynamic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryDynamic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAMxB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,cAAc,EAExB,mBAAmB,eAAe,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EACpD,KAAK,CAAC,EACN,SAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryDynamic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAMxB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,cAAc,EAExB,mBAAmB,eAAe,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,EACpD,KAAK,CAAC,EACN,SAAS,aAAa,4HAiBvB,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { LocalesValues } from '@intlayer/config/client';
|
|
2
2
|
import { DictionaryKeys } from '@intlayer/core';
|
|
3
3
|
import { IntlayerDictionaryTypesConnector } from 'intlayer';
|
|
4
|
+
import { MaybeRefOrGetter, ToRefs } from 'vue';
|
|
4
5
|
import { DeepTransformContent } from '../plugins';
|
|
5
|
-
/** guard utility — true only for objects generated by `renderIntlayerNode()` */
|
|
6
6
|
export declare const isUpdatableNode: (val: unknown) => val is {
|
|
7
7
|
__update: (n: unknown) => void;
|
|
8
8
|
};
|
|
9
|
-
export declare const useIntlayer: <T extends DictionaryKeys>(key: T
|
|
9
|
+
export declare const useIntlayer: <T extends DictionaryKeys>(key: MaybeRefOrGetter<T>, locale?: MaybeRefOrGetter<LocalesValues | null | undefined>) => ToRefs<DeepTransformContent<IntlayerDictionaryTypesConnector[T]["content"]>>;
|
|
10
10
|
//# sourceMappingURL=useIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/client/useIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/client/useIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EASL,KAAK,gBAAgB,EACrB,KAAK,MAAM,EACZ,MAAM,KAAK,CAAC;AAEb,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGlD,eAAO,MAAM,eAAe,GAC1B,KAAK,OAAO,KACX,GAAG,IAAI;IAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;CAGG,CAAC;AAE9C,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,cAAc,EAClD,KAAK,gBAAgB,CAAC,CAAC,CAAC,EACxB,SAAS,gBAAgB,CAAC,aAAa,GAAG,IAAI,GAAG,SAAS,CAAC,KAC1D,MAAM,CACP,oBAAoB,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CA4CrE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { useCompact } from './useCompact';
|
|
2
|
+
export { useCurrency } from './useCurrency';
|
|
3
|
+
export { useDate } from './useDate';
|
|
4
|
+
export { useList } from './useList';
|
|
5
|
+
export { useNumber } from './useNumber';
|
|
6
|
+
export { usePercentage } from './usePercentage';
|
|
7
|
+
export { useRelativeTime } from './useRelativeTime';
|
|
8
|
+
export { useUnit } from './useUnit';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/format/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue composable that provides a compact number formatter
|
|
3
|
+
* bound to the current application locale.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```vue
|
|
7
|
+
* const formatCompact = useCompact();
|
|
8
|
+
* formatCompact(1500); // "1.5K"
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const useCompact: () => import('vue').ComputedRef<(value: string | number, options?: (Intl.NumberFormatOptions & {
|
|
12
|
+
locale?: import('intlayer').LocalesValues;
|
|
13
|
+
}) | undefined) => string>;
|
|
14
|
+
//# sourceMappingURL=useCompact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCompact.d.ts","sourceRoot":"","sources":["../../../src/format/useCompact.ts"],"names":[],"mappings":"AAOA;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU;;0BAYtB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue composable that provides a currency formatter
|
|
3
|
+
* bound to the current application locale.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```vue
|
|
7
|
+
* const formatCurrency = useCurrency();
|
|
8
|
+
*
|
|
9
|
+
* formatCurrency(1500, { currency: "USD" });
|
|
10
|
+
* // "$1,500.00"
|
|
11
|
+
*
|
|
12
|
+
* formatCurrency(1500, { currency: "EUR", locale: "de-DE" });
|
|
13
|
+
* // "1.500,00 €"
|
|
14
|
+
*
|
|
15
|
+
* formatCurrency(9876543.21, {
|
|
16
|
+
* currency: "JPY",
|
|
17
|
+
* fractionDigits: 0,
|
|
18
|
+
* });
|
|
19
|
+
* // "¥9,876,543"
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const useCurrency: () => import('vue').ComputedRef<(value: string | number, options?: (Intl.NumberFormatOptions & {
|
|
23
|
+
locale?: import('intlayer').LocalesValues;
|
|
24
|
+
}) | undefined) => string>;
|
|
25
|
+
//# sourceMappingURL=useCurrency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCurrency.d.ts","sourceRoot":"","sources":["../../../src/format/useCurrency.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,WAAW;;0BAYvB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue composable that provides a date/time formatter
|
|
3
|
+
* bound to the current application locale.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```vue
|
|
7
|
+
* const formatDate = useDate();
|
|
8
|
+
*
|
|
9
|
+
* formatDate(new Date(), "short");
|
|
10
|
+
* // e.g., "08/02/25, 14:30"
|
|
11
|
+
*
|
|
12
|
+
* formatDate("2025-08-02T14:30:00Z", {
|
|
13
|
+
* locale: "fr",
|
|
14
|
+
* month: "long",
|
|
15
|
+
* day: "numeric"
|
|
16
|
+
* });
|
|
17
|
+
* // "2 août"
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const useDate: () => import('vue').ComputedRef<(date: string | number | Date, options?: (Intl.DateTimeFormatOptions & {
|
|
21
|
+
locale?: import('intlayer').LocalesValues;
|
|
22
|
+
}) | undefined) => string>;
|
|
23
|
+
//# sourceMappingURL=useDate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDate.d.ts","sourceRoot":"","sources":["../../../src/format/useDate.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,OAAO;;0BAYnB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue composable that provides a list formatter
|
|
3
|
+
* bound to the current application locale.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```vue
|
|
7
|
+
* const formatList = useList();
|
|
8
|
+
*
|
|
9
|
+
* formatList(['apple', 'banana', 'orange']);
|
|
10
|
+
* // "apple, banana, and orange"
|
|
11
|
+
*
|
|
12
|
+
* formatList(['red', 'green', 'blue'], { type: 'disjunction' });
|
|
13
|
+
* // "red, green, or blue"
|
|
14
|
+
*
|
|
15
|
+
* formatList([1, 2, 3], { type: 'unit', locale: 'de-DE' });
|
|
16
|
+
* // "1, 2 und 3"
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const useList: () => import('vue').ComputedRef<(values: (string | number)[], options?: (Intl.ListFormatOptions & {
|
|
20
|
+
locale?: import('intlayer').LocalesValues;
|
|
21
|
+
}) | undefined) => string>;
|
|
22
|
+
//# sourceMappingURL=useList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useList.d.ts","sourceRoot":"","sources":["../../../src/format/useList.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,OAAO;;0BAYnB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue composable that provides a localized number formatter.
|
|
3
|
+
*
|
|
4
|
+
* Uses the current locale from the IntlayerProvider and returns
|
|
5
|
+
* a function that can be used to format numbers consistently
|
|
6
|
+
* according to the user's locale.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```vue
|
|
10
|
+
* const formatNumber = useNumber();
|
|
11
|
+
*
|
|
12
|
+
* formatNumber(12345);
|
|
13
|
+
* // e.g. "12,345" (en-US)
|
|
14
|
+
* // e.g. "12 345" (fr-FR)
|
|
15
|
+
*
|
|
16
|
+
* formatNumber(0.75, { style: "percent" });
|
|
17
|
+
* // e.g. "75%"
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const useNumber: () => import('vue').ComputedRef<(value: string | number, options?: (Intl.NumberFormatOptions & {
|
|
21
|
+
locale?: import('intlayer').LocalesValues;
|
|
22
|
+
}) | undefined) => string>;
|
|
23
|
+
//# sourceMappingURL=useNumber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNumber.d.ts","sourceRoot":"","sources":["../../../src/format/useNumber.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS;;0BAYrB,CAAC"}
|