@colegium_dev/vue3-unlayer-embed 1.0.10 → 1.0.11

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.
@@ -1,4 +1,4 @@
1
- import { watch as S, getCurrentScope as T, onScopeDispose as M, computed as _, toValue as h, unref as b, defineComponent as x, ref as m, onMounted as W, createElementBlock as k, openBlock as D, createElementVNode as j, toRaw as A } from "vue";
1
+ import { watch as S, getCurrentScope as T, onScopeDispose as M, computed as _, toValue as g, unref as b, defineComponent as W, ref as m, onMounted as k, createElementBlock as x, openBlock as D, createElementVNode as j, toRaw as A } from "vue";
2
2
  function I(e) {
3
3
  return T() ? (M(e), !0) : !1;
4
4
  }
@@ -21,34 +21,34 @@ function G(e, r, s) {
21
21
  const P = L ? window : void 0;
22
22
  function $(e) {
23
23
  var r;
24
- const s = h(e);
24
+ const s = g(e);
25
25
  return (r = s == null ? void 0 : s.$el) != null ? r : s;
26
26
  }
27
27
  function N(...e) {
28
28
  const r = [], s = () => {
29
29
  r.forEach((n) => n()), r.length = 0;
30
- }, c = (n, t, o, a) => (n.addEventListener(t, o, a), () => n.removeEventListener(t, o, a)), i = _(() => {
31
- const n = E(h(e[0])).filter((t) => t != null);
30
+ }, c = (n, t, o, u) => (n.addEventListener(t, o, u), () => n.removeEventListener(t, o, u)), i = _(() => {
31
+ const n = E(g(e[0])).filter((t) => t != null);
32
32
  return n.every((t) => typeof t != "string") ? n : void 0;
33
33
  }), f = G(
34
34
  () => {
35
35
  var n, t;
36
36
  return [
37
37
  (t = (n = i.value) == null ? void 0 : n.map((o) => $(o))) != null ? t : [P].filter((o) => o != null),
38
- E(h(i.value ? e[1] : e[0])),
38
+ E(g(i.value ? e[1] : e[0])),
39
39
  E(b(i.value ? e[2] : e[1])),
40
40
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
41
- h(i.value ? e[3] : e[2])
41
+ g(i.value ? e[3] : e[2])
42
42
  ];
43
43
  },
44
- ([n, t, o, a]) => {
44
+ ([n, t, o, u]) => {
45
45
  if (s(), !(n != null && n.length) || !(t != null && t.length) || !(o != null && o.length))
46
46
  return;
47
- const g = B(a) ? { ...a } : a;
47
+ const h = B(u) ? { ...u } : u;
48
48
  r.push(
49
49
  ...n.flatMap(
50
50
  (y) => t.flatMap(
51
- (v) => o.map((w) => c(y, v, w, g))
51
+ (v) => o.map((w) => c(y, v, w, h))
52
52
  )
53
53
  )
54
54
  );
@@ -59,12 +59,12 @@ function N(...e) {
59
59
  };
60
60
  return I(s), p;
61
61
  }
62
- const R = { class: "flex flex-col w-full h-full" }, U = ["src"], z = /* @__PURE__ */ x({
62
+ const R = { class: "flex flex-col w-full h-full" }, U = ["src"], q = /* @__PURE__ */ W({
63
63
  __name: "App",
64
64
  emits: ["load", "ready", "onSuccess", "onError"],
65
65
  setup(e, { expose: r, emit: s }) {
66
- const c = s, i = m("https://cdn2.colegium.com/production/unlayer/index.html"), f = m(), p = m(), n = m(null);
67
- N(window, "message", a);
66
+ const c = s, i = m("https://tranquil-longma-fdecee.netlify.app/"), f = m(), p = m(), n = m(null);
67
+ N(window, "message", u);
68
68
  function t() {
69
69
  const l = new MessageChannel();
70
70
  f.value = l;
@@ -73,33 +73,33 @@ const R = { class: "flex flex-col w-full h-full" }, U = ["src"], z = /* @__PURE_
73
73
  const { port1: l } = f.value;
74
74
  p.value = l, p.value.onmessage = y;
75
75
  }
76
- function a({ data: l }) {
76
+ function u({ data: l }) {
77
77
  "ready" in l && c("ready");
78
78
  }
79
- function g() {
79
+ function h() {
80
80
  c("load"), o();
81
81
  }
82
82
  function y(l) {
83
- const { data: u } = l;
84
- if (u.status == "success") {
85
- const { template: d, originalTemplate: C } = u;
83
+ const { data: a } = l;
84
+ if (a.status == "success") {
85
+ const { template: d, originalTemplate: C } = a;
86
86
  c("onSuccess", { template: d, originalTemplate: C });
87
87
  } else {
88
- const { message: d } = u;
88
+ const { message: d } = a;
89
89
  c("onError", { message: d });
90
90
  }
91
91
  t(), o();
92
92
  }
93
93
  const v = () => {
94
- var l, u;
95
- (u = (l = n.value) == null ? void 0 : l.contentWindow) == null || u.postMessage({ type: "GET" }, "*", [f.value.port2]);
94
+ var l, a;
95
+ (a = (l = n.value) == null ? void 0 : l.contentWindow) == null || a.postMessage({ type: "GET" }, "*", [f.value.port2]);
96
96
  }, w = (l) => {
97
- var u, d;
98
- (d = (u = n.value) == null ? void 0 : u.contentWindow) == null || d.postMessage({ template: A(l), type: "PUT" }, "*", [
97
+ var a, d;
98
+ (d = (a = n.value) == null ? void 0 : a.contentWindow) == null || d.postMessage({ template: A(l), type: "PUT" }, "*", [
99
99
  f.value.port2
100
100
  ]), t(), o();
101
101
  };
102
- return W(() => t()), r({ getTemplateDesign: v, setTemplateDesign: w }), (l, u) => (D(), k("div", R, [
102
+ return k(() => t()), r({ getTemplateDesign: v, setTemplateDesign: w }), (l, a) => (D(), x("div", R, [
103
103
  j("iframe", {
104
104
  class: "w-full h-full overflow-hidden",
105
105
  style: { width: "100%", height: "100%" },
@@ -110,11 +110,11 @@ const R = { class: "flex flex-col w-full h-full" }, U = ["src"], z = /* @__PURE_
110
110
  "no-referrer": "",
111
111
  title: "Colegium Unlayer Embed",
112
112
  src: `${b(i)}?v=${(/* @__PURE__ */ new Date()).getTime()}`,
113
- onLoad: g
113
+ onLoad: h
114
114
  }, null, 40, U)
115
115
  ]));
116
116
  }
117
117
  });
118
118
  export {
119
- z as ClgTemplateBuilder
119
+ q as ClgTemplateBuilder
120
120
  };
@@ -1 +1 @@
1
- (function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u["@colegium/vue3-unlayer-embed"]={},u.Vue))})(this,function(u,e){"use strict";function E(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}const S=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const C=Object.prototype.toString,M=n=>C.call(n)==="[object Object]";function y(n){return Array.isArray(n)?n:[n]}function _(n,i,r){return e.watch(n,i,{...r,immediate:!0})}const x=S?window:void 0;function j(n){var i;const r=e.toValue(n);return(i=r==null?void 0:r.$el)!=null?i:r}function V(...n){const i=[],r=()=>{i.forEach(t=>t()),i.length=0},f=(t,o,l,a)=>(t.addEventListener(o,l,a),()=>t.removeEventListener(o,l,a)),d=e.computed(()=>{const t=y(e.toValue(n[0])).filter(o=>o!=null);return t.every(o=>typeof o!="string")?t:void 0}),p=_(()=>{var t,o;return[(o=(t=d.value)==null?void 0:t.map(l=>j(l)))!=null?o:[x].filter(l=>l!=null),y(e.toValue(d.value?n[1]:n[0])),y(e.unref(d.value?n[2]:n[1])),e.toValue(d.value?n[3]:n[2])]},([t,o,l,a])=>{if(r(),!(t!=null&&t.length)||!(o!=null&&o.length)||!(l!=null&&l.length))return;const g=M(a)?{...a}:a;i.push(...t.flatMap(b=>o.flatMap(T=>l.map(w=>f(b,T,w,g)))))},{flush:"post"}),h=()=>{p(),r()};return E(r),h}const W={class:"flex flex-col w-full h-full"},k=["src"],D=e.defineComponent({__name:"App",emits:["load","ready","onSuccess","onError"],setup(n,{expose:i,emit:r}){const f=r,d=e.ref("https://cdn2.colegium.com/production/unlayer/index.html"),p=e.ref(),h=e.ref(),t=e.ref(null);V(window,"message",a);function o(){const s=new MessageChannel;p.value=s}function l(){const{port1:s}=p.value;h.value=s,h.value.onmessage=b}function a({data:s}){"ready"in s&&f("ready")}function g(){f("load"),l()}function b(s){const{data:c}=s;if(c.status=="success"){const{template:m,originalTemplate:O}=c;f("onSuccess",{template:m,originalTemplate:O})}else{const{message:m}=c;f("onError",{message:m})}o(),l()}const T=()=>{var s,c;(c=(s=t.value)==null?void 0:s.contentWindow)==null||c.postMessage({type:"GET"},"*",[p.value.port2])},w=s=>{var c,m;(m=(c=t.value)==null?void 0:c.contentWindow)==null||m.postMessage({template:e.toRaw(s),type:"PUT"},"*",[p.value.port2]),o(),l()};return e.onMounted(()=>o()),i({getTemplateDesign:T,setTemplateDesign:w}),(s,c)=>(e.openBlock(),e.createElementBlock("div",W,[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(d)}?v=${new Date().getTime()}`,onLoad:g},null,40,k)]))}});u.ClgTemplateBuilder=D,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
1
+ (function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u["@colegium/vue3-unlayer-embed"]={},u.Vue))})(this,(function(u,e){"use strict";function E(n){return e.getCurrentScope()?(e.onScopeDispose(n),!0):!1}const S=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const C=Object.prototype.toString,M=n=>C.call(n)==="[object Object]";function y(n){return Array.isArray(n)?n:[n]}function _(n,a,r){return e.watch(n,a,{...r,immediate:!0})}const j=S?window:void 0;function x(n){var a;const r=e.toValue(n);return(a=r==null?void 0:r.$el)!=null?a:r}function V(...n){const a=[],r=()=>{a.forEach(t=>t()),a.length=0},f=(t,o,l,c)=>(t.addEventListener(o,l,c),()=>t.removeEventListener(o,l,c)),d=e.computed(()=>{const t=y(e.toValue(n[0])).filter(o=>o!=null);return t.every(o=>typeof o!="string")?t:void 0}),p=_(()=>{var t,o;return[(o=(t=d.value)==null?void 0:t.map(l=>x(l)))!=null?o:[j].filter(l=>l!=null),y(e.toValue(d.value?n[1]:n[0])),y(e.unref(d.value?n[2]:n[1])),e.toValue(d.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 g=M(c)?{...c}:c;a.push(...t.flatMap(b=>o.flatMap(T=>l.map(w=>f(b,T,w,g)))))},{flush:"post"}),h=()=>{p(),r()};return E(r),h}const W={class:"flex flex-col w-full h-full"},k=["src"],D=e.defineComponent({__name:"App",emits:["load","ready","onSuccess","onError"],setup(n,{expose:a,emit:r}){const f=r,d=e.ref("https://tranquil-longma-fdecee.netlify.app/"),p=e.ref(),h=e.ref(),t=e.ref(null);V(window,"message",c);function o(){const s=new MessageChannel;p.value=s}function l(){const{port1:s}=p.value;h.value=s,h.value.onmessage=b}function c({data:s}){"ready"in s&&f("ready")}function g(){f("load"),l()}function b(s){const{data:i}=s;if(i.status=="success"){const{template:m,originalTemplate:O}=i;f("onSuccess",{template:m,originalTemplate:O})}else{const{message:m}=i;f("onError",{message:m})}o(),l()}const T=()=>{var s,i;(i=(s=t.value)==null?void 0:s.contentWindow)==null||i.postMessage({type:"GET"},"*",[p.value.port2])},w=s=>{var i,m;(m=(i=t.value)==null?void 0:i.contentWindow)==null||m.postMessage({template:e.toRaw(s),type:"PUT"},"*",[p.value.port2]),o(),l()};return e.onMounted(()=>o()),a({getTemplateDesign:T,setTemplateDesign:w}),(s,i)=>(e.openBlock(),e.createElementBlock("div",W,[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(d)}?v=${new Date().getTime()}`,onLoad:g},null,40,k)]))}});u.ClgTemplateBuilder=D,Object.defineProperty(u,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.10",
3
+ "version": "1.0.11",
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"
28
+ "release": "pnpm publish --access public --tag beta"
29
29
  }
30
30
  }