@colegium_dev/vue3-unlayer-embed 1.0.15 → 1.1.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/index.d.ts CHANGED
@@ -39,6 +39,13 @@ message: string;
39
39
  unlayerIframe: HTMLIFrameElement;
40
40
  }, HTMLDivElement>;
41
41
 
42
+ /**
43
+ * Monta el editor completo de Unlayer (iframe `?module=informes`) dentro de `container` y
44
+ * devuelve un objeto con la misma API que `window.unlayer`. Las llamadas hechas antes de que
45
+ * el iframe esté listo se encolan y se envían en orden.
46
+ */
47
+ export declare function mountUnlayerIframe(container: HTMLElement, options?: UnlayerIframeOptions): UnlayerProxy;
48
+
42
49
  declare type TemplateConfig = {
43
50
  form: Array<TemplateContentForm>;
44
51
  design: object;
@@ -55,4 +62,27 @@ declare type TemplateContentForm = {
55
62
  value: string;
56
63
  };
57
64
 
65
+ export declare type UnlayerIframeOptions = {
66
+ /** URL del iframe publicado. Por defecto, producción. */
67
+ iframeUrl?: string;
68
+ /**
69
+ * Prefijos de `type` de los mensajes propios que se reenvían entre la app y Unlayer
70
+ * (p. ej. `['gzd']` para los `postMessage` de los `customJS` de Informes).
71
+ */
72
+ relayPrefixes?: string[];
73
+ /** El iframe rechazó el dominio de la app o no pudo cargar Unlayer. */
74
+ onDenied?: (message: string) => void;
75
+ };
76
+
77
+ /**
78
+ * Sustituto de `window.unlayer`: cualquier método (`init`, `loadDesign`, `exportHtml`,
79
+ * `addEventListener`, `registerCallback`…) se ejecuta en el Unlayer del iframe.
80
+ * Los métodos no devuelven valor: los resultados llegan por callback, como en Unlayer.
81
+ */
82
+ export declare type UnlayerProxy = {
83
+ [method: string]: (...args: any[]) => void;
84
+ /** Destruye el editor y quita el iframe. */
85
+ destroy: () => void;
86
+ };
87
+
58
88
  export { }
@@ -1,127 +1,204 @@
1
- import { watch as x, getCurrentScope as k, onScopeDispose as D, computed as C, toValue as h, unref as T, defineComponent as L, ref as E, onMounted as P, createElementBlock as U, openBlock as W, createElementVNode as j, toRaw as A } from "vue";
2
- function I(e) {
3
- return k() ? (D(e), !0) : !1;
1
+ import { watch as S, getCurrentScope as T, onScopeDispose as x, computed as A, toValue as M, unref as L, defineComponent as O, ref as P, onMounted as v, createElementBlock as R, openBlock as U, createElementVNode as _, toRaw as I } from "vue";
2
+ function W(n) {
3
+ return T() ? (x(n), !0) : !1;
4
4
  }
5
- const O = typeof window < "u" && typeof document < "u";
5
+ const D = typeof window < "u" && typeof document < "u";
6
6
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
7
- const B = Object.prototype.toString, G = (e) => B.call(e) === "[object Object]";
8
- function b(e) {
9
- return Array.isArray(e) ? e : [e];
7
+ const F = Object.prototype.toString, B = (n) => F.call(n) === "[object Object]";
8
+ function j(n) {
9
+ return Array.isArray(n) ? n : [n];
10
10
  }
11
- function R(e, s, r) {
12
- return x(
13
- e,
14
- s,
11
+ function G(n, a, l) {
12
+ return S(
13
+ n,
14
+ a,
15
15
  {
16
- ...r,
16
+ ...l,
17
17
  immediate: !0
18
18
  }
19
19
  );
20
20
  }
21
- const N = O ? window : void 0;
22
- function V(e) {
23
- var s;
24
- const r = h(e);
25
- return (s = r == null ? void 0 : r.$el) != null ? s : r;
21
+ const N = D ? window : void 0;
22
+ function $(n) {
23
+ var a;
24
+ const l = M(n);
25
+ return (a = l == null ? void 0 : l.$el) != null ? a : l;
26
26
  }
27
- function _(...e) {
28
- const s = [], r = () => {
29
- s.forEach((n) => n()), s.length = 0;
30
- }, u = (n, t, l, a) => (n.addEventListener(t, l, a), () => n.removeEventListener(t, l, a)), c = C(() => {
31
- const n = b(h(e[0])).filter((t) => t != null);
32
- return n.every((t) => typeof t != "string") ? n : void 0;
33
- }), d = R(
27
+ function V(...n) {
28
+ const a = [], l = () => {
29
+ a.forEach((o) => o()), a.length = 0;
30
+ }, p = (o, e, t, s) => (o.addEventListener(e, t, s), () => o.removeEventListener(e, t, s)), f = A(() => {
31
+ const o = j(M(n[0])).filter((e) => e != null);
32
+ return o.every((e) => typeof e != "string") ? o : void 0;
33
+ }), u = G(
34
34
  () => {
35
- var n, t;
35
+ var o, e;
36
36
  return [
37
- (t = (n = c.value) == null ? void 0 : n.map((l) => V(l))) != null ? t : [N].filter((l) => l != null),
38
- b(h(c.value ? e[1] : e[0])),
39
- b(T(c.value ? e[2] : e[1])),
37
+ (e = (o = f.value) == null ? void 0 : o.map((t) => $(t))) != null ? e : [N].filter((t) => t != null),
38
+ j(M(f.value ? n[1] : n[0])),
39
+ j(L(f.value ? n[2] : n[1])),
40
40
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
41
- h(c.value ? e[3] : e[2])
41
+ M(f.value ? n[3] : n[2])
42
42
  ];
43
43
  },
44
- ([n, t, l, a]) => {
45
- if (r(), !(n != null && n.length) || !(t != null && t.length) || !(l != null && l.length))
44
+ ([o, e, t, s]) => {
45
+ if (l(), !(o != null && o.length) || !(e != null && e.length) || !(t != null && t.length))
46
46
  return;
47
- const g = G(a) ? { ...a } : a;
48
- s.push(
49
- ...n.flatMap(
50
- (y) => t.flatMap(
51
- (v) => l.map((w) => u(y, v, w, g))
47
+ const m = B(s) ? { ...s } : s;
48
+ a.push(
49
+ ...o.flatMap(
50
+ (h) => e.flatMap(
51
+ (y) => t.map((w) => p(h, y, w, m))
52
52
  )
53
53
  )
54
54
  );
55
55
  },
56
56
  { flush: "post" }
57
- ), m = () => {
58
- d(), r();
57
+ ), d = () => {
58
+ u(), l();
59
59
  };
60
- return I(r), m;
60
+ return W(l), d;
61
61
  }
62
- const $ = { class: "flex flex-col w-full h-full" }, z = ["src"], F = /* @__PURE__ */ L({
62
+ const z = { class: "flex flex-col w-full h-full" }, q = ["src"], X = /* @__PURE__ */ O({
63
63
  __name: "App",
64
64
  props: {
65
65
  iframeUrl: { default: () => "https://cdn2.colegium.com/production/unlayer/index.html" },
66
66
  module: {}
67
67
  },
68
68
  emits: ["load", "ready", "onSuccess", "onError"],
69
- setup(e, { expose: s, emit: r }) {
70
- const u = r, c = C(() => {
71
- const o = new URL(e.iframeUrl, window.location.href);
72
- return e.module && o.searchParams.set("module", e.module), o.searchParams.set("v", `${(/* @__PURE__ */ new Date()).getTime()}`), o.toString();
73
- }), d = E(), m = E(), n = E(null);
74
- _(window, "message", a);
75
- function t() {
76
- const o = new MessageChannel();
77
- d.value = o;
69
+ setup(n, { expose: a, emit: l }) {
70
+ const p = l, f = A(() => {
71
+ const c = new URL(n.iframeUrl, window.location.href);
72
+ return n.module && c.searchParams.set("module", n.module), c.searchParams.set("v", `${(/* @__PURE__ */ new Date()).getTime()}`), c.toString();
73
+ }), u = P(), d = P(), o = P(null);
74
+ V(window, "message", s);
75
+ function e() {
76
+ const c = new MessageChannel();
77
+ u.value = c;
78
78
  }
79
- function l() {
80
- const { port1: o } = d.value;
81
- m.value = o, m.value.onmessage = y;
79
+ function t() {
80
+ const { port1: c } = u.value;
81
+ d.value = c, d.value.onmessage = h;
82
82
  }
83
- function a({ data: o }) {
84
- "ready" in o && u("ready");
83
+ function s({ data: c }) {
84
+ "ready" in c && p("ready");
85
85
  }
86
- function g() {
87
- u("load"), l();
86
+ function m() {
87
+ p("load"), t();
88
88
  }
89
- function y(o) {
90
- const { data: i } = o;
91
- if (i.status == "success") {
92
- const { template: f, originalTemplate: p, html: M } = i;
93
- u("onSuccess", { template: f, originalTemplate: p, html: M });
89
+ function h(c) {
90
+ const { data: g } = c;
91
+ if (g.status == "success") {
92
+ const { template: i, originalTemplate: r, html: b } = g;
93
+ p("onSuccess", { template: i, originalTemplate: r, html: b });
94
94
  } else {
95
- const { message: f } = i;
96
- u("onError", { message: f });
95
+ const { message: i } = g;
96
+ p("onError", { message: i });
97
97
  }
98
- t(), l();
98
+ e(), t();
99
99
  }
100
- const v = () => {
101
- S("GET");
102
- }, w = (o) => {
103
- S("PUT", { template: A(o) }), t(), l();
100
+ const y = () => {
101
+ E("GET");
102
+ }, w = (c) => {
103
+ E("PUT", { template: I(c) }), e(), t();
104
104
  };
105
- function S(o, i = {}) {
106
- var f, p;
107
- (p = (f = n.value) == null ? void 0 : f.contentWindow) == null || p.postMessage({ type: o, ...i }, "*", [d.value.port2]);
105
+ function E(c, g = {}) {
106
+ var i, r;
107
+ (r = (i = o.value) == null ? void 0 : i.contentWindow) == null || r.postMessage({ type: c, ...g }, "*", [u.value.port2]);
108
108
  }
109
- return P(() => t()), s({ getTemplateDesign: v, setTemplateDesign: w }), (o, i) => (W(), U("div", $, [
110
- j("iframe", {
109
+ return v(() => e()), a({ getTemplateDesign: y, setTemplateDesign: w }), (c, g) => (U(), R("div", z, [
110
+ _("iframe", {
111
111
  class: "w-full h-full overflow-hidden",
112
112
  style: { width: "100%", height: "100%" },
113
113
  ref_key: "unlayerIframe",
114
- ref: n,
114
+ ref: o,
115
115
  frameborder: "0",
116
116
  loading: "lazy",
117
117
  "no-referrer": "",
118
118
  title: "Colegium Unlayer Embed",
119
- src: T(c),
120
- onLoad: g
121
- }, null, 40, z)
119
+ src: L(f),
120
+ onLoad: m
121
+ }, null, 40, q)
122
122
  ]));
123
123
  }
124
- });
124
+ }), k = "clg-unlayer-bridge", H = (n) => !!n && typeof n == "object" && typeof n.__clgFnRef == "number", C = (n) => {
125
+ if (!n || typeof n != "object") return !1;
126
+ const a = Object.getPrototypeOf(n);
127
+ return a === Object.prototype || a === null;
128
+ };
129
+ function J(n) {
130
+ return !!n && typeof n == "object" && n.canal === k;
131
+ }
132
+ function K(n) {
133
+ let a = 1;
134
+ const l = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
135
+ function u(e) {
136
+ if (typeof e == "function") {
137
+ let t = l.get(e);
138
+ return t || (t = a++, l.set(e, t), p.set(t, e)), { __clgFnRef: t };
139
+ }
140
+ if (Array.isArray(e)) return e.map(u);
141
+ if (C(e)) {
142
+ const t = {};
143
+ for (const [s, m] of Object.entries(e)) t[s] = u(m);
144
+ return t;
145
+ }
146
+ return e;
147
+ }
148
+ function d(e) {
149
+ if (H(e)) {
150
+ const t = e.__clgFnRef;
151
+ let s = f.get(t);
152
+ return s || (s = (...m) => n(t, m.map(u)), f.set(t, s)), s;
153
+ }
154
+ if (Array.isArray(e)) return e.map(d);
155
+ if (C(e)) {
156
+ const t = {};
157
+ for (const [s, m] of Object.entries(e)) t[s] = d(m);
158
+ return t;
159
+ }
160
+ return e;
161
+ }
162
+ function o(e, t) {
163
+ const s = p.get(e);
164
+ s && s(...t.map(d));
165
+ }
166
+ return { codificar: u, decodificar: d, invocarLocal: o };
167
+ }
168
+ function Y(n, a = {}) {
169
+ const { iframeUrl: l = "https://cdn2.colegium.com/production/unlayer/index.html", relayPrefixes: p = [], onDenied: f } = a, u = new URL(l, window.location.href);
170
+ u.searchParams.set("module", "informes"), u.searchParams.set("v", `${Date.now()}`);
171
+ const d = u.origin, o = document.createElement("iframe");
172
+ o.src = u.toString(), o.title = "Colegium Unlayer Editor", o.setAttribute("frameborder", "0"), o.style.cssText = "width:100%;height:100%;border:0;display:block;", n.appendChild(o);
173
+ let e = !1, t = !1;
174
+ const s = [], m = K((i, r) => y({ canal: k, kind: "invoke", ref: i, args: r }));
175
+ function h(i) {
176
+ var r;
177
+ (r = o.contentWindow) == null || r.postMessage(i, d);
178
+ }
179
+ function y(i) {
180
+ t || (e ? h(i) : s.push(i));
181
+ }
182
+ function w(i) {
183
+ if (i.source !== o.contentWindow || i.origin !== d || !J(i.data)) return;
184
+ const r = i.data;
185
+ r.kind === "hello" ? (e = !0, h({ canal: k, kind: "setup", relayPrefixes: p }), s.splice(0).forEach(h)) : r.kind === "invoke" ? m.invocarLocal(r.ref, r.args ?? []) : r.kind === "denied" && (f ? f(r.message) : console.error("[unlayer-embed]", r.message));
186
+ }
187
+ window.addEventListener("message", w);
188
+ const E = (i) => (...r) => y({ canal: k, kind: "call", method: i, args: r.map(m.codificar) });
189
+ function c() {
190
+ t || (e && h({ canal: k, kind: "call", method: "destroy", args: [] }), t = !0, s.length = 0, window.removeEventListener("message", w), o.remove());
191
+ }
192
+ const g = /* @__PURE__ */ new Map([["destroy", c]]);
193
+ return new Proxy({}, {
194
+ get(i, r) {
195
+ if (typeof r != "string" || r === "then") return;
196
+ let b = g.get(r);
197
+ return b || (b = E(r), g.set(r, b)), b;
198
+ }
199
+ });
200
+ }
125
201
  export {
126
- F as ClgTemplateBuilder
202
+ X as ClgTemplateBuilder,
203
+ Y as mountUnlayerIframe
127
204
  };
@@ -1 +1 @@
1
- (function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c["@colegium/vue3-unlayer-embed"]={},c.Vue))})(this,function(c,e){"use strict";function C(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}const M=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const x=Object.prototype.toString,j=n=>x.call(n)==="[object Object]";function y(n){return Array.isArray(n)?n:[n]}function P(n,i,s){return e.watch(n,i,{...s,immediate:!0})}const V=M?window:void 0;function k(n){var i;const s=e.toValue(n);return(i=s==null?void 0:s.$el)!=null?i:s}function D(...n){const i=[],s=()=>{i.forEach(t=>t()),i.length=0},u=(t,o,r,a)=>(t.addEventListener(o,r,a),()=>t.removeEventListener(o,r,a)),f=e.computed(()=>{const t=y(e.toValue(n[0])).filter(o=>o!=null);return t.every(o=>typeof o!="string")?t:void 0}),p=P(()=>{var t,o;return[(o=(t=f.value)==null?void 0:t.map(r=>k(r)))!=null?o:[V].filter(r=>r!=null),y(e.toValue(f.value?n[1]:n[0])),y(e.unref(f.value?n[2]:n[1])),e.toValue(f.value?n[3]:n[2])]},([t,o,r,a])=>{if(s(),!(t!=null&&t.length)||!(o!=null&&o.length)||!(r!=null&&r.length))return;const b=j(a)?{...a}:a;i.push(...t.flatMap(w=>o.flatMap(S=>r.map(T=>u(w,S,T,b)))))},{flush:"post"}),h=()=>{p(),s()};return C(s),h}const L={class:"flex flex-col w-full h-full"},O=["src"],U=e.defineComponent({__name:"App",props:{iframeUrl:{default:()=>"https://cdn2.colegium.com/production/unlayer/index.html"},module:{}},emits:["load","ready","onSuccess","onError"],setup(n,{expose:i,emit:s}){const u=s,f=e.computed(()=>{const l=new URL(n.iframeUrl,window.location.href);return n.module&&l.searchParams.set("module",n.module),l.searchParams.set("v",`${new Date().getTime()}`),l.toString()}),p=e.ref(),h=e.ref(),t=e.ref(null);D(window,"message",a);function o(){const l=new MessageChannel;p.value=l}function r(){const{port1:l}=p.value;h.value=l,h.value.onmessage=w}function a({data:l}){"ready"in l&&u("ready")}function b(){u("load"),r()}function w(l){const{data:d}=l;if(d.status=="success"){const{template:m,originalTemplate:g,html:W}=d;u("onSuccess",{template:m,originalTemplate:g,html:W})}else{const{message:m}=d;u("onError",{message:m})}o(),r()}const S=()=>{E("GET")},T=l=>{E("PUT",{template:e.toRaw(l)}),o(),r()};function E(l,d={}){var m,g;(g=(m=t.value)==null?void 0:m.contentWindow)==null||g.postMessage({type:l,...d},"*",[p.value.port2])}return e.onMounted(()=>o()),i({getTemplateDesign:S,setTemplateDesign:T}),(l,d)=>(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("iframe",{class:"w-full h-full overflow-hidden",style:{width:"100%",height:"100%"},ref_key:"unlayerIframe",ref:t,frameborder:"0",loading:"lazy","no-referrer":"",title:"Colegium Unlayer Embed",src:e.unref(f),onLoad:b},null,40,O)]))}});c.ClgTemplateBuilder=U,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
1
+ (function(h,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(h=typeof globalThis<"u"?globalThis:h||self,i(h["@colegium/vue3-unlayer-embed"]={},h.Vue))})(this,function(h,i){"use strict";function S(n){return i.getCurrentScope()?(i.onScopeDispose(n),!0):!1}const C=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const A=Object.prototype.toString,L=n=>A.call(n)==="[object Object]";function j(n){return Array.isArray(n)?n:[n]}function O(n,l,f){return i.watch(n,l,{...f,immediate:!0})}const x=C?window:void 0;function U(n){var l;const f=i.toValue(n);return(l=f==null?void 0:f.$el)!=null?l:f}function I(...n){const l=[],f=()=>{l.forEach(o=>o()),l.length=0},g=(o,e,t,s)=>(o.addEventListener(e,t,s),()=>o.removeEventListener(e,t,s)),d=i.computed(()=>{const o=j(i.toValue(n[0])).filter(e=>e!=null);return o.every(e=>typeof e!="string")?o:void 0}),u=O(()=>{var o,e;return[(e=(o=d.value)==null?void 0:o.map(t=>U(t)))!=null?e:[x].filter(t=>t!=null),j(i.toValue(d.value?n[1]:n[0])),j(i.unref(d.value?n[2]:n[1])),i.toValue(d.value?n[3]:n[2])]},([o,e,t,s])=>{if(f(),!(o!=null&&o.length)||!(e!=null&&e.length)||!(t!=null&&t.length))return;const p=L(s)?{...s}:s;l.push(...o.flatMap(b=>e.flatMap(w=>t.map(k=>g(b,w,k,p)))))},{flush:"post"}),m=()=>{u(),f()};return S(f),m}const R={class:"flex flex-col w-full h-full"},_=["src"],W=i.defineComponent({__name:"App",props:{iframeUrl:{default:()=>"https://cdn2.colegium.com/production/unlayer/index.html"},module:{}},emits:["load","ready","onSuccess","onError"],setup(n,{expose:l,emit:f}){const g=f,d=i.computed(()=>{const a=new URL(n.iframeUrl,window.location.href);return n.module&&a.searchParams.set("module",n.module),a.searchParams.set("v",`${new Date().getTime()}`),a.toString()}),u=i.ref(),m=i.ref(),o=i.ref(null);I(window,"message",s);function e(){const a=new MessageChannel;u.value=a}function t(){const{port1:a}=u.value;m.value=a,m.value.onmessage=b}function s({data:a}){"ready"in a&&g("ready")}function p(){g("load"),t()}function b(a){const{data:y}=a;if(y.status=="success"){const{template:c,originalTemplate:r,html:E}=y;g("onSuccess",{template:c,originalTemplate:r,html:E})}else{const{message:c}=y;g("onError",{message:c})}e(),t()}const w=()=>{P("GET")},k=a=>{P("PUT",{template:i.toRaw(a)}),e(),t()};function P(a,y={}){var c,r;(r=(c=o.value)==null?void 0:c.contentWindow)==null||r.postMessage({type:a,...y},"*",[u.value.port2])}return i.onMounted(()=>e()),l({getTemplateDesign:w,setTemplateDesign:k}),(a,y)=>(i.openBlock(),i.createElementBlock("div",R,[i.createElementVNode("iframe",{class:"w-full h-full overflow-hidden",style:{width:"100%",height:"100%"},ref_key:"unlayerIframe",ref:o,frameborder:"0",loading:"lazy","no-referrer":"",title:"Colegium Unlayer Embed",src:i.unref(d),onLoad:p},null,40,_)]))}}),M="clg-unlayer-bridge",D=n=>!!n&&typeof n=="object"&&typeof n.__clgFnRef=="number",T=n=>{if(!n||typeof n!="object")return!1;const l=Object.getPrototypeOf(n);return l===Object.prototype||l===null};function F(n){return!!n&&typeof n=="object"&&n.canal===M}function V(n){let l=1;const f=new WeakMap,g=new Map,d=new Map;function u(e){if(typeof e=="function"){let t=f.get(e);return t||(t=l++,f.set(e,t),g.set(t,e)),{__clgFnRef:t}}if(Array.isArray(e))return e.map(u);if(T(e)){const t={};for(const[s,p]of Object.entries(e))t[s]=u(p);return t}return e}function m(e){if(D(e)){const t=e.__clgFnRef;let s=d.get(t);return s||(s=(...p)=>n(t,p.map(u)),d.set(t,s)),s}if(Array.isArray(e))return e.map(m);if(T(e)){const t={};for(const[s,p]of Object.entries(e))t[s]=m(p);return t}return e}function o(e,t){const s=g.get(e);s&&s(...t.map(m))}return{codificar:u,decodificar:m,invocarLocal:o}}function B(n,l={}){const{iframeUrl:f="https://cdn2.colegium.com/production/unlayer/index.html",relayPrefixes:g=[],onDenied:d}=l,u=new URL(f,window.location.href);u.searchParams.set("module","informes"),u.searchParams.set("v",`${Date.now()}`);const m=u.origin,o=document.createElement("iframe");o.src=u.toString(),o.title="Colegium Unlayer Editor",o.setAttribute("frameborder","0"),o.style.cssText="width:100%;height:100%;border:0;display:block;",n.appendChild(o);let e=!1,t=!1;const s=[],p=V((c,r)=>w({canal:M,kind:"invoke",ref:c,args:r}));function b(c){var r;(r=o.contentWindow)==null||r.postMessage(c,m)}function w(c){t||(e?b(c):s.push(c))}function k(c){if(c.source!==o.contentWindow||c.origin!==m||!F(c.data))return;const r=c.data;r.kind==="hello"?(e=!0,b({canal:M,kind:"setup",relayPrefixes:g}),s.splice(0).forEach(b)):r.kind==="invoke"?p.invocarLocal(r.ref,r.args??[]):r.kind==="denied"&&(d?d(r.message):console.error("[unlayer-embed]",r.message))}window.addEventListener("message",k);const P=c=>(...r)=>w({canal:M,kind:"call",method:c,args:r.map(p.codificar)});function a(){t||(e&&b({canal:M,kind:"call",method:"destroy",args:[]}),t=!0,s.length=0,window.removeEventListener("message",k),o.remove())}const y=new Map([["destroy",a]]);return new Proxy({},{get(c,r){if(typeof r!="string"||r==="then")return;let E=y.get(r);return E||(E=P(r),y.set(r,E)),E}})}h.ClgTemplateBuilder=W,h.mountUnlayerIframe=B,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colegium_dev/vue3-unlayer-embed",
3
- "version": "1.0.15",
3
+ "version": "1.1.0",
4
4
  "description": "Unlayer Embed project for Colegium Cloud Platform",
5
5
  "author": "Colegium Frontend Team",
6
6
  "type": "module",