@opengis/cms 0.0.55 → 0.0.56

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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  This package standardizes static website content management process. Built using the **Fastify** and **Vite** frameworks for reactive, component-driven development.
10
10
 
11
- ### Features
11
+ ## Features
12
12
 
13
13
  - **Real-time Editing** - Update content without stopping or reloading the website.
14
14
  - **Page Templates** - Use pre-created templates to quickly start your website.
@@ -16,43 +16,76 @@ This package standardizes static website content management process. Built using
16
16
  - **Multi-user mode** - Work together with a team on content in real time.
17
17
  - **User Settings** - Includes functionality for managing user settings, creating user groups, and defining roles with interface permissions.
18
18
 
19
- ---
20
-
21
- ### Install
19
+ ## Install
22
20
 
23
21
  ```bash
24
22
  npm i @opengis/cms
25
23
  ```
26
24
 
27
- ### Configuration
25
+ ## Usage Astro
28
26
 
29
- Configure **pg**, **redis** and **s3** connections in `.env` file
27
+ ```js
28
+ ---
29
+ import Layout from "@/layouts/Layout.astro";
30
30
 
31
- ```bash
32
- node --env-file=.env.ip server
33
- bun --env-file=.env.ip server
34
- pm2 start server --name api -- --env-file=.env.ip
35
- pm2
31
+ // get posts
32
+ import { getContents } from "@/utils/cms";
33
+ const postsData = await getContents({ collection: "posts"});
34
+ const { lang } = Astro.params;
35
+ ---
36
+
37
+ <Layout
38
+ title={lang === "uk" ? "Про нас" : "About us"}
39
+ >
40
+ { postsData }
41
+ </Layout>
36
42
  ```
37
43
 
38
- ### Usage
44
+ ## Usage CMS
39
45
 
40
46
  ```js
41
- import { getContents } from "@/utils/cms";
47
+ // main.ts
48
+ app.config.globalProperties.$settings = {
49
+ cms: {
50
+ locale: 'uk', // мова сайту по замовчуванню
51
+ locales: ['uk', 'en'], // доступні варіанти перекладу
52
+ previewUrl: 'http://site.ua' // адреса перегляду контенту з редактора
53
+ }
54
+ };
55
+ ```
42
56
 
43
- // Get posts from API
44
- let postsData = await getContents("posts");
57
+ ```js
58
+ // router.config
59
+ export default [
60
+ {
61
+ path: '/cms.dashboard',
62
+ component: () => import('@opengis/cms').then(el => el.Dashboard),
63
+ },
64
+ {
65
+ path: '/cms.content/:type?/:id?',
66
+ component: () => import('@opengis/cms').then(el => el.Contnet),
67
+ },
68
+ {
69
+ path: '/cms.menu/:id?',
70
+ component: () => import('@opengis/cms').then(el => el.Menu),
71
+ },
72
+ ]
45
73
  ```
74
+ ## Start
46
75
 
47
- ---
76
+ Configure **pg**, **redis** and **s3** connections in `.env` file
48
77
 
49
- ### Documentation
78
+ ```bash
79
+ node --env-file=.env.ip server
80
+ bun --env-file=.env.ip server
81
+ pm2 start server --name api -- --env-file=.env.ip
82
+ ```
50
83
 
51
- For a detailed understanding of `cms`, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/cms/).
84
+ ## Documentation
52
85
 
53
- ---
86
+ For a detailed understanding of `cms`, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/cms/).
54
87
 
55
- ### Technology stack
88
+ ## Technology stack
56
89
 
57
90
  <a href="https://fastify.dev/" target="_blank">
58
91
  <img src="https://img.shields.io/badge/Fastify-323330?style=for-the-badge&logo=fastify" /></a>
@@ -72,9 +105,9 @@ For a detailed understanding of `cms`, its features, and how to use them, refer
72
105
  <a href="https://nodejs.org/" target="_blank">
73
106
  <img src="https://img.shields.io/badge/Node.js-323330?style=for-the-badge&logo=node.js&logoColor=white" /></a>
74
107
 
75
- ---
76
108
 
77
- ### Contribute
109
+
110
+ ## Contribute
78
111
 
79
112
  Feel free to contact us through our website [SOFTPRO.UA](https://softpro.ua) or email <info@softpro.ua>
80
113
 
@@ -82,7 +115,7 @@ Feel free to contact us through our website [SOFTPRO.UA](https://softpro.ua) or
82
115
  - Share your ideas
83
116
  - Ask questions
84
117
 
85
- ### Follow Us
118
+ ## Follow Us
86
119
 
87
120
  [Official site](https://softpro.ua)
88
121
 
@@ -93,6 +126,6 @@ Feel free to contact us through our website [SOFTPRO.UA](https://softpro.ua) or
93
126
  <a href="https://www.linkedin.com/in/softpro-ukraine-a8876b282/recent-activity/all/" target="_blank"><img src="https://cdn.softpro.ua/data/npm/social/linkedin.png" alt="Softpro Linkedin" title="Softpro LinkedIn"></a>&nbsp;&nbsp;
94
127
  </p>
95
128
 
96
- ### License
129
+ ## License
97
130
 
98
131
  Copyright © SOFTPRO. All rights reserved.
@@ -1,10 +1,10 @@
1
- import { openBlock as w, createElementBlock as F, createStaticVNode as Re, defineComponent as D, ref as k, normalizeClass as B, createTextVNode as Z, toDisplayString as _, createCommentVNode as $, createBlock as O, unref as y, withModifiers as Y, createVNode as A, createElementVNode as v, withDirectives as Le, withKeys as re, vModelText as Me, watch as Ue, resolveComponent as De, withCtx as j, nextTick as te, mergeModels as Ye, useModel as de, onBeforeMount as Be, Fragment as $e, computed as Pe, onMounted as Ve } from "vue";
1
+ import { openBlock as w, createElementBlock as F, createStaticVNode as Re, defineComponent as D, ref as k, normalizeClass as B, createTextVNode as X, toDisplayString as _, createCommentVNode as $, createBlock as O, unref as y, withModifiers as Y, createVNode as A, createElementVNode as v, withDirectives as Le, withKeys as te, vModelText as Me, watch as Ue, resolveComponent as De, withCtx as j, nextTick as ne, mergeModels as Ye, useModel as pe, onBeforeMount as Be, Fragment as $e, computed as Pe, onMounted as Ve } from "vue";
2
2
  import { d as He } from "./vuedraggable-CoAPPFYd.js";
3
3
  import { _ as qe } from "./_plugin-vue_export-helper-CHgC5LLL.js";
4
4
  import { Pencil as je, Trash2 as Ke, Check as Ge, X as Qe, Plus as We, ArrowLeft as ze, HelpCircle as Ze, Save as Xe } from "lucide-vue-next";
5
5
  import { confirm as Je, VsModal as er, notify as I } from "@opengis/core";
6
6
  import { useI18n as H } from "vue-i18n";
7
- import rr, { inputs as pe, VForm as ve } from "@opengis/form";
7
+ import rr, { inputs as K, VForm as ve } from "@opengis/form";
8
8
  import { _ as he } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-B1DrxmQX.js";
9
9
  import { useRouter as tr, useRoute as nr } from "vue-router";
10
10
  const ir = {}, lr = {
@@ -55,8 +55,8 @@ const ur = /* @__PURE__ */ qe(ir, [["render", ar]]), or = {
55
55
  Le(v("input", {
56
56
  "onUpdate:modelValue": m[1] || (m[1] = (p) => a.value = p),
57
57
  onKeyup: [
58
- re(u, ["enter"]),
59
- re(o, ["esc"])
58
+ te(u, ["enter"]),
59
+ te(o, ["esc"])
60
60
  ],
61
61
  onBlur: u,
62
62
  class: "flex-1 px-2 py-1 text-sm border border-gray-300 rounded dark:bg-neutral-800 dark:border-neutral-600 dark:text-neutral-200 focus:outline-none focus:ring-2 focus:ring-blue-500",
@@ -80,7 +80,7 @@ const ur = /* @__PURE__ */ qe(ir, [["render", ar]]), or = {
80
80
  A(y(Qe), { class: "size-4" })
81
81
  ])
82
82
  ])) : (w(), F("div", or, [
83
- Z(_(e.title) + " ", 1),
83
+ X(_(e.title) + " ", 1),
84
84
  typeof e.value == "string" ? (w(), F("span", sr, _(e.value), 1)) : $("", !0),
85
85
  typeof e.value == "string" ? (w(), O(y(je), {
86
86
  key: 1,
@@ -129,11 +129,11 @@ const ur = /* @__PURE__ */ qe(ir, [["render", ar]]), or = {
129
129
  }
130
130
  });
131
131
  }, o = (m, p) => {
132
- m.value = p, te(() => {
132
+ m.value = p, ne(() => {
133
133
  a.value = [...a.value], n("update:list", a.value);
134
134
  });
135
135
  }, s = (m, p) => {
136
- m.children = p, te(() => {
136
+ m.children = p, ne(() => {
137
137
  a.value = [...a.value], n("update:list", a.value);
138
138
  });
139
139
  };
@@ -177,7 +177,7 @@ const ur = /* @__PURE__ */ qe(ir, [["render", ar]]), or = {
177
177
  },
178
178
  emits: /* @__PURE__ */ Ye(["addNewItem"], ["update:isOpen"]),
179
179
  setup(e, { emit: r }) {
180
- const { t } = H(), i = de(e, "isOpen"), n = k({}), a = r, l = k({}), u = {
180
+ const { t } = H(), i = pe(e, "isOpen"), n = k({}), a = r, l = k({}), u = {
181
181
  title: {
182
182
  type: "text",
183
183
  label: t("cms.menu.form.name"),
@@ -245,8 +245,8 @@ const ur = /* @__PURE__ */ qe(ir, [["render", ar]]), or = {
245
245
  },
246
246
  emits: ["update:modelValue"],
247
247
  setup(e) {
248
- pe["vs-input-monaco-editor"] = he;
249
- const { t: r } = H(), t = k(!1), i = k(null), n = de(e, "modelValue"), a = k({}), l = async (c) => {
248
+ K["vs-input-monaco-editor"] = he;
249
+ const { t: r } = H(), t = k(!1), i = k(null), n = pe(e, "modelValue"), a = k({}), l = async (c) => {
250
250
  try {
251
251
  if (await a.value.validate()) {
252
252
  I({
@@ -333,7 +333,7 @@ const ur = /* @__PURE__ */ qe(ir, [["render", ar]]), or = {
333
333
  class: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium w-min ml-auto my-6 h-9 px-4 py-2 bg-blue-600 text-white shadow-md transition-all duration-200 transform hover:bg-blue-700 hover:shadow-lg hover:scale-105 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
334
334
  }, [
335
335
  A(y(We), { class: "w-4 h-4 mr-2" }),
336
- Z(" " + _(c.$t("cms.menu.createMenu")), 1)
336
+ X(" " + _(c.$t("cms.menu.createMenu")), 1)
337
337
  ]),
338
338
  A(hr, {
339
339
  isOpen: t.value,
@@ -435,7 +435,7 @@ function Ir(e, r) {
435
435
  throw new b('Unknown kind "' + this.kind + '" is specified for "' + e + '" YAML type.');
436
436
  }
437
437
  var x = Ir;
438
- function ne(e, r) {
438
+ function ie(e, r) {
439
439
  var t = [];
440
440
  return e[r].forEach(function(i) {
441
441
  var n = t.length;
@@ -464,10 +464,10 @@ function Rr() {
464
464
  arguments[r].forEach(i);
465
465
  return e;
466
466
  }
467
- function K(e) {
467
+ function G(e) {
468
468
  return this.extend(e);
469
469
  }
470
- K.prototype.extend = function(r) {
470
+ G.prototype.extend = function(r) {
471
471
  var t = [], i = [];
472
472
  if (r instanceof x)
473
473
  i.push(r);
@@ -488,10 +488,10 @@ K.prototype.extend = function(r) {
488
488
  if (!(a instanceof x))
489
489
  throw new b("Specified list of YAML types (or a single Type object) contains a non-Type object.");
490
490
  });
491
- var n = Object.create(K.prototype);
492
- return n.implicit = (this.implicit || []).concat(t), n.explicit = (this.explicit || []).concat(i), n.compiledImplicit = ne(n, "implicit"), n.compiledExplicit = ne(n, "explicit"), n.compiledTypeMap = Rr(n.compiledImplicit, n.compiledExplicit), n;
491
+ var n = Object.create(G.prototype);
492
+ return n.implicit = (this.implicit || []).concat(t), n.explicit = (this.explicit || []).concat(i), n.compiledImplicit = ie(n, "implicit"), n.compiledExplicit = ie(n, "explicit"), n.compiledTypeMap = Rr(n.compiledImplicit, n.compiledExplicit), n;
493
493
  };
494
- var Lr = K, Mr = new x("tag:yaml.org,2002:str", {
494
+ var Lr = G, Mr = new x("tag:yaml.org,2002:str", {
495
495
  kind: "scalar",
496
496
  construct: function(e) {
497
497
  return e !== null ? e : "";
@@ -780,12 +780,12 @@ function dt(e) {
780
780
  var pt = new x("tag:yaml.org,2002:merge", {
781
781
  kind: "scalar",
782
782
  resolve: dt
783
- }), X = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
783
+ }), J = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
784
784
  \r`;
785
785
  function vt(e) {
786
786
  if (e === null)
787
787
  return !1;
788
- var r, t, i = 0, n = e.length, a = X;
788
+ var r, t, i = 0, n = e.length, a = J;
789
789
  for (t = 0; t < n; t++)
790
790
  if (r = a.indexOf(e.charAt(t)), !(r > 64)) {
791
791
  if (r < 0)
@@ -795,13 +795,13 @@ function vt(e) {
795
795
  return i % 8 === 0;
796
796
  }
797
797
  function ht(e) {
798
- var r, t, i = e.replace(/[\r\n=]/g, ""), n = i.length, a = X, l = 0, u = [];
798
+ var r, t, i = e.replace(/[\r\n=]/g, ""), n = i.length, a = J, l = 0, u = [];
799
799
  for (r = 0; r < n; r++)
800
800
  r % 4 === 0 && r && (u.push(l >> 16 & 255), u.push(l >> 8 & 255), u.push(l & 255)), l = l << 6 | a.indexOf(i.charAt(r));
801
801
  return t = n % 4 * 6, t === 0 ? (u.push(l >> 16 & 255), u.push(l >> 8 & 255), u.push(l & 255)) : t === 18 ? (u.push(l >> 10 & 255), u.push(l >> 2 & 255)) : t === 12 && u.push(l >> 4 & 255), new Uint8Array(u);
802
802
  }
803
803
  function xt(e) {
804
- var r = "", t = 0, i, n, a = e.length, l = X;
804
+ var r = "", t = 0, i, n, a = e.length, l = J;
805
805
  for (i = 0; i < a; i++)
806
806
  i % 3 === 0 && i && (r += l[t >> 18 & 63], r += l[t >> 12 & 63], r += l[t >> 6 & 63], r += l[t & 63]), t = (t << 8) + e[i];
807
807
  return n = a % 3, n === 0 ? (r += l[t >> 18 & 63], r += l[t >> 12 & 63], r += l[t >> 6 & 63], r += l[t & 63]) : n === 2 ? (r += l[t >> 10 & 63], r += l[t >> 4 & 63], r += l[t << 2 & 63], r += l[64]) : n === 1 && (r += l[t >> 2 & 63], r += l[t << 4 & 63], r += l[64], r += l[64]), r;
@@ -898,14 +898,14 @@ var It = new x("tag:yaml.org,2002:set", {
898
898
  It
899
899
  ]
900
900
  });
901
- function ie(e) {
901
+ function le(e) {
902
902
  return e === 48 ? "\0" : e === 97 ? "\x07" : e === 98 ? "\b" : e === 116 || e === 9 ? " " : e === 110 ? `
903
903
  ` : e === 118 ? "\v" : e === 102 ? "\f" : e === 114 ? "\r" : e === 101 ? "\x1B" : e === 32 ? " " : e === 34 ? '"' : e === 47 ? "/" : e === 92 ? "\\" : e === 78 ? "…" : e === 95 ? " " : e === 76 ? "\u2028" : e === 80 ? "\u2029" : "";
904
904
  }
905
905
  var Lt = new Array(256), Mt = new Array(256);
906
906
  for (var S = 0; S < 256; S++)
907
- Lt[S] = ie(S) ? 1 : 0, Mt[S] = ie(S);
908
- var ke = Object.prototype.toString, Ae = Object.prototype.hasOwnProperty, J = 65279, Ut = 9, L = 10, Dt = 13, Yt = 32, Bt = 33, $t = 34, G = 35, Pt = 37, Vt = 38, Ht = 39, qt = 42, be = 44, jt = 45, P = 58, Kt = 61, Gt = 62, Qt = 63, Wt = 64, _e = 91, Ee = 93, zt = 96, Fe = 123, Zt = 124, Ce = 125, g = {};
907
+ Lt[S] = le(S) ? 1 : 0, Mt[S] = le(S);
908
+ var ke = Object.prototype.toString, Ae = Object.prototype.hasOwnProperty, ee = 65279, Ut = 9, L = 10, Dt = 13, Yt = 32, Bt = 33, $t = 34, Q = 35, Pt = 37, Vt = 38, Ht = 39, qt = 42, be = 44, jt = 45, P = 58, Kt = 61, Gt = 62, Qt = 63, Wt = 64, _e = 91, Ee = 93, zt = 96, Fe = 123, Zt = 124, Ce = 125, g = {};
909
909
  g[0] = "\\0";
910
910
  g[7] = "\\a";
911
911
  g[8] = "\\b";
@@ -963,14 +963,14 @@ var tn = 1, M = 2;
963
963
  function nn(e) {
964
964
  this.schema = e.schema || Rt, this.indent = Math.max(1, e.indent || 2), this.noArrayIndent = e.noArrayIndent || !1, this.skipInvalid = e.skipInvalid || !1, this.flowLevel = C.isNothing(e.flowLevel) ? -1 : e.flowLevel, this.styleMap = en(this.schema, e.styles || null), this.sortKeys = e.sortKeys || !1, this.lineWidth = e.lineWidth || 80, this.noRefs = e.noRefs || !1, this.noCompatMode = e.noCompatMode || !1, this.condenseFlow = e.condenseFlow || !1, this.quotingType = e.quotingType === '"' ? M : tn, this.forceQuotes = e.forceQuotes || !1, this.replacer = typeof e.replacer == "function" ? e.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
965
965
  }
966
- function le(e, r) {
966
+ function ae(e, r) {
967
967
  for (var t = C.repeat(" ", r), i = 0, n = -1, a = "", l, u = e.length; i < u; )
968
968
  n = e.indexOf(`
969
969
  `, i), n === -1 ? (l = e.slice(i), i = u) : (l = e.slice(i, n + 1), i = n + 1), l.length && l !== `
970
970
  ` && (a += t), a += l;
971
971
  return a;
972
972
  }
973
- function Q(e, r) {
973
+ function W(e, r) {
974
974
  return `
975
975
  ` + C.repeat(" ", e.indent * r);
976
976
  }
@@ -985,23 +985,23 @@ function V(e) {
985
985
  return e === Yt || e === Ut;
986
986
  }
987
987
  function U(e) {
988
- return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== J || 65536 <= e && e <= 1114111;
988
+ return 32 <= e && e <= 126 || 161 <= e && e <= 55295 && e !== 8232 && e !== 8233 || 57344 <= e && e <= 65533 && e !== ee || 65536 <= e && e <= 1114111;
989
989
  }
990
- function ae(e) {
991
- return U(e) && e !== J && e !== Dt && e !== L;
990
+ function ue(e) {
991
+ return U(e) && e !== ee && e !== Dt && e !== L;
992
992
  }
993
- function ue(e, r, t) {
994
- var i = ae(e), n = i && !V(e);
993
+ function oe(e, r, t) {
994
+ var i = ue(e), n = i && !V(e);
995
995
  return (
996
996
  // ns-plain-safe
997
997
  (t ? (
998
998
  // c = flow-in
999
999
  i
1000
- ) : i && e !== be && e !== _e && e !== Ee && e !== Fe && e !== Ce) && e !== G && !(r === P && !n) || ae(r) && !V(r) && e === G || r === P && n
1000
+ ) : i && e !== be && e !== _e && e !== Ee && e !== Fe && e !== Ce) && e !== Q && !(r === P && !n) || ue(r) && !V(r) && e === Q || r === P && n
1001
1001
  );
1002
1002
  }
1003
1003
  function an(e) {
1004
- return U(e) && e !== J && !V(e) && e !== jt && e !== Qt && e !== P && e !== be && e !== _e && e !== Ee && e !== Fe && e !== Ce && e !== G && e !== Vt && e !== qt && e !== Bt && e !== Zt && e !== Kt && e !== Gt && e !== Ht && e !== $t && e !== Pt && e !== Wt && e !== zt;
1004
+ return U(e) && e !== ee && !V(e) && e !== jt && e !== Qt && e !== P && e !== be && e !== _e && e !== Ee && e !== Fe && e !== Ce && e !== Q && e !== Vt && e !== qt && e !== Bt && e !== Zt && e !== Kt && e !== Gt && e !== Ht && e !== $t && e !== Pt && e !== Wt && e !== zt;
1005
1005
  }
1006
1006
  function un(e) {
1007
1007
  return !V(e) && e !== P;
@@ -1014,14 +1014,14 @@ function Se(e) {
1014
1014
  var r = /^\n* /;
1015
1015
  return r.test(e);
1016
1016
  }
1017
- var Ne = 1, W = 2, Oe = 3, Te = 4, N = 5;
1017
+ var Ne = 1, z = 2, Oe = 3, Te = 4, N = 5;
1018
1018
  function on(e, r, t, i, n, a, l, u) {
1019
1019
  var o, s = 0, m = null, p = !1, c = !1, d = i !== -1, f = -1, h = an(T(e, 0)) && un(T(e, e.length - 1));
1020
1020
  if (r || l)
1021
1021
  for (o = 0; o < e.length; s >= 65536 ? o += 2 : o++) {
1022
1022
  if (s = T(e, o), !U(s))
1023
1023
  return N;
1024
- h = h && ue(s, m, u), m = s;
1024
+ h = h && oe(s, m, u), m = s;
1025
1025
  }
1026
1026
  else {
1027
1027
  for (o = 0; o < e.length; s >= 65536 ? o += 2 : o++) {
@@ -1030,11 +1030,11 @@ function on(e, r, t, i, n, a, l, u) {
1030
1030
  o - f - 1 > i && e[f + 1] !== " ", f = o);
1031
1031
  else if (!U(s))
1032
1032
  return N;
1033
- h = h && ue(s, m, u), m = s;
1033
+ h = h && oe(s, m, u), m = s;
1034
1034
  }
1035
1035
  c = c || d && o - f - 1 > i && e[f + 1] !== " ";
1036
1036
  }
1037
- return !p && !c ? h && !l && !n(e) ? Ne : a === M ? N : W : t > 9 && Se(e) ? N : l ? a === M ? N : W : c ? Te : Oe;
1037
+ return !p && !c ? h && !l && !n(e) ? Ne : a === M ? N : z : t > 9 && Se(e) ? N : l ? a === M ? N : z : c ? Te : Oe;
1038
1038
  }
1039
1039
  function sn(e, r, t, i, n) {
1040
1040
  e.dump = function() {
@@ -1058,12 +1058,12 @@ function sn(e, r, t, i, n) {
1058
1058
  )) {
1059
1059
  case Ne:
1060
1060
  return r;
1061
- case W:
1061
+ case z:
1062
1062
  return "'" + r.replace(/'/g, "''") + "'";
1063
1063
  case Oe:
1064
- return "|" + oe(r, e.indent) + se(le(r, a));
1064
+ return "|" + se(r, e.indent) + ce(ae(r, a));
1065
1065
  case Te:
1066
- return ">" + oe(r, e.indent) + se(le(cn(r, l), a));
1066
+ return ">" + se(r, e.indent) + ce(ae(cn(r, l), a));
1067
1067
  case N:
1068
1068
  return '"' + fn(r) + '"';
1069
1069
  default:
@@ -1071,7 +1071,7 @@ function sn(e, r, t, i, n) {
1071
1071
  }
1072
1072
  }();
1073
1073
  }
1074
- function oe(e, r) {
1074
+ function se(e, r) {
1075
1075
  var t = Se(e) ? String(r) : "", i = e[e.length - 1] === `
1076
1076
  `, n = i && (e[e.length - 2] === `
1077
1077
  ` || e === `
@@ -1079,7 +1079,7 @@ function oe(e, r) {
1079
1079
  return t + a + `
1080
1080
  `;
1081
1081
  }
1082
- function se(e) {
1082
+ function ce(e) {
1083
1083
  return e[e.length - 1] === `
1084
1084
  ` ? e.slice(0, -1) : e;
1085
1085
  }
@@ -1087,16 +1087,16 @@ function cn(e, r) {
1087
1087
  for (var t = /(\n+)([^\n]*)/g, i = function() {
1088
1088
  var s = e.indexOf(`
1089
1089
  `);
1090
- return s = s !== -1 ? s : e.length, t.lastIndex = s, ce(e.slice(0, s), r);
1090
+ return s = s !== -1 ? s : e.length, t.lastIndex = s, fe(e.slice(0, s), r);
1091
1091
  }(), n = e[0] === `
1092
1092
  ` || e[0] === " ", a, l; l = t.exec(e); ) {
1093
1093
  var u = l[1], o = l[2];
1094
1094
  a = o[0] === " ", i += u + (!n && !a && o !== "" ? `
1095
- ` : "") + ce(o, r), n = a;
1095
+ ` : "") + fe(o, r), n = a;
1096
1096
  }
1097
1097
  return i;
1098
1098
  }
1099
- function ce(e, r) {
1099
+ function fe(e, r) {
1100
1100
  if (e === "" || e[0] === " ")
1101
1101
  return e;
1102
1102
  for (var t = / [^ ]/g, i, n = 0, a, l = 0, u = 0, o = ""; i = t.exec(e); )
@@ -1117,10 +1117,10 @@ function mn(e, r, t) {
1117
1117
  u = t[a], e.replacer && (u = e.replacer.call(t, String(a), u)), (E(e, r, u, !1, !1) || typeof u > "u" && E(e, r, null, !1, !1)) && (i !== "" && (i += "," + (e.condenseFlow ? "" : " ")), i += e.dump);
1118
1118
  e.tag = n, e.dump = "[" + i + "]";
1119
1119
  }
1120
- function fe(e, r, t, i) {
1120
+ function me(e, r, t, i) {
1121
1121
  var n = "", a = e.tag, l, u, o;
1122
1122
  for (l = 0, u = t.length; l < u; l += 1)
1123
- o = t[l], e.replacer && (o = e.replacer.call(t, String(l), o)), (E(e, r + 1, o, !0, !0, !1, !0) || typeof o > "u" && E(e, r + 1, null, !0, !0, !1, !0)) && ((!i || n !== "") && (n += Q(e, r)), e.dump && L === e.dump.charCodeAt(0) ? n += "-" : n += "- ", n += e.dump);
1123
+ o = t[l], e.replacer && (o = e.replacer.call(t, String(l), o)), (E(e, r + 1, o, !0, !0, !1, !0) || typeof o > "u" && E(e, r + 1, null, !0, !0, !1, !0)) && ((!i || n !== "") && (n += W(e, r)), e.dump && L === e.dump.charCodeAt(0) ? n += "-" : n += "- ", n += e.dump);
1124
1124
  e.tag = a, e.dump = n || "[]";
1125
1125
  }
1126
1126
  function dn(e, r, t) {
@@ -1138,10 +1138,10 @@ function pn(e, r, t, i) {
1138
1138
  else if (e.sortKeys)
1139
1139
  throw new b("sortKeys must be a boolean or a function");
1140
1140
  for (u = 0, o = l.length; u < o; u += 1)
1141
- c = "", (!i || n !== "") && (c += Q(e, r)), s = l[u], m = t[s], e.replacer && (m = e.replacer.call(t, s, m)), E(e, r + 1, s, !0, !0, !0) && (p = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, p && (e.dump && L === e.dump.charCodeAt(0) ? c += "?" : c += "? "), c += e.dump, p && (c += Q(e, r)), E(e, r + 1, m, !0, p) && (e.dump && L === e.dump.charCodeAt(0) ? c += ":" : c += ": ", c += e.dump, n += c));
1141
+ c = "", (!i || n !== "") && (c += W(e, r)), s = l[u], m = t[s], e.replacer && (m = e.replacer.call(t, s, m)), E(e, r + 1, s, !0, !0, !0) && (p = e.tag !== null && e.tag !== "?" || e.dump && e.dump.length > 1024, p && (e.dump && L === e.dump.charCodeAt(0) ? c += "?" : c += "? "), c += e.dump, p && (c += W(e, r)), E(e, r + 1, m, !0, p) && (e.dump && L === e.dump.charCodeAt(0) ? c += ":" : c += ": ", c += e.dump, n += c));
1142
1142
  e.tag = a, e.dump = n || "{}";
1143
1143
  }
1144
- function me(e, r, t) {
1144
+ function de(e, r, t) {
1145
1145
  var i, n, a, l, u, o;
1146
1146
  for (n = t ? e.explicitTypes : e.implicitTypes, a = 0, l = n.length; a < l; a += 1)
1147
1147
  if (u = n[a], (u.instanceOf || u.predicate) && (!u.instanceOf || typeof r == "object" && r instanceof u.instanceOf) && (!u.predicate || u.predicate(r))) {
@@ -1159,7 +1159,7 @@ function me(e, r, t) {
1159
1159
  return !1;
1160
1160
  }
1161
1161
  function E(e, r, t, i, n, a, l) {
1162
- e.tag = null, e.dump = t, me(e, t, !1) || me(e, t, !0);
1162
+ e.tag = null, e.dump = t, de(e, t, !1) || de(e, t, !0);
1163
1163
  var u = ke.call(e.dump), o = i, s;
1164
1164
  i && (i = e.flowLevel < 0 || e.flowLevel > r);
1165
1165
  var m = u === "[object Object]" || u === "[object Array]", p, c;
@@ -1169,7 +1169,7 @@ function E(e, r, t, i, n, a, l) {
1169
1169
  if (m && c && !e.usedDuplicates[p] && (e.usedDuplicates[p] = !0), u === "[object Object]")
1170
1170
  i && Object.keys(e.dump).length !== 0 ? (pn(e, r, e.dump, n), c && (e.dump = "&ref_" + p + e.dump)) : (dn(e, r, e.dump), c && (e.dump = "&ref_" + p + " " + e.dump));
1171
1171
  else if (u === "[object Array]")
1172
- i && e.dump.length !== 0 ? (e.noArrayIndent && !l && r > 0 ? fe(e, r - 1, e.dump, n) : fe(e, r, e.dump, n), c && (e.dump = "&ref_" + p + e.dump)) : (mn(e, r, e.dump), c && (e.dump = "&ref_" + p + " " + e.dump));
1172
+ i && e.dump.length !== 0 ? (e.noArrayIndent && !l && r > 0 ? me(e, r - 1, e.dump, n) : me(e, r, e.dump, n), c && (e.dump = "&ref_" + p + e.dump)) : (mn(e, r, e.dump), c && (e.dump = "&ref_" + p + " " + e.dump));
1173
1173
  else if (u === "[object String]")
1174
1174
  e.tag !== "?" && sn(e, e.dump, r, a, o);
1175
1175
  else {
@@ -1187,21 +1187,21 @@ function E(e, r, t, i, n, a, l) {
1187
1187
  }
1188
1188
  function vn(e, r) {
1189
1189
  var t = [], i = [], n, a;
1190
- for (z(e, t, i), n = 0, a = i.length; n < a; n += 1)
1190
+ for (Z(e, t, i), n = 0, a = i.length; n < a; n += 1)
1191
1191
  r.duplicates.push(t[i[n]]);
1192
1192
  r.usedDuplicates = new Array(a);
1193
1193
  }
1194
- function z(e, r, t) {
1194
+ function Z(e, r, t) {
1195
1195
  var i, n, a;
1196
1196
  if (e !== null && typeof e == "object")
1197
1197
  if (n = r.indexOf(e), n !== -1)
1198
1198
  t.indexOf(n) === -1 && t.push(n);
1199
1199
  else if (r.push(e), Array.isArray(e))
1200
1200
  for (n = 0, a = e.length; n < a; n += 1)
1201
- z(e[n], r, t);
1201
+ Z(e[n], r, t);
1202
1202
  else
1203
1203
  for (i = Object.keys(e), n = 0, a = i.length; n < a; n += 1)
1204
- z(e[i[n]], r, t);
1204
+ Z(e[i[n]], r, t);
1205
1205
  }
1206
1206
  function hn(e, r) {
1207
1207
  r = r || {};
@@ -1220,7 +1220,7 @@ const wn = { class: "space-y-6 max-w-7xl mx-auto" }, kn = { class: "flex items-c
1220
1220
  }, Sn = { class: "flex ml-2 mb-6 w-min border border-gray-200 dark:border-gray-700 rounded-full overflow-hidden" }, Yn = /* @__PURE__ */ D({
1221
1221
  __name: "MenuItemPage",
1222
1222
  setup(e) {
1223
- pe["vs-input-monaco-editor"] = he;
1223
+ K["vs-input-monaco-editor"] = he, console.log("[MenuItemPage] vs-input-monaco-editor registered:", !!K["vs-input-monaco-editor"]);
1224
1224
  const { t: r, locale: t } = H(), i = tr(), n = nr(), a = Pe(() => [
1225
1225
  {
1226
1226
  key: "name",
@@ -1261,11 +1261,12 @@ const wn = { class: "space-y-6 max-w-7xl mx-auto" }, kn = { class: "flex items-c
1261
1261
  ]), l = k(null), u = k({}), o = k(!1), s = k(!1), m = (d) => {
1262
1262
  const f = {};
1263
1263
  for (const h of d) {
1264
- const { title: ee, value: Ie, children: q } = h;
1265
- q && q.length > 0 ? f[ee] = m(q) : f[ee] = Ie;
1264
+ const { title: re, value: Ie, children: q } = h;
1265
+ q && q.length > 0 ? f[re] = m(q) : f[re] = Ie;
1266
1266
  }
1267
1267
  return f;
1268
1268
  }, p = async () => {
1269
+ l.value;
1269
1270
  let d = { ...l.value || {} };
1270
1271
  if (await u.value.validate()) {
1271
1272
  I({
@@ -1275,7 +1276,7 @@ const wn = { class: "space-y-6 max-w-7xl mx-auto" }, kn = { class: "flex items-c
1275
1276
  });
1276
1277
  return;
1277
1278
  }
1278
- Array.isArray(d.items) && (d.items = m(d.items), d.content = yn(d.items));
1279
+ s.value && Array.isArray(d.items) && (d.items = m(d.items), d.content = yn(d.items));
1279
1280
  try {
1280
1281
  await fetch(`/api/cms-menu/${n.params.id}`, {
1281
1282
  method: "PUT",
@@ -1329,7 +1330,7 @@ const wn = { class: "space-y-6 max-w-7xl mx-auto" }, kn = { class: "flex items-c
1329
1330
  class: "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium h-9 px-4 py-2 bg-blue-600 text-white shadow-md transition-all duration-200 transform hover:bg-blue-700 hover:shadow-lg hover:scale-105 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"
1330
1331
  }, [
1331
1332
  A(y(Xe), { class: "w-4 h-4 mr-2" }),
1332
- Z(" " + _(d.$t("cms.common.actions.save")), 1)
1333
+ X(" " + _(d.$t("cms.common.actions.save")), 1)
1333
1334
  ])
1334
1335
  ])
1335
1336
  ]),
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ const B = "menu", D = (u, i) => {
6
6
  }, C = o(() => import("./CollectionsPage-JfmrHNR_.js")), K = o(() => import("./ArticlesPage-BcR1hbds.js")), y = o(() => import("./contentForm-B6gHgGkz.js")), O = o(() => import("./EditCollectionPage-Cw3GQYRe.js")), L = o(
7
7
  () => import("./MenuPage-tJZtK46W.js")
8
8
  ), W = o(
9
- () => import("./MenuItemPage-BSwUW8tv.js")
9
+ () => import("./MenuItemPage-CXn5HC8j.js")
10
10
  ), N = o(
11
11
  () => import("./MenuAddPage-Bf48Z-ah.js")
12
12
  ), j = {
@@ -90,7 +90,7 @@ const B = "menu", D = (u, i) => {
90
90
  });
91
91
  return w(I, M), (e, t) => f.value ? (v(), b(h(f.value), { key: A.value })) : (v(), k("div", T, x(e.$t("cms.navigation.collections")), 1));
92
92
  }
93
- }), z = o(() => import("./CollectionsPage-JfmrHNR_.js")), G = o(() => import("./ArticlesPage-BcR1hbds.js")), H = o(() => import("./BuilderPage-CK_osM89.js")), J = o(() => import("./EditCollectionPage-Cw3GQYRe.js")), Q = o(() => import("./MenuPage-tJZtK46W.js")), X = o(() => import("./MenuAddPage-Bf48Z-ah.js")), Y = o(() => import("./MenuItemPage-BSwUW8tv.js"));
93
+ }), z = o(() => import("./CollectionsPage-JfmrHNR_.js")), G = o(() => import("./ArticlesPage-BcR1hbds.js")), H = o(() => import("./BuilderPage-CK_osM89.js")), J = o(() => import("./EditCollectionPage-Cw3GQYRe.js")), Q = o(() => import("./MenuPage-tJZtK46W.js")), X = o(() => import("./MenuAddPage-Bf48Z-ah.js")), Y = o(() => import("./MenuItemPage-CXn5HC8j.js"));
94
94
  export {
95
95
  G as ArticlesPage,
96
96
  H as BuilderPage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/cms",
3
- "version": "0.0.55",
3
+ "version": "0.0.56",
4
4
  "description": "cms",
5
5
  "type": "module",
6
6
  "author": "Softpro",
@@ -35,7 +35,9 @@ addHook('preFilter', async ({ pg = pgClients.client, table }) => {
35
35
 
36
36
  const defaultFields = ['title', 'slug', 'status', 'created_at', 'updated_at', 'main_image', 'published_at'];
37
37
 
38
- export default async function getContent(req, reply, called = false) {
38
+ export default async function getContent(req, reply, opt) {
39
+ const called = !!opt;
40
+ const { showDrafts: showDrafts1 } = opt || {};
39
41
  const { pg = pgClients.client, params = {}, query = {}, headers = {} } = req;
40
42
  const user = req.user || {};
41
43
  const { type, id } = params;
@@ -46,7 +48,7 @@ export default async function getContent(req, reply, called = false) {
46
48
 
47
49
  const { draftKey } = await getDraftKey();
48
50
  const showDrafts = query.draftKey && query.draftKey === draftKey;
49
- const statusQuery = !!req.user?.uid || showDrafts || called ? '1=1' : `status='published'`;
51
+ const statusQuery = !!req.user?.uid || showDrafts || showDrafts1 ? '1=1' : `status='published'`;
50
52
 
51
53
  // headers.authorization = 'Bearer tokenExample'
52
54
  const isValidToken = await pg.query(
@@ -63,7 +65,7 @@ export default async function getContent(req, reply, called = false) {
63
65
  }
64
66
 
65
67
  const { contentId, contentTypeId, meta } = params.type === 'pages'
66
- ? await pg.query(`select content_id as "contentId", content_type_id as "contentTypeId", meta from site.contents where content_id=$1`, [params.type]).then(el => el.rows?.[0] || {})
68
+ ? { contentId: params.id || 'pages', contentTypeId: params.id || 'pages', meta: null }
67
69
  : await pg.query(`select content_id as "contentId", content_type_id as "contentTypeId", meta from site.contents where $1 in (slug, content_id, content_type_id)`, [params.type]).then(el => el.rows?.[0] || {});
68
70
 
69
71
  if (!contentId) {
@@ -86,7 +88,7 @@ export default async function getContent(req, reply, called = false) {
86
88
 
87
89
  defaultColumns.forEach(col => Object.assign(col, { default: true }));
88
90
 
89
- const columns = columns1.filter(col => !defaultColumns.map(el => el.name).includes(col.name));
91
+ const columns = (columns1 || []).filter(col => !defaultColumns.map(el => el.name).includes(col.name));
90
92
 
91
93
  const result = contentType === 'collection' && table
92
94
  ? await getCollection({
@@ -11,16 +11,9 @@ export default async function getSingle({
11
11
  const id = id1 || (contentId1 === 'pages' ? undefined : contentId1) || '';
12
12
  const contentId = id1 ? contentId1 : "pages";
13
13
 
14
- // defaultColumns.push({
15
- // "name": "content_type_id",
16
- // "label": "Тип сторінки",
17
- // "type": "select",
18
- // "data": "cms.page_type"
19
- // });
20
-
21
- const customColumns = await pg.query(`
22
- SELECT columns FROM site.content_types WHERE content_type_id in (select content_type_id from site.contents where content_id=$1) limit 1
23
- `, [id1 || contentId]).then(el => el.rows?.[0]?.columns || []);
14
+ const customColumns = await pg.query(
15
+ `select columns FROM site.content_types where content_type_id=$1`, [id || contentId]
16
+ ).then(el => el.rows?.[0]?.columns || []);
24
17
 
25
18
  const contentQuery = contentId === 'pages' || !id
26
19
  ? `(type = 'single' or content_type_id = 'pages')`