@cling-se/widget 0.14.4 → 0.14.6

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 (129) hide show
  1. package/dist/AddClientCallout-C7abPZ87.js +46 -0
  2. package/dist/AnswerModal-CsA2pl2P.js +3874 -0
  3. package/dist/AttachmentItem-Da1-7xwf.js +78 -0
  4. package/dist/BaseDatePicker-k9zlSi5J.js +3183 -0
  5. package/dist/BaseUpload-BUrXX3fT.js +1977 -0
  6. package/dist/BlockMedia-CYI07qAn.js +76 -0
  7. package/dist/CCallout-Qwae66vo.js +59 -0
  8. package/dist/CCurrencyDropdown-Y_u0hgBx.js +246 -0
  9. package/dist/CDropdownItem-CXJ4xD8W.js +538 -0
  10. package/dist/CField.vue_vue_type_style_index_0_lang-l0sNRNKZ.js +1 -0
  11. package/dist/CFormField--m3PvQuT.js +241 -0
  12. package/dist/CPhoneFormat-Qg6MkDVP.js +62 -0
  13. package/dist/CPriceInput-Dlx44UrR.js +112 -0
  14. package/dist/CTabs.vue_vue_type_style_index_0_scoped_b7262014_lang-l0sNRNKZ.js +1 -0
  15. package/dist/ClientAutocomplete-BKKc_br6.js +78 -0
  16. package/dist/ClientModal-CVZFb1Br.js +625 -0
  17. package/dist/ColorPicker-Bo3s3Esp.js +2879 -0
  18. package/dist/CompanyModal-DadjAioS.js +141 -0
  19. package/dist/ContentWrapper-BC3ZBQW9.js +183 -0
  20. package/dist/CoverBlockSettings-B484eE4g.js +275 -0
  21. package/dist/DocAnswer-CcYryOWI.js +36 -0
  22. package/dist/DocDetails-BigsoEWL.js +246 -0
  23. package/dist/DocForm-DlN0eNWt.js +7273 -0
  24. package/dist/DocFormSend-TqKo210I.js +143 -0
  25. package/dist/DocLinks-DSo54vDn.js +38 -0
  26. package/dist/DocModalBase-XlM1SThW.js +28 -0
  27. package/dist/DocPrint-tD0Vd9Sw.js +240 -0
  28. package/dist/DocReceipt-CDHPrhXM.js +210 -0
  29. package/dist/DocSendReminder-C62RhltH.js +137 -0
  30. package/dist/DocTextEditor-VjhV9IRp.js +17181 -0
  31. package/dist/DocTimeline-LcW4z3nC.js +481 -0
  32. package/dist/DocumentClient-CqbTRdpB.js +136 -0
  33. package/dist/DocumentLayout-Dbf8_01r.js +4909 -0
  34. package/dist/DocumentLogotype-DXYnBedV.js +87 -0
  35. package/dist/DocumentVoided-vH1Ti5lZ.js +25 -0
  36. package/dist/EmbedInput-D9qP8OnY.js +113 -0
  37. package/dist/EmbedSettings-DISuNqJT.js +72 -0
  38. package/dist/ErrorCallout-CCtCVwSh.js +28 -0
  39. package/dist/FilePreviewModal-BjhNyb6L.js +81 -0
  40. package/dist/Flag-Dhukv9_J.js +114 -0
  41. package/dist/HeaderSettings-CK4SkB1x.js +392 -0
  42. package/dist/ImageSelectModal-DnvPZzXx.js +84 -0
  43. package/dist/ImageUploadWrapper-B7cNMu5a.js +1604 -0
  44. package/dist/Index-B3HoK_cZ.js +84 -0
  45. package/dist/Index-B3aucNji.js +25 -0
  46. package/dist/Index-B9H5MMHb.js +62 -0
  47. package/dist/Index-BAYdvT-t.js +754 -0
  48. package/dist/Index-BLeQprjq.js +46 -0
  49. package/dist/Index-BOyvQlng.js +154 -0
  50. package/dist/Index-BVsw2tak.js +70 -0
  51. package/dist/Index-BY1UKGEO.js +98 -0
  52. package/dist/Index-Bh0kMSsA.js +107 -0
  53. package/dist/Index-BlQSM7tC.js +144 -0
  54. package/dist/Index-BpcJBGGd.js +642 -0
  55. package/dist/Index-Bs8wprXw.js +58 -0
  56. package/dist/Index-BvZZAvFd.js +21 -0
  57. package/dist/Index-CFo-3Y5Q.js +26 -0
  58. package/dist/Index-CNvp5K3L.js +559 -0
  59. package/dist/Index-CPJVx14x.js +171 -0
  60. package/dist/Index-CQ325eVT.js +140 -0
  61. package/dist/Index-CWrDtcfT.js +49 -0
  62. package/dist/Index-CyJnSvDR.js +223 -0
  63. package/dist/Index-D6bc7lg4.js +52 -0
  64. package/dist/Index-DCR8ev4U.js +33 -0
  65. package/dist/Index-DGQSB9cH.js +24 -0
  66. package/dist/Index-DXAvlq74.js +292 -0
  67. package/dist/Index-D_rfst8y.js +45 -0
  68. package/dist/Index-Dm8xMFGg.js +61 -0
  69. package/dist/Index-DtSSgtxB.js +55 -0
  70. package/dist/Index-DuTw9vhb.js +77 -0
  71. package/dist/Index-Dw26jtGV.js +31 -0
  72. package/dist/Index-OxN73_fO.js +32 -0
  73. package/dist/Index-S-FHG7_k.js +2402 -0
  74. package/dist/Index-ZFkitzfq.js +69 -0
  75. package/dist/Index-dyWK9jgr.js +25 -0
  76. package/dist/Index-gb11ngPS.js +57 -0
  77. package/dist/Index-lKk_XKJ3.js +150 -0
  78. package/dist/InputToggleRow-DSSvhPKA.js +57 -0
  79. package/dist/ManualPopover-lpJYSkw5.js +58 -0
  80. package/dist/MediaWrapper-BQ22FA2B.js +23 -0
  81. package/dist/NotBindingText-JxwzZLPP.js +32 -0
  82. package/dist/PackageGroup-BLSMSUDz.js +699 -0
  83. package/dist/PdfTerms-DtutjM5Y.js +36 -0
  84. package/dist/PdfViewer-BsxcZI_x.js +374 -0
  85. package/dist/PlainHtml-BMPZs2fT.js +20 -0
  86. package/dist/PriceHeader-BRYY01H2.js +339 -0
  87. package/dist/SearchApi-6001iFxU.js +161 -0
  88. package/dist/Setup-cw6jMI9M.js +50 -0
  89. package/dist/SmartList-q6H-uLbm.js +83 -0
  90. package/dist/TermsSettings-DWvaPneu.js +102 -0
  91. package/dist/ThemeColorRow-BXWnvfz-.js +67 -0
  92. package/dist/ToggleBinding-DydtwpNG.js +38 -0
  93. package/dist/UploadModal-D_EDKHGD.js +95 -0
  94. package/dist/VideoPlayerInput-B9yzUeBW.js +93 -0
  95. package/dist/VideoPlayerSettings-Bvp9l0yj.js +61 -0
  96. package/dist/VideoSelectModal-DY3N4JiS.js +100 -0
  97. package/dist/anime.es-BrPTThYb.js +858 -0
  98. package/dist/answerDocumentMixin-BYZPU_R-.js +51 -0
  99. package/dist/color-TdtKxwVa.js +19 -0
  100. package/dist/debounce-BPnlzNwd.js +84 -0
  101. package/dist/dom-CJxkno7i.js +91 -0
  102. package/dist/favicon.ico +0 -0
  103. package/dist/focusDrawerMixin-DC9Oa1i7.js +22 -0
  104. package/dist/formComponentsInstall-CEW6TK6z.js +2499 -0
  105. package/dist/formDrawerState-CAzvSMiQ.js +20 -0
  106. package/dist/formValidationMixin-D7zXxCpC.js +49 -0
  107. package/dist/i18nMessages-Chz_lxGG.js +17 -0
  108. package/dist/index-B9WDC3Xe.js +166 -0
  109. package/dist/index-BCMaUC5r.js +3916 -0
  110. package/dist/index-BDMI4NVY.js +492 -0
  111. package/dist/index-BbscgdRg.js +81 -0
  112. package/dist/index-CLUljEDI.js +347 -0
  113. package/dist/index-SxyZvewN.js +102 -0
  114. package/dist/index.es.js +35 -0
  115. package/dist/index.umd.js +3148 -0
  116. package/dist/main-CQBEuZk9.js +56739 -0
  117. package/dist/mapFormMixin-DlFcgwhm.js +72 -0
  118. package/dist/omit-BWy0Zhd3.js +31 -0
  119. package/dist/publicSenderState-CvOcFv2U.js +21 -0
  120. package/dist/splitpanes-BHUVsCZF.js +382 -0
  121. package/dist/style.css +4 -0
  122. package/dist/throttle-BrC8eGjQ.js +18 -0
  123. package/dist/tinycolor-PhFP695w.js +633 -0
  124. package/dist/tippy.esm-7dmKOUvu.js +1799 -0
  125. package/dist/utils-NBLgNGHR.js +108 -0
  126. package/dist/vuedraggable.umd-ByfH7ZxC.js +3161 -0
  127. package/dist/vuex.esm-DKGl8mcw.js +467 -0
  128. package/package.json +1 -1
  129. package/vite.config.ts +0 -1
@@ -0,0 +1,58 @@
1
+ import { m as r } from "./mapFormMixin-DlFcgwhm.js";
2
+ import { I as n } from "./InputToggleRow-DSSvhPKA.js";
3
+ import { B as s } from "./BaseDatePicker-k9zlSi5J.js";
4
+ import { n as l } from "./main-CQBEuZk9.js";
5
+ const c = {
6
+ i18nOptions: {
7
+ namespaces: "estimatedTimeStartEnd",
8
+ messages: {
9
+ en: {
10
+ title: "Start and end date",
11
+ label: "Work start and ends",
12
+ placeholders: {
13
+ start: "Start date",
14
+ end: "End date"
15
+ }
16
+ },
17
+ sv: {
18
+ title: "Start- och slutdatum",
19
+ label: "Arbetet påbörjas och avslutas",
20
+ placeholders: {
21
+ start: "Startdatum",
22
+ end: "Slutdatum"
23
+ }
24
+ }
25
+ }
26
+ },
27
+ name: "EstimatedWorkStartAndEndAtTextEdit",
28
+ components: {
29
+ InputToggleRow: n,
30
+ BaseDatePicker: s
31
+ },
32
+ mixins: [r(["startAt", "endAt"])]
33
+ };
34
+ var i = function() {
35
+ var t = this, a = t._self._c;
36
+ return a("InputToggleRow", { attrs: { "display-value": t.startAt && t.endAt ? `${t.$formatDate(t.startAt)} → ${t.$formatDate(t.endAt)}` : t.$t("_common:add"), label: t.$t("label"), "show-clear": !!(t.startAt && t.endAt) }, on: { remove: function(e) {
37
+ t.startAt = null, t.endAt = null;
38
+ } } }, [a("div", { staticStyle: { display: "inline-flex" } }, [a("BaseDatePicker", { staticClass: "datepicker-simple", staticStyle: { width: "calc(8 * var(--rem))" }, attrs: { placeholder: t.$t("placeholders.start") }, on: { click: function(e) {
39
+ e.preventDefault();
40
+ } }, model: { value: t.startAt, callback: function(e) {
41
+ t.startAt = e;
42
+ }, expression: "startAt" } }), a("div", { staticStyle: { "line-height": "calc(3 * var(--rem))", margin: "0 calc(0.5 * var(--rem))", "font-size": "calc(calc(1 * var(--rem)) + 2px)" } }, [t._v(" → ")]), a("BaseDatePicker", { staticClass: "datepicker-simple", staticStyle: { width: "calc(8 * var(--rem))" }, attrs: { static: !0, placeholder: t.$t("placeholders.end") }, on: { click: function(e) {
43
+ e.preventDefault();
44
+ } }, model: { value: t.endAt, callback: function(e) {
45
+ t.endAt = e;
46
+ }, expression: "endAt" } })], 1)]);
47
+ }, o = [], d = /* @__PURE__ */ l(
48
+ c,
49
+ i,
50
+ o,
51
+ !1,
52
+ null,
53
+ null
54
+ );
55
+ const A = d.exports;
56
+ export {
57
+ A as default
58
+ };
@@ -0,0 +1,21 @@
1
+ import { P as n } from "./PlainHtml-BMPZs2fT.js";
2
+ import { n as e } from "./main-CQBEuZk9.js";
3
+ const o = {
4
+ name: "WorkAddressTextRead",
5
+ functional: !0,
6
+ render(s, r) {
7
+ return s(n, [r.props.street ? `${r.props.street}, ` : "", r.props.zip ? `${r.props.zip} ` : " ", r.props.city]);
8
+ }
9
+ }, p = null, t = null;
10
+ var l = /* @__PURE__ */ e(
11
+ o,
12
+ p,
13
+ t,
14
+ !1,
15
+ null,
16
+ null
17
+ );
18
+ const m = l.exports;
19
+ export {
20
+ m as default
21
+ };
@@ -0,0 +1,26 @@
1
+ import { m as o } from "./mapFormMixin-DlFcgwhm.js";
2
+ import { n as i } from "./main-CQBEuZk9.js";
3
+ const a = {
4
+ name: "NotBinding",
5
+ components: {
6
+ Edit: () => import("./ToggleBinding-DydtwpNG.js"),
7
+ Read: () => import("./NotBindingText-JxwzZLPP.js")
8
+ },
9
+ mixins: [o()]
10
+ };
11
+ var r = function() {
12
+ var e;
13
+ var n = this, t = n._self._c;
14
+ return n.canEdit ? t("Edit", n._g({ attrs: { _document: n._document, _value: { notBinding: "data.notBinding" } } }, n.$listeners)) : (e = n._document.data) != null && e.notBinding ? t("Read") : n._e();
15
+ }, m = [], _ = /* @__PURE__ */ i(
16
+ a,
17
+ r,
18
+ m,
19
+ !1,
20
+ null,
21
+ "8587fb62"
22
+ );
23
+ const f = _.exports;
24
+ export {
25
+ f as default
26
+ };
@@ -0,0 +1,559 @@
1
+ import { m as g } from "./mapFormMixin-DlFcgwhm.js";
2
+ import { A as o, ap as u, b as h, n as l, aq as b, ar as a, as as n } from "./main-CQBEuZk9.js";
3
+ import { s as v, p as y } from "./splitpanes-BHUVsCZF.js";
4
+ import { t as w } from "./throttle-BrC8eGjQ.js";
5
+ import { W as m } from "./DocumentLayout-Dbf8_01r.js";
6
+ import { e as p } from "./dom-CJxkno7i.js";
7
+ import { d as _ } from "./debounce-BPnlzNwd.js";
8
+ const x = `
9
+ /*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}html{box-sizing:border-box;font-family:sans-serif}*,::after,::before{box-sizing:inherit}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,p,pre{margin:0}button{background:0 0;padding:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}fieldset{margin:0;padding:0}ol,ul{margin:0}*,::after,::before{border-width:0;border-style:solid;border-color:#dae1e7}img{border-style:solid}[type=button],[type=reset],[type=submit],button{border-radius:0}textarea{resize:vertical}img{max-width:100%;height:auto}button,input,optgroup,select,textarea{font-family:inherit}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:inherit;opacity:.5}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:inherit;opacity:.5}input::-ms-input-placeholder,textarea::-ms-input-placeholder{color:inherit;opacity:.5}input::placeholder,textarea::placeholder{color:inherit;opacity:.5}[role=button],button{cursor:pointer}table{border-collapse:collapse}
10
+ `, M = (e, { _document: t, id: s, firstRender: i }) => `
11
+ <!DOCTYPE html>
12
+ <html>
13
+ <head>
14
+ <style>${x}</style>
15
+ <style>${e.css}</style>
16
+ </head>
17
+ <body>
18
+ ${e.html}
19
+ </body>
20
+ <script>
21
+ var doc = ${t};
22
+ var firstRender = ${i};
23
+ function getOuterHeight(el) {
24
+ var height = el.clientHeight;
25
+ var computedStyle = window.getComputedStyle(el);
26
+ height += parseInt(computedStyle.marginTop, 10);
27
+ height += parseInt(computedStyle.marginBottom, 10);
28
+ height += parseInt(computedStyle.borderTopWidth, 10);
29
+ height += parseInt(computedStyle.borderBottomWidth, 10);
30
+ return height;
31
+ };
32
+
33
+ function sendHeightMessage() {
34
+ var message = JSON.stringify({
35
+ id: '${s}',
36
+ channel: 'customBlock',
37
+ data: {
38
+ height: getOuterHeight(document.body),
39
+ },
40
+ });
41
+
42
+ window.parent.postMessage(message, '*');
43
+ };
44
+
45
+ setTimeout(sendHeightMessage, 10);
46
+ setInterval(sendHeightMessage, 1000);
47
+
48
+ // Update doc variable on changes
49
+ window.addEventListener('message', function(e){
50
+ try {
51
+ parsed = JSON.parse(e.data);
52
+ } catch (error) {
53
+ // nope
54
+ }
55
+ if (!(parsed && parsed.channel === 'document')) return;
56
+ doc = parsed.data.body;
57
+ window.dispatchEvent(new CustomEvent('docUpdate', { detail: doc }));
58
+ });
59
+ <\/script>
60
+ <script type="module">
61
+ ${e.javascript}
62
+ <\/script>
63
+ </html>`, f = {
64
+ name: "CustomView",
65
+ props: {
66
+ html: {
67
+ type: String,
68
+ default: ""
69
+ },
70
+ css: {
71
+ type: String,
72
+ default: ""
73
+ },
74
+ javascript: {
75
+ type: String,
76
+ default: ""
77
+ },
78
+ _document: {
79
+ type: Object,
80
+ default: () => ({})
81
+ }
82
+ },
83
+ data() {
84
+ return {
85
+ storeListenerUnsubscribe: null,
86
+ // Temp obj to store current used paths and their value to detect when we should re-render
87
+ usedPathValues: {}
88
+ };
89
+ },
90
+ watch: {
91
+ html() {
92
+ this.updateView();
93
+ },
94
+ css() {
95
+ this.updateView();
96
+ },
97
+ javascript() {
98
+ this.updateView();
99
+ }
100
+ },
101
+ methods: {
102
+ updateView({
103
+ firstRender: e = !1
104
+ } = {}) {
105
+ if (!this.$refs.iframe)
106
+ return;
107
+ const t = this._document.getRawData();
108
+ this.setUsedPathValues(), this.$refs.iframe.srcdoc = M({
109
+ html: o(this.html, t),
110
+ css: o(this.css, t),
111
+ javascript: o(this.javascript, t)
112
+ }, {
113
+ _document: JSON.stringify(t),
114
+ id: this._uid,
115
+ firstRender: e
116
+ });
117
+ },
118
+ registerStoreListener() {
119
+ this.sendDocumentUpdate = w(this.sendDocMessage, 1e3), this.storeListenerUnsubscribe = this.$store.subscribe((e) => {
120
+ const {
121
+ type: t
122
+ } = e;
123
+ (t === "forms/SET_FORM_VALUE" || t === "publicDocuments/SET_CURRENT_DOCUMENT_VALUE") && (this.sendDocumentUpdate(), ["html", "css", "javascript"].some((i) => {
124
+ const c = u(this[i]);
125
+ return Object.keys(c).some((d) => this.usedPathValues[d] !== h(this._document.getRawData(), d));
126
+ }) && this.updateView());
127
+ });
128
+ },
129
+ unregisterStoreListener() {
130
+ var e;
131
+ (e = this.storeListenerUnsubscribe) == null || e.call(this);
132
+ },
133
+ setUsedPathValues() {
134
+ ["html", "css", "javascript"].forEach((e) => {
135
+ const t = u(this[e]);
136
+ Object.keys(t).forEach((s) => {
137
+ this.usedPathValues[s] = h(this._document.getRawData(), s);
138
+ });
139
+ });
140
+ },
141
+ // Update doc variable in iFrame
142
+ sendDocMessage() {
143
+ const e = JSON.stringify({
144
+ channel: "document",
145
+ data: {
146
+ body: this._document.getRawData()
147
+ }
148
+ });
149
+ this.$refs.iframe.contentWindow.postMessage(e, "*");
150
+ }
151
+ },
152
+ mounted() {
153
+ this.updateView({
154
+ firstRender: !0
155
+ }), this.sendDocMessage(), window.addEventListener("message", (e) => {
156
+ let t = null;
157
+ try {
158
+ t = JSON.parse(e.data);
159
+ } catch {
160
+ }
161
+ t && t.channel === "customBlock" && (t == null ? void 0 : t.id) === `${this._uid}` && this.$refs.iframe && (this.$refs.iframe.style.height = t.data.height + "px");
162
+ }), this.registerStoreListener();
163
+ },
164
+ beforeDestroy() {
165
+ var e, t;
166
+ this.unregisterStoreListener(), (t = (e = this.sendDocumentUpdate) == null ? void 0 : e.cancel) == null || t.call(e);
167
+ },
168
+ render(e) {
169
+ return e("iframe", {
170
+ attrs: {
171
+ id: this._uid,
172
+ sandbox: "allow-scripts",
173
+ frameBorder: "0"
174
+ },
175
+ ref: "iframe",
176
+ class: "h-0 w-full"
177
+ });
178
+ }
179
+ }, S = {
180
+ name: "MonacoEditor",
181
+ props: {
182
+ value: String,
183
+ srcdoc: String,
184
+ language: {
185
+ type: String,
186
+ default: "javascript"
187
+ },
188
+ theme: {
189
+ type: String,
190
+ default: "vs-dark"
191
+ },
192
+ options: {
193
+ type: Object,
194
+ default: () => ({
195
+ tabSize: 2,
196
+ insertSpaces: !0,
197
+ minimap: {
198
+ enabled: !1
199
+ }
200
+ })
201
+ },
202
+ editorMounted: {
203
+ type: Function,
204
+ default: () => {
205
+ }
206
+ },
207
+ editorBeforeMount: {
208
+ type: Function,
209
+ default: () => {
210
+ }
211
+ },
212
+ debounceTime: {
213
+ type: Number,
214
+ default: 500
215
+ },
216
+ disabled: {
217
+ type: Boolean,
218
+ default: !1
219
+ }
220
+ },
221
+ components: {
222
+ WithDimensions: m
223
+ },
224
+ watch: {
225
+ options: {
226
+ deep: !0,
227
+ handler(e) {
228
+ var t;
229
+ (t = this.editor) == null || t.updateOptions(e);
230
+ }
231
+ },
232
+ value() {
233
+ this.editor && this.value !== this.getValue() && this.setValue(this.value);
234
+ },
235
+ language() {
236
+ this.editor && window.monaco.editor.setModelLanguage(this.editor.getModel(), this.language);
237
+ },
238
+ theme() {
239
+ this.editor && window.monaco.editor.setTheme(this.theme);
240
+ },
241
+ disabled(e) {
242
+ var t;
243
+ (t = this.editor) == null || t.updateOptions({
244
+ readOnly: e
245
+ });
246
+ }
247
+ },
248
+ mounted() {
249
+ this.loadMonaco().then(() => {
250
+ var e;
251
+ this.initMonaco(), (e = this.editor) == null || e.focus();
252
+ });
253
+ },
254
+ beforeDestroy() {
255
+ var e, t, s;
256
+ (e = this.editor) == null || e.dispose(), (s = (t = this.codeChangeEmitter) == null ? void 0 : t.cancel) == null || s.call(t);
257
+ },
258
+ render(e) {
259
+ return e(m, {
260
+ on: {
261
+ width: () => {
262
+ var t;
263
+ return (t = this.editor) == null ? void 0 : t.layout();
264
+ },
265
+ height: () => {
266
+ var t;
267
+ return (t = this.editor) == null ? void 0 : t.layout();
268
+ }
269
+ }
270
+ }, [e("div")]);
271
+ },
272
+ methods: {
273
+ async loadMonaco() {
274
+ await p("https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/min/vs/loader.js");
275
+ const e = {
276
+ paths: {
277
+ vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/min/vs"
278
+ }
279
+ };
280
+ await new Promise((t, s) => {
281
+ window.require.config(e), window.require(["vs/editor/editor.main"], t, s);
282
+ }), await p("https://cdn.jsdelivr.net/npm/emmet-monaco-es@5.1.0/dist/emmet-monaco.js");
283
+ },
284
+ initMonaco() {
285
+ window.emmetMonaco.emmetHTML(window.monaco), window.emmetMonaco.emmetCSS(window.monaco);
286
+ const {
287
+ value: e,
288
+ language: t,
289
+ theme: s,
290
+ options: i
291
+ } = this;
292
+ Object.assign(i, this._editorBeforeMount()), this.editor = window.monaco.editor.create(this.$el, {
293
+ value: e,
294
+ language: t,
295
+ theme: s,
296
+ readOnly: this.disabled,
297
+ ...i
298
+ }), this._editorMounted(this.editor);
299
+ },
300
+ getEditor() {
301
+ return this.editor ? this.editor : null;
302
+ },
303
+ setValue(e) {
304
+ const t = this.getEditor();
305
+ t == null || t.setValue(e);
306
+ },
307
+ getValue() {
308
+ const e = this.getEditor();
309
+ return e ? e.getValue() : "";
310
+ },
311
+ _editorBeforeMount() {
312
+ return this.editorBeforeMount(window.monaco) || {};
313
+ },
314
+ _editorMounted(e) {
315
+ this.editorMounted(e, window.monaco), this.codeChangeEmitter = _((t, s) => this.emitChange(t, s), this.debounceTime), e.onDidChangeModelContent((t) => {
316
+ const s = this.getValue();
317
+ this.codeChangeEmitter(s, t);
318
+ });
319
+ },
320
+ emitChange(e, t) {
321
+ this.$emit("change", e, t), this.$emit("input", e);
322
+ }
323
+ }
324
+ }, z = {
325
+ html: '<path fill="#e44f26" d="M5.902 27.201L3.655 2h24.69l-2.25 25.197L15.985 30L5.902 27.201z"></path><path fill="#f1662a" d="m16 27.858l8.17-2.265l1.922-21.532H16v23.797z"></path><path fill="#ebebeb" d="M16 13.407h-4.09l-.282-3.165H16V7.151H8.25l.074.83l.759 8.517H16v-3.091zm0 8.027l-.014.004l-3.442-.929l-.22-2.465H9.221l.433 4.852l6.332 1.758l.014-.004v-3.216z"></path><path fill="#fff" d="M15.989 13.407v3.091h3.806l-.358 4.009l-3.448.93v3.216l6.337-1.757l.046-.522l.726-8.137l.076-.83h-7.185zm0-6.256v3.091h7.466l.062-.694l.141-1.567l.074-.83h-7.743z"></path>',
326
+ css: '<path fill="#1572b6" d="M5.902 27.201L3.656 2h24.688l-2.249 25.197L15.985 30L5.902 27.201z"></path><path fill="#33a9dc" d="m16 27.858l8.17-2.265l1.922-21.532H16v23.797z"></path><path fill="#fff" d="M16 13.191h4.09l.282-3.165H16V6.935h7.75l-.074.829l-.759 8.518H16v-3.091z"></path><path fill="#ebebeb" d="m16.019 21.218l-.014.004l-3.442-.93l-.22-2.465H9.24l.433 4.853l6.331 1.758l.015-.004v-3.216z"></path><path fill="#fff" d="m19.827 16.151l-.372 4.139l-3.447.93v3.216l6.336-1.756l.047-.522l.537-6.007h-3.101z"></path><path fill="#ebebeb" d="M16.011 6.935v3.091H8.545l-.062-.695l-.141-1.567l-.074-.829h7.743zM16 13.191v3.091h-3.399l-.062-.695l-.14-1.567l-.074-.829H16z"></path>',
327
+ javascript: '<path fill="#f5de19" d="M2 2h28v28H2z"></path><path d="M20.809 23.875a2.866 2.866 0 0 0 2.6 1.6c1.09 0 1.787-.545 1.787-1.3c0-.9-.716-1.222-1.916-1.747l-.658-.282c-1.9-.809-3.16-1.822-3.16-3.964c0-1.973 1.5-3.476 3.853-3.476a3.889 3.889 0 0 1 3.742 2.107L25 18.128A1.789 1.789 0 0 0 23.311 17a1.145 1.145 0 0 0-1.259 1.128c0 .789.489 1.109 1.618 1.6l.658.282c2.236.959 3.5 1.936 3.5 4.133c0 2.369-1.861 3.667-4.36 3.667a5.055 5.055 0 0 1-4.795-2.691Zm-9.295.228c.413.733.789 1.353 1.693 1.353c.864 0 1.41-.338 1.41-1.653v-8.947h2.631v8.982c0 2.724-1.6 3.964-3.929 3.964a4.085 4.085 0 0 1-3.947-2.4Z"></path>',
328
+ json: '<path fill="currentColor" d="M31 11v10h-2l-2-6v6h-2V11h2l2 6v-6h2zm-9.666 10h-2.667A1.668 1.668 0 0 1 17 19.334v-6.667A1.668 1.668 0 0 1 18.666 11h2.667A1.668 1.668 0 0 1 23 12.666v6.667A1.668 1.668 0 0 1 21.334 21zM19 19h2v-6h-2zm-5.666 2H9v-2h4v-2h-2a2.002 2.002 0 0 1-2-2v-2.334A1.668 1.668 0 0 1 10.666 11H15v2h-4v2h2a2.002 2.002 0 0 1 2 2v2.333A1.668 1.668 0 0 1 13.334 21zm-8 0H2.667A1.668 1.668 0 0 1 1 19.334V17h2v2h2v-8h2v8.334A1.668 1.668 0 0 1 5.333 21z"></path>'
329
+ }, k = {
330
+ name: "Tabs",
331
+ props: {
332
+ value: {
333
+ type: String,
334
+ default: ""
335
+ },
336
+ items: {
337
+ type: Array,
338
+ default: () => []
339
+ },
340
+ hLayout: {
341
+ type: Boolean,
342
+ default: !1
343
+ }
344
+ },
345
+ data() {
346
+ return {
347
+ icons: z
348
+ };
349
+ }
350
+ };
351
+ var C = function() {
352
+ var t = this, s = t._self._c;
353
+ return s("div", { staticClass: "tabs-root" }, [s("div", { staticClass: "simple-btn", on: { click: function(i) {
354
+ return t.$emit("close");
355
+ } } }, [s("CIcon", { attrs: { type: "x", size: "18" } })], 1), t._l(t.items, function(i) {
356
+ return s("div", { key: i.value, staticClass: "tab-item", class: {
357
+ "tab-item-active": t.value === i.value
358
+ }, on: { click: function(c) {
359
+ return t.$emit("input", i.value);
360
+ } } }, [s("svg", { staticStyle: { "margin-right": "0.5em" }, attrs: { xmlns: "http://www.w3.org/2000/svg", "xmlns:xlink": "http://www.w3.org/1999/xlink", "aria-hidden": "true", role: "img", width: "18", height: "18", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 32 32" }, domProps: { innerHTML: t._s(t.icons[i.value]) } }), s("span", { domProps: { textContent: t._s(i.text) } })]);
361
+ }), s("div", { staticClass: "simple-btn", staticStyle: { "margin-left": "auto" }, on: { click: function(i) {
362
+ return t.$emit("update:hLayout", !t.hLayout);
363
+ } } }, [s("CIcon", { staticStyle: { transition: "transform 150ms" }, style: {
364
+ transform: t.hLayout ? "rotate(0deg)" : "rotate(90deg)"
365
+ }, attrs: { type: "layout", size: "18" } })], 1)], 2);
366
+ }, j = [], $ = /* @__PURE__ */ l(
367
+ k,
368
+ C,
369
+ j,
370
+ !1,
371
+ null,
372
+ "9216f5b5"
373
+ );
374
+ const L = $.exports, V = {
375
+ name: "CustomModal",
376
+ components: {
377
+ Tabs: L,
378
+ MonacoEditor: S,
379
+ Splitpanes: v,
380
+ Pane: y,
381
+ CustomView: f
382
+ },
383
+ props: {
384
+ _document: {
385
+ type: Object,
386
+ default: () => ({})
387
+ },
388
+ html: {
389
+ type: String,
390
+ default: ""
391
+ },
392
+ css: {
393
+ type: String,
394
+ default: ""
395
+ },
396
+ javascript: {
397
+ type: String,
398
+ default: ""
399
+ }
400
+ },
401
+ data() {
402
+ return {
403
+ hLayout: !1,
404
+ currentTab: "html",
405
+ items: [
406
+ { text: "HTML", value: "html" },
407
+ { text: "CSS", value: "css" },
408
+ { text: "JS", value: "javascript" },
409
+ { text: "Data", value: "json", disabled: !0 }
410
+ ],
411
+ modalName: `customModal${this._uid}`
412
+ };
413
+ },
414
+ computed: {
415
+ currentValue() {
416
+ return this[this.currentTab];
417
+ },
418
+ currentItem() {
419
+ return this.items.find(({ value: e }) => e === this.currentTab) || {};
420
+ },
421
+ json() {
422
+ return JSON.stringify(this._document.getRawData(), null, 2);
423
+ }
424
+ },
425
+ methods: {
426
+ show() {
427
+ this.$modal.show(this.modalName);
428
+ }
429
+ }
430
+ };
431
+ var T = function() {
432
+ var t = this, s = t._self._c;
433
+ return s("portal", { attrs: { to: "modal" } }, [s("modal", { attrs: { name: t.modalName, adaptive: !0, width: "100%", height: "100%", classes: "overflow-visible primary" } }, [s("Splitpanes", { staticClass: "root font-inter", attrs: { horizontal: t.hLayout } }, [s("Pane", [s("Tabs", { attrs: { items: t.items, "h-layout": t.hLayout }, on: { "update:hLayout": function(i) {
434
+ t.hLayout = i;
435
+ }, "update:h-layout": function(i) {
436
+ t.hLayout = i;
437
+ }, close: function(i) {
438
+ return t.$modal.hide(t.modalName);
439
+ } }, model: { value: t.currentTab, callback: function(i) {
440
+ t.currentTab = i;
441
+ }, expression: "currentTab" } }), s("MonacoEditor", { staticStyle: { width: "100%", height: "100%" }, attrs: { language: t.currentTab, value: t.currentValue, disabled: t.currentItem.disabled }, on: { change: function(i) {
442
+ return t.$emit(`update:${t.currentTab}`, i);
443
+ } }, nativeOn: { keyup: function(i) {
444
+ i.stopPropagation();
445
+ } } })], 1), s("Pane", [s("div", { staticStyle: { height: "100%", width: "100%", overflow: "auto" } }, [s("CustomView", { attrs: { html: t.html, css: t.css, javascript: t.javascript, _document: t._document } })], 1)])], 1)], 1)], 1);
446
+ }, E = [], H = /* @__PURE__ */ l(
447
+ V,
448
+ T,
449
+ E,
450
+ !1,
451
+ null,
452
+ "178af298"
453
+ );
454
+ const O = H.exports, r = b(), D = {
455
+ components: {
456
+ CustomView: f,
457
+ CustomModal: O
458
+ },
459
+ i18nOptions: {
460
+ namespaces: "Custom",
461
+ messages: {
462
+ en: {
463
+ title: "Create your own custom block.",
464
+ text: "Use HTML, CSS and Javascript to create & design a block exactly the way you want it.",
465
+ action: "Open editor"
466
+ },
467
+ sv: {
468
+ title: "Skapa ett skräddarsytt block.",
469
+ text: "Använd HTML, CSS och Javascript för att koda & design:a ett block precis som du vill ha det.",
470
+ action: "Öppna kod-editor"
471
+ }
472
+ }
473
+ },
474
+ mixins: [g(["custom"])],
475
+ inject: {
476
+ setOpenDrawer: {
477
+ type: Function,
478
+ default: null
479
+ }
480
+ },
481
+ data() {
482
+ return {
483
+ showControls: !1
484
+ };
485
+ },
486
+ computed: {
487
+ isEdited() {
488
+ return this.custom ? this.custom.html !== r.html || this.custom.css !== r.css || this.custom.javascript !== r.javascript : !1;
489
+ },
490
+ html: {
491
+ get() {
492
+ return this.custom.html ? a(this.custom.html) : "";
493
+ },
494
+ set(e) {
495
+ this.custom = {
496
+ ...this.custom,
497
+ html: n(e)
498
+ };
499
+ }
500
+ },
501
+ css: {
502
+ get() {
503
+ return this.custom.css ? a(this.custom.css) : "";
504
+ },
505
+ set(e) {
506
+ this.custom = {
507
+ ...this.custom,
508
+ css: n(e)
509
+ };
510
+ }
511
+ },
512
+ javascript: {
513
+ get() {
514
+ return this.custom.javascript ? a(this.custom.javascript) : "";
515
+ },
516
+ set(e) {
517
+ this.custom = {
518
+ ...this.custom,
519
+ javascript: n(e)
520
+ };
521
+ }
522
+ }
523
+ },
524
+ created() {
525
+ this.setOpenDrawer && this.setOpenDrawer(this.openModal);
526
+ },
527
+ methods: {
528
+ openModal() {
529
+ this.$refs.customModal.show();
530
+ }
531
+ }
532
+ };
533
+ var P = function() {
534
+ var t = this, s = t._self._c;
535
+ return s("div", { staticClass: "custom-root", class: {
536
+ "is-empty": !t.isEdited
537
+ }, style: t.canEdit && { minHeight: "100px" }, on: { "&mouseover": function(i) {
538
+ t.showControls = !0;
539
+ }, "&mouseleave": function(i) {
540
+ t.showControls = !1;
541
+ } } }, [t.isEdited ? s("CustomView", { staticStyle: { width: "100%", "min-height": "0" }, attrs: { html: t.html, css: t.css, javascript: t.javascript, _document: t._document } }) : t._e(), t.isForm ? [t.canEdit && !t.isEdited ? s("div", { staticClass: "flex flex-col items-center justify-center text-center", staticStyle: { padding: "calc(3 * var(--rem)) calc(1 * var(--rem))", "line-height": "1.5", color: "white" } }, [s("div", { staticStyle: { "font-weight": "500", "margin-bottom": "0.25em", opacity: "0.98" }, domProps: { textContent: t._s(t.$t("title")) } }), s("div", { staticStyle: { "font-size": "14px", "margin-bottom": "calc(2 * var(--rem))", color: "hsl(218deg 24% 60%)", "max-width": "40ch" }, domProps: { textContent: t._s(t.$t("text")) } }), s("CButton", { staticStyle: { "font-size": "14px", "border-radius": "8px", padding: "12px 12px", height: "initial", "box-shadow": "rgb(0, 0, 0, 50%) 0px 10px 40px" }, attrs: { size: "normal", "icon-left": "code", type: "secondary" }, on: { click: t.openModal } }, [t._v(" " + t._s(t.$t("action")) + " ")])], 1) : t._e()] : t._e(), s("CustomModal", { ref: "customModal", attrs: { html: t.html, css: t.css, javascript: t.javascript, _document: t._document }, on: { "update:html": function(i) {
542
+ t.html = i;
543
+ }, "update:css": function(i) {
544
+ t.css = i;
545
+ }, "update:javascript": function(i) {
546
+ t.javascript = i;
547
+ } } })], 2);
548
+ }, R = [], U = /* @__PURE__ */ l(
549
+ D,
550
+ P,
551
+ R,
552
+ !1,
553
+ null,
554
+ null
555
+ );
556
+ const W = U.exports;
557
+ export {
558
+ W as default
559
+ };