vue-intlayer 8.2.2 → 8.2.4

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.
Files changed (59) hide show
  1. package/dist/cjs/client/index.cjs +1 -1
  2. package/dist/cjs/client/installIntlayer.cjs +1 -1
  3. package/dist/cjs/client/useDictionary.cjs +1 -1
  4. package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
  5. package/dist/cjs/client/useIntlayer.cjs +1 -1
  6. package/dist/cjs/client/useLocale.cjs +1 -1
  7. package/dist/cjs/editor/ContentSelectorWrapper.cjs +1 -1
  8. package/dist/cjs/editor/EditorSelectorRenderer.cjs +1 -1
  9. package/dist/cjs/editor/editorLocale.cjs +1 -1
  10. package/dist/cjs/editor/index.cjs +1 -1
  11. package/dist/cjs/editor/useEditor.cjs +1 -1
  12. package/dist/cjs/format/useCompact.cjs +1 -1
  13. package/dist/cjs/format/useCurrency.cjs +1 -1
  14. package/dist/cjs/format/useDate.cjs +1 -1
  15. package/dist/cjs/format/useIntl.cjs +1 -1
  16. package/dist/cjs/format/useList.cjs +1 -1
  17. package/dist/cjs/format/useNumber.cjs +1 -1
  18. package/dist/cjs/format/usePercentage.cjs +1 -1
  19. package/dist/cjs/format/useRelativeTime.cjs +1 -1
  20. package/dist/cjs/format/useUnit.cjs +1 -1
  21. package/dist/cjs/getDictionary.cjs +1 -1
  22. package/dist/cjs/getIntlayer.cjs +1 -1
  23. package/dist/cjs/index.cjs +1 -1
  24. package/dist/cjs/markdown/MarkdownRenderer.cjs +1 -1
  25. package/dist/cjs/markdown/installIntlayerMarkdown.cjs +1 -1
  26. package/dist/cjs/plugins.cjs +1 -1
  27. package/dist/esm/client/index.mjs +1 -1
  28. package/dist/esm/client/installIntlayer.mjs +1 -1
  29. package/dist/esm/client/useDictionary.mjs +1 -1
  30. package/dist/esm/client/useDictionaryAsync.mjs +1 -1
  31. package/dist/esm/client/useIntlayer.mjs +1 -1
  32. package/dist/esm/client/useLocale.mjs +1 -1
  33. package/dist/esm/editor/ContentSelectorWrapper.mjs +1 -1
  34. package/dist/esm/editor/EditorSelectorRenderer.mjs +1 -1
  35. package/dist/esm/editor/editorLocale.mjs +1 -1
  36. package/dist/esm/editor/index.mjs +1 -1
  37. package/dist/esm/editor/useEditor.mjs +1 -1
  38. package/dist/esm/format/useCompact.mjs +1 -1
  39. package/dist/esm/format/useCurrency.mjs +1 -1
  40. package/dist/esm/format/useDate.mjs +1 -1
  41. package/dist/esm/format/useIntl.mjs +1 -1
  42. package/dist/esm/format/useList.mjs +1 -1
  43. package/dist/esm/format/useNumber.mjs +1 -1
  44. package/dist/esm/format/usePercentage.mjs +1 -1
  45. package/dist/esm/format/useRelativeTime.mjs +1 -1
  46. package/dist/esm/format/useUnit.mjs +1 -1
  47. package/dist/esm/getDictionary.mjs +1 -1
  48. package/dist/esm/getIntlayer.mjs +1 -1
  49. package/dist/esm/index.mjs +1 -1
  50. package/dist/esm/markdown/MarkdownRenderer.mjs +46 -34
  51. package/dist/esm/markdown/installIntlayerMarkdown.mjs +59 -60
  52. package/dist/esm/plugins.mjs +1 -1
  53. package/dist/plugins-DzWUv12j.mjs +293 -0
  54. package/dist/plugins-JE2C_MXR.js +1 -0
  55. package/dist/types/markdown/MarkdownRenderer.d.ts +3 -7
  56. package/dist/types/markdown/installIntlayerMarkdown.d.ts +18 -31
  57. package/package.json +10 -10
  58. package/dist/plugins-DMjvMNJp.mjs +0 -287
  59. package/dist/plugins-pJ683VWg.js +0 -1
@@ -1,287 +0,0 @@
1
- import { splitInsertionTemplate as T, getHTML as O } from "@intlayer/core/interpreter";
2
- import { getMarkdownMetadata as H } from "@intlayer/core/markdown";
3
- import { HTML_TAGS as v } from "@intlayer/core/transpiler";
4
- import { NodeType as u } from "@intlayer/types";
5
- import { ref as K, readonly as L, inject as M, watch as S, defineComponent as I, computed as h, unref as j, openBlock as P, createBlock as N, withCtx as R, renderSlot as k, createElementBlock as D, markRaw as A, h as f, Fragment as Y } from "vue";
6
- import { isSameKeyPath as $ } from "@intlayer/core/utils";
7
- import { MessageKey as g } from "@intlayer/editor";
8
- import { _ as B } from "./ContentSelector.vue_vue_type_script_setup_true_lang-CR8kSRs9.mjs";
9
- import { useCommunicator as F } from "./esm/editor/communicator.mjs";
10
- import { useEditorEnabled as C } from "./esm/editor/editorEnabled.mjs";
11
- import { useFocusDictionary as E } from "./esm/editor/focusDictionary.mjs";
12
- import { useConfiguration as U } from "./esm/editor/configuration.mjs";
13
- import { createSharedComposable as _ } from "./esm/editor/createSharedComposable.mjs";
14
- import { useDictionariesRecord as G } from "./esm/editor/dictionariesRecord.mjs";
15
- import V from "@intlayer/config/built";
16
- import { installIntlayerEditor as x } from "./esm/editor/installIntlayerEditor.mjs";
17
- import "./esm/client/useLocaleStorage.mjs";
18
- import "@intlayer/core/localization";
19
- import { useMarkdown as z } from "./esm/markdown/installIntlayerMarkdown.mjs";
20
- import { renderIntlayerNode as m } from "./esm/renderIntlayerNode.mjs";
21
- import { useCrossFrameState as J } from "./esm/editor/useCrossFrameState.mjs";
22
- import { useCrossURLPathSetter as W } from "./esm/editor/useCrossURLPathState.mjs";
23
- import { useIframeClickMerger as q } from "./esm/editor/useIframeClickInterceptor.mjs";
24
- const w = /* @__PURE__ */ Symbol("intlayer");
25
- let y = null;
26
- const Q = (t, e = !0) => {
27
- if (y) return y;
28
- const { defaultLocale: n } = V.internationalization ?? {}, r = K(t ?? n), o = (i) => {
29
- r.value = i;
30
- };
31
- return y = {
32
- locale: L(r),
33
- setLocale: o,
34
- isCookieEnabled: e
35
- }, y;
36
- }, vt = (t, e, n = !0) => {
37
- const r = Q(e, n);
38
- return t.provide(w, r), x(t, r), t;
39
- }, X = _(() => {
40
- const t = M(w);
41
- if (!t)
42
- throw new Error("IntlayerEditor state not found");
43
- const [e, n] = J(
44
- g.INTLAYER_CURRENT_LOCALE
45
- );
46
- return S(
47
- t.locale,
48
- (r) => {
49
- n(r);
50
- },
51
- { immediate: !0 }
52
- ), t;
53
- }), Z = _(() => {
54
- U(), C(), E(), q(), W(), X(), G();
55
- }), tt = {
56
- key: 1,
57
- style: { display: "contents" }
58
- }, b = /* @__PURE__ */ I({
59
- __name: "ContentSelectorWrapper",
60
- props: {
61
- dictionaryKey: {},
62
- keyPath: {},
63
- plugins: {},
64
- locale: {},
65
- dictionaryPath: {},
66
- children: {}
67
- },
68
- setup(t) {
69
- const e = t, n = E(), r = C(), o = F();
70
- Z();
71
- const i = h(
72
- () => e.keyPath.filter((l) => l.type !== u.Translation)
73
- ), a = h(
74
- () => n?.focusedContent.value?.dictionaryKey === e.dictionaryKey && (n?.focusedContent.value.keyPath?.length ?? 0) > 0 && $(
75
- n?.focusedContent.value.keyPath ?? [],
76
- i.value
77
- )
78
- ), s = () => {
79
- n?.setFocusedContent({
80
- dictionaryKey: e.dictionaryKey,
81
- keyPath: i.value
82
- });
83
- }, d = () => {
84
- o?.postMessage({
85
- type: `${g.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
86
- data: {
87
- dictionaryKey: e.dictionaryKey,
88
- keyPath: i.value
89
- }
90
- });
91
- }, c = () => {
92
- o?.postMessage({
93
- type: `${g.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,
94
- data: null
95
- });
96
- };
97
- return (l, p) => j(r)?.enabled.value ? (P(), N(B, {
98
- key: 0,
99
- onPress: s,
100
- isSelecting: a.value,
101
- onHover: d,
102
- onUnhover: c
103
- }, {
104
- default: R(() => [
105
- k(l.$slots, "default")
106
- ]),
107
- _: 3
108
- }, 8, ["isSelecting"])) : (P(), D("span", tt, [
109
- k(l.$slots, "default")
110
- ]));
111
- }
112
- }), Kt = {
113
- id: "intlayer-node-plugin",
114
- canHandle: (t) => typeof t == "bigint" || typeof t == "string" || typeof t == "number",
115
- transform: (t, { children: e, ...n }) => {
116
- const r = (a) => m({
117
- ...n,
118
- value: a,
119
- children: () => f(
120
- // EditorSelectorRenderer, // Maximum stack size exceeded
121
- b,
122
- {
123
- dictionaryKey: n.dictionaryKey,
124
- keyPath: n.keyPath
125
- },
126
- {
127
- default: () => typeof a == "function" ? a() : a
128
- }
129
- )
130
- }), o = r(e);
131
- if (typeof e != "function")
132
- return o;
133
- const i = (...a) => {
134
- const s = e(...a);
135
- return r(s);
136
- };
137
- Object.setPrototypeOf(i, Object.getPrototypeOf(o));
138
- for (const a of Object.getOwnPropertyNames(o)) {
139
- const s = Object.getOwnPropertyDescriptor(o, a);
140
- s && Object.defineProperty(i, a, s);
141
- }
142
- for (const a of Object.getOwnPropertySymbols(o)) {
143
- const s = Object.getOwnPropertyDescriptor(o, a);
144
- s && Object.defineProperty(i, a, s);
145
- }
146
- return A(i);
147
- }
148
- }, et = (t, e) => {
149
- const n = T(t, e);
150
- return n.isSimple ? n.parts : f(Y, null, n.parts);
151
- }, Lt = {
152
- id: "insertion-plugin",
153
- canHandle: (t) => typeof t == "object" && t?.nodeType === u.Insertion,
154
- transform: (t, e, n) => {
155
- const r = [
156
- ...e.keyPath,
157
- {
158
- type: u.Insertion
159
- }
160
- ], o = t[u.Insertion];
161
- return n(o, {
162
- ...e,
163
- children: o,
164
- keyPath: r,
165
- plugins: [{
166
- id: "insertion-string-plugin",
167
- canHandle: (a) => typeof a == "string",
168
- transform: (a, s, d) => {
169
- const c = d(a, {
170
- ...s,
171
- children: a,
172
- plugins: [
173
- ...(e.plugins ?? []).filter(
174
- (l) => l.id !== "intlayer-node-plugin"
175
- )
176
- ]
177
- });
178
- return (l) => {
179
- const p = et(c, l);
180
- return d(p, {
181
- ...s,
182
- plugins: e.plugins,
183
- children: p
184
- });
185
- };
186
- }
187
- }, ...e.plugins ?? []]
188
- });
189
- }
190
- }, nt = {
191
- id: "markdown-string-plugin",
192
- canHandle: (t) => typeof t == "string",
193
- transform: (t, e, n) => {
194
- const {
195
- plugins: r,
196
- // Removed to avoid next error - Functions cannot be passed directly to Client Components
197
- ...o
198
- } = e, i = H(t), s = n(i, {
199
- plugins: [{
200
- id: "markdown-metadata-plugin",
201
- canHandle: (c) => typeof c == "string" || typeof c == "number" || typeof c == "boolean" || !c,
202
- transform: (c, l) => m({
203
- ...l,
204
- value: c,
205
- children: t
206
- })
207
- }],
208
- dictionaryKey: o.dictionaryKey,
209
- keyPath: []
210
- });
211
- return ((c) => m({
212
- ...e,
213
- value: t,
214
- children: () => f(
215
- // EditorSelectorRenderer, // Maximum stack size exceeded
216
- b,
217
- {
218
- dictionaryKey: o.dictionaryKey,
219
- keyPath: o.keyPath
220
- },
221
- {
222
- default: () => {
223
- const { renderMarkdown: l } = z();
224
- return l(t, c);
225
- }
226
- }
227
- ),
228
- additionalProps: {
229
- metadata: s
230
- }
231
- }))();
232
- }
233
- }, Mt = {
234
- id: "markdown-plugin",
235
- canHandle: (t) => typeof t == "object" && t?.nodeType === u.Markdown,
236
- transform: (t, e, n) => {
237
- const r = [
238
- ...e.keyPath,
239
- {
240
- type: u.Markdown
241
- }
242
- ], o = t[u.Markdown];
243
- return n(o, {
244
- ...e,
245
- children: o,
246
- keyPath: r,
247
- plugins: [nt, ...e.plugins ?? []]
248
- });
249
- }
250
- }, ot = () => {
251
- const t = {};
252
- for (const e of v)
253
- t[e] = ({ children: n, ...r }) => f(e, r, n);
254
- return t;
255
- }, rt = ot(), St = {
256
- id: "html-plugin",
257
- canHandle: (t) => typeof t == "object" && t?.nodeType === u.HTML,
258
- transform: (t, e) => {
259
- const n = t[u.HTML];
260
- t.tags;
261
- const r = (o) => {
262
- const i = {
263
- ...rt,
264
- ...o
265
- };
266
- return O(n, i);
267
- };
268
- return m({
269
- ...e,
270
- value: n,
271
- children: (o) => r(o)
272
- });
273
- }
274
- };
275
- export {
276
- w as I,
277
- b as _,
278
- vt as a,
279
- Kt as b,
280
- Q as c,
281
- nt as d,
282
- X as e,
283
- St as h,
284
- Lt as i,
285
- Mt as m,
286
- Z as u
287
- };
@@ -1 +0,0 @@
1
- "use strict";const _=require("@intlayer/core/interpreter"),S=require("@intlayer/core/markdown"),b=require("@intlayer/core/transpiler"),d=require("@intlayer/types"),i=require("vue"),q=require("@intlayer/core/utils"),m=require("@intlayer/editor"),L=require("./ContentSelector.vue_vue_type_script_setup_true_lang-87sjUiJI.js"),M=require("./cjs/editor/communicator.cjs"),k=require("./cjs/editor/editorEnabled.cjs"),C=require("./cjs/editor/focusDictionary.cjs"),v=require("./cjs/editor/configuration.cjs"),E=require("./cjs/editor/createSharedComposable.cjs"),O=require("./cjs/editor/dictionariesRecord.cjs"),K=require("@intlayer/config/built"),H=require("./cjs/editor/installIntlayerEditor.cjs");require("./cjs/client/useLocaleStorage.cjs");require("@intlayer/core/localization");const R=require("./cjs/markdown/installIntlayerMarkdown.cjs"),g=require("./cjs/renderIntlayerNode.cjs"),D=require("./cjs/editor/useCrossFrameState.cjs"),j=require("./cjs/editor/useCrossURLPathState.cjs"),A=require("./cjs/editor/useIframeClickInterceptor.cjs"),h=Symbol("intlayer");let p=null;const T=(e,t=!0)=>{if(p)return p;const{defaultLocale:n}=K.internationalization??{},o=i.ref(e??n),r=s=>{o.value=s};return p={locale:i.readonly(o),setLocale:r,isCookieEnabled:t},p},Y=(e,t,n=!0)=>{const o=T(t,n);return e.provide(h,o),H.installIntlayerEditor(e,o),e},w=E.createSharedComposable(()=>{const e=i.inject(h);if(!e)throw new Error("IntlayerEditor state not found");const[t,n]=D.useCrossFrameState(m.MessageKey.INTLAYER_CURRENT_LOCALE);return i.watch(e.locale,o=>{n(o)},{immediate:!0}),e}),I=E.createSharedComposable(()=>{v.useConfiguration(),k.useEditorEnabled(),C.useFocusDictionary(),A.useIframeClickMerger(),j.useCrossURLPathSetter(),w(),O.useDictionariesRecord()}),B={key:1,style:{display:"contents"}},P=i.defineComponent({__name:"ContentSelectorWrapper",props:{dictionaryKey:{},keyPath:{},plugins:{},locale:{},dictionaryPath:{},children:{}},setup(e){const t=e,n=C.useFocusDictionary(),o=k.useEditorEnabled(),r=M.useCommunicator();I();const s=i.computed(()=>t.keyPath.filter(u=>u.type!==d.NodeType.Translation)),a=i.computed(()=>n?.focusedContent.value?.dictionaryKey===t.dictionaryKey&&(n?.focusedContent.value.keyPath?.length??0)>0&&q.isSameKeyPath(n?.focusedContent.value.keyPath??[],s.value)),c=()=>{n?.setFocusedContent({dictionaryKey:t.dictionaryKey,keyPath:s.value})},y=()=>{r?.postMessage({type:`${m.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:{dictionaryKey:t.dictionaryKey,keyPath:s.value}})},l=()=>{r?.postMessage({type:`${m.MessageKey.INTLAYER_HOVERED_CONTENT_CHANGED}/post`,data:null})};return(u,f)=>i.unref(o)?.enabled.value?(i.openBlock(),i.createBlock(L._sfc_main,{key:0,onPress:c,isSelecting:a.value,onHover:y,onUnhover:l},{default:i.withCtx(()=>[i.renderSlot(u.$slots,"default")]),_:3},8,["isSelecting"])):(i.openBlock(),i.createElementBlock("span",B,[i.renderSlot(u.$slots,"default")]))}}),F={id:"intlayer-node-plugin",canHandle:e=>typeof e=="bigint"||typeof e=="string"||typeof e=="number",transform:(e,{children:t,...n})=>{const o=a=>g.renderIntlayerNode({...n,value:a,children:()=>i.h(P,{dictionaryKey:n.dictionaryKey,keyPath:n.keyPath},{default:()=>typeof a=="function"?a():a})}),r=o(t);if(typeof t!="function")return r;const s=(...a)=>{const c=t(...a);return o(c)};Object.setPrototypeOf(s,Object.getPrototypeOf(r));for(const a of Object.getOwnPropertyNames(r)){const c=Object.getOwnPropertyDescriptor(r,a);c&&Object.defineProperty(s,a,c)}for(const a of Object.getOwnPropertySymbols(r)){const c=Object.getOwnPropertyDescriptor(r,a);c&&Object.defineProperty(s,a,c)}return i.markRaw(s)}},U=(e,t)=>{const n=_.splitInsertionTemplate(e,t);return n.isSimple?n.parts:i.h(i.Fragment,null,n.parts)},$={id:"insertion-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===d.NodeType.Insertion,transform:(e,t,n)=>{const o=[...t.keyPath,{type:d.NodeType.Insertion}],r=e[d.NodeType.Insertion];return n(r,{...t,children:r,keyPath:o,plugins:[{id:"insertion-string-plugin",canHandle:a=>typeof a=="string",transform:(a,c,y)=>{const l=y(a,{...c,children:a,plugins:[...(t.plugins??[]).filter(u=>u.id!=="intlayer-node-plugin")]});return u=>{const f=U(l,u);return y(f,{...c,plugins:t.plugins,children:f})}}},...t.plugins??[]]})}},N={id:"markdown-string-plugin",canHandle:e=>typeof e=="string",transform:(e,t,n)=>{const{plugins:o,...r}=t,s=S.getMarkdownMetadata(e),c=n(s,{plugins:[{id:"markdown-metadata-plugin",canHandle:l=>typeof l=="string"||typeof l=="number"||typeof l=="boolean"||!l,transform:(l,u)=>g.renderIntlayerNode({...u,value:l,children:e})}],dictionaryKey:r.dictionaryKey,keyPath:[]});return(l=>g.renderIntlayerNode({...t,value:e,children:()=>i.h(P,{dictionaryKey:r.dictionaryKey,keyPath:r.keyPath},{default:()=>{const{renderMarkdown:u}=R.useMarkdown();return u(e,l)}}),additionalProps:{metadata:c}}))()}},G={id:"markdown-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===d.NodeType.Markdown,transform:(e,t,n)=>{const o=[...t.keyPath,{type:d.NodeType.Markdown}],r=e[d.NodeType.Markdown];return n(r,{...t,children:r,keyPath:o,plugins:[N,...t.plugins??[]]})}},V=()=>{const e={};for(const t of b.HTML_TAGS)e[t]=({children:n,...o})=>i.h(t,o,n);return e},z=V(),J={id:"html-plugin",canHandle:e=>typeof e=="object"&&e?.nodeType===d.NodeType.HTML,transform:(e,t)=>{const n=e[d.NodeType.HTML];e.tags;const o=r=>{const s={...z,...r};return _.getHTML(n,s)};return g.renderIntlayerNode({...t,value:n,children:r=>o(r)})}};exports.INTLAYER_SYMBOL=h;exports._sfc_main=P;exports.createIntlayerClient=T;exports.htmlPlugin=J;exports.insertionPlugin=$;exports.installIntlayer=Y;exports.intlayerNodePlugins=F;exports.markdownPlugin=G;exports.markdownStringPlugin=N;exports.useEditor=I;exports.useEditorLocale=w;