@nubisco/cms-vue 1.3.0 → 1.4.1
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/cms-vue.css +1 -1
- package/dist/index.d.ts +10 -510
- package/dist/index.js +192 -743
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -1,596 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
{
|
|
5
|
-
id: "featureFlag",
|
|
6
|
-
label: "Feature flag",
|
|
7
|
-
valueType: "boolean",
|
|
8
|
-
params: { flag: {
|
|
9
|
-
type: "text",
|
|
10
|
-
label: "Flag key",
|
|
11
|
-
required: !0
|
|
12
|
-
} },
|
|
13
|
-
resolveAt: "build"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
id: "environment",
|
|
17
|
-
label: "Environment",
|
|
18
|
-
valueType: "enum",
|
|
19
|
-
enumValues: ["staging", "production"],
|
|
20
|
-
resolveAt: "build"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: "locale",
|
|
24
|
-
label: "Locale",
|
|
25
|
-
valueType: "enum",
|
|
26
|
-
enumValues: [
|
|
27
|
-
"en",
|
|
28
|
-
"pt",
|
|
29
|
-
"es",
|
|
30
|
-
"fr"
|
|
31
|
-
],
|
|
32
|
-
resolveAt: "build"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: "schedule",
|
|
36
|
-
label: "Schedule window",
|
|
37
|
-
valueType: "date",
|
|
38
|
-
params: {
|
|
39
|
-
from: {
|
|
40
|
-
type: "date",
|
|
41
|
-
label: "From"
|
|
42
|
-
},
|
|
43
|
-
to: {
|
|
44
|
-
type: "date",
|
|
45
|
-
label: "To"
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
resolveAt: "build"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
id: "auth",
|
|
52
|
-
label: "Signed in",
|
|
53
|
-
valueType: "boolean",
|
|
54
|
-
resolveAt: "request"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: "region",
|
|
58
|
-
label: "Region",
|
|
59
|
-
valueType: "enum",
|
|
60
|
-
enumValues: [
|
|
61
|
-
"EU",
|
|
62
|
-
"NA",
|
|
63
|
-
"SA",
|
|
64
|
-
"AS",
|
|
65
|
-
"AF",
|
|
66
|
-
"OC"
|
|
67
|
-
],
|
|
68
|
-
resolveAt: "request"
|
|
69
|
-
}
|
|
70
|
-
], w = {
|
|
71
|
-
featureFlag: {
|
|
72
|
-
label: "Feature flag",
|
|
73
|
-
color: "#6e6bd6",
|
|
74
|
-
category: "input",
|
|
75
|
-
ports: [{
|
|
76
|
-
id: "out",
|
|
77
|
-
label: "on",
|
|
78
|
-
type: "output"
|
|
79
|
-
}],
|
|
80
|
-
param: "flag"
|
|
81
|
-
},
|
|
82
|
-
environment: {
|
|
83
|
-
label: "Environment",
|
|
84
|
-
color: "#b9781e",
|
|
85
|
-
category: "input",
|
|
86
|
-
ports: [{
|
|
87
|
-
id: "out",
|
|
88
|
-
label: "is",
|
|
89
|
-
type: "output"
|
|
90
|
-
}],
|
|
91
|
-
param: "environment"
|
|
92
|
-
},
|
|
93
|
-
auth: {
|
|
94
|
-
label: "Signed in",
|
|
95
|
-
color: "#2c9560",
|
|
96
|
-
category: "input",
|
|
97
|
-
ports: [{
|
|
98
|
-
id: "out",
|
|
99
|
-
label: "yes",
|
|
100
|
-
type: "output"
|
|
101
|
-
}]
|
|
102
|
-
},
|
|
103
|
-
region: {
|
|
104
|
-
label: "Region",
|
|
105
|
-
color: "#3a86c8",
|
|
106
|
-
category: "input",
|
|
107
|
-
ports: [{
|
|
108
|
-
id: "out",
|
|
109
|
-
label: "in",
|
|
110
|
-
type: "output"
|
|
111
|
-
}],
|
|
112
|
-
param: "region"
|
|
113
|
-
},
|
|
114
|
-
and: {
|
|
115
|
-
label: "AND",
|
|
116
|
-
color: "#5a5a6a",
|
|
117
|
-
category: "gate",
|
|
118
|
-
ports: [
|
|
119
|
-
{
|
|
120
|
-
id: "a",
|
|
121
|
-
label: "a",
|
|
122
|
-
type: "input"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
id: "b",
|
|
126
|
-
label: "b",
|
|
127
|
-
type: "input"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
id: "out",
|
|
131
|
-
label: "out",
|
|
132
|
-
type: "output"
|
|
133
|
-
}
|
|
134
|
-
]
|
|
135
|
-
},
|
|
136
|
-
or: {
|
|
137
|
-
label: "OR",
|
|
138
|
-
color: "#5a5a6a",
|
|
139
|
-
category: "gate",
|
|
140
|
-
ports: [
|
|
141
|
-
{
|
|
142
|
-
id: "a",
|
|
143
|
-
label: "a",
|
|
144
|
-
type: "input"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
id: "b",
|
|
148
|
-
label: "b",
|
|
149
|
-
type: "input"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
id: "out",
|
|
153
|
-
label: "out",
|
|
154
|
-
type: "output"
|
|
155
|
-
}
|
|
156
|
-
]
|
|
157
|
-
},
|
|
158
|
-
not: {
|
|
159
|
-
label: "NOT",
|
|
160
|
-
color: "#5a5a6a",
|
|
161
|
-
category: "gate",
|
|
162
|
-
ports: [{
|
|
163
|
-
id: "in",
|
|
164
|
-
label: "in",
|
|
165
|
-
type: "input"
|
|
166
|
-
}, {
|
|
167
|
-
id: "out",
|
|
168
|
-
label: "out",
|
|
169
|
-
type: "output"
|
|
170
|
-
}]
|
|
171
|
-
},
|
|
172
|
-
visible: {
|
|
173
|
-
label: "Visible",
|
|
174
|
-
color: "#c0392b",
|
|
175
|
-
category: "output",
|
|
176
|
-
ports: [{
|
|
177
|
-
id: "in",
|
|
178
|
-
label: "show",
|
|
179
|
-
type: "input"
|
|
180
|
-
}]
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
function ee(e) {
|
|
184
|
-
return e.nodes.map((e) => {
|
|
185
|
-
let t = w[e.kind], n = e.param ? `${t.label}: ${e.param}` : t.label;
|
|
186
|
-
return {
|
|
187
|
-
id: e.id,
|
|
188
|
-
x: e.x,
|
|
189
|
-
y: e.y,
|
|
190
|
-
width: 160,
|
|
191
|
-
height: 52 + t.ports.length * 8,
|
|
192
|
-
paint: {
|
|
193
|
-
title: n,
|
|
194
|
-
color: t.color,
|
|
195
|
-
category: t.category,
|
|
196
|
-
ports: t.ports
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
function te(e, t) {
|
|
202
|
-
let n = {}, r = (t, n) => e.connections.find((e) => e.toNode === t && e.toPort === n)?.fromNode, i = (e, t) => {
|
|
203
|
-
let n = r(e, t);
|
|
204
|
-
return n ? a(n) : !1;
|
|
205
|
-
};
|
|
206
|
-
function a(r) {
|
|
207
|
-
if (r in n) return n[r];
|
|
208
|
-
n[r] = !1;
|
|
209
|
-
let a = e.nodes.find((e) => e.id === r);
|
|
210
|
-
if (!a) return !1;
|
|
211
|
-
let o = !1;
|
|
212
|
-
switch (a.kind) {
|
|
213
|
-
case "featureFlag":
|
|
214
|
-
o = t.featureFlag?.({ flag: a.param ?? "" }, void 0, void 0) ?? !1;
|
|
215
|
-
break;
|
|
216
|
-
case "environment":
|
|
217
|
-
o = t.environment?.(void 0, "is", a.param ?? "staging") ?? !1;
|
|
218
|
-
break;
|
|
219
|
-
case "auth":
|
|
220
|
-
o = t.auth?.(void 0, void 0, void 0) ?? !1;
|
|
221
|
-
break;
|
|
222
|
-
case "region":
|
|
223
|
-
o = t.region?.(void 0, "in", [a.param ?? ""]) ?? !1;
|
|
224
|
-
break;
|
|
225
|
-
case "and":
|
|
226
|
-
o = i(r, "a") && i(r, "b");
|
|
227
|
-
break;
|
|
228
|
-
case "or":
|
|
229
|
-
o = i(r, "a") || i(r, "b");
|
|
230
|
-
break;
|
|
231
|
-
case "not":
|
|
232
|
-
o = !i(r, "in");
|
|
233
|
-
break;
|
|
234
|
-
case "visible": o = i(r, "in");
|
|
235
|
-
}
|
|
236
|
-
return n[r] = o, o;
|
|
237
|
-
}
|
|
238
|
-
let o = e.nodes.find((e) => e.kind === "visible"), s = {};
|
|
239
|
-
for (let t of e.nodes) s[t.id] = a(t.id);
|
|
240
|
-
return {
|
|
241
|
-
visible: o ? a(o.id) : !1,
|
|
242
|
-
nodeOut: s
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region src/evaluate.ts
|
|
247
|
-
function T(e, t, n) {
|
|
248
|
-
if (!e || e.kind === "always") return !0;
|
|
249
|
-
switch (e.kind) {
|
|
250
|
-
case "simple": {
|
|
251
|
-
let n = t[e.input];
|
|
252
|
-
return n ? n(e.params, e.op, e.value) : !1;
|
|
253
|
-
}
|
|
254
|
-
case "all": return e.of.every((e) => T(e, t, n));
|
|
255
|
-
case "any": return e.of.some((e) => T(e, t, n));
|
|
256
|
-
case "not": return !T(e.of, t, n);
|
|
257
|
-
case "graph": {
|
|
258
|
-
let r = n?.[e.graphId];
|
|
259
|
-
return !r || te(r, t).visible;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
//#endregion
|
|
264
|
-
//#region src/resolve.ts
|
|
265
|
-
function E(e) {
|
|
266
|
-
return typeof e == "object" && !!e && "$t" in e;
|
|
267
|
-
}
|
|
268
|
-
function ne(e) {
|
|
269
|
-
return typeof e == "object" && !!e && "src" in e;
|
|
270
|
-
}
|
|
271
|
-
function re(e) {
|
|
272
|
-
return typeof e == "object" && !!e && "href" in e;
|
|
273
|
-
}
|
|
274
|
-
function D(e, t) {
|
|
275
|
-
return e == null ? "" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : E(e) ? t[e.$t] ?? e.$t : "";
|
|
276
|
-
}
|
|
277
|
-
//#endregion
|
|
1
|
+
import { applySerializers as e, compileLinks as t, evaluate as n, isHtml as r, linkAttrs as i, linkTag as a, normalizeImage as o, normalizeLink as s, pickField as c, text as l } from "@nubisco/cms-core";
|
|
2
|
+
import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as g, defineComponent as _, getCurrentInstance as v, inject as y, mergeProps as b, normalizeClass as x, openBlock as S, provide as C, ref as w, renderList as T, renderSlot as E, resolveDynamicComponent as D, toDisplayString as O, unref as k, withCtx as A, withKeys as ee, withModifiers as j } from "vue";
|
|
3
|
+
export * from "@nubisco/cms-core";
|
|
278
4
|
//#region src/context.ts
|
|
279
|
-
var
|
|
5
|
+
var M = Symbol("cms-context");
|
|
280
6
|
//#endregion
|
|
281
7
|
//#region src/useField.ts
|
|
282
|
-
function
|
|
283
|
-
let e =
|
|
8
|
+
function N() {
|
|
9
|
+
let e = y(M, {
|
|
284
10
|
messages: {},
|
|
285
11
|
editing: !1,
|
|
286
12
|
setText: () => {}
|
|
287
13
|
});
|
|
288
|
-
return { t: (t) =>
|
|
289
|
-
}
|
|
290
|
-
//#endregion
|
|
291
|
-
//#region src/link.ts
|
|
292
|
-
var k = {
|
|
293
|
-
ok: !1,
|
|
294
|
-
href: "",
|
|
295
|
-
internal: !1,
|
|
296
|
-
newTab: !1,
|
|
297
|
-
status: "empty",
|
|
298
|
-
kind: "none"
|
|
299
|
-
};
|
|
300
|
-
function A(e, t) {
|
|
301
|
-
return {
|
|
302
|
-
...k,
|
|
303
|
-
status: e,
|
|
304
|
-
kind: t
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
function j(e) {
|
|
308
|
-
return e.startsWith("/") && !e.startsWith("//");
|
|
309
|
-
}
|
|
310
|
-
function M(e) {
|
|
311
|
-
return e.startsWith("#") || /^(mailto:|tel:|sms:)/i.test(e);
|
|
312
|
-
}
|
|
313
|
-
function N(e) {
|
|
314
|
-
let t = e.trim();
|
|
315
|
-
return t ? j(t) ? {
|
|
316
|
-
ok: !0,
|
|
317
|
-
href: t,
|
|
318
|
-
internal: !0,
|
|
319
|
-
newTab: !1,
|
|
320
|
-
status: "ok",
|
|
321
|
-
kind: "doc"
|
|
322
|
-
} : {
|
|
323
|
-
ok: !0,
|
|
324
|
-
href: t,
|
|
325
|
-
internal: !1,
|
|
326
|
-
newTab: !M(t),
|
|
327
|
-
status: "ok",
|
|
328
|
-
kind: "url"
|
|
329
|
-
} : k;
|
|
330
|
-
}
|
|
331
|
-
function P(e) {
|
|
332
|
-
return typeof e == "string" ? e.trim() : "";
|
|
333
|
-
}
|
|
334
|
-
function ae(e) {
|
|
335
|
-
let t = P(e);
|
|
336
|
-
return t === "ok" || t === "missing" || t === "unpublished" || t === "empty" || t === "unresolved" ? t : "";
|
|
337
|
-
}
|
|
338
|
-
function F(e, t, n) {
|
|
339
|
-
return M(t) ? !1 : typeof e.newTab == "boolean" ? e.newTab : n;
|
|
340
|
-
}
|
|
341
|
-
function oe(e) {
|
|
342
|
-
let t = P(e.kind), n = ae(e.status), r = P(e.href), i = P(e.route), a = P(e.url), o = t === "doc" || t === "url" || t === "media" ? t : i ? "doc" : a ? "url" : r ? j(r) ? "doc" : "url" : "none";
|
|
343
|
-
if (n && n !== "ok") return A(n, o);
|
|
344
|
-
if (o === "doc") {
|
|
345
|
-
if (!n) return A("unresolved", "doc");
|
|
346
|
-
let t = r || i;
|
|
347
|
-
return t ? {
|
|
348
|
-
ok: !0,
|
|
349
|
-
href: t,
|
|
350
|
-
internal: j(t),
|
|
351
|
-
newTab: F(e, t, !1),
|
|
352
|
-
status: "ok",
|
|
353
|
-
kind: "doc"
|
|
354
|
-
} : A("empty", "doc");
|
|
355
|
-
}
|
|
356
|
-
if (o === "media") {
|
|
357
|
-
let t = r || a || P(e.src);
|
|
358
|
-
return t ? {
|
|
359
|
-
ok: !0,
|
|
360
|
-
href: t,
|
|
361
|
-
internal: j(t),
|
|
362
|
-
newTab: F(e, t, !0),
|
|
363
|
-
status: "ok",
|
|
364
|
-
kind: "media"
|
|
365
|
-
} : A("unresolved", "media");
|
|
366
|
-
}
|
|
367
|
-
let s = r || a;
|
|
368
|
-
return s ? {
|
|
369
|
-
ok: !0,
|
|
370
|
-
href: s,
|
|
371
|
-
internal: j(s),
|
|
372
|
-
newTab: F(e, s, !j(s)),
|
|
373
|
-
status: "ok",
|
|
374
|
-
kind: "url"
|
|
375
|
-
} : A("empty", o);
|
|
376
|
-
}
|
|
377
|
-
function I(e, t = "") {
|
|
378
|
-
if (typeof e == "string") {
|
|
379
|
-
let n = N(e);
|
|
380
|
-
return n.ok || n.status !== "empty" ? n : N(t);
|
|
381
|
-
}
|
|
382
|
-
return e && typeof e == "object" && !Array.isArray(e) ? oe(e) : N(t);
|
|
383
|
-
}
|
|
384
|
-
function L(e, t) {
|
|
385
|
-
if (e) for (let n of t) {
|
|
386
|
-
let t = e[n];
|
|
387
|
-
if (t != null && !(typeof t == "string" && !t.trim())) return t;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
function se(e, t, n = "") {
|
|
391
|
-
return I(L(e, t), n);
|
|
392
|
-
}
|
|
393
|
-
function R(e) {
|
|
394
|
-
if (!e.ok || !e.href) return {};
|
|
395
|
-
let t = { href: e.href };
|
|
396
|
-
return e.newTab && (t.target = "_blank", t.rel = "noopener"), t;
|
|
397
|
-
}
|
|
398
|
-
function z(e) {
|
|
399
|
-
return e.ok && e.href ? "a" : "span";
|
|
400
|
-
}
|
|
401
|
-
function ce(e) {
|
|
402
|
-
return e.ok && e.href ? "" : "cms-link--inert";
|
|
403
|
-
}
|
|
404
|
-
//#endregion
|
|
405
|
-
//#region src/image.ts
|
|
406
|
-
function B(e) {
|
|
407
|
-
if (typeof e == "number" && Number.isFinite(e)) return e;
|
|
408
|
-
if (typeof e == "string" && e.trim() && Number.isFinite(Number(e))) return Number(e);
|
|
409
|
-
}
|
|
410
|
-
function V(e) {
|
|
411
|
-
return typeof e == "string" ? e.trim() : "";
|
|
412
|
-
}
|
|
413
|
-
function H(e, t = {}, n = "") {
|
|
414
|
-
let r = typeof n == "string" ? {
|
|
415
|
-
src: n.trim(),
|
|
416
|
-
alt: ""
|
|
417
|
-
} : n;
|
|
418
|
-
if (typeof e == "string") {
|
|
419
|
-
let t = e.trim();
|
|
420
|
-
return t ? {
|
|
421
|
-
src: t,
|
|
422
|
-
alt: ""
|
|
423
|
-
} : { ...r };
|
|
424
|
-
}
|
|
425
|
-
if (!e || typeof e != "object" || Array.isArray(e)) return { ...r };
|
|
426
|
-
let i = e, a = V(i.src) || V(i.url) || V(i.href);
|
|
427
|
-
if (!a) return { ...r };
|
|
428
|
-
let o = i.alt;
|
|
429
|
-
return {
|
|
430
|
-
src: a,
|
|
431
|
-
alt: typeof o == "string" ? o : o && typeof o == "object" ? D(o, t) : "",
|
|
432
|
-
width: B(i.w) ?? B(i.width),
|
|
433
|
-
height: B(i.h) ?? B(i.height)
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
function le(e) {
|
|
437
|
-
return !!H(e).src;
|
|
438
|
-
}
|
|
439
|
-
//#endregion
|
|
440
|
-
//#region src/richtext.ts
|
|
441
|
-
var ue = {
|
|
442
|
-
p: "paragraph",
|
|
443
|
-
h1: "heading1",
|
|
444
|
-
h2: "heading2",
|
|
445
|
-
h3: "heading3",
|
|
446
|
-
h4: "heading4",
|
|
447
|
-
h5: "heading5",
|
|
448
|
-
h6: "heading6",
|
|
449
|
-
ul: "list",
|
|
450
|
-
ol: "oList",
|
|
451
|
-
li: "listItem",
|
|
452
|
-
blockquote: "quote",
|
|
453
|
-
pre: "preformatted",
|
|
454
|
-
code: "code",
|
|
455
|
-
a: "hyperlink",
|
|
456
|
-
img: "image",
|
|
457
|
-
strong: "strong",
|
|
458
|
-
b: "strong",
|
|
459
|
-
em: "em",
|
|
460
|
-
i: "em",
|
|
461
|
-
span: "span",
|
|
462
|
-
br: "break",
|
|
463
|
-
table: "table",
|
|
464
|
-
tr: "row",
|
|
465
|
-
td: "cell",
|
|
466
|
-
th: "cell"
|
|
467
|
-
}, de = /<router-?link\b([^>]*)>/gi, fe = /<\/router-?link\s*>/gi, U = /\s:?to\s*=\s*("([^"]*)"|'([^']*)')/i, pe = /<\/?router-?link\b/i;
|
|
468
|
-
function W(e) {
|
|
469
|
-
if (!pe.test(e)) return e;
|
|
470
|
-
let t = [];
|
|
471
|
-
return e.replace(de, (e, n) => {
|
|
472
|
-
let r = U.exec(n), i = me((r?.[2] ?? r?.[3] ?? "").trim()), a = n.replace(U, ""), o = i ? "a" : "span";
|
|
473
|
-
return t.push(o), i ? `<a href="${G(i)}"${a}>` : `<span${a}>`;
|
|
474
|
-
}).replace(fe, () => `</${t.shift() ?? "a"}>`);
|
|
475
|
-
}
|
|
476
|
-
function me(e) {
|
|
477
|
-
let t = e.slice(0, 1);
|
|
478
|
-
return (t === "'" || t === "\"") && e.endsWith(t) && e.length > 1 ? e.slice(1, -1).trim() : e;
|
|
479
|
-
}
|
|
480
|
-
function G(e) {
|
|
481
|
-
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
482
|
-
}
|
|
483
|
-
var K = /* @__PURE__ */ new Set([
|
|
484
|
-
"area",
|
|
485
|
-
"base",
|
|
486
|
-
"br",
|
|
487
|
-
"col",
|
|
488
|
-
"embed",
|
|
489
|
-
"hr",
|
|
490
|
-
"img",
|
|
491
|
-
"input",
|
|
492
|
-
"link",
|
|
493
|
-
"meta",
|
|
494
|
-
"param",
|
|
495
|
-
"source",
|
|
496
|
-
"track",
|
|
497
|
-
"wbr"
|
|
498
|
-
]), q = /<(\/?)([a-zA-Z][\w:-]*)((?:"[^"]*"|'[^']*'|[^'">])*?)(\/?)>/g, J = /([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;
|
|
499
|
-
function he(e) {
|
|
500
|
-
let t = {};
|
|
501
|
-
J.lastIndex = 0;
|
|
502
|
-
let n;
|
|
503
|
-
for (; n = J.exec(e);) {
|
|
504
|
-
let e = n[1];
|
|
505
|
-
e && (t[e] = n[2] ?? n[3] ?? n[4] ?? "");
|
|
506
|
-
}
|
|
507
|
-
return t;
|
|
508
|
-
}
|
|
509
|
-
function ge(e) {
|
|
510
|
-
return Object.entries(e).map(([e, t]) => t === "" ? ` ${e}` : ` ${e}="${G(t)}"`).join("");
|
|
511
|
-
}
|
|
512
|
-
function Y(e) {
|
|
513
|
-
return ue[e.toLowerCase()] ?? "other";
|
|
514
|
-
}
|
|
515
|
-
function _e(e, t) {
|
|
516
|
-
if (!t || !e) return e;
|
|
517
|
-
let n = [], r = "", i = 0;
|
|
518
|
-
q.lastIndex = 0;
|
|
519
|
-
let a;
|
|
520
|
-
for (; a = q.exec(e);) {
|
|
521
|
-
let [o, s, c, l = "", u] = a;
|
|
522
|
-
r += e.slice(i, a.index), i = a.index + o.length;
|
|
523
|
-
let d = c.toLowerCase();
|
|
524
|
-
if (s) {
|
|
525
|
-
let e = n.length - 1;
|
|
526
|
-
for (; e >= 0 && n[e].tag !== d;) e--;
|
|
527
|
-
if (e >= 0) {
|
|
528
|
-
let t = n[e].as;
|
|
529
|
-
n.length = e, r += `</${t}>`;
|
|
530
|
-
} else r += o;
|
|
531
|
-
continue;
|
|
532
|
-
}
|
|
533
|
-
let f = Y(d), p = t[f], m = he(l), h = K.has(d) || !!u;
|
|
534
|
-
if (!p) {
|
|
535
|
-
r += o, h || n.push({
|
|
536
|
-
tag: d,
|
|
537
|
-
as: d
|
|
538
|
-
});
|
|
539
|
-
continue;
|
|
540
|
-
}
|
|
541
|
-
let g = typeof p == "string" ? { class: p } : p({
|
|
542
|
-
type: f,
|
|
543
|
-
tag: d,
|
|
544
|
-
attrs: m
|
|
545
|
-
});
|
|
546
|
-
if (typeof g == "string") {
|
|
547
|
-
r += g, h || n.push({
|
|
548
|
-
tag: d,
|
|
549
|
-
as: d
|
|
550
|
-
});
|
|
551
|
-
continue;
|
|
552
|
-
}
|
|
553
|
-
let _ = (g?.tag ?? d).toLowerCase(), v = {
|
|
554
|
-
...m,
|
|
555
|
-
...g?.attrs ?? {}
|
|
556
|
-
};
|
|
557
|
-
g?.class && (v.class = [m.class, g.class].filter(Boolean).join(" ")), r += `<${_}${ge(v)}${h && !K.has(_) ? " /" : ""}>`, h || n.push({
|
|
558
|
-
tag: d,
|
|
559
|
-
as: _
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
return r += e.slice(i), r;
|
|
563
|
-
}
|
|
564
|
-
function ve(e) {
|
|
565
|
-
return /<[a-z][\s\S]*>/i.test(e);
|
|
14
|
+
return { t: (t) => l(t, e.messages) };
|
|
566
15
|
}
|
|
567
16
|
//#endregion
|
|
568
17
|
//#region src/client.ts
|
|
569
|
-
var
|
|
570
|
-
function
|
|
18
|
+
var P = Symbol("cms-client");
|
|
19
|
+
function F() {
|
|
571
20
|
return typeof window > "u";
|
|
572
21
|
}
|
|
573
|
-
function
|
|
22
|
+
function te() {
|
|
574
23
|
return typeof window < "u" ? new URLSearchParams(window.location.search) : null;
|
|
575
24
|
}
|
|
576
|
-
function
|
|
577
|
-
let e =
|
|
25
|
+
function I() {
|
|
26
|
+
let e = te();
|
|
578
27
|
return e?.has("cms-edit") ? {
|
|
579
28
|
active: !0,
|
|
580
29
|
environment: e.get("cms-env")?.trim() || void 0,
|
|
581
30
|
token: e.get("cms-preview-token")?.trim() || void 0
|
|
582
31
|
} : { active: !1 };
|
|
583
32
|
}
|
|
584
|
-
var
|
|
585
|
-
function
|
|
33
|
+
var L = { active: !1 };
|
|
34
|
+
function R(e) {
|
|
586
35
|
if (!e.apiBase) throw Error("createCms: apiBase is required, for example https://cms.example.com");
|
|
587
36
|
if (!e.siteId) throw Error("createCms: siteId is required");
|
|
588
|
-
let t = e.apiBase.replace(/\/$/, ""), n = e.environment || "production", r = e.siteId, i = e.fetch ?? ((e, t) => fetch(e, t)), a = e.preview ??
|
|
37
|
+
let t = e.apiBase.replace(/\/$/, ""), n = e.environment || "production", r = e.siteId, i = e.fetch ?? ((e, t) => fetch(e, t)), a = e.preview ?? I;
|
|
589
38
|
function o() {
|
|
590
39
|
try {
|
|
591
|
-
return a() ??
|
|
40
|
+
return a() ?? L;
|
|
592
41
|
} catch {
|
|
593
|
-
return
|
|
42
|
+
return L;
|
|
594
43
|
}
|
|
595
44
|
}
|
|
596
45
|
function s(e) {
|
|
@@ -598,7 +47,7 @@ function Se(e) {
|
|
|
598
47
|
return `${t}/api/v1/${r}/${a}/${e.replace(/^\/+/, "")}${s}`;
|
|
599
48
|
}
|
|
600
49
|
async function c(e) {
|
|
601
|
-
let t = o().active ||
|
|
50
|
+
let t = o().active || F() ? "no-store" : "default", n = await i(s(e), { cache: t });
|
|
602
51
|
return n.ok ? {
|
|
603
52
|
status: n.status,
|
|
604
53
|
body: await n.json()
|
|
@@ -682,23 +131,23 @@ function Se(e) {
|
|
|
682
131
|
fetchPage: l,
|
|
683
132
|
fetchPartial: u,
|
|
684
133
|
install(e) {
|
|
685
|
-
e.provide(
|
|
134
|
+
e.provide(P, f);
|
|
686
135
|
}
|
|
687
136
|
};
|
|
688
137
|
return f;
|
|
689
138
|
}
|
|
690
|
-
function
|
|
691
|
-
return
|
|
139
|
+
function z() {
|
|
140
|
+
return y(P, null);
|
|
692
141
|
}
|
|
693
|
-
function
|
|
694
|
-
let e =
|
|
142
|
+
function ne() {
|
|
143
|
+
let e = z();
|
|
695
144
|
if (!e) throw Error("[cms-vue] No CMS client provided. Call app.use(createCms({ siteId }))");
|
|
696
145
|
return e;
|
|
697
146
|
}
|
|
698
147
|
//#endregion
|
|
699
148
|
//#region src/usePage.ts
|
|
700
|
-
function
|
|
701
|
-
let n = t ??
|
|
149
|
+
function re(e, t) {
|
|
150
|
+
let n = t ?? z(), r = w(null), i = w(null), a = w("unavailable"), o = w(!1);
|
|
702
151
|
async function s() {
|
|
703
152
|
if (!n) {
|
|
704
153
|
i.value = "CMS client is not configured", a.value = "unavailable";
|
|
@@ -722,35 +171,35 @@ function we(e, t) {
|
|
|
722
171
|
}
|
|
723
172
|
//#endregion
|
|
724
173
|
//#region src/usePartial.ts
|
|
725
|
-
var
|
|
726
|
-
function
|
|
727
|
-
if (!
|
|
728
|
-
let t = e ??
|
|
174
|
+
var B = /* @__PURE__ */ new Map();
|
|
175
|
+
function V(e) {
|
|
176
|
+
if (!F()) return B;
|
|
177
|
+
let t = e ?? v()?.appContext.app;
|
|
729
178
|
return t ? t.__cmsPartialStates ??= /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map();
|
|
730
179
|
}
|
|
731
|
-
function
|
|
180
|
+
function H(e, t) {
|
|
732
181
|
return e ? `${e.siteId}:${e.environment}:${t}` : `:${t}`;
|
|
733
182
|
}
|
|
734
|
-
function
|
|
183
|
+
function U() {
|
|
735
184
|
return {
|
|
736
|
-
doc:
|
|
737
|
-
messages:
|
|
738
|
-
error:
|
|
739
|
-
loading:
|
|
185
|
+
doc: w(null),
|
|
186
|
+
messages: w({}),
|
|
187
|
+
error: w(null),
|
|
188
|
+
loading: w(!0),
|
|
740
189
|
started: !1,
|
|
741
190
|
ready: null
|
|
742
191
|
};
|
|
743
192
|
}
|
|
744
|
-
function
|
|
745
|
-
let n =
|
|
746
|
-
return r || (r =
|
|
193
|
+
function W(e, t) {
|
|
194
|
+
let n = V(t), r = n.get(e);
|
|
195
|
+
return r || (r = U(), n.set(e, r)), r;
|
|
747
196
|
}
|
|
748
|
-
function
|
|
197
|
+
function G(e, t) {
|
|
749
198
|
if (!e || typeof e != "object") return !1;
|
|
750
199
|
let n = e, r = (typeof n.contentType == "string" ? n.contentType : typeof n.content_type == "string" ? n.content_type : "") === "partial" || n.kind === "partial", i = typeof n.key == "string" ? n.key : typeof n.route == "string" && !n.route.startsWith("/") ? n.route : "";
|
|
751
200
|
return !r && !i ? !1 : !t || i === t || r && i === "";
|
|
752
201
|
}
|
|
753
|
-
function
|
|
202
|
+
function K(e) {
|
|
754
203
|
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
755
204
|
if (e) try {
|
|
756
205
|
t.add(new URL(e).origin);
|
|
@@ -760,19 +209,19 @@ function je(e) {
|
|
|
760
209
|
for (let t of e?.options.consoleOrigins ?? []) n(t);
|
|
761
210
|
return n(typeof document < "u" ? document.referrer : void 0), Array.from(t);
|
|
762
211
|
}
|
|
763
|
-
function
|
|
212
|
+
function q(e, t, n) {
|
|
764
213
|
typeof window > "u" || window.addEventListener("message", (r) => {
|
|
765
214
|
if (!e?.preview().active) return;
|
|
766
215
|
if (window.parent !== window) {
|
|
767
|
-
if (r.source !== window.parent || !
|
|
216
|
+
if (r.source !== window.parent || !K(e).includes(r.origin)) return;
|
|
768
217
|
} else if (r.origin !== window.location.origin) return;
|
|
769
218
|
let i = r.data, a = e?.patchMessageType ?? "nubisco-cms:patch";
|
|
770
|
-
!i || i.type !== a || !i.document?.zones?.main ||
|
|
219
|
+
!i || i.type !== a || !i.document?.zones?.main || G(i.document, t) && (i.messages && typeof i.messages == "object" && (n.messages.value = i.messages), n.doc.value = i.document, n.error.value = "", n.loading.value = !1);
|
|
771
220
|
});
|
|
772
221
|
}
|
|
773
|
-
function
|
|
774
|
-
let n = t ??
|
|
775
|
-
return r.started || (r.started = !0, n ? (n.options.livePreview !== !1 && n.preview().active &&
|
|
222
|
+
function J(e, t) {
|
|
223
|
+
let n = t ?? z(), r = W(H(n, e));
|
|
224
|
+
return r.started || (r.started = !0, n ? (n.options.livePreview !== !1 && n.preview().active && q(n, e, r), r.ready = n.fetchPartial(e).then((e) => {
|
|
776
225
|
r.doc.value || (r.doc.value = e.doc, r.error.value = e.error, r.loading.value = !1);
|
|
777
226
|
}), r.ready) : (r.error.value = "CMS client is not configured", r.loading.value = !1)), {
|
|
778
227
|
doc: r.doc,
|
|
@@ -782,29 +231,29 @@ function Ne(e, t) {
|
|
|
782
231
|
whenReady: () => r.ready ?? Promise.resolve()
|
|
783
232
|
};
|
|
784
233
|
}
|
|
785
|
-
function
|
|
786
|
-
|
|
234
|
+
function Y() {
|
|
235
|
+
B.clear();
|
|
787
236
|
}
|
|
788
|
-
var
|
|
789
|
-
function
|
|
237
|
+
var X = "cmsPartials";
|
|
238
|
+
function ie(e) {
|
|
790
239
|
let t = {};
|
|
791
|
-
for (let [n, r] of
|
|
240
|
+
for (let [n, r] of V(e)) r.loading.value || (t[n] = {
|
|
792
241
|
doc: r.doc.value,
|
|
793
242
|
error: r.error.value
|
|
794
243
|
});
|
|
795
244
|
return t;
|
|
796
245
|
}
|
|
797
|
-
function
|
|
246
|
+
function ae(e, t) {
|
|
798
247
|
if (!(!e || typeof e != "object") && !t?.preview().active) for (let [t, n] of Object.entries(e)) {
|
|
799
248
|
let e = n;
|
|
800
249
|
if (!e || typeof e != "object") continue;
|
|
801
|
-
let r =
|
|
250
|
+
let r = W(t);
|
|
802
251
|
r.started || (r.started = !0, r.doc.value = e.doc ?? null, r.error.value = typeof e.error == "string" ? e.error : e.doc ? "" : "CMS partial unavailable", r.loading.value = !1, r.ready = Promise.resolve());
|
|
803
252
|
}
|
|
804
253
|
}
|
|
805
254
|
//#endregion
|
|
806
255
|
//#region src/props.ts
|
|
807
|
-
function
|
|
256
|
+
function Z() {
|
|
808
257
|
return {
|
|
809
258
|
block: {
|
|
810
259
|
type: Object,
|
|
@@ -827,53 +276,53 @@ function Re() {
|
|
|
827
276
|
}
|
|
828
277
|
};
|
|
829
278
|
}
|
|
830
|
-
function
|
|
831
|
-
return
|
|
279
|
+
function oe() {
|
|
280
|
+
return Z();
|
|
832
281
|
}
|
|
833
282
|
//#endregion
|
|
834
283
|
//#region src/CmsText.vue?vue&type=script&setup=true&lang.ts
|
|
835
|
-
var
|
|
284
|
+
var se = [
|
|
836
285
|
"data-cms-block",
|
|
837
286
|
"data-cms-field",
|
|
838
287
|
"onKeydown"
|
|
839
|
-
],
|
|
288
|
+
], ce = { key: 1 }, le = /*@__PURE__*/ _({
|
|
840
289
|
__name: "CmsText",
|
|
841
290
|
props: {
|
|
842
291
|
block: {},
|
|
843
292
|
field: {}
|
|
844
293
|
},
|
|
845
294
|
setup(e) {
|
|
846
|
-
let
|
|
295
|
+
let t = e, n = y(M, {
|
|
847
296
|
messages: {},
|
|
848
297
|
editing: !1,
|
|
849
298
|
setText: () => {}
|
|
850
|
-
}),
|
|
851
|
-
function
|
|
852
|
-
let e =
|
|
853
|
-
e !==
|
|
299
|
+
}), r = d(() => t.block.fields[t.field]), i = d(() => l(r.value, n.messages)), a = w(null);
|
|
300
|
+
function o() {
|
|
301
|
+
let e = a.value?.innerText.trim() ?? "";
|
|
302
|
+
e !== i.value && n.setText(t.block, t.field, r.value, e), a.value?.blur();
|
|
854
303
|
}
|
|
855
|
-
return (t,
|
|
304
|
+
return (t, r) => k(n).editing ? (S(), m("span", {
|
|
856
305
|
key: 0,
|
|
857
306
|
ref_key: "el",
|
|
858
|
-
ref:
|
|
307
|
+
ref: a,
|
|
859
308
|
class: "cms-text cms-text--editing",
|
|
860
309
|
"data-cms-block": e.block.id,
|
|
861
310
|
"data-cms-field": e.field,
|
|
862
311
|
contenteditable: "plaintext-only",
|
|
863
312
|
role: "textbox",
|
|
864
313
|
tabindex: "0",
|
|
865
|
-
onBlur:
|
|
866
|
-
onKeydown:
|
|
867
|
-
},
|
|
314
|
+
onBlur: o,
|
|
315
|
+
onKeydown: ee(j(o, ["prevent"]), ["enter"])
|
|
316
|
+
}, O(i.value), 41, se)) : (S(), m("span", ce, O(i.value), 1));
|
|
868
317
|
}
|
|
869
|
-
}),
|
|
318
|
+
}), Q = (e, t) => {
|
|
870
319
|
let n = e.__vccOpts || e;
|
|
871
320
|
for (let [e, r] of t) n[e] = r;
|
|
872
321
|
return n;
|
|
873
|
-
},
|
|
322
|
+
}, ue = /*#__PURE__*/ Q(le, [["__scopeId", "data-v-67fffd3d"]]), de = { class: "bf__type" }, fe = {
|
|
874
323
|
key: 0,
|
|
875
324
|
class: "bf__badge"
|
|
876
|
-
},
|
|
325
|
+
}, pe = ["disabled"], $ = ["disabled"], me = { class: "bf__body" }, he = /*#__PURE__*/ Q(/* @__PURE__ */ _({
|
|
877
326
|
__name: "BlockFrame",
|
|
878
327
|
props: {
|
|
879
328
|
label: {},
|
|
@@ -888,43 +337,43 @@ var Be = [
|
|
|
888
337
|
"select"
|
|
889
338
|
],
|
|
890
339
|
setup(e) {
|
|
891
|
-
return (t, n) => (
|
|
340
|
+
return (t, n) => (S(), m("div", { class: x(["bf", {
|
|
892
341
|
"bf--dim": e.hidden,
|
|
893
342
|
"bf--selected": e.selected
|
|
894
|
-
}]) }, [
|
|
343
|
+
}]) }, [h("div", {
|
|
895
344
|
class: "bf__bar",
|
|
896
345
|
onClick: n[2] ||= (e) => t.$emit("select")
|
|
897
346
|
}, [
|
|
898
|
-
n[3] ||=
|
|
347
|
+
n[3] ||= h("span", {
|
|
899
348
|
class: "bf__grip",
|
|
900
349
|
"aria-hidden": "true"
|
|
901
350
|
}, "⠿", -1),
|
|
902
|
-
|
|
903
|
-
e.hidden ? (
|
|
904
|
-
n[4] ||=
|
|
905
|
-
|
|
351
|
+
h("span", de, O(e.label), 1),
|
|
352
|
+
e.hidden ? (S(), m("span", fe, "hidden by condition")) : p("", !0),
|
|
353
|
+
n[4] ||= h("span", { class: "bf__spacer" }, null, -1),
|
|
354
|
+
h("button", {
|
|
906
355
|
class: "bf__btn",
|
|
907
356
|
type: "button",
|
|
908
357
|
disabled: e.isFirst,
|
|
909
358
|
title: "Move up",
|
|
910
|
-
onClick: n[0] ||=
|
|
911
|
-
}, " ↑ ", 8,
|
|
912
|
-
|
|
359
|
+
onClick: n[0] ||= j((e) => t.$emit("up"), ["stop"])
|
|
360
|
+
}, " ↑ ", 8, pe),
|
|
361
|
+
h("button", {
|
|
913
362
|
class: "bf__btn",
|
|
914
363
|
type: "button",
|
|
915
364
|
disabled: e.isLast,
|
|
916
365
|
title: "Move down",
|
|
917
|
-
onClick: n[1] ||=
|
|
918
|
-
}, " ↓ ", 8,
|
|
919
|
-
]),
|
|
366
|
+
onClick: n[1] ||= j((e) => t.$emit("down"), ["stop"])
|
|
367
|
+
}, " ↓ ", 8, $)
|
|
368
|
+
]), h("div", me, [E(t.$slots, "default", {}, void 0, !0)])], 2));
|
|
920
369
|
}
|
|
921
|
-
}), [["__scopeId", "data-v-22d52899"]]),
|
|
370
|
+
}), [["__scopeId", "data-v-22d52899"]]), ge = { class: "cms-zone" }, _e = {
|
|
922
371
|
key: 1,
|
|
923
372
|
class: "cms-zone__missing"
|
|
924
|
-
},
|
|
373
|
+
}, ve = {
|
|
925
374
|
key: 1,
|
|
926
375
|
class: "cms-zone__missing"
|
|
927
|
-
},
|
|
376
|
+
}, ye = /*#__PURE__*/ Q(/* @__PURE__ */ _({
|
|
928
377
|
__name: "CmsZone",
|
|
929
378
|
props: {
|
|
930
379
|
zone: {},
|
|
@@ -939,52 +388,52 @@ var Be = [
|
|
|
939
388
|
setText: { type: Function }
|
|
940
389
|
},
|
|
941
390
|
emits: ["select"],
|
|
942
|
-
setup(
|
|
943
|
-
let
|
|
944
|
-
|
|
391
|
+
setup(e, { emit: t }) {
|
|
392
|
+
let r = e, i = t;
|
|
393
|
+
C(M, {
|
|
945
394
|
get messages() {
|
|
946
|
-
return
|
|
395
|
+
return r.messages;
|
|
947
396
|
},
|
|
948
397
|
get editing() {
|
|
949
|
-
return
|
|
398
|
+
return r.editing ?? !1;
|
|
950
399
|
},
|
|
951
|
-
setText: (e, t, n,
|
|
400
|
+
setText: (e, t, n, i) => r.setText?.(e, t, n, i)
|
|
952
401
|
});
|
|
953
|
-
function
|
|
954
|
-
return
|
|
402
|
+
function a(e) {
|
|
403
|
+
return n(e.when, r.env, r.graphs);
|
|
955
404
|
}
|
|
956
|
-
let
|
|
957
|
-
function
|
|
958
|
-
if (
|
|
405
|
+
let o = d(() => r.zone.blocks.filter(a));
|
|
406
|
+
function s(e) {
|
|
407
|
+
if (r.provideBlockProps) return {
|
|
959
408
|
index: e,
|
|
960
|
-
blocks:
|
|
961
|
-
context:
|
|
409
|
+
blocks: r.zone.blocks,
|
|
410
|
+
context: r.context
|
|
962
411
|
};
|
|
963
412
|
}
|
|
964
|
-
function
|
|
413
|
+
function c(e) {
|
|
965
414
|
return e.type + (e.variation ? ` · ${e.variation}` : "");
|
|
966
415
|
}
|
|
967
|
-
function
|
|
968
|
-
let n =
|
|
416
|
+
function l(e, t) {
|
|
417
|
+
let n = r.zone.blocks;
|
|
969
418
|
if (t < 0 || t >= n.length) return;
|
|
970
|
-
let [
|
|
971
|
-
n.splice(t, 0,
|
|
419
|
+
let [i] = n.splice(e, 1);
|
|
420
|
+
n.splice(t, 0, i);
|
|
972
421
|
}
|
|
973
|
-
return (t,
|
|
974
|
-
key:
|
|
975
|
-
label:
|
|
976
|
-
hidden: !
|
|
977
|
-
"is-first":
|
|
978
|
-
"is-last":
|
|
979
|
-
selected:
|
|
980
|
-
onUp: (e) =>
|
|
981
|
-
onDown: (e) =>
|
|
982
|
-
onSelect: (
|
|
422
|
+
return (t, n) => (S(), m("div", ge, [e.editing ? (S(!0), m(u, { key: 0 }, T(e.zone.blocks, (t, n) => (S(), f(he, {
|
|
423
|
+
key: t.id,
|
|
424
|
+
label: c(t),
|
|
425
|
+
hidden: !a(t),
|
|
426
|
+
"is-first": n === 0,
|
|
427
|
+
"is-last": n === e.zone.blocks.length - 1,
|
|
428
|
+
selected: t.id === e.selectedId,
|
|
429
|
+
onUp: (e) => l(n, n - 1),
|
|
430
|
+
onDown: (e) => l(n, n + 1),
|
|
431
|
+
onSelect: (e) => i("select", t.id)
|
|
983
432
|
}, {
|
|
984
|
-
default:
|
|
433
|
+
default: A(() => [e.registry[t.type] ? (S(), f(D(e.registry[t.type]), b({
|
|
985
434
|
key: 0,
|
|
986
|
-
block:
|
|
987
|
-
}, { ref_for: !0 },
|
|
435
|
+
block: t
|
|
436
|
+
}, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (S(), m("div", _e, "Unknown block type: " + O(t.type), 1))]),
|
|
988
437
|
_: 2
|
|
989
438
|
}, 1032, [
|
|
990
439
|
"label",
|
|
@@ -995,12 +444,12 @@ var Be = [
|
|
|
995
444
|
"onUp",
|
|
996
445
|
"onDown",
|
|
997
446
|
"onSelect"
|
|
998
|
-
]))), 128)) : (
|
|
447
|
+
]))), 128)) : (S(!0), m(u, { key: 1 }, T(o.value, (t, n) => (S(), m(u, { key: t.id }, [e.registry[t.type] ? (S(), f(D(e.registry[t.type]), b({
|
|
999
448
|
key: 0,
|
|
1000
449
|
block: t
|
|
1001
|
-
}, { ref_for: !0 },
|
|
450
|
+
}, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (S(), m("div", ve, "Unknown block type: " + O(t.type), 1))], 64))), 128))]));
|
|
1002
451
|
}
|
|
1003
|
-
}), [["__scopeId", "data-v-
|
|
452
|
+
}), [["__scopeId", "data-v-6a544d0b"]]), be = /* @__PURE__ */ _({
|
|
1004
453
|
__name: "CmsRichText",
|
|
1005
454
|
props: {
|
|
1006
455
|
block: {},
|
|
@@ -1011,59 +460,59 @@ var Be = [
|
|
|
1011
460
|
plainAs: { default: "p" },
|
|
1012
461
|
transform: {}
|
|
1013
462
|
},
|
|
1014
|
-
setup(
|
|
1015
|
-
let a =
|
|
463
|
+
setup(n, { expose: i }) {
|
|
464
|
+
let a = n, o = y(M, {
|
|
1016
465
|
messages: {},
|
|
1017
466
|
editing: !1,
|
|
1018
467
|
setText: () => {}
|
|
1019
|
-
}),
|
|
1020
|
-
function
|
|
468
|
+
}), s = z(), u = d(() => a.block?.fields);
|
|
469
|
+
function m(e) {
|
|
1021
470
|
return e === void 0 ? [] : typeof e == "string" ? [e] : e;
|
|
1022
471
|
}
|
|
1023
|
-
let
|
|
472
|
+
let h = d(() => {
|
|
1024
473
|
if (!a.block) return;
|
|
1025
474
|
let e = u.value;
|
|
1026
|
-
return
|
|
1027
|
-
}),
|
|
1028
|
-
let
|
|
1029
|
-
return a.transform && (
|
|
475
|
+
return m(a.field).find((t) => e && e[t] !== void 0 && e[t] !== null);
|
|
476
|
+
}), _ = d(() => a.block?.id), v = d(() => a.value === void 0 ? c(u.value, m(a.field)) : a.value), b = d(() => l(v.value, o.messages)), x = d(() => r(b.value)), C = d(() => x.value ? "" : b.value), w = d(() => {
|
|
477
|
+
let n = e(t(b.value), a.serializers);
|
|
478
|
+
return a.transform && (n = a.transform(n)), n;
|
|
1030
479
|
});
|
|
1031
|
-
function
|
|
1032
|
-
if (!
|
|
480
|
+
function T(e) {
|
|
481
|
+
if (!s || e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
1033
482
|
let t = e.target?.closest?.("a");
|
|
1034
483
|
if (!t || t.hasAttribute("download")) return;
|
|
1035
484
|
let n = t.getAttribute("target");
|
|
1036
485
|
if (n && n !== "_self") return;
|
|
1037
486
|
let r = t.getAttribute("href") ?? "";
|
|
1038
|
-
!r.startsWith("/") || r.startsWith("//") ||
|
|
487
|
+
!r.startsWith("/") || r.startsWith("//") || s.navigate(r) && e.preventDefault();
|
|
1039
488
|
}
|
|
1040
489
|
return i({
|
|
1041
|
-
html:
|
|
1042
|
-
plain:
|
|
1043
|
-
}), (
|
|
490
|
+
html: w,
|
|
491
|
+
plain: C
|
|
492
|
+
}), (e, t) => x.value ? (S(), f(D(n.as), {
|
|
1044
493
|
key: 0,
|
|
1045
494
|
class: "cms-richtext-body",
|
|
1046
|
-
"data-cms-block":
|
|
1047
|
-
"data-cms-field":
|
|
495
|
+
"data-cms-block": _.value,
|
|
496
|
+
"data-cms-field": h.value,
|
|
1048
497
|
"data-cms-field-kind": "richtext",
|
|
1049
|
-
onClick:
|
|
1050
|
-
innerHTML:
|
|
498
|
+
onClick: T,
|
|
499
|
+
innerHTML: w.value
|
|
1051
500
|
}, null, 8, [
|
|
1052
501
|
"data-cms-block",
|
|
1053
502
|
"data-cms-field",
|
|
1054
503
|
"innerHTML"
|
|
1055
|
-
])) :
|
|
504
|
+
])) : C.value ? (S(), f(D(n.plainAs), {
|
|
1056
505
|
key: 1,
|
|
1057
506
|
class: "cms-richtext-body",
|
|
1058
|
-
"data-cms-block":
|
|
1059
|
-
"data-cms-field":
|
|
507
|
+
"data-cms-block": _.value,
|
|
508
|
+
"data-cms-field": h.value,
|
|
1060
509
|
"data-cms-field-kind": "richtext"
|
|
1061
510
|
}, {
|
|
1062
|
-
default:
|
|
511
|
+
default: A(() => [g(O(C.value), 1)]),
|
|
1063
512
|
_: 1
|
|
1064
|
-
}, 8, ["data-cms-block", "data-cms-field"])) :
|
|
513
|
+
}, 8, ["data-cms-block", "data-cms-field"])) : p("", !0);
|
|
1065
514
|
}
|
|
1066
|
-
}),
|
|
515
|
+
}), xe = /*#__PURE__*/ Q(/* @__PURE__ */ _({
|
|
1067
516
|
__name: "CmsLink",
|
|
1068
517
|
props: {
|
|
1069
518
|
block: {},
|
|
@@ -1073,37 +522,37 @@ var Be = [
|
|
|
1073
522
|
label: {},
|
|
1074
523
|
labelField: {}
|
|
1075
524
|
},
|
|
1076
|
-
setup(e, { expose:
|
|
1077
|
-
let
|
|
525
|
+
setup(e, { expose: t }) {
|
|
526
|
+
let n = e, r = y(M, {
|
|
1078
527
|
messages: {},
|
|
1079
528
|
editing: !1,
|
|
1080
529
|
setText: () => {}
|
|
1081
|
-
}),
|
|
1082
|
-
function
|
|
530
|
+
}), o = z(), u = d(() => n.block?.fields);
|
|
531
|
+
function p(e) {
|
|
1083
532
|
return e === void 0 ? [] : typeof e == "string" ? [e] : e;
|
|
1084
533
|
}
|
|
1085
|
-
let
|
|
1086
|
-
if (!
|
|
1087
|
-
let e =
|
|
1088
|
-
return
|
|
1089
|
-
}),
|
|
1090
|
-
if (
|
|
1091
|
-
let e =
|
|
1092
|
-
return e === void 0 ? "" :
|
|
534
|
+
let m = d(() => {
|
|
535
|
+
if (!n.block) return;
|
|
536
|
+
let e = u.value;
|
|
537
|
+
return p(n.field).find((t) => e && e[t] !== void 0 && e[t] !== null);
|
|
538
|
+
}), h = d(() => n.block?.id), _ = d(() => n.value === void 0 ? c(u.value, p(n.field)) : n.value), v = d(() => s(_.value, n.fallback ?? "")), x = d(() => a(v.value)), C = d(() => i(v.value)), w = d(() => {
|
|
539
|
+
if (n.label !== void 0) return l(n.label, r.messages);
|
|
540
|
+
let e = c(u.value, p(n.labelField));
|
|
541
|
+
return e === void 0 ? "" : l(e, r.messages);
|
|
1093
542
|
});
|
|
1094
|
-
|
|
1095
|
-
function
|
|
1096
|
-
let t =
|
|
1097
|
-
!t.ok || !t.internal || !t.href || t.newTab || e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey ||
|
|
543
|
+
t({ link: v });
|
|
544
|
+
function T(e) {
|
|
545
|
+
let t = v.value;
|
|
546
|
+
!t.ok || !t.internal || !t.href || t.newTab || e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || o && o.navigate(t.href) && e.preventDefault();
|
|
1098
547
|
}
|
|
1099
|
-
return (e, t) => (
|
|
1100
|
-
class: ["cms-link",
|
|
1101
|
-
"data-cms-block":
|
|
1102
|
-
"data-cms-field":
|
|
1103
|
-
"data-cms-link-status":
|
|
1104
|
-
onClick:
|
|
548
|
+
return (e, t) => (S(), f(D(x.value), b(C.value, {
|
|
549
|
+
class: ["cms-link", v.value.ok && v.value.href ? "" : "cms-link--inert"],
|
|
550
|
+
"data-cms-block": h.value,
|
|
551
|
+
"data-cms-field": m.value,
|
|
552
|
+
"data-cms-link-status": v.value.status,
|
|
553
|
+
onClick: T
|
|
1105
554
|
}), {
|
|
1106
|
-
default:
|
|
555
|
+
default: A(() => [E(e.$slots, "default", { link: v.value }, () => [g(O(w.value), 1)], !0)]),
|
|
1107
556
|
_: 3
|
|
1108
557
|
}, 16, [
|
|
1109
558
|
"class",
|
|
@@ -1112,14 +561,14 @@ var Be = [
|
|
|
1112
561
|
"data-cms-link-status"
|
|
1113
562
|
]));
|
|
1114
563
|
}
|
|
1115
|
-
}), [["__scopeId", "data-v-
|
|
564
|
+
}), [["__scopeId", "data-v-87a57473"]]), Se = [
|
|
1116
565
|
"src",
|
|
1117
566
|
"alt",
|
|
1118
567
|
"width",
|
|
1119
568
|
"height",
|
|
1120
569
|
"data-cms-block",
|
|
1121
570
|
"data-cms-field"
|
|
1122
|
-
],
|
|
571
|
+
], Ce = /* @__PURE__ */ _({
|
|
1123
572
|
__name: "CmsImage",
|
|
1124
573
|
props: {
|
|
1125
574
|
block: {},
|
|
@@ -1128,36 +577,36 @@ var Be = [
|
|
|
1128
577
|
fallback: {},
|
|
1129
578
|
alt: {}
|
|
1130
579
|
},
|
|
1131
|
-
setup(e, { expose:
|
|
1132
|
-
let
|
|
580
|
+
setup(e, { expose: t }) {
|
|
581
|
+
let n = e, r = y(M, {
|
|
1133
582
|
messages: {},
|
|
1134
583
|
editing: !1,
|
|
1135
584
|
setText: () => {}
|
|
1136
|
-
}),
|
|
1137
|
-
function
|
|
585
|
+
}), i = d(() => n.block?.fields);
|
|
586
|
+
function a(e) {
|
|
1138
587
|
return e === void 0 ? [] : typeof e == "string" ? [e] : e;
|
|
1139
588
|
}
|
|
1140
|
-
let
|
|
1141
|
-
if (!
|
|
1142
|
-
let e =
|
|
1143
|
-
return
|
|
1144
|
-
}),
|
|
1145
|
-
let e =
|
|
1146
|
-
return
|
|
589
|
+
let s = d(() => {
|
|
590
|
+
if (!n.block) return;
|
|
591
|
+
let e = i.value;
|
|
592
|
+
return a(n.field).find((t) => e && e[t] !== void 0 && e[t] !== null);
|
|
593
|
+
}), l = d(() => n.block?.id), u = d(() => n.value === void 0 ? c(i.value, a(n.field)) : n.value), f = d(() => {
|
|
594
|
+
let e = o(u.value, r.messages, n.fallback ?? "");
|
|
595
|
+
return n.alt === void 0 ? e : {
|
|
1147
596
|
...e,
|
|
1148
|
-
alt:
|
|
597
|
+
alt: n.alt
|
|
1149
598
|
};
|
|
1150
599
|
});
|
|
1151
|
-
return
|
|
600
|
+
return t({ image: f }), (e, t) => f.value.src ? (S(), m("img", {
|
|
1152
601
|
key: 0,
|
|
1153
|
-
src:
|
|
1154
|
-
alt:
|
|
1155
|
-
width:
|
|
1156
|
-
height:
|
|
1157
|
-
"data-cms-block":
|
|
1158
|
-
"data-cms-field":
|
|
1159
|
-
}, null, 8,
|
|
602
|
+
src: f.value.src,
|
|
603
|
+
alt: f.value.alt,
|
|
604
|
+
width: f.value.width,
|
|
605
|
+
height: f.value.height,
|
|
606
|
+
"data-cms-block": l.value,
|
|
607
|
+
"data-cms-field": s.value
|
|
608
|
+
}, null, 8, Se)) : p("", !0);
|
|
1160
609
|
}
|
|
1161
610
|
});
|
|
1162
611
|
//#endregion
|
|
1163
|
-
export {
|
|
612
|
+
export { P as CMS_CLIENT, M as CMS_CONTEXT, X as CMS_PARTIAL_STATE_KEY, Ce as CmsImage, xe as CmsLink, be as CmsRichText, ue as CmsText, ye as CmsZone, R as createCms, oe as defineBlock, Z as getBlockComponentProps, ae as hydrateCmsPartials, G as isPartialDocument, F as isServerRender, I as readPreviewFromLocation, Y as resetCmsPartials, ie as snapshotCmsPartials, z as useCms, ne as useCmsOrThrow, re as useCmsPage, J as useCmsPartial, N as useField };
|