@dotcms/vue 1.5.5-next.2350

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 (47) hide show
  1. package/README.md +719 -0
  2. package/index.d.ts +16 -0
  3. package/index.js +912 -0
  4. package/lib/__test__/mocks.d.ts +6 -0
  5. package/lib/client/dotcms-client.plugin.d.ts +79 -0
  6. package/lib/components/Column/Column.vue.d.ts +12 -0
  7. package/lib/components/Container/Container.vue.d.ts +11 -0
  8. package/lib/components/Container/ContainerNotFound.vue.d.ts +6 -0
  9. package/lib/components/Container/EmptyContainer.vue.d.ts +2 -0
  10. package/lib/components/Contentlet/Contentlet.vue.d.ts +14 -0
  11. package/lib/components/Contentlet/constants.d.ts +2 -0
  12. package/lib/components/DotCMSBlockEditorRenderer/DotCMSBlockEditorRenderer.vue.d.ts +5 -0
  13. package/lib/components/DotCMSBlockEditorRenderer/components/BlockEditorBlock.vue.d.ts +13 -0
  14. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/BulletList.vue.d.ts +17 -0
  15. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/CodeBlock.vue.d.ts +22 -0
  16. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/DotContent.vue.d.ts +10 -0
  17. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/DotImage.vue.d.ts +7 -0
  18. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/DotVideo.vue.d.ts +7 -0
  19. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/GridBlock.vue.d.ts +10 -0
  20. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/Heading.vue.d.ts +22 -0
  21. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/ListItem.vue.d.ts +17 -0
  22. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/NoComponentProvided.vue.d.ts +6 -0
  23. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/OrderedList.vue.d.ts +17 -0
  24. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/Paragraph.vue.d.ts +22 -0
  25. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/Quote.vue.d.ts +17 -0
  26. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/TableRenderer.vue.d.ts +15 -0
  27. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/TextBlock.vue.d.ts +13 -0
  28. package/lib/components/DotCMSBlockEditorRenderer/components/blocks/UnknownBlock.vue.d.ts +10 -0
  29. package/lib/components/DotCMSBlockEditorRenderer/types.d.ts +44 -0
  30. package/lib/components/DotCMSEditableText/DotCMSEditableText.vue.d.ts +15 -0
  31. package/lib/components/DotCMSEditableText/utils.d.ts +22 -0
  32. package/lib/components/DotCMSLayoutBody/DotCMSLayoutBody.vue.d.ts +5 -0
  33. package/lib/components/DotCMSLayoutBody/components/ErrorMessage.vue.d.ts +2 -0
  34. package/lib/components/DotCMSLayoutBody/types.d.ts +25 -0
  35. package/lib/components/DotCMSShow/DotCMSShow.vue.d.ts +35 -0
  36. package/lib/components/FallbackComponent/FallbackComponent.vue.d.ts +13 -0
  37. package/lib/components/Row/Row.vue.d.ts +13 -0
  38. package/lib/composables/useCheckVisibleContent.d.ts +16 -0
  39. package/lib/composables/useDotCMSShowWhen.d.ts +20 -0
  40. package/lib/composables/useEditableDotCMSPage.d.ts +37 -0
  41. package/lib/composables/useIsAnalyticsActive.d.ts +14 -0
  42. package/lib/composables/useIsDevMode.d.ts +23 -0
  43. package/lib/contexts/dotcms-page.context.d.ts +74 -0
  44. package/lib/utils/imageLoader.d.ts +54 -0
  45. package/lib/utils/toPlain.d.ts +12 -0
  46. package/package.json +47 -0
  47. package/test-setup.d.ts +0 -0
package/index.js ADDED
@@ -0,0 +1,912 @@
1
+ import { inject as ee, isRef as le, isReactive as ie, toRaw as j, shallowRef as ue, toValue as L, watch as V, onMounted as b, onBeforeUnmount as K, ref as N, computed as c, defineComponent as v, unref as E, renderSlot as S, createCommentVNode as T, provide as de, openBlock as r, createElementBlock as i, createElementVNode as y, createTextVNode as C, normalizeStyle as w, toDisplayString as O, mergeProps as $, Fragment as k, createBlock as f, resolveDynamicComponent as D, normalizeProps as R, getCurrentInstance as me, renderList as M, normalizeClass as W, markRaw as te, useSlots as pe, createVNode as h, withCtx as B, resolveComponent as ne } from "vue";
2
+ import { createDotCMSClient as ve } from "@dotcms/client";
3
+ import { UVEEventType as fe, UVE_MODE as P, DotCMSUVEAction as z } from "@dotcms/types";
4
+ import { createUVESubscription as ye, getUVEState as x, initUVE as _e, updateNavigation as ge, sendMessageToUVE as X } from "@dotcms/uve";
5
+ import { registerStyleEditorSchemas as Ce, isDotAnalyticsActive as Q, ANALYTICS_READY_EVENT as J, DEVELOPMENT_MODE as Ee, EMPTY_CONTAINER_STYLE_REACT as oe, getDotContentletAttributes as ke, getAnalyticsContentletAttributes as De, CUSTOM_NO_COMPONENT as Te, getContainersData as Me, getContentletsInContainer as he, getDotContainerAttributes as be, combineClasses as Se, DOT_SECTION_ID_PREFIX as Ne, __DEFAULT_TINYMCE_CONFIG__ as we, __BASE_TINYMCE_CONFIG_WITH_NO_DEFAULT__ as H, __TINYMCE_PATH_ON_DOTCMS__ as $e, isValidBlocks as Oe } from "@dotcms/uve/internal";
6
+ import xe from "@tinymce/tinymce-vue";
7
+ import { __DOTCMS_UVE_EVENT__ as Ae, BlockEditorDefaultBlocks as Ie } from "@dotcms/types/internal";
8
+ const se = /* @__PURE__ */ Symbol("DotCMSClient");
9
+ function qt(t) {
10
+ const e = ve(t);
11
+ return {
12
+ client: e,
13
+ install(n) {
14
+ n.provide(se, e);
15
+ }
16
+ };
17
+ }
18
+ function zt() {
19
+ const t = ee(se, null);
20
+ if (!t)
21
+ throw new Error(
22
+ "[useDotCMSClient] No dotCMS client found. Did you install the plugin with `app.use(createDotCMSVue({ ... }))`?"
23
+ );
24
+ return t;
25
+ }
26
+ function Re(t) {
27
+ const e = /* @__PURE__ */ new WeakMap(), n = (a) => {
28
+ const o = le(a) ? a.value : ie(a) ? j(a) : a;
29
+ if (o === null || typeof o != "object")
30
+ return o;
31
+ if (e.has(o))
32
+ return e.get(o);
33
+ if (Array.isArray(o)) {
34
+ const d = [];
35
+ return e.set(o, d), o.forEach((p) => d.push(n(p))), d;
36
+ }
37
+ const s = Object.getPrototypeOf(o);
38
+ if (s !== Object.prototype && s !== null)
39
+ return o;
40
+ const l = {};
41
+ e.set(o, l);
42
+ for (const d of Object.keys(o))
43
+ l[d] = n(o[d]);
44
+ return l;
45
+ };
46
+ return n(t);
47
+ }
48
+ function Xt(t) {
49
+ const e = ue(L(t));
50
+ let n, a;
51
+ const o = (s) => {
52
+ if (n?.(), n = void 0, !x())
53
+ return;
54
+ if (!s) {
55
+ console.warn("[useEditableDotCMSPage]: No page response provided");
56
+ return;
57
+ }
58
+ const l = Re(s), d = l?.pageAsset?.page?.pageURI;
59
+ ({ destroyUVESubscriptions: n } = _e(l)), d && ge(d), l.styleEditorSchemas?.length && Ce(l.styleEditorSchemas);
60
+ };
61
+ return V(
62
+ () => L(t),
63
+ (s) => {
64
+ e.value = s, o(s);
65
+ },
66
+ { immediate: !0 }
67
+ ), b(() => {
68
+ ({ unsubscribe: a } = ye(
69
+ fe.CONTENT_CHANGES,
70
+ (s) => {
71
+ e.value = s;
72
+ }
73
+ ));
74
+ }), K(() => {
75
+ n?.(), a?.();
76
+ }), e;
77
+ }
78
+ function Le(t) {
79
+ const e = N(!1);
80
+ return b(() => {
81
+ e.value = !0;
82
+ }), c(() => e.value ? x()?.mode === L(t) : !1);
83
+ }
84
+ const Be = /^https?:\/\//;
85
+ function Qt(t = "") {
86
+ const e = t ? new URL(t).origin : "";
87
+ return (n, a = {}) => {
88
+ if (Be.test(n))
89
+ return n;
90
+ const { width: o, quality: s = 50, languageId: l = "1" } = a, d = n.includes("/dA/") ? n : `/dA/${n}`, p = o ? `/${o}w` : "";
91
+ return `${e}${d}${p}/${s}q?language_id=${l}`;
92
+ };
93
+ }
94
+ const Jt = /* @__PURE__ */ v({
95
+ __name: "DotCMSShow",
96
+ props: {
97
+ when: { default: P.EDIT }
98
+ },
99
+ setup(t) {
100
+ const e = t, n = Le(() => e.when);
101
+ return (a, o) => E(n) ? S(a.$slots, "default", { key: 0 }) : T("", !0);
102
+ }
103
+ }), re = /* @__PURE__ */ Symbol("DotCMSPageContext");
104
+ function Pe(t) {
105
+ de(re, t);
106
+ }
107
+ const Ue = {
108
+ pageAsset: {},
109
+ mode: "production",
110
+ userComponents: {},
111
+ isDevMode: !1,
112
+ isAnalyticsActive: !1,
113
+ slots: {}
114
+ };
115
+ function A() {
116
+ return ee(
117
+ re,
118
+ c(() => Ue)
119
+ );
120
+ }
121
+ const Ve = {
122
+ key: 0,
123
+ "data-testid": "error-message",
124
+ style: { padding: "1rem", border: "1px solid #e0e0e0", borderRadius: "4px" }
125
+ }, Fe = /* @__PURE__ */ v({
126
+ __name: "ErrorMessage",
127
+ setup(t) {
128
+ const e = A(), n = c(() => e.value.isDevMode);
129
+ return b(() => {
130
+ console.warn("Missing required layout.body property in page");
131
+ }), (a, o) => n.value ? (r(), i("div", Ve, [...o[0] || (o[0] = [
132
+ y("p", { style: { margin: "0 0 0.5rem", color: "#666" } }, [
133
+ C(" The "),
134
+ y("code", null, "page"),
135
+ C(" is missing the required "),
136
+ y("code", null, "layout.body"),
137
+ C(" property. ")
138
+ ], -1),
139
+ y("p", { style: { margin: 0, color: "#666" } }, " Make sure the page asset is properly loaded and includes a layout configuration. ", -1)
140
+ ])])) : T("", !0);
141
+ }
142
+ }), Z = "contentlet-";
143
+ function Ge() {
144
+ const t = N(!1), e = () => {
145
+ t.value = Q();
146
+ };
147
+ return b(() => {
148
+ t.value = Q(), window.addEventListener(J, e);
149
+ }), K(() => {
150
+ window.removeEventListener(J, e);
151
+ }), t;
152
+ }
153
+ function He(t) {
154
+ const e = x()?.mode;
155
+ return e ? e === P.EDIT : t === Ee;
156
+ }
157
+ function Ye(t) {
158
+ return c(() => He(L(t)));
159
+ }
160
+ const je = /* @__PURE__ */ v({
161
+ __name: "ContainerNotFound",
162
+ props: {
163
+ identifier: {}
164
+ },
165
+ setup(t) {
166
+ const e = t, n = A(), a = c(() => n.value.isDevMode);
167
+ return b(() => {
168
+ a.value && console.error(`Container with identifier ${e.identifier} not found`);
169
+ }), (o, s) => a.value ? (r(), i("div", {
170
+ key: 0,
171
+ "data-testid": "container-not-found",
172
+ style: w(E(oe))
173
+ }, " This container with identifier " + O(t.identifier) + " was not found. ", 5)) : T("", !0);
174
+ }
175
+ }), Ke = /* @__PURE__ */ v({
176
+ inheritAttrs: !1,
177
+ __name: "EmptyContainer",
178
+ setup(t) {
179
+ const e = A(), n = c(() => e.value.isDevMode);
180
+ return (a, o) => n.value ? (r(), i("div", $({ key: 0 }, a.$attrs, { style: E(oe) }), [...o[0] || (o[0] = [
181
+ y("span", {
182
+ "data-testid": "empty-container-message",
183
+ "data-dot-object": "empty-content"
184
+ }, " This container is empty. ", -1)
185
+ ])], 16)) : T("", !0);
186
+ }
187
+ });
188
+ function We(t) {
189
+ const e = N(!1);
190
+ return b(() => {
191
+ const n = t()?.getBoundingClientRect().height ?? 0;
192
+ e.value = n > 0;
193
+ }), e;
194
+ }
195
+ const qe = "dotcms-contentlet", ze = {
196
+ key: 1,
197
+ "data-testid": "no-component"
198
+ }, Xe = /* @__PURE__ */ v({
199
+ __name: "FallbackComponent",
200
+ props: {
201
+ contentlet: {},
202
+ userNoComponent: {}
203
+ },
204
+ setup(t) {
205
+ const e = t, n = A(), a = c(() => n.value.isDevMode), o = c(() => !!e.userNoComponent);
206
+ return (s, l) => a.value ? (r(), i(k, { key: 0 }, [
207
+ o.value ? (r(), f(D(t.userNoComponent), R($({ key: 0 }, t.contentlet)), null, 16)) : (r(), i("div", ze, [
208
+ l[0] || (l[0] = C(" No Component for ", -1)),
209
+ y("strong", null, O(t.contentlet.contentType), 1),
210
+ l[1] || (l[1] = C(" . ", -1))
211
+ ]))
212
+ ], 64)) : T("", !0);
213
+ }
214
+ }), Qe = /* @__PURE__ */ v({
215
+ __name: "Contentlet",
216
+ props: {
217
+ contentlet: {},
218
+ container: {}
219
+ },
220
+ setup(t) {
221
+ const e = t, n = A(), a = c(() => n.value.isDevMode), o = me(), s = We(
222
+ () => o?.proxy?.$el
223
+ ), l = c(() => n.value.isDevMode ? {
224
+ ...ke(e.contentlet, e.container),
225
+ "data-dot-object": "contentlet"
226
+ } : n.value.isAnalyticsActive ? De(e.contentlet) : {}), d = c(
227
+ () => a.value ? { minHeight: s.value ? void 0 : "4rem" } : {}
228
+ ), p = c(() => {
229
+ const m = e.contentlet?.identifier, g = m ? n.value.slots?.[m] : void 0;
230
+ if (g)
231
+ return () => g({ contentlet: e.contentlet });
232
+ }), u = c(
233
+ () => n.value.userComponents[e.contentlet?.contentType]
234
+ ), _ = c(
235
+ () => n.value.userComponents[Te]
236
+ );
237
+ return (m, g) => (r(), i("div", $(l.value, {
238
+ class: E(qe),
239
+ style: d.value
240
+ }), [
241
+ p.value ? (r(), f(D(p.value), { key: 0 })) : u.value ? (r(), f(D(u.value), R($({ key: 1 }, t.contentlet)), null, 16)) : (r(), f(Xe, {
242
+ key: 2,
243
+ "user-no-component": _.value,
244
+ contentlet: t.contentlet
245
+ }, null, 8, ["user-no-component", "contentlet"]))
246
+ ], 16));
247
+ }
248
+ }), Je = /* @__PURE__ */ v({
249
+ __name: "Container",
250
+ props: {
251
+ container: {}
252
+ },
253
+ setup(t) {
254
+ const e = t, n = A(), a = c(() => Me(n.value.pageAsset, e.container)), o = c(() => he(n.value.pageAsset, e.container)), s = c(() => o.value.length === 0), l = c(
255
+ () => n.value.isDevMode && a.value ? be(a.value) : {}
256
+ ), d = c(
257
+ () => n.value.isDevMode ? JSON.stringify(a.value) : ""
258
+ );
259
+ return (p, u) => a.value ? s.value ? (r(), f(Ke, R($({ key: 1 }, l.value)), null, 16)) : (r(), i("div", R($({ key: 2 }, l.value)), [
260
+ (r(!0), i(k, null, M(o.value, (_) => (r(), f(Qe, {
261
+ key: _.identifier,
262
+ contentlet: _,
263
+ container: d.value
264
+ }, null, 8, ["contentlet", "container"]))), 128))
265
+ ], 16)) : (r(), f(je, {
266
+ key: 0,
267
+ identifier: t.container.identifier
268
+ }, null, 8, ["identifier"]));
269
+ }
270
+ }), Ze = /* @__PURE__ */ v({
271
+ __name: "Column",
272
+ props: {
273
+ column: {}
274
+ },
275
+ setup(t) {
276
+ const e = t, n = c(() => ({
277
+ gridColumnStart: e.column.leftOffset,
278
+ gridColumnEnd: e.column.leftOffset + e.column.width
279
+ }));
280
+ return (a, o) => (r(), i("div", {
281
+ "data-dot": "column",
282
+ style: w(n.value)
283
+ }, [
284
+ y("div", {
285
+ class: W(t.column.styleClass)
286
+ }, [
287
+ (r(!0), i(k, null, M(t.column.containers, (s) => (r(), f(Je, {
288
+ key: `${s.identifier}-${s.uuid}`,
289
+ container: s
290
+ }, null, 8, ["container"]))), 128))
291
+ ], 2)
292
+ ], 4));
293
+ }
294
+ }), et = ["id"], tt = /* @__PURE__ */ v({
295
+ __name: "Row",
296
+ props: {
297
+ row: {},
298
+ index: {}
299
+ },
300
+ setup(t) {
301
+ const e = t, n = c(() => Se(["dot-row-container", e.row.styleClass || ""])), a = c(() => `${Ne}${e.index}`), o = {
302
+ display: "grid",
303
+ gridTemplateColumns: "repeat(12, 1fr)",
304
+ gap: "1rem"
305
+ };
306
+ return (s, l) => (r(), i("div", {
307
+ id: a.value,
308
+ class: W(n.value)
309
+ }, [
310
+ y("div", {
311
+ class: "dotcms-row",
312
+ "data-dot-object": "row",
313
+ style: o
314
+ }, [
315
+ (r(!0), i(k, null, M(t.row.columns, (d, p) => (r(), f(Ze, {
316
+ key: p,
317
+ column: d
318
+ }, null, 8, ["column"]))), 128))
319
+ ])
320
+ ], 10, et));
321
+ }
322
+ }), Zt = /* @__PURE__ */ v({
323
+ __name: "DotCMSLayoutBody",
324
+ props: {
325
+ page: {},
326
+ components: {},
327
+ mode: { default: "production" }
328
+ },
329
+ setup(t) {
330
+ const e = t, n = Ye(() => e.mode), a = Ge(), o = c(() => {
331
+ const p = {};
332
+ for (const u of Object.keys(e.components))
333
+ p[u] = j(e.components[u]);
334
+ return te(p);
335
+ }), s = pe(), l = c(() => {
336
+ const p = {}, u = Object.entries(s);
337
+ for (const [_, m] of u)
338
+ m && _.startsWith(Z) && (p[_.slice(Z.length)] = m);
339
+ return p;
340
+ });
341
+ Pe(
342
+ c(() => ({
343
+ pageAsset: e.page,
344
+ mode: e.mode,
345
+ userComponents: o.value,
346
+ isDevMode: n.value,
347
+ isAnalyticsActive: a.value,
348
+ slots: l.value
349
+ }))
350
+ );
351
+ const d = c(() => e.page?.layout?.body?.rows);
352
+ return (p, u) => d.value ? (r(!0), i(k, { key: 0 }, M(d.value, (_, m) => (r(), f(tt, {
353
+ key: m,
354
+ row: _,
355
+ index: m + 1
356
+ }, null, 8, ["row", "index"]))), 128)) : (r(), f(Fe, { key: 1 }));
357
+ }
358
+ }), Y = {
359
+ ...we,
360
+ licenseKey: "gpl"
361
+ // Self-hosted GPL license.
362
+ }, nt = {
363
+ full: {
364
+ ...Y,
365
+ ...H.full
366
+ },
367
+ plain: {
368
+ ...Y,
369
+ ...H.plain
370
+ },
371
+ minimal: {
372
+ ...Y,
373
+ ...H.minimal
374
+ }
375
+ }, ot = ["innerHTML"], st = {
376
+ key: 1,
377
+ style: { outline: "2px solid #006ce7", borderRadius: "4px" }
378
+ }, en = /* @__PURE__ */ v({
379
+ __name: "DotCMSEditableText",
380
+ props: {
381
+ contentlet: {},
382
+ fieldName: {},
383
+ format: { default: "text" },
384
+ mode: { default: "plain" }
385
+ },
386
+ setup(t) {
387
+ const e = t, n = N(null), a = N(""), o = N(!1), s = N(e.contentlet?.[e.fieldName] || ""), l = c(() => nt[e.mode]);
388
+ V(
389
+ () => [e.fieldName, e.contentlet],
390
+ () => {
391
+ s.value = e.contentlet?.[e.fieldName] || "", n.value?.setContent(s.value, { format: e.format });
392
+ }
393
+ );
394
+ const d = (m, g) => {
395
+ n.value = g;
396
+ }, p = (m) => {
397
+ if (Number(
398
+ e.contentlet.onNumberOfPages ?? 1
399
+ ) <= 1 || n.value?.hasFocus())
400
+ return;
401
+ m.stopPropagation(), m.preventDefault();
402
+ const { inode: I, languageId: G } = e.contentlet;
403
+ X({
404
+ action: z.COPY_CONTENTLET_INLINE_EDITING,
405
+ payload: {
406
+ dataset: { inode: I, language: G, fieldName: e.fieldName }
407
+ }
408
+ });
409
+ }, u = () => {
410
+ const m = n.value?.getContent({ format: e.format }) || "";
411
+ if (!n.value?.isDirty() || m === s.value)
412
+ return;
413
+ const { inode: g, languageId: I } = e.contentlet;
414
+ X({
415
+ action: z.UPDATE_CONTENTLET_INLINE_EDITING,
416
+ payload: {
417
+ content: m,
418
+ dataset: { inode: g, langId: I, fieldName: e.fieldName }
419
+ }
420
+ });
421
+ }, _ = ({ data: m }) => {
422
+ const { name: g, payload: I } = m ?? {};
423
+ if (g !== Ae.UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS)
424
+ return;
425
+ const { oldInode: G, inode: ae, fieldName: ce } = I ?? {}, q = e.contentlet.inode;
426
+ (q === G || q === ae) && ce === e.fieldName && n.value?.focus();
427
+ };
428
+ return b(() => {
429
+ const m = x();
430
+ if (o.value = m?.mode === P.EDIT && !!m?.dotCMSHost?.length, !e.contentlet || !e.fieldName) {
431
+ console.error(
432
+ "[DotCMSEditableText]: contentlet or fieldName is missing. Ensure all needed props are passed to view and edit the content."
433
+ );
434
+ return;
435
+ }
436
+ if (m && m.mode !== P.EDIT) {
437
+ console.warn("[DotCMSEditableText]: TinyMCE is not available in the current mode");
438
+ return;
439
+ }
440
+ m?.dotCMSHost && (a.value = new URL($e, m.dotCMSHost).toString(), window.addEventListener("message", _));
441
+ }), K(() => {
442
+ window.removeEventListener("message", _);
443
+ }), (m, g) => o.value ? (r(), i("div", st, [
444
+ h(E(xe), {
445
+ "tinymce-script-src": a.value,
446
+ inline: !0,
447
+ init: l.value,
448
+ "initial-value": s.value,
449
+ onInit: d,
450
+ onMousedown: p,
451
+ onFocusout: u
452
+ }, null, 8, ["tinymce-script-src", "init", "initial-value"])
453
+ ])) : (r(), i("span", {
454
+ key: 0,
455
+ innerHTML: s.value
456
+ }, null, 8, ot));
457
+ }
458
+ }), F = (t, e) => {
459
+ const n = t.__vccOpts || t;
460
+ for (const [a, o] of e)
461
+ n[a] = o;
462
+ return n;
463
+ }, rt = {};
464
+ function at(t, e) {
465
+ return r(), i("ul", null, [
466
+ S(t.$slots, "default")
467
+ ]);
468
+ }
469
+ const ct = /* @__PURE__ */ F(rt, [["render", at]]), lt = ["data-language"], it = /* @__PURE__ */ v({
470
+ __name: "CodeBlock",
471
+ props: {
472
+ node: {}
473
+ },
474
+ setup(t) {
475
+ const e = t, n = c(() => e.node?.attrs?.language || "");
476
+ return (a, o) => (r(), i("pre", { "data-language": n.value }, [
477
+ y("code", null, [
478
+ S(a.$slots, "default")
479
+ ])
480
+ ], 8, lt));
481
+ }
482
+ }), ut = /* @__PURE__ */ v({
483
+ __name: "NoComponentProvided",
484
+ props: {
485
+ contentType: {}
486
+ },
487
+ setup(t) {
488
+ const e = {
489
+ backgroundColor: "#fffaf0",
490
+ color: "#333",
491
+ padding: "1rem",
492
+ borderRadius: "0.5rem",
493
+ marginBottom: "1rem",
494
+ marginTop: "1rem",
495
+ border: "1px solid #ed8936"
496
+ }, n = { color: "#c05621" };
497
+ return (a, o) => (r(), i("div", {
498
+ "data-testid": "no-component-provided",
499
+ style: e
500
+ }, [
501
+ y("strong", { style: n }, "Dev Warning"),
502
+ o[0] || (o[0] = C(" : No component or custom renderer provided for content type ", -1)),
503
+ y("strong", { style: n }, O(t.contentType || "Unknown"), 1),
504
+ o[1] || (o[1] = C(" . ", -1)),
505
+ o[2] || (o[2] = y("br", null, null, -1)),
506
+ o[3] || (o[3] = C(" Please refer to the ", -1)),
507
+ y("a", {
508
+ href: "https://dev.dotcms.com/docs/block-editor",
509
+ target: "_blank",
510
+ rel: "noopener noreferrer",
511
+ style: n
512
+ }, " Block Editor Custom Renderers Documentation "),
513
+ o[4] || (o[4] = C(" for guidance. ", -1))
514
+ ]));
515
+ }
516
+ }), dt = "[DotCMSBlockEditorRenderer]: No data provided for Contentlet Block. Try to add a contentlet to the block editor. If the error persists, please contact the DotCMS support team.", mt = /* @__PURE__ */ v({
517
+ __name: "DotContent",
518
+ props: {
519
+ node: {},
520
+ customRenderers: {},
521
+ isDevMode: { type: Boolean }
522
+ },
523
+ setup(t) {
524
+ const e = (d) => `[DotCMSBlockEditorRenderer]: No matching component found for content type: ${d}. Provide a custom renderer for this content type to fix this error.`, n = t, a = c(() => n.node.attrs?.data), o = c(() => a.value?.contentType ?? "Unknown Content Type"), s = c(() => n.customRenderers?.[o.value]), l = c(() => a.value ? n.isDevMode && !s.value ? "dev-warning" : s.value ? "render" : "no-component" : "no-data");
525
+ return V(
526
+ l,
527
+ (d) => {
528
+ d === "no-data" ? console.error(dt) : d === "no-component" && console.warn(e(o.value));
529
+ },
530
+ { immediate: !0 }
531
+ ), (d, p) => l.value === "dev-warning" ? (r(), f(ut, {
532
+ key: 0,
533
+ "content-type": o.value
534
+ }, null, 8, ["content-type"])) : l.value === "render" ? (r(), f(D(s.value), {
535
+ key: 1,
536
+ node: t.node
537
+ }, null, 8, ["node"])) : T("", !0);
538
+ }
539
+ }), pt = ["alt", "src"], vt = /* @__PURE__ */ v({
540
+ __name: "DotImage",
541
+ props: {
542
+ node: {}
543
+ },
544
+ setup(t) {
545
+ const e = t, n = c(() => e.node.attrs ?? {}), a = c(() => {
546
+ const { textWrap: s, textAlign: l } = n.value;
547
+ return s === "left" ? { float: "left", width: "50%", margin: "0 1rem 1rem 0" } : s === "right" ? { float: "right", width: "50%", margin: "0 0 1rem 1rem" } : l ? { textAlign: l } : {};
548
+ }), o = c(
549
+ () => n.value.textWrap ? { maxWidth: "100%", height: "auto" } : void 0
550
+ );
551
+ return (s, l) => (r(), i("figure", {
552
+ style: w(a.value)
553
+ }, [
554
+ y("img", {
555
+ alt: n.value.alt,
556
+ src: n.value.src,
557
+ style: w(o.value)
558
+ }, null, 12, pt)
559
+ ], 4));
560
+ }
561
+ }), ft = ["width", "height", "poster"], yt = ["src", "type"], _t = /* @__PURE__ */ v({
562
+ __name: "DotVideo",
563
+ props: {
564
+ node: {}
565
+ },
566
+ setup(t) {
567
+ const e = t, n = c(() => e.node.attrs ?? {}), a = c(() => n.value.data?.thumbnail);
568
+ return (o, s) => (r(), i("video", {
569
+ controls: "",
570
+ preload: "metadata",
571
+ width: n.value.width,
572
+ height: n.value.height,
573
+ poster: a.value
574
+ }, [
575
+ s[0] || (s[0] = y("track", {
576
+ default: "",
577
+ kind: "captions",
578
+ srclang: "en"
579
+ }, null, -1)),
580
+ y("source", {
581
+ src: n.value.src,
582
+ type: n.value.mimeType
583
+ }, null, 8, yt),
584
+ s[1] || (s[1] = C(" Your browser does not support the ", -1)),
585
+ s[2] || (s[2] = y("code", null, "video", -1)),
586
+ s[3] || (s[3] = C(" element. ", -1))
587
+ ], 8, ft));
588
+ }
589
+ }), gt = /* @__PURE__ */ v({
590
+ __name: "GridBlock",
591
+ props: {
592
+ node: {},
593
+ customRenderers: {},
594
+ isDevMode: { type: Boolean }
595
+ },
596
+ setup(t) {
597
+ const e = t, n = c(() => {
598
+ const o = e.node.attrs?.columns;
599
+ return Array.isArray(o) && o.length === 2 && o.every((s) => typeof s == "number" && Number.isFinite(s)) ? o : [6, 6];
600
+ }), a = {
601
+ display: "grid",
602
+ gridTemplateColumns: "repeat(12, 1fr)",
603
+ gap: "1rem"
604
+ };
605
+ return (o, s) => (r(), i("div", {
606
+ "data-type": "gridBlock",
607
+ class: "grid-block",
608
+ style: a
609
+ }, [
610
+ (r(!0), i(k, null, M(t.node.content ?? [], (l, d) => (r(), i("div", {
611
+ key: `gridColumn-${d}`,
612
+ "data-type": "gridColumn",
613
+ class: "grid-block__column",
614
+ style: w({ gridColumn: `span ${n.value[d] ?? 6}` })
615
+ }, [
616
+ h(U, {
617
+ content: l.content,
618
+ "custom-renderers": t.customRenderers,
619
+ "is-dev-mode": t.isDevMode
620
+ }, null, 8, ["content", "custom-renderers", "is-dev-mode"])
621
+ ], 4))), 128))
622
+ ]));
623
+ }
624
+ }), Ct = /* @__PURE__ */ v({
625
+ __name: "Heading",
626
+ props: {
627
+ node: {}
628
+ },
629
+ setup(t) {
630
+ const e = t, n = c(() => `h${e.node?.attrs?.level || 1}`);
631
+ return (a, o) => (r(), f(D(n.value), null, {
632
+ default: B(() => [
633
+ S(a.$slots, "default")
634
+ ]),
635
+ _: 3
636
+ }));
637
+ }
638
+ }), Et = {};
639
+ function kt(t, e) {
640
+ return r(), i("li", null, [
641
+ S(t.$slots, "default")
642
+ ]);
643
+ }
644
+ const Dt = /* @__PURE__ */ F(Et, [["render", kt]]), Tt = {};
645
+ function Mt(t, e) {
646
+ return r(), i("ol", null, [
647
+ S(t.$slots, "default")
648
+ ]);
649
+ }
650
+ const ht = /* @__PURE__ */ F(Tt, [["render", Mt]]), bt = /* @__PURE__ */ v({
651
+ __name: "Paragraph",
652
+ props: {
653
+ node: {}
654
+ },
655
+ setup(t) {
656
+ const e = t, n = c(() => e.node?.attrs ?? {});
657
+ return (a, o) => (r(), i("p", {
658
+ style: w(n.value)
659
+ }, [
660
+ S(a.$slots, "default")
661
+ ], 4));
662
+ }
663
+ }), St = {};
664
+ function Nt(t, e) {
665
+ return r(), i("blockquote", null, [
666
+ S(t.$slots, "default")
667
+ ]);
668
+ }
669
+ const wt = /* @__PURE__ */ F(St, [["render", Nt]]), $t = ["aria-label", "aria-labelledby"], Ot = { key: 0 }, xt = ["colspan", "rowspan", "scope"], At = ["colspan", "rowspan"], It = /* @__PURE__ */ v({
670
+ __name: "TableRenderer",
671
+ props: {
672
+ content: {},
673
+ attrs: {},
674
+ customRenderers: {},
675
+ isDevMode: { type: Boolean }
676
+ },
677
+ setup(t) {
678
+ const e = t, n = c(() => e.attrs?.caption || void 0), a = c(() => e.attrs?.ariaLabel || void 0), o = c(() => e.attrs?.ariaLabelledby || void 0), s = (d) => Number(d.attrs?.colspan || 1), l = (d) => Number(d.attrs?.rowspan || 1);
679
+ return (d, p) => (r(), i("table", {
680
+ "aria-label": a.value,
681
+ "aria-labelledby": o.value
682
+ }, [
683
+ n.value ? (r(), i("caption", Ot, O(n.value), 1)) : T("", !0),
684
+ y("tbody", null, [
685
+ (r(!0), i(k, null, M(t.content, (u, _) => (r(), i("tr", {
686
+ key: `row-${_}`
687
+ }, [
688
+ (r(!0), i(k, null, M(u.content ?? [], (m, g) => (r(), i(k, {
689
+ key: `cell-${g}`
690
+ }, [
691
+ m.type === "tableHeader" ? (r(), i("th", {
692
+ key: 0,
693
+ colspan: s(m),
694
+ rowspan: l(m),
695
+ scope: m.attrs?.scope || void 0
696
+ }, [
697
+ h(U, {
698
+ content: m.content ?? [],
699
+ "custom-renderers": t.customRenderers,
700
+ "is-dev-mode": t.isDevMode
701
+ }, null, 8, ["content", "custom-renderers", "is-dev-mode"])
702
+ ], 8, xt)) : (r(), i("td", {
703
+ key: 1,
704
+ colspan: s(m),
705
+ rowspan: l(m)
706
+ }, [
707
+ h(U, {
708
+ content: m.content ?? [],
709
+ "custom-renderers": t.customRenderers,
710
+ "is-dev-mode": t.isDevMode
711
+ }, null, 8, ["content", "custom-renderers", "is-dev-mode"])
712
+ ], 8, At))
713
+ ], 64))), 128))
714
+ ]))), 128))
715
+ ])
716
+ ], 8, $t));
717
+ }
718
+ }), Rt = /* @__PURE__ */ v({
719
+ __name: "TextBlock",
720
+ props: {
721
+ text: {},
722
+ marks: {}
723
+ },
724
+ setup(t) {
725
+ const e = t, n = {
726
+ bold: "strong",
727
+ italic: "em",
728
+ strike: "s",
729
+ underline: "u",
730
+ superscript: "sup",
731
+ subscript: "sub",
732
+ link: "a"
733
+ }, a = c(() => e.marks ?? []), o = c(() => a.value[0]), s = c(() => a.value.slice(1)), l = c(() => o.value ? n[o.value.type] : void 0), d = c(() => o.value?.attrs ?? {});
734
+ return (p, u) => {
735
+ const _ = ne("TextBlock", !0);
736
+ return l.value ? (r(), f(D(l.value), R($({ key: 0 }, d.value)), {
737
+ default: B(() => [
738
+ h(_, {
739
+ text: t.text,
740
+ marks: s.value
741
+ }, null, 8, ["text", "marks"])
742
+ ]),
743
+ _: 1
744
+ }, 16)) : (r(), i(k, { key: 1 }, [
745
+ C(O(t.text), 1)
746
+ ], 64));
747
+ };
748
+ }
749
+ }), Lt = /* @__PURE__ */ v({
750
+ __name: "UnknownBlock",
751
+ props: {
752
+ node: {}
753
+ },
754
+ setup(t) {
755
+ const e = t, n = {
756
+ backgroundColor: "#fff5f5",
757
+ color: "#333",
758
+ padding: "1rem",
759
+ borderRadius: "0.5rem",
760
+ marginBottom: "1rem",
761
+ marginTop: "1rem",
762
+ border: "1px solid #fc8181"
763
+ };
764
+ return b(() => {
765
+ x() || console.warn(
766
+ `[DotCMSBlockEditorRenderer]: Unknown block type "${e.node?.type}". No renderer was found for it.`
767
+ );
768
+ }), (a, o) => E(x)() ? (r(), i("div", {
769
+ key: 0,
770
+ "data-testid": "unknown-block",
771
+ style: n
772
+ }, [
773
+ o[0] || (o[0] = C(" Unknown block type: ", -1)),
774
+ y("strong", null, O(t.node?.type), 1)
775
+ ])) : T("", !0);
776
+ }
777
+ }), Bt = { key: 4 }, Pt = { key: 5 }, U = /* @__PURE__ */ v({
778
+ __name: "BlockEditorBlock",
779
+ props: {
780
+ content: {},
781
+ customRenderers: {},
782
+ isDevMode: { type: Boolean }
783
+ },
784
+ setup(t) {
785
+ const e = Ie, n = {
786
+ [e.PARAGRAPH]: bt,
787
+ [e.HEADING]: Ct,
788
+ [e.BULLET_LIST]: ct,
789
+ [e.ORDERED_LIST]: ht,
790
+ [e.LIST_ITEM]: Dt,
791
+ [e.BLOCK_QUOTE]: wt,
792
+ [e.CODE_BLOCK]: it
793
+ }, a = {
794
+ [e.DOT_IMAGE]: vt,
795
+ [e.DOT_VIDEO]: _t
796
+ }, o = (l) => n[l], s = (l) => a[l];
797
+ return (l, d) => {
798
+ const p = ne("BlockEditorBlock", !0);
799
+ return r(!0), i(k, null, M(t.content ?? [], (u, _) => (r(), i(k, {
800
+ key: `${u.type}-${_}`
801
+ }, [
802
+ t.customRenderers && t.customRenderers[u.type] ? (r(), f(D(t.customRenderers[u.type]), {
803
+ key: 0,
804
+ node: u
805
+ }, {
806
+ default: B(() => [
807
+ h(p, {
808
+ content: u.content,
809
+ "custom-renderers": t.customRenderers,
810
+ "is-dev-mode": t.isDevMode
811
+ }, null, 8, ["content", "custom-renderers", "is-dev-mode"])
812
+ ]),
813
+ _: 2
814
+ }, 1032, ["node"])) : o(u.type) ? (r(), f(D(o(u.type)), {
815
+ key: 1,
816
+ node: u
817
+ }, {
818
+ default: B(() => [
819
+ h(p, {
820
+ content: u.content,
821
+ "custom-renderers": t.customRenderers,
822
+ "is-dev-mode": t.isDevMode
823
+ }, null, 8, ["content", "custom-renderers", "is-dev-mode"])
824
+ ]),
825
+ _: 2
826
+ }, 1032, ["node"])) : u.type === E(e).TEXT ? (r(), f(Rt, {
827
+ key: 2,
828
+ text: u.text,
829
+ marks: u.marks
830
+ }, null, 8, ["text", "marks"])) : s(u.type) ? (r(), f(D(s(u.type)), {
831
+ key: 3,
832
+ node: u
833
+ }, null, 8, ["node"])) : u.type === E(e).HARDBREAK ? (r(), i("br", Bt)) : u.type === E(e).HORIZONTAL_RULE ? (r(), i("hr", Pt)) : u.type === E(e).TABLE ? (r(), f(It, {
834
+ key: 6,
835
+ content: u.content ?? [],
836
+ attrs: u.attrs,
837
+ "custom-renderers": t.customRenderers,
838
+ "is-dev-mode": t.isDevMode
839
+ }, null, 8, ["content", "attrs", "custom-renderers", "is-dev-mode"])) : u.type === E(e).GRID_BLOCK ? (r(), f(gt, {
840
+ key: 7,
841
+ node: u,
842
+ "custom-renderers": t.customRenderers,
843
+ "is-dev-mode": t.isDevMode
844
+ }, null, 8, ["node", "custom-renderers", "is-dev-mode"])) : u.type === E(e).DOT_CONTENT ? (r(), f(mt, {
845
+ key: 8,
846
+ node: u,
847
+ "custom-renderers": t.customRenderers,
848
+ "is-dev-mode": t.isDevMode
849
+ }, null, 8, ["node", "custom-renderers", "is-dev-mode"])) : (r(), f(Lt, {
850
+ key: 9,
851
+ node: u
852
+ }, null, 8, ["node"]))
853
+ ], 64))), 128);
854
+ };
855
+ }
856
+ }), Ut = {
857
+ key: 0,
858
+ "data-testid": "invalid-blocks-message"
859
+ }, tn = /* @__PURE__ */ v({
860
+ __name: "DotCMSBlockEditorRenderer",
861
+ props: {
862
+ blocks: {},
863
+ style: {},
864
+ className: {},
865
+ customRenderers: {},
866
+ isDevMode: { type: Boolean, default: !1 }
867
+ },
868
+ setup(t) {
869
+ const e = t, n = c(() => {
870
+ if (!e.customRenderers)
871
+ return;
872
+ const s = {};
873
+ for (const l of Object.keys(e.customRenderers))
874
+ s[l] = j(e.customRenderers[l]);
875
+ return te(s);
876
+ }), a = c(() => Oe(e.blocks)), o = c(() => a.value.error);
877
+ return V(
878
+ o,
879
+ (s) => {
880
+ s && console.error(s);
881
+ },
882
+ { immediate: !0 }
883
+ ), (s, l) => o.value && t.isDevMode ? (r(), i("div", Ut, O(o.value), 1)) : o.value ? T("", !0) : (r(), i("div", {
884
+ key: 1,
885
+ class: W(t.className),
886
+ style: w(t.style),
887
+ "data-testid": "dot-block-editor-container"
888
+ }, [
889
+ h(U, {
890
+ content: t.blocks?.content,
891
+ "custom-renderers": n.value,
892
+ "is-dev-mode": t.isDevMode
893
+ }, null, 8, ["content", "custom-renderers", "is-dev-mode"])
894
+ ], 6));
895
+ }
896
+ });
897
+ export {
898
+ se as DOTCMS_CLIENT,
899
+ re as DOTCMS_PAGE_CONTEXT,
900
+ tn as DotCMSBlockEditorRenderer,
901
+ en as DotCMSEditableText,
902
+ Zt as DotCMSLayoutBody,
903
+ Jt as DotCMSShow,
904
+ Qt as createDotCMSImageLoader,
905
+ qt as createDotCMSVue,
906
+ Pe as provideDotCMSPageContext,
907
+ Re as toPlain,
908
+ zt as useDotCMSClient,
909
+ A as useDotCMSPageContext,
910
+ Le as useDotCMSShowWhen,
911
+ Xt as useEditableDotCMSPage
912
+ };