@colegium_dev/vue3-unlayer-embed 1.0.14 → 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
@@ -3,7 +3,14 @@ import { ComponentProvideOptions } from 'vue';
3
3
  import { DefineComponent } from 'vue';
4
4
  import { PublicProps } from 'vue';
5
5
 
6
- export declare const ClgTemplateBuilder: DefineComponent< {}, {
6
+ declare type __VLS_Props = {
7
+ /** URL del iframe publicado en el CDN. Por defecto, producción. */
8
+ iframeUrl?: string;
9
+ /** Módulo que abre el editor (define su configuración). Sin valor, el iframe usa `mensajes`. */
10
+ module?: 'mensajes' | 'matricula';
11
+ };
12
+
13
+ export declare const ClgTemplateBuilder: DefineComponent<__VLS_Props, {
7
14
  getTemplateDesign: () => void;
8
15
  setTemplateDesign: (template: unknown) => void;
9
16
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
@@ -17,7 +24,7 @@ html: string;
17
24
  onError: (args_0: {
18
25
  message: string;
19
26
  }) => any;
20
- }, string, PublicProps, Readonly<{}> & Readonly<{
27
+ }, string, PublicProps, Readonly<__VLS_Props> & Readonly<{
21
28
  onLoad?: (() => any) | undefined;
22
29
  onReady?: (() => any) | undefined;
23
30
  onOnSuccess?: ((args_0: {
@@ -28,10 +35,17 @@ html: string;
28
35
  onOnError?: ((args_0: {
29
36
  message: string;
30
37
  }) => any) | undefined;
31
- }>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {
38
+ }>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
32
39
  unlayerIframe: HTMLIFrameElement;
33
40
  }, HTMLDivElement>;
34
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
+
35
49
  declare type TemplateConfig = {
36
50
  form: Array<TemplateContentForm>;
37
51
  design: object;
@@ -48,4 +62,27 @@ declare type TemplateContentForm = {
48
62
  value: string;
49
63
  };
50
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
+
51
88
  export { }
@@ -1,120 +1,204 @@
1
- import { watch as M, getCurrentScope as _, onScopeDispose as x, computed as k, toValue as g, unref as S, defineComponent as D, ref as h, onMounted as W, createElementBlock as j, openBlock as A, createElementVNode as I, toRaw as L } from "vue";
2
- function O(e) {
3
- return _() ? (x(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 B = 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 G = Object.prototype.toString, P = (e) => G.call(e) === "[object Object]";
8
- function w(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 $(e, r, s) {
12
- return M(
13
- e,
14
- r,
11
+ function G(n, a, l) {
12
+ return S(
13
+ n,
14
+ a,
15
15
  {
16
- ...s,
16
+ ...l,
17
17
  immediate: !0
18
18
  }
19
19
  );
20
20
  }
21
- const N = B ? window : void 0;
22
- function R(e) {
23
- var r;
24
- const s = g(e);
25
- return (r = s == null ? void 0 : s.$el) != null ? r : s;
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 U(...e) {
28
- const r = [], s = () => {
29
- r.forEach((n) => n()), r.length = 0;
30
- }, a = (n, t, o, u) => (n.addEventListener(t, o, u), () => n.removeEventListener(t, o, u)), c = k(() => {
31
- const n = w(g(e[0])).filter((t) => t != null);
32
- return n.every((t) => typeof t != "string") ? n : void 0;
33
- }), d = $(
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((o) => R(o))) != null ? t : [N].filter((o) => o != null),
38
- w(g(c.value ? e[1] : e[0])),
39
- w(S(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
- g(c.value ? e[3] : e[2])
41
+ M(f.value ? n[3] : n[2])
42
42
  ];
43
43
  },
44
- ([n, t, o, u]) => {
45
- if (s(), !(n != null && n.length) || !(t != null && t.length) || !(o != null && o.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 y = P(u) ? { ...u } : u;
48
- r.push(
49
- ...n.flatMap(
50
- (v) => t.flatMap(
51
- (b) => o.map((E) => a(v, b, E, y))
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(), s();
57
+ ), d = () => {
58
+ u(), l();
59
59
  };
60
- return O(s), m;
60
+ return W(l), d;
61
61
  }
62
- const V = { class: "flex flex-col w-full h-full" }, z = ["src"], F = /* @__PURE__ */ D({
62
+ const z = { class: "flex flex-col w-full h-full" }, q = ["src"], X = /* @__PURE__ */ O({
63
63
  __name: "App",
64
+ props: {
65
+ iframeUrl: { default: () => "https://cdn2.colegium.com/production/unlayer/index.html" },
66
+ module: {}
67
+ },
64
68
  emits: ["load", "ready", "onSuccess", "onError"],
65
- setup(e, { expose: r, emit: s }) {
66
- const a = s, c = h("https://cdn2.colegium.com/beta/unlayer/index.html"), d = h(), m = h(), n = h(null);
67
- U(window, "message", u);
68
- function t() {
69
- const l = new MessageChannel();
70
- d.value = l;
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;
71
78
  }
72
- function o() {
73
- const { port1: l } = d.value;
74
- m.value = l, m.value.onmessage = v;
79
+ function t() {
80
+ const { port1: c } = u.value;
81
+ d.value = c, d.value.onmessage = h;
75
82
  }
76
- function u({ data: l }) {
77
- "ready" in l && a("ready");
83
+ function s({ data: c }) {
84
+ "ready" in c && p("ready");
78
85
  }
79
- function y() {
80
- a("load"), o();
86
+ function m() {
87
+ p("load"), t();
81
88
  }
82
- function v(l) {
83
- const { data: i } = l;
84
- if (i.status == "success") {
85
- const { template: f, originalTemplate: p, html: T } = i;
86
- a("onSuccess", { template: f, originalTemplate: p, html: T });
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 });
87
94
  } else {
88
- const { message: f } = i;
89
- a("onError", { message: f });
95
+ const { message: i } = g;
96
+ p("onError", { message: i });
90
97
  }
91
- t(), o();
98
+ e(), t();
92
99
  }
93
- const b = () => {
94
- C("GET");
95
- }, E = (l) => {
96
- C("PUT", { template: L(l) }), t(), o();
100
+ const y = () => {
101
+ E("GET");
102
+ }, w = (c) => {
103
+ E("PUT", { template: I(c) }), e(), t();
97
104
  };
98
- function C(l, i = {}) {
99
- var f, p;
100
- (p = (f = n.value) == null ? void 0 : f.contentWindow) == null || p.postMessage({ type: l, ...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]);
101
108
  }
102
- return W(() => t()), r({ getTemplateDesign: b, setTemplateDesign: E }), (l, i) => (A(), j("div", V, [
103
- I("iframe", {
109
+ return v(() => e()), a({ getTemplateDesign: y, setTemplateDesign: w }), (c, g) => (U(), R("div", z, [
110
+ _("iframe", {
104
111
  class: "w-full h-full overflow-hidden",
105
112
  style: { width: "100%", height: "100%" },
106
113
  ref_key: "unlayerIframe",
107
- ref: n,
114
+ ref: o,
108
115
  frameborder: "0",
109
116
  loading: "lazy",
110
117
  "no-referrer": "",
111
118
  title: "Colegium Unlayer Embed",
112
- src: `${S(c)}?v=${(/* @__PURE__ */ new Date()).getTime()}`,
113
- onLoad: y
114
- }, null, 40, z)
119
+ src: L(f),
120
+ onLoad: m
121
+ }, null, 40, q)
115
122
  ]));
116
123
  }
117
- });
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
+ }
118
201
  export {
119
- F as ClgTemplateBuilder
202
+ X as ClgTemplateBuilder,
203
+ Y as mountUnlayerIframe
120
204
  };
@@ -1 +1 @@
1
- (function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a["@colegium/vue3-unlayer-embed"]={},a.Vue))})(this,(function(a,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 _=Object.prototype.toString,x=n=>_.call(n)==="[object Object]";function y(n){return Array.isArray(n)?n:[n]}function j(n,i,r){return e.watch(n,i,{...r,immediate:!0})}const V=M?window:void 0;function k(n){var i;const r=e.toValue(n);return(i=r==null?void 0:r.$el)!=null?i:r}function D(...n){const i=[],r=()=>{i.forEach(t=>t()),i.length=0},u=(t,o,l,c)=>(t.addEventListener(o,l,c),()=>t.removeEventListener(o,l,c)),f=e.computed(()=>{const t=y(e.toValue(n[0])).filter(o=>o!=null);return t.every(o=>typeof o!="string")?t:void 0}),m=j(()=>{var t,o;return[(o=(t=f.value)==null?void 0:t.map(l=>k(l)))!=null?o:[V].filter(l=>l!=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,l,c])=>{if(r(),!(t!=null&&t.length)||!(o!=null&&o.length)||!(l!=null&&l.length))return;const b=x(c)?{...c}:c;i.push(...t.flatMap(T=>o.flatMap(E=>l.map(S=>u(T,E,S,b)))))},{flush:"post"}),h=()=>{m(),r()};return C(r),h}const O={class:"flex flex-col w-full h-full"},W=["src"],A=e.defineComponent({__name:"App",emits:["load","ready","onSuccess","onError"],setup(n,{expose:i,emit:r}){const u=r,f=e.ref("https://cdn2.colegium.com/beta/unlayer/index.html"),m=e.ref(),h=e.ref(),t=e.ref(null);D(window,"message",c);function o(){const s=new MessageChannel;m.value=s}function l(){const{port1:s}=m.value;h.value=s,h.value.onmessage=T}function c({data:s}){"ready"in s&&u("ready")}function b(){u("load"),l()}function T(s){const{data:d}=s;if(d.status=="success"){const{template:p,originalTemplate:g,html:I}=d;u("onSuccess",{template:p,originalTemplate:g,html:I})}else{const{message:p}=d;u("onError",{message:p})}o(),l()}const E=()=>{w("GET")},S=s=>{w("PUT",{template:e.toRaw(s)}),o(),l()};function w(s,d={}){var p,g;(g=(p=t.value)==null?void 0:p.contentWindow)==null||g.postMessage({type:s,...d},"*",[m.value.port2])}return e.onMounted(()=>o()),i({getTemplateDesign:E,setTemplateDesign:S}),(s,d)=>(e.openBlock(),e.createElementBlock("div",O,[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)}?v=${new Date().getTime()}`,onLoad:b},null,40,W)]))}});a.ClgTemplateBuilder=A,Object.defineProperty(a,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.14",
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",
@@ -25,6 +25,6 @@
25
25
  "version-patch": "pnpm version patch",
26
26
  "version-minor": "pnpm version minor",
27
27
  "version-major": "pnpm version major",
28
- "release": "pnpm publish --access public --tag beta"
28
+ "release": "pnpm publish --access public"
29
29
  }
30
30
  }