@nubisco/cms-vue 1.4.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +120 -120
- package/package.json +20 -4
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
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,
|
|
2
|
-
import { Fragment as
|
|
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, sanitizeRichText as l, text as u } from "@nubisco/cms-core";
|
|
2
|
+
import { Fragment as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createTextVNode as _, defineComponent as v, getCurrentInstance as y, inject as b, mergeProps as x, normalizeClass as S, openBlock as C, provide as w, ref as T, renderList as E, renderSlot as D, resolveDynamicComponent as O, toDisplayString as k, unref as A, withCtx as j, withKeys as ee, withModifiers as M } from "vue";
|
|
3
3
|
export * from "@nubisco/cms-core";
|
|
4
4
|
//#region src/context.ts
|
|
5
|
-
var
|
|
5
|
+
var N = Symbol("cms-context");
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/useField.ts
|
|
8
|
-
function
|
|
9
|
-
let e =
|
|
8
|
+
function te() {
|
|
9
|
+
let e = b(N, {
|
|
10
10
|
messages: {},
|
|
11
11
|
editing: !1,
|
|
12
12
|
setText: () => {}
|
|
13
13
|
});
|
|
14
|
-
return { t: (t) =>
|
|
14
|
+
return { t: (t) => u(t, e.messages) };
|
|
15
15
|
}
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/client.ts
|
|
@@ -19,11 +19,11 @@ var P = Symbol("cms-client");
|
|
|
19
19
|
function F() {
|
|
20
20
|
return typeof window > "u";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ne() {
|
|
23
23
|
return typeof window < "u" ? new URLSearchParams(window.location.search) : null;
|
|
24
24
|
}
|
|
25
25
|
function I() {
|
|
26
|
-
let e =
|
|
26
|
+
let e = ne();
|
|
27
27
|
return e?.has("cms-edit") ? {
|
|
28
28
|
active: !0,
|
|
29
29
|
environment: e.get("cms-env")?.trim() || void 0,
|
|
@@ -137,9 +137,9 @@ function R(e) {
|
|
|
137
137
|
return f;
|
|
138
138
|
}
|
|
139
139
|
function z() {
|
|
140
|
-
return
|
|
140
|
+
return b(P, null);
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function B() {
|
|
143
143
|
let e = z();
|
|
144
144
|
if (!e) throw Error("[cms-vue] No CMS client provided. Call app.use(createCms({ siteId }))");
|
|
145
145
|
return e;
|
|
@@ -147,7 +147,7 @@ function ne() {
|
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/usePage.ts
|
|
149
149
|
function re(e, t) {
|
|
150
|
-
let n = t ?? z(), r =
|
|
150
|
+
let n = t ?? z(), r = T(null), i = T(null), a = T("unavailable"), o = T(!1);
|
|
151
151
|
async function s() {
|
|
152
152
|
if (!n) {
|
|
153
153
|
i.value = "CMS client is not configured", a.value = "unavailable";
|
|
@@ -171,35 +171,35 @@ function re(e, t) {
|
|
|
171
171
|
}
|
|
172
172
|
//#endregion
|
|
173
173
|
//#region src/usePartial.ts
|
|
174
|
-
var
|
|
175
|
-
function
|
|
176
|
-
if (!F()) return
|
|
177
|
-
let t = e ??
|
|
174
|
+
var V = /* @__PURE__ */ new Map();
|
|
175
|
+
function H(e) {
|
|
176
|
+
if (!F()) return V;
|
|
177
|
+
let t = e ?? y()?.appContext.app;
|
|
178
178
|
return t ? t.__cmsPartialStates ??= /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map();
|
|
179
179
|
}
|
|
180
|
-
function
|
|
180
|
+
function U(e, t) {
|
|
181
181
|
return e ? `${e.siteId}:${e.environment}:${t}` : `:${t}`;
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function W() {
|
|
184
184
|
return {
|
|
185
|
-
doc:
|
|
186
|
-
messages:
|
|
187
|
-
error:
|
|
188
|
-
loading:
|
|
185
|
+
doc: T(null),
|
|
186
|
+
messages: T({}),
|
|
187
|
+
error: T(null),
|
|
188
|
+
loading: T(!0),
|
|
189
189
|
started: !1,
|
|
190
190
|
ready: null
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
function W(e, t) {
|
|
194
|
-
let n = V(t), r = n.get(e);
|
|
195
|
-
return r || (r = U(), n.set(e, r)), r;
|
|
196
|
-
}
|
|
197
193
|
function G(e, t) {
|
|
194
|
+
let n = H(t), r = n.get(e);
|
|
195
|
+
return r || (r = W(), n.set(e, r)), r;
|
|
196
|
+
}
|
|
197
|
+
function K(e, t) {
|
|
198
198
|
if (!e || typeof e != "object") return !1;
|
|
199
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 : "";
|
|
200
200
|
return !r && !i ? !1 : !t || i === t || r && i === "";
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function q(e) {
|
|
203
203
|
let t = /* @__PURE__ */ new Set(), n = (e) => {
|
|
204
204
|
if (e) try {
|
|
205
205
|
t.add(new URL(e).origin);
|
|
@@ -209,19 +209,19 @@ function K(e) {
|
|
|
209
209
|
for (let t of e?.options.consoleOrigins ?? []) n(t);
|
|
210
210
|
return n(typeof document < "u" ? document.referrer : void 0), Array.from(t);
|
|
211
211
|
}
|
|
212
|
-
function
|
|
212
|
+
function J(e, t, n) {
|
|
213
213
|
typeof window > "u" || window.addEventListener("message", (r) => {
|
|
214
214
|
if (!e?.preview().active) return;
|
|
215
215
|
if (window.parent !== window) {
|
|
216
|
-
if (r.source !== window.parent || !
|
|
216
|
+
if (r.source !== window.parent || !q(e).includes(r.origin)) return;
|
|
217
217
|
} else if (r.origin !== window.location.origin) return;
|
|
218
218
|
let i = r.data, a = e?.patchMessageType ?? "nubisco-cms:patch";
|
|
219
|
-
!i || i.type !== a || !i.document?.zones?.main ||
|
|
219
|
+
!i || i.type !== a || !i.document?.zones?.main || K(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);
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
|
-
function
|
|
223
|
-
let n = t ?? z(), r =
|
|
224
|
-
return r.started || (r.started = !0, n ? (n.options.livePreview !== !1 && n.preview().active &&
|
|
222
|
+
function Y(e, t) {
|
|
223
|
+
let n = t ?? z(), r = G(U(n, e));
|
|
224
|
+
return r.started || (r.started = !0, n ? (n.options.livePreview !== !1 && n.preview().active && J(n, e, r), r.ready = n.fetchPartial(e).then((e) => {
|
|
225
225
|
r.doc.value || (r.doc.value = e.doc, r.error.value = e.error, r.loading.value = !1);
|
|
226
226
|
}), r.ready) : (r.error.value = "CMS client is not configured", r.loading.value = !1)), {
|
|
227
227
|
doc: r.doc,
|
|
@@ -231,23 +231,23 @@ function J(e, t) {
|
|
|
231
231
|
whenReady: () => r.ready ?? Promise.resolve()
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
-
function
|
|
235
|
-
|
|
234
|
+
function X() {
|
|
235
|
+
V.clear();
|
|
236
236
|
}
|
|
237
|
-
var
|
|
238
|
-
function
|
|
237
|
+
var ie = "cmsPartials";
|
|
238
|
+
function ae(e) {
|
|
239
239
|
let t = {};
|
|
240
|
-
for (let [n, r] of
|
|
240
|
+
for (let [n, r] of H(e)) r.loading.value || (t[n] = {
|
|
241
241
|
doc: r.doc.value,
|
|
242
242
|
error: r.error.value
|
|
243
243
|
});
|
|
244
244
|
return t;
|
|
245
245
|
}
|
|
246
|
-
function
|
|
246
|
+
function oe(e, t) {
|
|
247
247
|
if (!(!e || typeof e != "object") && !t?.preview().active) for (let [t, n] of Object.entries(e)) {
|
|
248
248
|
let e = n;
|
|
249
249
|
if (!e || typeof e != "object") continue;
|
|
250
|
-
let r =
|
|
250
|
+
let r = G(t);
|
|
251
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());
|
|
252
252
|
}
|
|
253
253
|
}
|
|
@@ -276,32 +276,32 @@ function Z() {
|
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function se() {
|
|
280
280
|
return Z();
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/CmsText.vue?vue&type=script&setup=true&lang.ts
|
|
284
|
-
var
|
|
284
|
+
var ce = [
|
|
285
285
|
"data-cms-block",
|
|
286
286
|
"data-cms-field",
|
|
287
287
|
"onKeydown"
|
|
288
|
-
],
|
|
288
|
+
], le = { key: 1 }, ue = /*@__PURE__*/ v({
|
|
289
289
|
__name: "CmsText",
|
|
290
290
|
props: {
|
|
291
291
|
block: {},
|
|
292
292
|
field: {}
|
|
293
293
|
},
|
|
294
294
|
setup(e) {
|
|
295
|
-
let t = e, n =
|
|
295
|
+
let t = e, n = b(N, {
|
|
296
296
|
messages: {},
|
|
297
297
|
editing: !1,
|
|
298
298
|
setText: () => {}
|
|
299
|
-
}), r =
|
|
299
|
+
}), r = f(() => t.block.fields[t.field]), i = f(() => u(r.value, n.messages)), a = T(null);
|
|
300
300
|
function o() {
|
|
301
301
|
let e = a.value?.innerText.trim() ?? "";
|
|
302
302
|
e !== i.value && n.setText(t.block, t.field, r.value, e), a.value?.blur();
|
|
303
303
|
}
|
|
304
|
-
return (t, r) =>
|
|
304
|
+
return (t, r) => A(n).editing ? (C(), h("span", {
|
|
305
305
|
key: 0,
|
|
306
306
|
ref_key: "el",
|
|
307
307
|
ref: a,
|
|
@@ -312,17 +312,17 @@ var se = [
|
|
|
312
312
|
role: "textbox",
|
|
313
313
|
tabindex: "0",
|
|
314
314
|
onBlur: o,
|
|
315
|
-
onKeydown: ee(
|
|
316
|
-
},
|
|
315
|
+
onKeydown: ee(M(o, ["prevent"]), ["enter"])
|
|
316
|
+
}, k(i.value), 41, ce)) : (C(), h("span", le, k(i.value), 1));
|
|
317
317
|
}
|
|
318
318
|
}), Q = (e, t) => {
|
|
319
319
|
let n = e.__vccOpts || e;
|
|
320
320
|
for (let [e, r] of t) n[e] = r;
|
|
321
321
|
return n;
|
|
322
|
-
},
|
|
322
|
+
}, de = /*#__PURE__*/ Q(ue, [["__scopeId", "data-v-67fffd3d"]]), fe = { class: "bf__type" }, pe = {
|
|
323
323
|
key: 0,
|
|
324
324
|
class: "bf__badge"
|
|
325
|
-
},
|
|
325
|
+
}, me = ["disabled"], he = ["disabled"], ge = { class: "bf__body" }, _e = /*#__PURE__*/ Q(/* @__PURE__ */ v({
|
|
326
326
|
__name: "BlockFrame",
|
|
327
327
|
props: {
|
|
328
328
|
label: {},
|
|
@@ -337,43 +337,43 @@ var se = [
|
|
|
337
337
|
"select"
|
|
338
338
|
],
|
|
339
339
|
setup(e) {
|
|
340
|
-
return (t, n) => (
|
|
340
|
+
return (t, n) => (C(), h("div", { class: S(["bf", {
|
|
341
341
|
"bf--dim": e.hidden,
|
|
342
342
|
"bf--selected": e.selected
|
|
343
|
-
}]) }, [
|
|
343
|
+
}]) }, [g("div", {
|
|
344
344
|
class: "bf__bar",
|
|
345
345
|
onClick: n[2] ||= (e) => t.$emit("select")
|
|
346
346
|
}, [
|
|
347
|
-
n[3] ||=
|
|
347
|
+
n[3] ||= g("span", {
|
|
348
348
|
class: "bf__grip",
|
|
349
349
|
"aria-hidden": "true"
|
|
350
350
|
}, "⠿", -1),
|
|
351
|
-
|
|
352
|
-
e.hidden ? (
|
|
353
|
-
n[4] ||=
|
|
354
|
-
|
|
351
|
+
g("span", fe, k(e.label), 1),
|
|
352
|
+
e.hidden ? (C(), h("span", pe, "hidden by condition")) : m("", !0),
|
|
353
|
+
n[4] ||= g("span", { class: "bf__spacer" }, null, -1),
|
|
354
|
+
g("button", {
|
|
355
355
|
class: "bf__btn",
|
|
356
356
|
type: "button",
|
|
357
357
|
disabled: e.isFirst,
|
|
358
358
|
title: "Move up",
|
|
359
|
-
onClick: n[0] ||=
|
|
360
|
-
}, " ↑ ", 8,
|
|
361
|
-
|
|
359
|
+
onClick: n[0] ||= M((e) => t.$emit("up"), ["stop"])
|
|
360
|
+
}, " ↑ ", 8, me),
|
|
361
|
+
g("button", {
|
|
362
362
|
class: "bf__btn",
|
|
363
363
|
type: "button",
|
|
364
364
|
disabled: e.isLast,
|
|
365
365
|
title: "Move down",
|
|
366
|
-
onClick: n[1] ||=
|
|
367
|
-
}, " ↓ ", 8,
|
|
368
|
-
]),
|
|
366
|
+
onClick: n[1] ||= M((e) => t.$emit("down"), ["stop"])
|
|
367
|
+
}, " ↓ ", 8, he)
|
|
368
|
+
]), g("div", ge, [D(t.$slots, "default", {}, void 0, !0)])], 2));
|
|
369
369
|
}
|
|
370
|
-
}), [["__scopeId", "data-v-22d52899"]]),
|
|
370
|
+
}), [["__scopeId", "data-v-22d52899"]]), $ = { class: "cms-zone" }, ve = {
|
|
371
371
|
key: 1,
|
|
372
372
|
class: "cms-zone__missing"
|
|
373
|
-
},
|
|
373
|
+
}, ye = {
|
|
374
374
|
key: 1,
|
|
375
375
|
class: "cms-zone__missing"
|
|
376
|
-
},
|
|
376
|
+
}, be = /*#__PURE__*/ Q(/* @__PURE__ */ v({
|
|
377
377
|
__name: "CmsZone",
|
|
378
378
|
props: {
|
|
379
379
|
zone: {},
|
|
@@ -390,7 +390,7 @@ var se = [
|
|
|
390
390
|
emits: ["select"],
|
|
391
391
|
setup(e, { emit: t }) {
|
|
392
392
|
let r = e, i = t;
|
|
393
|
-
|
|
393
|
+
w(N, {
|
|
394
394
|
get messages() {
|
|
395
395
|
return r.messages;
|
|
396
396
|
},
|
|
@@ -402,7 +402,7 @@ var se = [
|
|
|
402
402
|
function a(e) {
|
|
403
403
|
return n(e.when, r.env, r.graphs);
|
|
404
404
|
}
|
|
405
|
-
let o =
|
|
405
|
+
let o = f(() => r.zone.blocks.filter(a));
|
|
406
406
|
function s(e) {
|
|
407
407
|
if (r.provideBlockProps) return {
|
|
408
408
|
index: e,
|
|
@@ -419,7 +419,7 @@ var se = [
|
|
|
419
419
|
let [i] = n.splice(e, 1);
|
|
420
420
|
n.splice(t, 0, i);
|
|
421
421
|
}
|
|
422
|
-
return (t, n) => (
|
|
422
|
+
return (t, n) => (C(), h("div", $, [e.editing ? (C(!0), h(d, { key: 0 }, E(e.zone.blocks, (t, n) => (C(), p(_e, {
|
|
423
423
|
key: t.id,
|
|
424
424
|
label: c(t),
|
|
425
425
|
hidden: !a(t),
|
|
@@ -430,10 +430,10 @@ var se = [
|
|
|
430
430
|
onDown: (e) => l(n, n + 1),
|
|
431
431
|
onSelect: (e) => i("select", t.id)
|
|
432
432
|
}, {
|
|
433
|
-
default:
|
|
433
|
+
default: j(() => [e.registry[t.type] ? (C(), p(O(e.registry[t.type]), x({
|
|
434
434
|
key: 0,
|
|
435
435
|
block: t
|
|
436
|
-
}, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (
|
|
436
|
+
}, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (C(), h("div", ve, "Unknown block type: " + k(t.type), 1))]),
|
|
437
437
|
_: 2
|
|
438
438
|
}, 1032, [
|
|
439
439
|
"label",
|
|
@@ -444,12 +444,12 @@ var se = [
|
|
|
444
444
|
"onUp",
|
|
445
445
|
"onDown",
|
|
446
446
|
"onSelect"
|
|
447
|
-
]))), 128)) : (
|
|
447
|
+
]))), 128)) : (C(!0), h(d, { key: 1 }, E(o.value, (t, n) => (C(), h(d, { key: t.id }, [e.registry[t.type] ? (C(), p(O(e.registry[t.type]), x({
|
|
448
448
|
key: 0,
|
|
449
449
|
block: t
|
|
450
|
-
}, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (
|
|
450
|
+
}, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (C(), h("div", ye, "Unknown block type: " + k(t.type), 1))], 64))), 128))]));
|
|
451
451
|
}
|
|
452
|
-
}), [["__scopeId", "data-v-6a544d0b"]]),
|
|
452
|
+
}), [["__scopeId", "data-v-6a544d0b"]]), xe = /* @__PURE__ */ v({
|
|
453
453
|
__name: "CmsRichText",
|
|
454
454
|
props: {
|
|
455
455
|
block: {},
|
|
@@ -461,23 +461,23 @@ var se = [
|
|
|
461
461
|
transform: {}
|
|
462
462
|
},
|
|
463
463
|
setup(n, { expose: i }) {
|
|
464
|
-
let a = n, o =
|
|
464
|
+
let a = n, o = b(N, {
|
|
465
465
|
messages: {},
|
|
466
466
|
editing: !1,
|
|
467
467
|
setText: () => {}
|
|
468
|
-
}), s = z(),
|
|
469
|
-
function
|
|
468
|
+
}), s = z(), d = f(() => a.block?.fields);
|
|
469
|
+
function h(e) {
|
|
470
470
|
return e === void 0 ? [] : typeof e == "string" ? [e] : e;
|
|
471
471
|
}
|
|
472
|
-
let
|
|
472
|
+
let g = f(() => {
|
|
473
473
|
if (!a.block) return;
|
|
474
|
-
let e =
|
|
475
|
-
return
|
|
476
|
-
}),
|
|
477
|
-
let n = e(t(
|
|
474
|
+
let e = d.value;
|
|
475
|
+
return h(a.field).find((t) => e && e[t] !== void 0 && e[t] !== null);
|
|
476
|
+
}), v = f(() => a.block?.id), y = f(() => a.value === void 0 ? c(d.value, h(a.field)) : a.value), x = f(() => u(y.value, o.messages)), S = f(() => r(x.value)), w = f(() => S.value ? "" : x.value), T = f(() => {
|
|
477
|
+
let n = e(l(t(x.value)), a.serializers);
|
|
478
478
|
return a.transform && (n = a.transform(n)), n;
|
|
479
479
|
});
|
|
480
|
-
function
|
|
480
|
+
function E(e) {
|
|
481
481
|
if (!s || e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
482
482
|
let t = e.target?.closest?.("a");
|
|
483
483
|
if (!t || t.hasAttribute("download")) return;
|
|
@@ -487,32 +487,32 @@ var se = [
|
|
|
487
487
|
!r.startsWith("/") || r.startsWith("//") || s.navigate(r) && e.preventDefault();
|
|
488
488
|
}
|
|
489
489
|
return i({
|
|
490
|
-
html:
|
|
491
|
-
plain:
|
|
492
|
-
}), (e, t) =>
|
|
490
|
+
html: T,
|
|
491
|
+
plain: w
|
|
492
|
+
}), (e, t) => S.value ? (C(), p(O(n.as), {
|
|
493
493
|
key: 0,
|
|
494
494
|
class: "cms-richtext-body",
|
|
495
|
-
"data-cms-block":
|
|
496
|
-
"data-cms-field":
|
|
495
|
+
"data-cms-block": v.value,
|
|
496
|
+
"data-cms-field": g.value,
|
|
497
497
|
"data-cms-field-kind": "richtext",
|
|
498
|
-
onClick:
|
|
499
|
-
innerHTML:
|
|
498
|
+
onClick: E,
|
|
499
|
+
innerHTML: T.value
|
|
500
500
|
}, null, 8, [
|
|
501
501
|
"data-cms-block",
|
|
502
502
|
"data-cms-field",
|
|
503
503
|
"innerHTML"
|
|
504
|
-
])) :
|
|
504
|
+
])) : w.value ? (C(), p(O(n.plainAs), {
|
|
505
505
|
key: 1,
|
|
506
506
|
class: "cms-richtext-body",
|
|
507
|
-
"data-cms-block":
|
|
508
|
-
"data-cms-field":
|
|
507
|
+
"data-cms-block": v.value,
|
|
508
|
+
"data-cms-field": g.value,
|
|
509
509
|
"data-cms-field-kind": "richtext"
|
|
510
510
|
}, {
|
|
511
|
-
default:
|
|
511
|
+
default: j(() => [_(k(w.value), 1)]),
|
|
512
512
|
_: 1
|
|
513
|
-
}, 8, ["data-cms-block", "data-cms-field"])) :
|
|
513
|
+
}, 8, ["data-cms-block", "data-cms-field"])) : m("", !0);
|
|
514
514
|
}
|
|
515
|
-
}),
|
|
515
|
+
}), Se = /*#__PURE__*/ Q(/* @__PURE__ */ v({
|
|
516
516
|
__name: "CmsLink",
|
|
517
517
|
props: {
|
|
518
518
|
block: {},
|
|
@@ -523,36 +523,36 @@ var se = [
|
|
|
523
523
|
labelField: {}
|
|
524
524
|
},
|
|
525
525
|
setup(e, { expose: t }) {
|
|
526
|
-
let n = e, r =
|
|
526
|
+
let n = e, r = b(N, {
|
|
527
527
|
messages: {},
|
|
528
528
|
editing: !1,
|
|
529
529
|
setText: () => {}
|
|
530
|
-
}), o = z(),
|
|
531
|
-
function
|
|
530
|
+
}), o = z(), l = f(() => n.block?.fields);
|
|
531
|
+
function d(e) {
|
|
532
532
|
return e === void 0 ? [] : typeof e == "string" ? [e] : e;
|
|
533
533
|
}
|
|
534
|
-
let m =
|
|
534
|
+
let m = f(() => {
|
|
535
535
|
if (!n.block) return;
|
|
536
|
-
let e =
|
|
537
|
-
return
|
|
538
|
-
}), h =
|
|
539
|
-
if (n.label !== void 0) return
|
|
540
|
-
let e = c(
|
|
541
|
-
return e === void 0 ? "" :
|
|
536
|
+
let e = l.value;
|
|
537
|
+
return d(n.field).find((t) => e && e[t] !== void 0 && e[t] !== null);
|
|
538
|
+
}), h = f(() => n.block?.id), g = f(() => n.value === void 0 ? c(l.value, d(n.field)) : n.value), v = f(() => s(g.value, n.fallback ?? "")), y = f(() => a(v.value)), S = f(() => i(v.value)), w = f(() => {
|
|
539
|
+
if (n.label !== void 0) return u(n.label, r.messages);
|
|
540
|
+
let e = c(l.value, d(n.labelField));
|
|
541
|
+
return e === void 0 ? "" : u(e, r.messages);
|
|
542
542
|
});
|
|
543
543
|
t({ link: v });
|
|
544
544
|
function T(e) {
|
|
545
545
|
let t = v.value;
|
|
546
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();
|
|
547
547
|
}
|
|
548
|
-
return (e, t) => (
|
|
548
|
+
return (e, t) => (C(), p(O(y.value), x(S.value, {
|
|
549
549
|
class: ["cms-link", v.value.ok && v.value.href ? "" : "cms-link--inert"],
|
|
550
550
|
"data-cms-block": h.value,
|
|
551
551
|
"data-cms-field": m.value,
|
|
552
552
|
"data-cms-link-status": v.value.status,
|
|
553
553
|
onClick: T
|
|
554
554
|
}), {
|
|
555
|
-
default:
|
|
555
|
+
default: j(() => [D(e.$slots, "default", { link: v.value }, () => [_(k(w.value), 1)], !0)]),
|
|
556
556
|
_: 3
|
|
557
557
|
}, 16, [
|
|
558
558
|
"class",
|
|
@@ -561,14 +561,14 @@ var se = [
|
|
|
561
561
|
"data-cms-link-status"
|
|
562
562
|
]));
|
|
563
563
|
}
|
|
564
|
-
}), [["__scopeId", "data-v-87a57473"]]),
|
|
564
|
+
}), [["__scopeId", "data-v-87a57473"]]), Ce = [
|
|
565
565
|
"src",
|
|
566
566
|
"alt",
|
|
567
567
|
"width",
|
|
568
568
|
"height",
|
|
569
569
|
"data-cms-block",
|
|
570
570
|
"data-cms-field"
|
|
571
|
-
],
|
|
571
|
+
], we = /* @__PURE__ */ v({
|
|
572
572
|
__name: "CmsImage",
|
|
573
573
|
props: {
|
|
574
574
|
block: {},
|
|
@@ -578,35 +578,35 @@ var se = [
|
|
|
578
578
|
alt: {}
|
|
579
579
|
},
|
|
580
580
|
setup(e, { expose: t }) {
|
|
581
|
-
let n = e, r =
|
|
581
|
+
let n = e, r = b(N, {
|
|
582
582
|
messages: {},
|
|
583
583
|
editing: !1,
|
|
584
584
|
setText: () => {}
|
|
585
|
-
}), i =
|
|
585
|
+
}), i = f(() => n.block?.fields);
|
|
586
586
|
function a(e) {
|
|
587
587
|
return e === void 0 ? [] : typeof e == "string" ? [e] : e;
|
|
588
588
|
}
|
|
589
|
-
let s =
|
|
589
|
+
let s = f(() => {
|
|
590
590
|
if (!n.block) return;
|
|
591
591
|
let e = i.value;
|
|
592
592
|
return a(n.field).find((t) => e && e[t] !== void 0 && e[t] !== null);
|
|
593
|
-
}), l =
|
|
593
|
+
}), l = f(() => n.block?.id), u = f(() => n.value === void 0 ? c(i.value, a(n.field)) : n.value), d = f(() => {
|
|
594
594
|
let e = o(u.value, r.messages, n.fallback ?? "");
|
|
595
595
|
return n.alt === void 0 ? e : {
|
|
596
596
|
...e,
|
|
597
597
|
alt: n.alt
|
|
598
598
|
};
|
|
599
599
|
});
|
|
600
|
-
return t({ image:
|
|
600
|
+
return t({ image: d }), (e, t) => d.value.src ? (C(), h("img", {
|
|
601
601
|
key: 0,
|
|
602
|
-
src:
|
|
603
|
-
alt:
|
|
604
|
-
width:
|
|
605
|
-
height:
|
|
602
|
+
src: d.value.src,
|
|
603
|
+
alt: d.value.alt,
|
|
604
|
+
width: d.value.width,
|
|
605
|
+
height: d.value.height,
|
|
606
606
|
"data-cms-block": l.value,
|
|
607
607
|
"data-cms-field": s.value
|
|
608
|
-
}, null, 8,
|
|
608
|
+
}, null, 8, Ce)) : m("", !0);
|
|
609
609
|
}
|
|
610
610
|
});
|
|
611
611
|
//#endregion
|
|
612
|
-
export { P as CMS_CLIENT,
|
|
612
|
+
export { P as CMS_CLIENT, N as CMS_CONTEXT, ie as CMS_PARTIAL_STATE_KEY, we as CmsImage, Se as CmsLink, xe as CmsRichText, de as CmsText, be as CmsZone, R as createCms, se as defineBlock, Z as getBlockComponentProps, oe as hydrateCmsPartials, K as isPartialDocument, F as isServerRender, I as readPreviewFromLocation, X as resetCmsPartials, ae as snapshotCmsPartials, z as useCms, B as useCmsOrThrow, re as useCmsPage, Y as useCmsPartial, te as useField };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nubisco/cms-vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Nubisco CMS content contract, evaluator, and Vue render kit.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"./style.css": "./dist/cms-vue.css"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
|
-
"dist"
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
24
26
|
],
|
|
25
27
|
"scripts": {
|
|
26
28
|
"build": "node scripts/check-core-boundary.mjs && vite build",
|
|
@@ -68,6 +70,20 @@
|
|
|
68
70
|
]
|
|
69
71
|
},
|
|
70
72
|
"dependencies": {
|
|
71
|
-
"@nubisco/cms-core": "^
|
|
72
|
-
}
|
|
73
|
+
"@nubisco/cms-core": "^1.1.0"
|
|
74
|
+
},
|
|
75
|
+
"author": "José Silva <jose@nubisco.io>",
|
|
76
|
+
"homepage": "https://github.com/nubisco/cms-vue#readme",
|
|
77
|
+
"bugs": {
|
|
78
|
+
"url": "https://github.com/nubisco/cms-vue/issues"
|
|
79
|
+
},
|
|
80
|
+
"keywords": [
|
|
81
|
+
"vue",
|
|
82
|
+
"vue3",
|
|
83
|
+
"cms",
|
|
84
|
+
"headless-cms",
|
|
85
|
+
"content",
|
|
86
|
+
"typescript",
|
|
87
|
+
"nubisco"
|
|
88
|
+
]
|
|
73
89
|
}
|