@nubisco/cms-vue 1.4.1 → 1.6.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.
Files changed (2) hide show
  1. package/dist/index.js +137 -137
  2. package/package.json +20 -4
package/dist/index.js CHANGED
@@ -1,45 +1,45 @@
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";
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, slugHeadings as u, text as d } from "@nubisco/cms-core";
2
+ import { Fragment as f, computed as p, createBlock as m, createCommentVNode as h, createElementBlock as g, createElementVNode as _, createTextVNode as v, defineComponent as y, getCurrentInstance as b, inject as x, mergeProps as S, normalizeClass as C, openBlock as w, provide as T, ref as E, renderList as D, renderSlot as O, resolveDynamicComponent as k, toDisplayString as A, unref as j, withCtx as M, withKeys as ee, withModifiers as N } from "vue";
3
3
  export * from "@nubisco/cms-core";
4
4
  //#region src/context.ts
5
- var M = Symbol("cms-context");
5
+ var P = Symbol("cms-context");
6
6
  //#endregion
7
7
  //#region src/useField.ts
8
- function N() {
9
- let e = y(M, {
8
+ function te() {
9
+ let e = x(P, {
10
10
  messages: {},
11
11
  editing: !1,
12
12
  setText: () => {}
13
13
  });
14
- return { t: (t) => l(t, e.messages) };
14
+ return { t: (t) => d(t, e.messages) };
15
15
  }
16
16
  //#endregion
17
17
  //#region src/client.ts
18
- var P = Symbol("cms-client");
19
- function F() {
18
+ var F = Symbol("cms-client");
19
+ function I() {
20
20
  return typeof window > "u";
21
21
  }
22
- function te() {
22
+ function ne() {
23
23
  return typeof window < "u" ? new URLSearchParams(window.location.search) : null;
24
24
  }
25
- function I() {
26
- let e = te();
25
+ function L() {
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,
30
30
  token: e.get("cms-preview-token")?.trim() || void 0
31
31
  } : { active: !1 };
32
32
  }
33
- var L = { active: !1 };
34
- function R(e) {
33
+ var R = { active: !1 };
34
+ function z(e) {
35
35
  if (!e.apiBase) throw Error("createCms: apiBase is required, for example https://cms.example.com");
36
36
  if (!e.siteId) throw Error("createCms: siteId is required");
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;
37
+ let t = e.apiBase.replace(/\/$/, ""), n = e.environment || "production", r = e.siteId, i = e.fetch ?? ((e, t) => fetch(e, t)), a = e.preview ?? L;
38
38
  function o() {
39
39
  try {
40
- return a() ?? L;
40
+ return a() ?? R;
41
41
  } catch {
42
- return L;
42
+ return R;
43
43
  }
44
44
  }
45
45
  function s(e) {
@@ -47,7 +47,7 @@ function R(e) {
47
47
  return `${t}/api/v1/${r}/${a}/${e.replace(/^\/+/, "")}${s}`;
48
48
  }
49
49
  async function c(e) {
50
- let t = o().active || F() ? "no-store" : "default", n = await i(s(e), { cache: t });
50
+ let t = o().active || I() ? "no-store" : "default", n = await i(s(e), { cache: t });
51
51
  return n.ok ? {
52
52
  status: n.status,
53
53
  body: await n.json()
@@ -131,23 +131,23 @@ function R(e) {
131
131
  fetchPage: l,
132
132
  fetchPartial: u,
133
133
  install(e) {
134
- e.provide(P, f);
134
+ e.provide(F, f);
135
135
  }
136
136
  };
137
137
  return f;
138
138
  }
139
- function z() {
140
- return y(P, null);
139
+ function B() {
140
+ return x(F, null);
141
141
  }
142
- function ne() {
143
- let e = z();
142
+ function V() {
143
+ let e = B();
144
144
  if (!e) throw Error("[cms-vue] No CMS client provided. Call app.use(createCms({ siteId }))");
145
145
  return e;
146
146
  }
147
147
  //#endregion
148
148
  //#region src/usePage.ts
149
149
  function re(e, t) {
150
- let n = t ?? z(), r = w(null), i = w(null), a = w("unavailable"), o = w(!1);
150
+ let n = t ?? B(), r = E(null), i = E(null), a = E("unavailable"), o = E(!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 B = /* @__PURE__ */ new Map();
175
- function V(e) {
176
- if (!F()) return B;
177
- let t = e ?? v()?.appContext.app;
174
+ var H = /* @__PURE__ */ new Map();
175
+ function U(e) {
176
+ if (!I()) return H;
177
+ let t = e ?? b()?.appContext.app;
178
178
  return t ? t.__cmsPartialStates ??= /* @__PURE__ */ new Map() : /* @__PURE__ */ new Map();
179
179
  }
180
- function H(e, t) {
180
+ function W(e, t) {
181
181
  return e ? `${e.siteId}:${e.environment}:${t}` : `:${t}`;
182
182
  }
183
- function U() {
183
+ function G() {
184
184
  return {
185
- doc: w(null),
186
- messages: w({}),
187
- error: w(null),
188
- loading: w(!0),
185
+ doc: E(null),
186
+ messages: E({}),
187
+ error: E(null),
188
+ loading: E(!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;
193
+ function K(e, t) {
194
+ let n = U(t), r = n.get(e);
195
+ return r || (r = G(), n.set(e, r)), r;
196
196
  }
197
- function G(e, t) {
197
+ function q(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 K(e) {
202
+ function J(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 q(e, t, n) {
212
+ function Y(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 || !K(e).includes(r.origin)) return;
216
+ if (r.source !== window.parent || !J(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 || 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);
219
+ !i || i.type !== a || !i.document?.zones?.main || q(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 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) => {
222
+ function X(e, t) {
223
+ let n = t ?? B(), r = K(W(n, e));
224
+ return r.started || (r.started = !0, n ? (n.options.livePreview !== !1 && n.preview().active && Y(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 Y() {
235
- B.clear();
234
+ function ie() {
235
+ H.clear();
236
236
  }
237
- var X = "cmsPartials";
238
- function ie(e) {
237
+ var ae = "cmsPartials";
238
+ function oe(e) {
239
239
  let t = {};
240
- for (let [n, r] of V(e)) r.loading.value || (t[n] = {
240
+ for (let [n, r] of U(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 ae(e, t) {
246
+ function se(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 = W(t);
250
+ let r = K(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 oe() {
279
+ function ce() {
280
280
  return Z();
281
281
  }
282
282
  //#endregion
283
283
  //#region src/CmsText.vue?vue&type=script&setup=true&lang.ts
284
- var se = [
284
+ var le = [
285
285
  "data-cms-block",
286
286
  "data-cms-field",
287
287
  "onKeydown"
288
- ], ce = { key: 1 }, le = /*@__PURE__*/ _({
288
+ ], ue = { key: 1 }, de = /*@__PURE__*/ y({
289
289
  __name: "CmsText",
290
290
  props: {
291
291
  block: {},
292
292
  field: {}
293
293
  },
294
294
  setup(e) {
295
- let t = e, n = y(M, {
295
+ let t = e, n = x(P, {
296
296
  messages: {},
297
297
  editing: !1,
298
298
  setText: () => {}
299
- }), r = d(() => t.block.fields[t.field]), i = d(() => l(r.value, n.messages)), a = w(null);
299
+ }), r = p(() => t.block.fields[t.field]), i = p(() => d(r.value, n.messages)), a = E(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) => k(n).editing ? (S(), m("span", {
304
+ return (t, r) => j(n).editing ? (w(), g("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(j(o, ["prevent"]), ["enter"])
316
- }, O(i.value), 41, se)) : (S(), m("span", ce, O(i.value), 1));
315
+ onKeydown: ee(N(o, ["prevent"]), ["enter"])
316
+ }, A(i.value), 41, le)) : (w(), g("span", ue, A(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
- }, ue = /*#__PURE__*/ Q(le, [["__scopeId", "data-v-67fffd3d"]]), de = { class: "bf__type" }, fe = {
322
+ }, fe = /*#__PURE__*/ Q(de, [["__scopeId", "data-v-67fffd3d"]]), pe = { class: "bf__type" }, me = {
323
323
  key: 0,
324
324
  class: "bf__badge"
325
- }, pe = ["disabled"], $ = ["disabled"], me = { class: "bf__body" }, he = /*#__PURE__*/ Q(/* @__PURE__ */ _({
325
+ }, he = ["disabled"], ge = ["disabled"], _e = { class: "bf__body" }, ve = /*#__PURE__*/ Q(/* @__PURE__ */ y({
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) => (S(), m("div", { class: x(["bf", {
340
+ return (t, n) => (w(), g("div", { class: C(["bf", {
341
341
  "bf--dim": e.hidden,
342
342
  "bf--selected": e.selected
343
- }]) }, [h("div", {
343
+ }]) }, [_("div", {
344
344
  class: "bf__bar",
345
345
  onClick: n[2] ||= (e) => t.$emit("select")
346
346
  }, [
347
- n[3] ||= h("span", {
347
+ n[3] ||= _("span", {
348
348
  class: "bf__grip",
349
349
  "aria-hidden": "true"
350
350
  }, "⠿", -1),
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", {
351
+ _("span", pe, A(e.label), 1),
352
+ e.hidden ? (w(), g("span", me, "hidden by condition")) : h("", !0),
353
+ n[4] ||= _("span", { class: "bf__spacer" }, null, -1),
354
+ _("button", {
355
355
  class: "bf__btn",
356
356
  type: "button",
357
357
  disabled: e.isFirst,
358
358
  title: "Move up",
359
- onClick: n[0] ||= j((e) => t.$emit("up"), ["stop"])
360
- }, " ↑ ", 8, pe),
361
- h("button", {
359
+ onClick: n[0] ||= N((e) => t.$emit("up"), ["stop"])
360
+ }, " ↑ ", 8, he),
361
+ _("button", {
362
362
  class: "bf__btn",
363
363
  type: "button",
364
364
  disabled: e.isLast,
365
365
  title: "Move down",
366
- onClick: n[1] ||= j((e) => t.$emit("down"), ["stop"])
367
- }, " ↓ ", 8, $)
368
- ]), h("div", me, [E(t.$slots, "default", {}, void 0, !0)])], 2));
366
+ onClick: n[1] ||= N((e) => t.$emit("down"), ["stop"])
367
+ }, " ↓ ", 8, ge)
368
+ ]), _("div", _e, [O(t.$slots, "default", {}, void 0, !0)])], 2));
369
369
  }
370
- }), [["__scopeId", "data-v-22d52899"]]), ge = { class: "cms-zone" }, _e = {
370
+ }), [["__scopeId", "data-v-22d52899"]]), $ = { class: "cms-zone" }, ye = {
371
371
  key: 1,
372
372
  class: "cms-zone__missing"
373
- }, ve = {
373
+ }, be = {
374
374
  key: 1,
375
375
  class: "cms-zone__missing"
376
- }, ye = /*#__PURE__*/ Q(/* @__PURE__ */ _({
376
+ }, xe = /*#__PURE__*/ Q(/* @__PURE__ */ y({
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
- C(M, {
393
+ T(P, {
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 = d(() => r.zone.blocks.filter(a));
405
+ let o = p(() => 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) => (S(), m("div", ge, [e.editing ? (S(!0), m(u, { key: 0 }, T(e.zone.blocks, (t, n) => (S(), f(he, {
422
+ return (t, n) => (w(), g("div", $, [e.editing ? (w(!0), g(f, { key: 0 }, D(e.zone.blocks, (t, n) => (w(), m(ve, {
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: A(() => [e.registry[t.type] ? (S(), f(D(e.registry[t.type]), b({
433
+ default: M(() => [e.registry[t.type] ? (w(), m(k(e.registry[t.type]), S({
434
434
  key: 0,
435
435
  block: t
436
- }, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (S(), m("div", _e, "Unknown block type: " + O(t.type), 1))]),
436
+ }, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (w(), g("div", ye, "Unknown block type: " + A(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)) : (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({
447
+ ]))), 128)) : (w(!0), g(f, { key: 1 }, D(o.value, (t, n) => (w(), g(f, { key: t.id }, [e.registry[t.type] ? (w(), m(k(e.registry[t.type]), S({
448
448
  key: 0,
449
449
  block: t
450
- }, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (S(), m("div", ve, "Unknown block type: " + O(t.type), 1))], 64))), 128))]));
450
+ }, { ref_for: !0 }, s(n)), null, 16, ["block"])) : (w(), g("div", be, "Unknown block type: " + A(t.type), 1))], 64))), 128))]));
451
451
  }
452
- }), [["__scopeId", "data-v-6a544d0b"]]), be = /* @__PURE__ */ _({
452
+ }), [["__scopeId", "data-v-6a544d0b"]]), Se = /* @__PURE__ */ y({
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 = y(M, {
464
+ let a = n, o = x(P, {
465
465
  messages: {},
466
466
  editing: !1,
467
467
  setText: () => {}
468
- }), s = z(), u = d(() => a.block?.fields);
469
- function m(e) {
468
+ }), s = B(), f = p(() => a.block?.fields);
469
+ function g(e) {
470
470
  return e === void 0 ? [] : typeof e == "string" ? [e] : e;
471
471
  }
472
- let h = d(() => {
472
+ let _ = p(() => {
473
473
  if (!a.block) return;
474
- let e = u.value;
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);
474
+ let e = f.value;
475
+ return g(a.field).find((t) => e && e[t] !== void 0 && e[t] !== null);
476
+ }), y = p(() => a.block?.id), b = p(() => a.value === void 0 ? c(f.value, g(a.field)) : a.value), S = p(() => d(b.value, o.messages)), C = p(() => r(S.value)), T = p(() => C.value ? "" : S.value), E = p(() => {
477
+ let n = e(u(l(t(S.value))), a.serializers);
478
478
  return a.transform && (n = a.transform(n)), n;
479
479
  });
480
- function T(e) {
480
+ function D(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: w,
491
- plain: C
492
- }), (e, t) => x.value ? (S(), f(D(n.as), {
490
+ html: E,
491
+ plain: T
492
+ }), (e, t) => C.value ? (w(), m(k(n.as), {
493
493
  key: 0,
494
494
  class: "cms-richtext-body",
495
- "data-cms-block": _.value,
496
- "data-cms-field": h.value,
495
+ "data-cms-block": y.value,
496
+ "data-cms-field": _.value,
497
497
  "data-cms-field-kind": "richtext",
498
- onClick: T,
499
- innerHTML: w.value
498
+ onClick: D,
499
+ innerHTML: E.value
500
500
  }, null, 8, [
501
501
  "data-cms-block",
502
502
  "data-cms-field",
503
503
  "innerHTML"
504
- ])) : C.value ? (S(), f(D(n.plainAs), {
504
+ ])) : T.value ? (w(), m(k(n.plainAs), {
505
505
  key: 1,
506
506
  class: "cms-richtext-body",
507
- "data-cms-block": _.value,
508
- "data-cms-field": h.value,
507
+ "data-cms-block": y.value,
508
+ "data-cms-field": _.value,
509
509
  "data-cms-field-kind": "richtext"
510
510
  }, {
511
- default: A(() => [g(O(C.value), 1)]),
511
+ default: M(() => [v(A(T.value), 1)]),
512
512
  _: 1
513
- }, 8, ["data-cms-block", "data-cms-field"])) : p("", !0);
513
+ }, 8, ["data-cms-block", "data-cms-field"])) : h("", !0);
514
514
  }
515
- }), xe = /*#__PURE__*/ Q(/* @__PURE__ */ _({
515
+ }), Ce = /*#__PURE__*/ Q(/* @__PURE__ */ y({
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 = y(M, {
526
+ let n = e, r = x(P, {
527
527
  messages: {},
528
528
  editing: !1,
529
529
  setText: () => {}
530
- }), o = z(), u = d(() => n.block?.fields);
531
- function p(e) {
530
+ }), o = B(), l = p(() => n.block?.fields);
531
+ function u(e) {
532
532
  return e === void 0 ? [] : typeof e == "string" ? [e] : e;
533
533
  }
534
- let m = d(() => {
534
+ let f = p(() => {
535
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);
536
+ let e = l.value;
537
+ return u(n.field).find((t) => e && e[t] !== void 0 && e[t] !== null);
538
+ }), h = p(() => n.block?.id), g = p(() => n.value === void 0 ? c(l.value, u(n.field)) : n.value), _ = p(() => s(g.value, n.fallback ?? "")), y = p(() => a(_.value)), b = p(() => i(_.value)), C = p(() => {
539
+ if (n.label !== void 0) return d(n.label, r.messages);
540
+ let e = c(l.value, u(n.labelField));
541
+ return e === void 0 ? "" : d(e, r.messages);
542
542
  });
543
- t({ link: v });
543
+ t({ link: _ });
544
544
  function T(e) {
545
- let t = v.value;
545
+ let t = _.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) => (S(), f(D(x.value), b(C.value, {
549
- class: ["cms-link", v.value.ok && v.value.href ? "" : "cms-link--inert"],
548
+ return (e, t) => (w(), m(k(y.value), S(b.value, {
549
+ class: ["cms-link", _.value.ok && _.value.href ? "" : "cms-link--inert"],
550
550
  "data-cms-block": h.value,
551
- "data-cms-field": m.value,
552
- "data-cms-link-status": v.value.status,
551
+ "data-cms-field": f.value,
552
+ "data-cms-link-status": _.value.status,
553
553
  onClick: T
554
554
  }), {
555
- default: A(() => [E(e.$slots, "default", { link: v.value }, () => [g(O(w.value), 1)], !0)]),
555
+ default: M(() => [O(e.$slots, "default", { link: _.value }, () => [v(A(C.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"]]), Se = [
564
+ }), [["__scopeId", "data-v-87a57473"]]), we = [
565
565
  "src",
566
566
  "alt",
567
567
  "width",
568
568
  "height",
569
569
  "data-cms-block",
570
570
  "data-cms-field"
571
- ], Ce = /* @__PURE__ */ _({
571
+ ], Te = /* @__PURE__ */ y({
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 = y(M, {
581
+ let n = e, r = x(P, {
582
582
  messages: {},
583
583
  editing: !1,
584
584
  setText: () => {}
585
- }), i = d(() => n.block?.fields);
585
+ }), i = p(() => n.block?.fields);
586
586
  function a(e) {
587
587
  return e === void 0 ? [] : typeof e == "string" ? [e] : e;
588
588
  }
589
- let s = d(() => {
589
+ let s = p(() => {
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 = d(() => n.block?.id), u = d(() => n.value === void 0 ? c(i.value, a(n.field)) : n.value), f = d(() => {
593
+ }), l = p(() => n.block?.id), u = p(() => n.value === void 0 ? c(i.value, a(n.field)) : n.value), d = p(() => {
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: f }), (e, t) => f.value.src ? (S(), m("img", {
600
+ return t({ image: d }), (e, t) => d.value.src ? (w(), g("img", {
601
601
  key: 0,
602
- src: f.value.src,
603
- alt: f.value.alt,
604
- width: f.value.width,
605
- height: f.value.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, Se)) : p("", !0);
608
+ }, null, 8, we)) : h("", !0);
609
609
  }
610
610
  });
611
611
  //#endregion
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 };
612
+ export { F as CMS_CLIENT, P as CMS_CONTEXT, ae as CMS_PARTIAL_STATE_KEY, Te as CmsImage, Ce as CmsLink, Se as CmsRichText, fe as CmsText, xe as CmsZone, z as createCms, ce as defineBlock, Z as getBlockComponentProps, se as hydrateCmsPartials, q as isPartialDocument, I as isServerRender, L as readPreviewFromLocation, ie as resetCmsPartials, oe as snapshotCmsPartials, B as useCms, V as useCmsOrThrow, re as useCmsPage, X as useCmsPartial, te as useField };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nubisco/cms-vue",
3
- "version": "1.4.1",
3
+ "version": "1.6.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": "^1.0.0"
72
- }
73
+ "@nubisco/cms-core": "^1.3.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
  }