@opengis/cms 0.0.59 → 0.0.61

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 (48) hide show
  1. package/README.md +4 -4
  2. package/dist/{ArticlesPage-BjYzvTWM.js → ArticlesPage-CFjE_cw_.js} +3 -3
  3. package/dist/{CollectionsBreadcrumb-HePNJb-d.js → CollectionsBreadcrumb-BCxeRikP.js} +1 -1
  4. package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-umRzB5mY.js +53 -0
  5. package/dist/{Dashboard-CXkg_pk8.js → Dashboard-C1eGscNd.js} +132 -132
  6. package/dist/EditCollectionPage-3Q57ptN3.js +188 -0
  7. package/dist/{MenuAddPage-QTnwCoGh.js → MenuAddPage-D-p3gFgm.js} +1 -1
  8. package/dist/{MenuBody-Bi0ONVZf.js → MenuBody-rN5j4YBu.js} +2 -2
  9. package/dist/{MenuItemPage-B7Y9KFyb.js → MenuItemPage-BoJw885D.js} +3 -3
  10. package/dist/{MenuList-BLIpeqSd.js → MenuList-DFEBS0NB.js} +53 -53
  11. package/dist/{MenuPage-3W6jZ15H.js → MenuPage-BCZB_S8j.js} +1 -1
  12. package/dist/{MenuWrapper-OrOv6sOb.js → MenuWrapper-AZ_8s-zd.js} +1 -1
  13. package/dist/{MonacoEditor-ByPT8pnv.js → MonacoEditor-Db-3Jc3E.js} +1 -1
  14. package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-B1DrxmQX.js +84 -0
  15. package/dist/{UniversalTable-GBd_pStq.js → UniversalTable-CzqPG-tY.js} +80 -80
  16. package/dist/{UniversalTablePagination-Dw2hc0nc.js → UniversalTablePagination-4gL47A7I.js} +46 -46
  17. package/dist/{contentForm-Buku-lel.js → contentForm-CLStrfSg.js} +49 -52
  18. package/dist/index.js +5 -5
  19. package/dist/{vs-builder-monaco-Cw-f19gc.js → vs-builder-monaco-B3Jj0V31.js} +1 -1
  20. package/package.json +69 -69
  21. package/server/migrations/fixes.sql +5 -2
  22. package/server/migrations/site.sql +4 -3
  23. package/server/routes/cms/controllers/deleteContent.js +7 -7
  24. package/server/routes/cms/controllers/getContent.js +6 -6
  25. package/server/routes/cms/controllers/getContentBySlug.js +13 -13
  26. package/server/routes/cms/controllers/getPermissions.js +15 -15
  27. package/server/routes/cms/controllers/insertContent.js +28 -19
  28. package/server/routes/cms/controllers/setPermissions.js +49 -49
  29. package/server/routes/cms/controllers/updateContent.js +12 -47
  30. package/server/routes/cms/utils/getCollection.js +1 -1
  31. package/server/routes/cms/utils/getSingle.js +1 -1
  32. package/server/routes/cms/utils/insertContentLocalization.js +1 -1
  33. package/server/routes/cms/utils/requestTranslation.js +73 -23
  34. package/server/routes/cms/utils/updateLocalization.js +1 -6
  35. package/server/routes/cmsSpace/controllers/deleteSpace.js +1 -0
  36. package/server/routes/cmsSpace/controllers/getSpaces.js +1 -0
  37. package/server/routes/cmsSpace/controllers/insertSpace.js +1 -0
  38. package/server/routes/cmsSpace/controllers/updateSpace.js +1 -0
  39. package/server/routes/contentType/controllers/contentTypeList.js +4 -11
  40. package/server/routes/contentType/controllers/editContentType.js +7 -25
  41. package/server/routes/contentType/controllers/getContentType.js +5 -13
  42. package/server/templates/select/core.user_mentioned.sql +1 -1
  43. package/dist/CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-BJh-tjam.js +0 -53
  44. package/dist/EditCollectionPage-CqYHpEON.js +0 -187
  45. package/dist/MonacoEditor.vue_vue_type_script_setup_true_lang-C8cip9Ci.js +0 -84
  46. package/dist/images/logo.png +0 -0
  47. package/dist/index.html +0 -29
  48. package/dist/vite.svg +0 -1
@@ -1,8 +1,8 @@
1
- import { logger, pgClients } from '@opengis/fastify-table/utils.js';
1
+ import { pgClients } from '@opengis/fastify-table/utils.js';
2
2
 
3
3
  const maxLimit = 100;
4
4
 
5
- export default async function builderList({ pg = pgClients.client, query = {} }, reply) {
5
+ export default async function contentTypeList({ pg = pgClients.client, query = {} }, reply) {
6
6
  if (!pg) {
7
7
  return reply.status(200).send({ total: 0, msg: 'empty pg', rows: [] });
8
8
  }
@@ -10,8 +10,8 @@ export default async function builderList({ pg = pgClients.client, query = {} },
10
10
  const limit = Math.min(maxLimit, query.limit || 16);
11
11
  const offset = query.page && query.page > 0 ? (query.page - 1) * limit : 0;
12
12
 
13
- const q = `select a.content_type_id as id, a.name, a.title, a.description, a.table_name as table, type, columns, a.include_search, json_build_object('locales', locales, 'default_locale', default_locale, 'name', space_name) as space FROM site.content_types a
14
- left join lateral ( select locales, default_locale, name as space_name from site.spaces where space_id= 'default' limit 1) b on 1=1
13
+ const q = `select a.content_type_id as id, a.name, a.title, a.description, a.table_name as table, type, columns, a.include_search FROM site.content_types a
14
+
15
15
  where ${query.type === 'collection' ? `type='collection'` : (query.type === 'single' ? `type='single'` : '1=1')}`;
16
16
 
17
17
  const where = query.search?.replace ? `(name ilike '%${query.search.replace(/'/, "''")}%' or title ilike '%${query.search.replace(/'/, "''")}%')` : '1=1';
@@ -28,13 +28,6 @@ export default async function builderList({ pg = pgClients.client, query = {} },
28
28
  ).then(el => el.rows?.[0] || {});
29
29
 
30
30
  await Promise.all(rows.map(async row => {
31
- if (row.table && false) {
32
- await pg.query('alter table data.' + row.table + ' add column if not exists created_at timestamp with time zone not null default now()');
33
- await pg.query('alter table data.' + row.table + ' add column if not exists updated_at timestamp with time zone not null default now()');
34
- await pg.query('alter table data.' + row.table + ' add column if not exists created_by text');
35
- await pg.query('alter table data.' + row.table + ' add column if not exists updated_by text');
36
- }
37
-
38
31
  const q2 = row.table
39
32
  ? `select count(*) from data."${row.table}" where $1=$1`
40
33
  : `select count(*) from site.contents where $1=$1 and ${row.id === 'pages' ? `slug <> 'pages' and content_type_id in (select content_type_id from site.content_types where type = 'single' or content_type_id='pages')` : 'content_type_id=$1'}`;
@@ -18,11 +18,6 @@ export default async function builderPut(req, reply) {
18
18
  where $1 in (content_id, content_type_id, slug)`, [params.id]
19
19
  ).then(el => el.rows?.[0]);
20
20
 
21
- const customCtExists = await pg.query(
22
- `select 1 FROM site.content_types
23
- where content_type_id=$1`, [params.id]
24
- ).then(el => el.rowCount || 0);
25
-
26
21
  const { cid, table } = await pg.query(
27
22
  `select content_type_id as cid, table_name as table, type from site.content_types where $1 in (content_type_id, name)`,
28
23
  [params.id],
@@ -53,26 +48,13 @@ export default async function builderPut(req, reply) {
53
48
 
54
49
  const name = body.name === 'pages' ? (single?.slug || params.id) : (body.name || body.slug);
55
50
 
56
- // insert new,
57
- if (single && !customCtExists && (single?.content_type_id === 'pages' || single?.content_type_id === params.id)) {
58
- // const loadTable = await getTemplate('table', 'single.default.table');
59
- // const { columns: defaultColumns } = loadTable || {};
60
- await dataInsert({
61
- pg,
62
- table: 'site.content_types',
63
- id: params.id,
64
- data: { ...body, type: 'single', name /*, columns: defaultColumns */ },
65
- uid: user?.uid,
66
- });
67
- } else {
68
- await dataUpdate({
69
- pg: client,
70
- table: 'site.content_types',
71
- id: cid1,
72
- data: { ...body, content_type_id: cid1, name },
73
- uid: user?.uid,
74
- });
75
- }
51
+ await dataUpdate({
52
+ pg: client,
53
+ table: 'site.content_types',
54
+ id: cid1,
55
+ data: { ...body, content_type_id: cid1, name },
56
+ uid: user?.uid,
57
+ });
76
58
 
77
59
  const row = await updateContents(client, cid1, { ...body, slug: name }, user?.uid);
78
60
 
@@ -2,11 +2,11 @@ import { pgClients, getTemplate } from '@opengis/fastify-table/utils.js';
2
2
 
3
3
  export default async function builderGet({ pg = pgClients.client, params = {} }, reply) {
4
4
  if (!params.id) {
5
- return reply.status(400).send('not enough params: id');
5
+ return reply.status(400).send({ error: 'not enough params: id', code: 400 });
6
6
  }
7
7
 
8
8
  if (!pg?.pk?.['site.content_types']) {
9
- return reply.status(404).send('table not found');
9
+ return reply.status(404).send({ error: 'table not found', code: 404 });
10
10
  }
11
11
 
12
12
  const single = await pg.query(
@@ -30,28 +30,20 @@ export default async function builderGet({ pg = pgClients.client, params = {} },
30
30
  if (single && !row) {
31
31
  const loadTable = await getTemplate('table', 'single.default.table');
32
32
  const { columns: defaultColumns } = loadTable || {};
33
- (defaultColumns || []).forEach(col => Object.assign(col, { default: true }));
33
+ (defaultColumns || []).forEach(col => Object.assign(col, { defaultColumn: true }));
34
34
  const columns = (defaultColumns || []).filter(col => !col.hidden);
35
35
  return reply.status(200).send({ default: true, id: single.id, name: single.slug, type: 'single', ...single, columns });
36
36
  }
37
37
 
38
38
  if (!row) {
39
- return reply.status(404).send('content type not found');
39
+ return reply.status(404).send({ error: 'content type not found', code: 404 });
40
40
  }
41
41
 
42
- const space = await pg.query(
43
- 'select name, default_locale, locales from site.spaces where space_id = $1', ['default'],
44
- ).then(el => el.rows?.[0] || {});
45
- Object.assign(row, { space });
46
-
47
- // const loadTable = params.id === 'pages' ? await getTemplate('table', 'single.default.table') : {};
48
- // const columns = params.id === 'pages' ? loadTable?.columns : row.columns;
49
-
50
42
  const loadTable = params.id === 'pages'
51
43
  ? await getTemplate('table', 'single.default.table')
52
44
  : await getTemplate('table', 'collection.default.table');
53
45
  const { columns: defaultColumns = [] } = loadTable || {};
54
- defaultColumns.forEach(col => Object.assign(col, { default: true }));
46
+ defaultColumns.forEach(col => Object.assign(col, { defaultColumn: true }));
55
47
  const columns = (defaultColumns || []).concat((row.columns || []).filter(col => !defaultColumns.map(el => el.name).includes(col.name)));
56
48
 
57
49
  Object.assign(row, { columns });
@@ -1,2 +1,2 @@
1
- select uid, coalesce(sur_name,'')||coalesce(' '||user_name,'') as text, email from admin.users
1
+ select uid, coalesce(sur_name,'')||coalesce(' '||user_name,'') as text, email from admin.users
2
2
  where enabled order by coalesce(sur_name,'')||coalesce(' '||user_name,'')
@@ -1,53 +0,0 @@
1
- import { defineComponent as k, openBlock as e, createElementBlock as s, createElementVNode as a, createVNode as m, unref as n, toDisplayString as u, Fragment as r, createBlock as c, createCommentVNode as p, renderList as b } from "vue";
2
- import { Layers as x, ChevronRight as i } from "lucide-vue-next";
3
- const h = { class: "flex items-center space-x-1 mb-4 overflow-hidden" }, g = { class: "truncate block max-w-[12rem]" }, w = ["onClick"], f = { class: "truncate block max-w-[20rem]" }, v = {
4
- key: 1,
5
- class: "flex gap-x-1 items-center px-2 py-1 rounded text-sm font-medium text-slate-700 dark:text-slate-300 min-w-0 overflow-hidden whitespace-nowrap text-ellipsis"
6
- }, y = { class: "truncate block max-w-[20rem]" }, N = /* @__PURE__ */ k({
7
- __name: "CollectionsBreadcrumb",
8
- props: {
9
- items: {},
10
- loading: { type: Boolean }
11
- },
12
- emits: ["navigate"],
13
- setup(C) {
14
- return (t, l) => (e(), s("div", h, [
15
- a("button", {
16
- class: "flex gap-x-1 items-center px-2 py-1 rounded text-sm font-medium transition-all duration-200 text-blue-600 dark:text-blue-400 bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30 min-w-0 overflow-hidden whitespace-nowrap text-ellipsis",
17
- onClick: l[0] || (l[0] = (o) => t.$emit("navigate", "collections"))
18
- }, [
19
- m(n(x), { class: "w-3 h-3 flex-shrink-0" }),
20
- a("span", g, u(t.$t("cms.navigation.collections")), 1)
21
- ]),
22
- t.loading ? (e(), s(r, { key: 0 }, [
23
- m(n(i), { class: "w-3 h-3 text-slate-400 dark:text-slate-500 flex-shrink-0" }),
24
- l[1] || (l[1] = a("div", { class: "h-7 w-24 rounded bg-slate-200 dark:bg-slate-700 animate-pulse" }, null, -1)),
25
- m(n(i), { class: "w-3 h-3 text-slate-400 dark:text-slate-500 flex-shrink-0" }),
26
- l[2] || (l[2] = a("div", { class: "h-7 w-20 rounded bg-slate-200 dark:bg-slate-700 animate-pulse" }, null, -1))
27
- ], 64)) : (e(), s(r, { key: 1 }, [
28
- t.items.length > 0 ? (e(), c(n(i), {
29
- key: 0,
30
- class: "w-3 h-3 text-slate-400 dark:text-slate-500 flex-shrink-0"
31
- })) : p("", !0),
32
- (e(!0), s(r, null, b(t.items, (o, d) => (e(), s(r, { key: d }, [
33
- d < t.items.length - 1 ? (e(), s("button", {
34
- key: 0,
35
- class: "flex gap-x-1 items-center px-2 py-1 rounded text-sm font-medium transition-all duration-200 text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30 min-w-0 overflow-hidden whitespace-nowrap text-ellipsis",
36
- onClick: (_) => t.$emit("navigate", o.route)
37
- }, [
38
- a("span", f, u(o.label), 1)
39
- ], 8, w)) : (e(), s("span", v, [
40
- a("span", y, u(o.label), 1)
41
- ])),
42
- d < t.items.length - 1 ? (e(), c(n(i), {
43
- key: 2,
44
- class: "w-3 h-3 text-slate-400 dark:text-slate-500 flex-shrink-0"
45
- })) : p("", !0)
46
- ], 64))), 128))
47
- ], 64))
48
- ]));
49
- }
50
- });
51
- export {
52
- N as _
53
- };
@@ -1,187 +0,0 @@
1
- import { defineAsyncComponent as k, defineComponent as z, inject as E, ref as u, computed as m, onMounted as S, openBlock as v, createElementBlock as h, createVNode as q, createElementVNode as n, createTextVNode as D, toDisplayString as d, unref as T, Fragment as O, renderList as R, normalizeClass as W, createBlock as J, resolveDynamicComponent as M, createCommentVNode as Y } from "vue";
2
- import { useRoute as G, useRouter as H } from "vue-router";
3
- import { useI18n as K } from "vue-i18n";
4
- import { notify as $ } from "@opengis/core";
5
- import { _ as P } from "./CollectionsBreadcrumb.vue_vue_type_script_setup_true_lang-BJh-tjam.js";
6
- const Q = {
7
- monaco: k(() => import("./vs-builder-monaco-Cw-f19gc.js")),
8
- edit: k(() => import("./vs-builder-edit-D-q1o8tF.js")),
9
- preview: k(() => import("./vs-builder-preview-BH4VAM3a.js"))
10
- }, X = { class: "mx-auto max-w-[90%]" }, Z = { class: "flex items-center justify-between mb-6" }, ee = { class: "mb-2 text-2xl font-semibold text-gray-900" }, te = { class: "lowercase" }, oe = { class: "text-gray-600" }, ne = { class: "flex items-center gap-2" }, se = { class: "w-full" }, ie = { class: "flex items-center w-full h-10 max-w-md grid-cols-3 p-1 mb-6 bg-white border border-gray-200 rounded-md text-muted-foreground" }, re = ["onClick"], ae = {
11
- key: 0,
12
- class: "mx-auto bg-white rounded-md py-4 px-2 bg-opacity-50"
13
- }, ve = /* @__PURE__ */ z({
14
- __name: "EditCollectionPage",
15
- setup(le) {
16
- const { t: s } = K(), j = E("cms.fetchContentTypes"), p = u("edit"), r = u({ yaml: "", data: { columns: [], type: "collection" } }), w = u({}), x = u(""), i = G(), b = H(), I = u(!1), _ = u(!0), C = u(""), A = m(() => [
17
- // {
18
- // name: "YAML",
19
- // id: "monaco",
20
- // },
21
- {
22
- name: s("cms.builder.edit"),
23
- id: "edit"
24
- },
25
- {
26
- name: s("cms.builder.preview"),
27
- id: "preview"
28
- }
29
- ]), a = m(() => {
30
- if (typeof i.params.collection == "string" && typeof i.params.contentId == "string")
31
- return i.params.collection;
32
- const e = i.params.id;
33
- return e === "edit" ? i.params.collection : e;
34
- }), g = m(() => typeof i.params.contentId == "string" ? i.params.contentId : null), L = m(() => {
35
- if (a.value && g.value)
36
- return `/collections/${a.value}/${g.value}`;
37
- const e = i.query.from;
38
- return typeof e == "string" && e.startsWith("/") ? e : null;
39
- }), N = m(() => {
40
- if (C.value)
41
- return C.value;
42
- const e = i.query.fromLabel;
43
- return typeof e == "string" && e.trim() ? e.trim() : null;
44
- }), F = m(() => {
45
- const o = [
46
- {
47
- label: x.value || a.value,
48
- route: `collections/${a.value}`
49
- },
50
- {
51
- label: s("cms.collections.edit")
52
- }
53
- ];
54
- return L.value && N.value && o.splice(1, 0, {
55
- label: N.value,
56
- route: L.value
57
- }), o;
58
- }), B = (e) => {
59
- if (e) {
60
- if (e.startsWith("/")) {
61
- b.push(e);
62
- return;
63
- }
64
- b.push(`/${e}`);
65
- }
66
- }, U = async () => {
67
- var e;
68
- try {
69
- if (_.value = !0, !a.value)
70
- return;
71
- if (g.value) {
72
- const f = await fetch(
73
- `/api/cms/${a.value}/${g.value}`
74
- );
75
- if (f.ok) {
76
- const c = await f.json(), y = Array.isArray(c == null ? void 0 : c.rows) ? c.rows[0] : c;
77
- y != null && y.title && (C.value = y.title);
78
- }
79
- }
80
- const t = await (await fetch(`/api/cms-type/${a.value}`)).json(), l = {
81
- ...t,
82
- columns: Array.isArray(t.columns) ? t.columns : (e = Object.entries((t == null ? void 0 : t.columns) || {})) == null ? void 0 : e.map(([f, c]) => ({
83
- ...c,
84
- name: f
85
- }))
86
- };
87
- r.value = {
88
- ...r.value,
89
- data: l
90
- }, x.value = l.title || l.name;
91
- } catch (o) {
92
- console.error(o);
93
- } finally {
94
- _.value = !1, I.value = !0;
95
- }
96
- }, V = async () => {
97
- var e, o;
98
- try {
99
- if (await w.value.validate()) {
100
- $({
101
- type: "warning",
102
- title: s("cms.common.actions.warning"),
103
- message: s("cms.builder.editFieldFailed")
104
- });
105
- return;
106
- }
107
- const l = a.value;
108
- if (!l)
109
- return;
110
- const f = await fetch(
111
- `/api/cms-type/${l}`,
112
- {
113
- method: "PUT",
114
- headers: {
115
- "Content-Type": "application/json"
116
- },
117
- body: JSON.stringify(p.value === "monaco" ? (e = r.value) == null ? void 0 : e.yaml : (o = r.value) == null ? void 0 : o.data)
118
- }
119
- );
120
- b.back(), j && j(), $({
121
- type: "success",
122
- title: s("cms.common.actions.success"),
123
- message: s("cms.collections.collectionCreated")
124
- });
125
- } catch (t) {
126
- console.error(t), $({
127
- type: "error",
128
- title: s("cms.common.actions.error"),
129
- message: s("cms.collections.collectionCreationFailed")
130
- });
131
- }
132
- };
133
- return S(() => {
134
- U();
135
- }), (e, o) => (v(), h("div", X, [
136
- q(P, {
137
- items: F.value,
138
- loading: _.value,
139
- onNavigate: B
140
- }, null, 8, ["items", "loading"]),
141
- n("div", Z, [
142
- n("div", null, [
143
- n("h1", ee, [
144
- D(d(e.$t("cms.builder.editCollection")) + ": ", 1),
145
- n("span", te, ' "' + d(x.value) + '" ', 1)
146
- ]),
147
- n("p", oe, d(e.$t("cms.builder.editContentForYourSite")), 1)
148
- ]),
149
- n("div", ne, [
150
- n("a", {
151
- onClick: o[0] || (o[0] = (t) => T(b).back()),
152
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border bg-background hover:text-accent-foreground h-10 px-4 py-2 border-gray-300 text-gray-700 hover:bg-gray-50"
153
- }, d(e.$t("cms.common.actions.back")), 1),
154
- n("button", {
155
- onClick: V,
156
- class: "inline-flex items-center justify-center gap-2 whitespace-nowrap text-white rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 text-primary-foreground h-10 px-4 py-2 bg-blue-600 hover:bg-blue-700"
157
- }, d(e.$t("cms.common.actions.save")), 1)
158
- ])
159
- ]),
160
- n("div", se, [
161
- n("div", ie, [
162
- (v(!0), h(O, null, R(A.value, (t) => (v(), h("button", {
163
- key: t.id,
164
- onClick: (l) => p.value = t.id,
165
- class: W([
166
- "inline-flex flex-1 items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm data-[state=active]:bg-blue-50 data-[state=active]:text-blue-700 data-[state=active]:border-blue-200",
167
- t.id === p.value ? "bg-blue-50 text-blue-700 border-blue-200" : ""
168
- ])
169
- }, d(t.name), 11, re))), 128))
170
- ])
171
- ]),
172
- I.value ? (v(), h("div", ae, [
173
- (v(), J(M(T(Q)[p.value]), {
174
- yaml: r.value.yaml,
175
- "onUpdate:yaml": o[1] || (o[1] = (t) => r.value.yaml = t),
176
- data: r.value.data,
177
- "onUpdate:data": o[2] || (o[2] = (t) => r.value.data = t),
178
- form: w.value,
179
- "onUpdate:form": o[3] || (o[3] = (t) => w.value = t)
180
- }, null, 40, ["yaml", "data", "form"]))
181
- ])) : Y("", !0)
182
- ]));
183
- }
184
- });
185
- export {
186
- ve as default
187
- };
@@ -1,84 +0,0 @@
1
- import { defineComponent as s, mergeModels as m, useModel as c, ref as f, onMounted as h, watch as d, onBeforeUnmount as p, openBlock as g, createElementBlock as v, normalizeStyle as w } from "vue";
2
- async function M() {
3
- if (window.monaco)
4
- return window.monaco;
5
- const i = "https://cdn.jsdelivr.net/npm/monaco-editor@0.45.0/min";
6
- return window.require || (window.require = { paths: { vs: `${i}/vs` } }, await new Promise((t, l) => {
7
- const n = document.createElement("script");
8
- n.src = `${i}/vs/loader.min.js`, n.onload = () => t(), n.onerror = l, document.head.appendChild(n);
9
- })), new Promise((t) => {
10
- window.require(["vs/editor/editor.main"], () => t(window.monaco));
11
- });
12
- }
13
- const C = /* @__PURE__ */ s({
14
- __name: "MonacoEditor",
15
- props: /* @__PURE__ */ m({
16
- language: { default: "javascript" },
17
- theme: { default: "vs-dark" },
18
- width: { default: "100%" },
19
- height: { default: "100%" },
20
- options: { default: () => ({
21
- minimap: { enabled: !1 }
22
- }) }
23
- }, {
24
- modelValue: {
25
- required: !0
26
- },
27
- modelModifiers: {}
28
- }),
29
- emits: ["update:modelValue"],
30
- setup(i) {
31
- const t = i, l = c(i, "modelValue"), n = f(null);
32
- let o = null, r = null;
33
- return h(async () => {
34
- var e;
35
- if (n.value)
36
- try {
37
- r = await M();
38
- const a = ((e = l.value) == null ? void 0 : e.replace(/\\n/g, `
39
- `)) || "";
40
- o = r.editor.create(n.value, {
41
- value: a,
42
- language: t.language,
43
- theme: t.theme,
44
- automaticLayout: !0,
45
- ...t.options
46
- }), o.onDidChangeModelContent(() => {
47
- const u = (o == null ? void 0 : o.getValue()) || "";
48
- l.value = u;
49
- });
50
- } catch (a) {
51
- console.error("Failed to load Monaco Editor:", a);
52
- }
53
- }), d(
54
- () => l.value,
55
- (e) => {
56
- if (o) {
57
- const a = (e == null ? void 0 : e.replace(/\\n/g, `
58
- `)) || "";
59
- a !== o.getValue() && o.setValue(a);
60
- }
61
- },
62
- { immediate: !0 }
63
- ), d(
64
- () => t.language,
65
- (e) => {
66
- o && e && r && r.editor.setModelLanguage(o.getModel(), e);
67
- }
68
- ), d(
69
- () => t.theme,
70
- (e) => {
71
- o && e && r && r.editor.setTheme(e);
72
- }
73
- ), p(() => {
74
- o && (o.dispose(), o = null);
75
- }), (e, a) => (g(), v("div", {
76
- ref_key: "editorContainer",
77
- ref: n,
78
- style: w({ width: e.width, height: e.height })
79
- }, null, 4));
80
- }
81
- });
82
- export {
83
- C as _
84
- };
Binary file
package/dist/index.html DELETED
@@ -1,29 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>CMS</title>
7
- <link rel="icon" type="image/png" href="/images/logo.png" />
8
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
9
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
10
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css">
11
- <link rel="stylesheet" href="/css/style.css">
12
- </head>
13
- <body>
14
- <div id="app">
15
- <div class="container">
16
- <div class="row">
17
- <div class="col-md-12">
18
- <h1 class="text-center">CMS</h1>
19
- </div>
20
- </div>
21
- </div>
22
- </div>
23
- <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
24
- <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js"></script>
25
- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
26
- <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>
27
- <script src="/js/app.js"></script>
28
- </body>
29
- </html>
package/dist/vite.svg DELETED
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>