@opengis/gis 0.2.117 → 0.2.119

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 (30) hide show
  1. package/dist/{CardIcon-FxpK90rl.js → CardIcon-ODZgA2Pb.js} +1 -1
  2. package/dist/EntityTablePage-UMttc2-F.js +281 -0
  3. package/dist/{ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-Bl5ZwNQX.js → ExtentOutlineLayer.vue_vue_type_script_setup_true_lang-DLAIOHJh.js} +1 -1
  4. package/dist/{FileEdit-C7tteUeG.js → FileEdit-GikPLv1T.js} +1 -1
  5. package/dist/{HeaderActions.vue_vue_type_script_setup_true_lang-CKEep8BL.js → HeaderActions.vue_vue_type_script_setup_true_lang-CTKkmXWD.js} +1 -1
  6. package/dist/{MapSettings-CjJ7WWkn.js → MapSettings-CbW0TfZl.js} +2 -2
  7. package/dist/{MonacoEditor.vue_vue_type_script_setup_true_lang-Bs7gz6Lt.js → MonacoEditor.vue_vue_type_script_setup_true_lang-D3ZPeXMw.js} +92 -73
  8. package/dist/RastersTablePage-CXqscX0i.js +245 -0
  9. package/dist/{cartocss-C_O8qG3h.js → cartocss-306ZE1Ha.js} +6 -6
  10. package/dist/{import-utils-BbZ1gVp-.js → import-utils-CHIDSKHz.js} +1 -1
  11. package/dist/index-CbdZv1jy.js +10123 -0
  12. package/dist/index.css +1 -1
  13. package/dist/index.js +1 -1
  14. package/dist/index.umd.cjs +41 -41
  15. package/dist/{raster-Du8ZMtjf.js → raster-Cn6l0xfZ.js} +4 -4
  16. package/dist/{register-B2gF-GzA.js → register-4wblFcw2.js} +3 -3
  17. package/dist/{service-BnPCDVwm.js → service-2uWyAfnR.js} +6 -6
  18. package/dist/{vs-datatable-QKks38xL.js → vs-datatable-D_Xzh4qf.js} +1 -1
  19. package/module/test/cls/doc_status.json +31 -31
  20. package/module/test/select/core.user_uid.sql +1 -1
  21. package/package.json +1 -1
  22. package/server/plugins/mapnik/funcs/checkRasterFile.js +19 -18
  23. package/server/routes/mapnik/controllers/clearTiles.js +15 -7
  24. package/server/routes/mapnik/controllers/createXml.js +5 -4
  25. package/server/routes/mapnik/controllers/createXmlMulti.js +3 -2
  26. package/server/routes/mapnik/controllers/rasterInfo.js +5 -4
  27. package/server/routes/mapnik/controllers/rtile.js +2 -2
  28. package/dist/EntityTablePage-ii-Wz0YZ.js +0 -286
  29. package/dist/RastersTablePage-DpKkFOyo.js +0 -359
  30. package/dist/index-4aSsUBB8.js +0 -10020
@@ -1,5 +1,5 @@
1
1
  import { openBlock as t, createElementBlock as n, createElementVNode as l } from "vue";
2
- import { _ as o } from "./index-4aSsUBB8.js";
2
+ import { _ as o } from "./index-CbdZv1jy.js";
3
3
  const s = {}, a = {
4
4
  xmlns: "http://www.w3.org/2000/svg",
5
5
  width: "24",
@@ -0,0 +1,281 @@
1
+ import { defineComponent as se, defineAsyncComponent as re, computed as i, ref as u, onMounted as oe, watch as U, openBlock as P, createElementBlock as k, createVNode as f, createSlots as le, withCtx as w, createTextVNode as g, toDisplayString as x, unref as c, createCommentVNode as R, createElementVNode as r, renderSlot as M } from "vue";
2
+ import { RefreshCw as ie, Plus as ue } from "lucide-vue-next";
3
+ import { useRoute as ce, useRouter as de } from "vue-router";
4
+ import { VsPagination as fe, notify as Q } from "@opengis/core";
5
+ import { FilterField as me, Filter as he } from "@opengis/filter";
6
+ import { F as ge } from "./FileEdit-GikPLv1T.js";
7
+ import { _ as ve } from "./TableFormHeader.vue_vue_type_script_setup_true_lang-Mci_tseM.js";
8
+ import { _ as pe } from "./index-CbdZv1jy.js";
9
+ const xe = { class: "flex-1 flex flex-col bg-gray-50 h-screen overflow-hidden p-0 m-0" }, be = {
10
+ key: 0,
11
+ href: "/api/gis-create-xml",
12
+ target: "_blank",
13
+ rel: "noreferrer",
14
+ class: "flex h-[2rem] items-center gap-1.5 px-3 py-1.5 bg-slate-50 text-slate-700 rounded-md border border-slate-200 hover:bg-slate-100 transition-colors text-sm"
15
+ }, ye = { class: "flex-1 px-4 sm:px-6 pb-4 overflow-y-auto overflow-x-visible" }, we = { class: "bg-white rounded-lg shadow-sm border border-gray-200 overflow-visible" }, _e = { class: "p-3 border-b border-gray-200" }, $e = { class: "flex flex-col sm:flex-row gap-2" }, Se = { class: "entity-table-root" }, Ce = { class: "inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800" }, Pe = {
16
+ key: 0,
17
+ class: "gap-2 inline-flex"
18
+ }, ke = ["onClick"], Te = {
19
+ key: 0,
20
+ class: "flex flex-col gap-3 border-t border-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-between bg-gray-50"
21
+ }, Ee = { class: "text-sm text-gray-500" }, Fe = { class: "font-medium text-gray-700" }, Re = { class: "font-medium text-gray-700" }, Ne = { class: "font-medium text-gray-700" }, Ve = { class: "flex items-center justify-end gap-3" }, je = /* @__PURE__ */ se({
22
+ __name: "EntityTablePage",
23
+ props: {
24
+ entityKey: { default: "" },
25
+ entityBasePath: { default: "" },
26
+ columnsConfig: { default: () => [] }
27
+ },
28
+ setup(D) {
29
+ const I = re(() => import("@opengis/table")), s = ce(), _ = de(), $ = D, N = i(
30
+ () => $.entityKey || String(s.name ?? "").split("-")[0]
31
+ ), J = i(() => {
32
+ var n;
33
+ let t = (((n = s.matched[s.matched.length - 1]) == null ? void 0 : n.path) || s.path).replace(/\/:id\??\/:action\??$/, "").replace(/\/:id\??$/, "").replace(/\/:action\??$/, "");
34
+ return t.startsWith("/") || (t = `/${t}`), t;
35
+ }), T = i(() => $.entityBasePath || J.value), E = i(() => {
36
+ var t;
37
+ const e = ((t = s.matched[s.matched.length - 1]) == null ? void 0 : t.path) || "";
38
+ return /:id\??/.test(e) && /:action\??/.test(e);
39
+ }), S = i(() => {
40
+ var t, n;
41
+ return (t = s.meta) != null && t.title ? s.meta.title : s.name ? s.name : ((n = s.path) == null ? void 0 : n.replace(/^\//, "")) || "" || "GIS";
42
+ }), V = i(() => {
43
+ var e;
44
+ return ((e = s.meta) == null ? void 0 : e.description) || "";
45
+ }), K = i(() => {
46
+ const e = String(S.value || "").trim();
47
+ return e ? `Пошук ${e}...` : "Пошук...";
48
+ }), b = u([]), y = u(!0), v = u([]), j = u([]), m = u({}), z = u([]), l = u(String(s.query.search ?? "")), o = u(Math.max(1, Number(s.query.page) || 1)), C = u(15), h = u(0), L = i(() => h.value > 0), O = i(() => h.value ? (o.value - 1) * C.value + 1 : 0), W = i(() => h.value ? Math.min(o.value * C.value, h.value) : 0);
49
+ function G(e) {
50
+ const t = new URLSearchParams();
51
+ return Object.entries(e).forEach(([n, a]) => {
52
+ if (!(a == null || a === "")) {
53
+ if (Array.isArray(a)) {
54
+ a.forEach((d) => {
55
+ d != null && d !== "" && t.append(n, String(d));
56
+ });
57
+ return;
58
+ }
59
+ t.append(n, String(a));
60
+ }
61
+ }), t.toString();
62
+ }
63
+ function H() {
64
+ return E.value ? `${T.value}/new` : s.name === "services" ? "/gis.datasets/new" : s.name === "group_list" ? "/gis.group/add" : `${s.path}/add`;
65
+ }
66
+ function X(e) {
67
+ if (E.value)
68
+ return `${T.value}/${e}/edit`;
69
+ const t = String(s.name ?? "").split("_")[0];
70
+ return t === "services" ? `/gis.datasets/${e}/edit` : `/gis.${t}/edit/${e}`;
71
+ }
72
+ const p = async () => {
73
+ const e = `/api/data/gis.${N.value}.table`;
74
+ if (!e) {
75
+ b.value = [], y.value = !1;
76
+ return;
77
+ }
78
+ try {
79
+ y.value = !0;
80
+ const t = G({
81
+ ...m.value,
82
+ page: o.value,
83
+ limit: C.value
84
+ }), n = await fetch(t ? `${e}?${t}` : e);
85
+ if (!n.ok)
86
+ throw new Error(`Rows fetch failed: ${n.status}`);
87
+ const a = await n.json();
88
+ b.value = a.rows || [], h.value = Number(a.filtered ?? a.total ?? a.count ?? b.value.length) || 0, v.value = $.columnsConfig.length ? $.columnsConfig : a.columns || [], j.value = a.filters || [], y.value = !1, z.value = a.actions, a.card !== !1 && v.value.length && (E.value ? v.value[0].link = `${T.value}/{id}` : v.value[0].link || (v.value[0].link = `/${s.name}/{id}`));
89
+ } catch {
90
+ b.value = [], y.value = !1;
91
+ }
92
+ };
93
+ function Y(e) {
94
+ m.value = e, o.value = 1, F(), p();
95
+ }
96
+ oe(() => {
97
+ p(), document.title = S.value;
98
+ }), U(
99
+ () => s.name,
100
+ () => {
101
+ o.value = 1, l.value = "", p(), document.title = S.value;
102
+ }
103
+ ), U(
104
+ () => s.query,
105
+ (e) => {
106
+ const t = Math.max(1, Number(e.page) || 1), n = String(e.search ?? ""), a = t !== o.value, d = n !== l.value;
107
+ !a && !d || (o.value = t, l.value = n, m.value = {
108
+ ...m.value,
109
+ search: n || void 0
110
+ }, p());
111
+ }
112
+ );
113
+ async function Z(e, t, n) {
114
+ const a = await fetch(`/api/form/gis.${N.value}.table/${e.id}`);
115
+ if (!a.ok) throw new Error(`Form fetch failed: ${a.status}`);
116
+ const ae = (await a.json()).token, ne = { [t]: n }, A = await fetch(`/api/table/${ae}`, {
117
+ method: "PUT",
118
+ headers: { "Content-Type": "application/json" },
119
+ body: JSON.stringify(ne)
120
+ });
121
+ if (!A.ok)
122
+ throw Q({
123
+ type: "error",
124
+ title: "Помилка збереження",
125
+ message: `Поле "${t}" не оновлено`
126
+ }), new Error(`Save failed: ${A.status}`);
127
+ Q({ title: "Збережено", message: `Поле "${t}" оновлено` });
128
+ }
129
+ function B(e, t) {
130
+ m.value = {
131
+ ...m.value,
132
+ [e]: t
133
+ }, o.value = 1, F(), p();
134
+ }
135
+ function ee(e) {
136
+ B((e == null ? void 0 : e.name) || "search", (e == null ? void 0 : e.value) ?? l.value);
137
+ }
138
+ function te(e) {
139
+ l.value = "", B(e || "search", void 0);
140
+ }
141
+ function q(e) {
142
+ !e || e === o.value || (o.value = e, F(), p());
143
+ }
144
+ function F() {
145
+ const e = {
146
+ ...s.query,
147
+ page: String(o.value),
148
+ ...l.value ? { search: l.value } : {}
149
+ };
150
+ l.value || delete e.search, _.replace({ query: e });
151
+ }
152
+ return (e, t) => (P(), k("div", xe, [
153
+ f(ve, { variant: "table" }, le({
154
+ title: w(() => [
155
+ g(x(S.value), 1)
156
+ ]),
157
+ actions: w(() => [
158
+ c(s).name === "rasters" ? (P(), k("a", be, [
159
+ f(c(ie), { size: 16 }),
160
+ t[2] || (t[2] = g(" Оновити растри ", -1))
161
+ ])) : R("", !0),
162
+ r("a", {
163
+ onClick: t[0] || (t[0] = (n) => c(_).push(H())),
164
+ class: "hover:cursor-pointer flex items-center gap-1.5 px-3 py-1.5 bg-blue-600 text-white rounded-md hover:bg-blue-700 transition-colors text-sm"
165
+ }, [
166
+ f(c(ue), { size: 16 }),
167
+ t[3] || (t[3] = g(" Додати ", -1))
168
+ ])
169
+ ]),
170
+ _: 2
171
+ }, [
172
+ V.value ? {
173
+ name: "description",
174
+ fn: w(() => [
175
+ g(x(V.value), 1)
176
+ ]),
177
+ key: "0"
178
+ } : void 0
179
+ ]), 1024),
180
+ r("div", ye, [
181
+ r("div", we, [
182
+ r("div", _e, [
183
+ r("div", $e, [
184
+ f(c(me), {
185
+ modelValue: l.value,
186
+ "onUpdate:modelValue": t[1] || (t[1] = (n) => l.value = n),
187
+ name: "search",
188
+ type: "text",
189
+ layout: "inline",
190
+ class: "flex-1",
191
+ width: "100%",
192
+ cleanable: !0,
193
+ onChange: ee,
194
+ onClear: te,
195
+ placeholder: K.value
196
+ }, null, 8, ["modelValue", "placeholder"]),
197
+ f(c(he), {
198
+ schema: j.value,
199
+ value: m.value,
200
+ onChange: Y,
201
+ layout: "inline",
202
+ mode: "soft",
203
+ view: "popover",
204
+ limit: 8,
205
+ class: "flex-shrink-0"
206
+ }, null, 8, ["schema", "value"])
207
+ ])
208
+ ]),
209
+ r("div", Se, [
210
+ f(c(I), {
211
+ rows: b.value,
212
+ columns: v.value,
213
+ loading: y.value,
214
+ router: c(_),
215
+ selectable: !1,
216
+ onCellUpdate: Z,
217
+ classWrapper: "overflow-x-auto overflow-y-visible",
218
+ TableStyle: "w-full",
219
+ classTable: "w-full min-w-[640px]",
220
+ classThead: "bg-gray-50 border-b border-gray-200",
221
+ classTh: "px-3 sm:px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",
222
+ classTbody: "bg-white divide-y divide-gray-200",
223
+ classTr: "hover:bg-gray-50 transition-colors",
224
+ classTd: "px-3 sm:px-4 py-2.5 whitespace-nowrap",
225
+ classLink: "text-sm font-medium text-blue-600 hover:text-blue-800 hover:underline text-left"
226
+ }, {
227
+ badge: w(({ row: n, value: a, column: d }) => [
228
+ M(e.$slots, "badge", {
229
+ row: n,
230
+ value: a,
231
+ column: d
232
+ }, () => [
233
+ r("span", Ce, x((a == null ? void 0 : a.text) || a || "-"), 1)
234
+ ], !0)
235
+ ]),
236
+ action: w(({ row: n }) => [
237
+ M(e.$slots, "action", { row: n }, () => [
238
+ z.value.includes("add") ? (P(), k("div", Pe, [
239
+ r("button", {
240
+ onClick: (a) => c(_).push(X(n.id)),
241
+ class: "inline-flex items-center justify-center bg-white border rounded-md size-7 gap-x-2 hover:bg-gray-100"
242
+ }, [
243
+ f(ge)
244
+ ], 8, ke)
245
+ ])) : R("", !0)
246
+ ], !0)
247
+ ]),
248
+ _: 3
249
+ }, 8, ["rows", "columns", "loading", "router"])
250
+ ]),
251
+ L.value ? (P(), k("div", Te, [
252
+ r("div", Ee, [
253
+ t[4] || (t[4] = g(" Показано ", -1)),
254
+ r("span", Fe, x(O.value), 1),
255
+ t[5] || (t[5] = g(" - ", -1)),
256
+ r("span", Re, x(W.value), 1),
257
+ t[6] || (t[6] = g(" з ", -1)),
258
+ r("span", Ne, x(h.value), 1)
259
+ ]),
260
+ r("div", Ve, [
261
+ f(c(fe), {
262
+ total: h.value,
263
+ page: o.value,
264
+ "page-size": C.value,
265
+ showPageSizes: !1,
266
+ pageRange: 5,
267
+ view: "button",
268
+ color: "gray",
269
+ "onUpdate:page": q,
270
+ onPageChange: q
271
+ }, null, 8, ["total", "page", "page-size"])
272
+ ])
273
+ ])) : R("", !0)
274
+ ])
275
+ ])
276
+ ]));
277
+ }
278
+ }), Ie = /* @__PURE__ */ pe(je, [["__scopeId", "data-v-1061effc"]]);
279
+ export {
280
+ Ie as default
281
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as y, computed as f, watch as d, createCommentVNode as x } from "vue";
2
- import { f as b, u as _ } from "./index-4aSsUBB8.js";
2
+ import { f as b, u as _ } from "./index-CbdZv1jy.js";
3
3
  const I = /* @__PURE__ */ y({
4
4
  __name: "ExtentOutlineLayer",
5
5
  props: {
@@ -1,5 +1,5 @@
1
1
  import { openBlock as n, createElementBlock as t, createElementVNode as e } from "vue";
2
- import { _ as r } from "./index-4aSsUBB8.js";
2
+ import { _ as r } from "./index-CbdZv1jy.js";
3
3
  const i = {}, s = {
4
4
  xmlns: "http://www.w3.org/2000/svg",
5
5
  width: "12px",
@@ -1,5 +1,5 @@
1
1
  import { openBlock as m, createElementBlock as v, createElementVNode as r, defineComponent as J, normalizeClass as he, createVNode as j, createBlock as le, unref as E, defineAsyncComponent as W, ref as b, watch as ve, computed as y, createTextVNode as _e, Fragment as ae, renderList as ue, toDisplayString as z, withCtx as X, nextTick as we, onMounted as ke, onUnmounted as xe, withModifiers as ze, Teleport as Ve, normalizeStyle as Ce, createCommentVNode as te } from "vue";
2
- import { _ as Ee } from "./index-4aSsUBB8.js";
2
+ import { _ as Ee } from "./index-CbdZv1jy.js";
3
3
  import { Settings as Me, BrushCleaning as ce, SquareCode as Le, Pencil as Te } from "lucide-vue-next";
4
4
  import { notify as D } from "@opengis/core";
5
5
  const Se = {}, $e = {
@@ -5,8 +5,8 @@ import { confirm as H, notify as F } from "@opengis/core";
5
5
  import { _ as de } from "./TableFormHeader.vue_vue_type_script_setup_true_lang-Mci_tseM.js";
6
6
  import { _ as ue } from "./MapSettingsTabs.vue_vue_type_script_setup_true_lang-CKCK3NqY.js";
7
7
  import { VsInputArraySelect as ce } from "@opengis/form";
8
- import { q as me, _ as pe } from "./index-4aSsUBB8.js";
9
- import { _ as ye } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-Bs7gz6Lt.js";
8
+ import { q as me, _ as pe } from "./index-CbdZv1jy.js";
9
+ import { _ as ye } from "./MonacoEditor.vue_vue_type_script_setup_true_lang-D3ZPeXMw.js";
10
10
  const fe = { class: "rounded-lg border border-gray-200 bg-[rgba(252,252,252,0.8)] p-6" }, ge = /* @__PURE__ */ I({
11
11
  __name: "GeneralSettings",
12
12
  props: {
@@ -1,5 +1,5 @@
1
- import { defineComponent as b, ref as T, watch as x, onMounted as v, onBeforeUnmount as z, openBlock as _, createElementBlock as A } from "vue";
2
- const g = "cartocss", P = {
1
+ import { defineComponent as b, ref as T, watch as k, onMounted as v, onBeforeUnmount as z, openBlock as S, createElementBlock as _ } from "vue";
2
+ const y = "cartocss", A = {
3
3
  defaultToken: "",
4
4
  tokenPostfix: ".cartocss",
5
5
  ignoreCase: !0,
@@ -47,7 +47,7 @@ const g = "cartocss", P = {
47
47
  { open: '"', close: '"' },
48
48
  { open: "'", close: "'" }
49
49
  ]
50
- }, w = [
50
+ }, C = [
51
51
  "image-filters",
52
52
  "image-filters-inflate",
53
53
  "direct-image-filters",
@@ -257,7 +257,7 @@ const g = "cartocss", P = {
257
257
  "dot-width",
258
258
  "dot-height",
259
259
  "dot-comp-op"
260
- ], S = {
260
+ ], P = {
261
261
  "polygon-fill": "Fill color to assign to a polygon. Type: color.",
262
262
  "polygon-opacity": "The opacity of the polygon (0-1). Type: float.",
263
263
  "line-color": "The color of a drawn line. Type: color.",
@@ -277,56 +277,56 @@ const g = "cartocss", P = {
277
277
  "comp-op": "Composite operation. Defines how this layer behaves relative to layers atop or below it. Type: keyword.",
278
278
  opacity: "An alpha value for the style (0-1). Type: float."
279
279
  };
280
- let k = !1;
281
- function j(a, n) {
282
- if (n < 1) return null;
283
- const l = a.substring(0, n - 1).match(/[a-zA-Z_-]+$/);
284
- if (!l) return null;
285
- const t = l[0], e = n - t.length;
286
- return { prefix: t, startColumn: e, endColumn: n };
280
+ let w = !1;
281
+ function M(l, a) {
282
+ if (a < 1) return null;
283
+ const r = l.substring(0, a - 1).match(/[a-zA-Z_-]+$/);
284
+ if (!r) return null;
285
+ const o = r[0], e = a - o.length;
286
+ return { prefix: o, startColumn: e, endColumn: a };
287
287
  }
288
- function M(a, n) {
288
+ function O(l, a) {
289
289
  const i = /[a-zA-Z_-]+\s*:/g;
290
- let l;
291
- for (; (l = i.exec(a)) !== null; ) {
292
- const t = l[0].replace(/\s*:$/, "").trim(), e = l.index + 1, o = l.index + l[0].length, s = a.substring(o).indexOf(";"), y = s >= 0 ? o + s + 1 : a.length + 1;
293
- if (n >= e && n <= y)
294
- return w.includes(t) ? t : null;
290
+ let r;
291
+ for (; (r = i.exec(l)) !== null; ) {
292
+ const o = r[0].replace(/\s*:$/, "").trim(), e = r.index + 1, t = r.index + r[0].length, s = l.substring(t).indexOf(";"), x = s >= 0 ? t + s + 1 : l.length + 1;
293
+ if (a >= e && a <= x)
294
+ return C.includes(o) ? o : null;
295
295
  }
296
296
  return null;
297
297
  }
298
- function Z(a) {
299
- k || (k = !0, a.languages.register({ id: g }), a.languages.setMonarchTokensProvider(g, P), a.languages.setLanguageConfiguration(g, L), a.languages.registerCompletionItemProvider(g, {
300
- provideCompletionItems(n, i) {
301
- const l = n.getLineContent(i.lineNumber), t = j(l, i.column), e = ((t == null ? void 0 : t.prefix) ?? "").toLowerCase(), o = t && t.startColumn >= 1 ? {
298
+ function E(l) {
299
+ w || (w = !0, l.languages.register({ id: y }), l.languages.setMonarchTokensProvider(y, A), l.languages.setLanguageConfiguration(y, L), l.languages.registerCompletionItemProvider(y, {
300
+ provideCompletionItems(a, i) {
301
+ const r = a.getLineContent(i.lineNumber), o = M(r, i.column), e = ((o == null ? void 0 : o.prefix) ?? "").toLowerCase(), t = o && o.startColumn >= 1 ? {
302
302
  startLineNumber: i.lineNumber,
303
- startColumn: t.startColumn,
303
+ startColumn: o.startColumn,
304
304
  endLineNumber: i.lineNumber,
305
- endColumn: t.endColumn
305
+ endColumn: o.endColumn
306
306
  } : void 0;
307
- return { suggestions: w.filter(
307
+ return { suggestions: C.filter(
308
308
  (s) => !e || s.toLowerCase().includes(e) || s.toLowerCase().startsWith(e)
309
309
  ).map((s) => ({
310
310
  label: s,
311
- kind: a.languages.CompletionItemKind.Property,
311
+ kind: l.languages.CompletionItemKind.Property,
312
312
  insertText: s + ": ",
313
- ...o && { range: o }
313
+ ...t && { range: t }
314
314
  })) };
315
315
  }
316
- }), a.languages.registerHoverProvider(g, {
317
- provideHover(n, i) {
318
- const l = n.getLineContent(i.lineNumber), t = M(l, i.column);
319
- if (!t) return;
320
- const e = S[t];
316
+ }), l.languages.registerHoverProvider(y, {
317
+ provideHover(a, i) {
318
+ const r = a.getLineContent(i.lineNumber), o = O(r, i.column);
319
+ if (!o) return;
320
+ const e = P[o];
321
321
  return {
322
- contents: [{ value: `**${t}**
322
+ contents: [{ value: `**${o}**
323
323
 
324
324
  ${e ?? "CartoCSS property (Mapnik)."}` }]
325
325
  };
326
326
  }
327
327
  }));
328
328
  }
329
- const E = /* @__PURE__ */ b({
329
+ const Z = /* @__PURE__ */ b({
330
330
  __name: "MonacoEditor",
331
331
  props: {
332
332
  modelValue: {},
@@ -334,75 +334,94 @@ const E = /* @__PURE__ */ b({
334
334
  theme: {}
335
335
  },
336
336
  emits: ["update:modelValue", "load"],
337
- setup(a, { emit: n }) {
338
- const i = a, l = n, t = T(null);
339
- let e = null, o = null, c = !1;
337
+ setup(l, { emit: a }) {
338
+ const i = l, r = a, o = T(null);
339
+ let e = null, t = null, f = !1;
340
340
  function s() {
341
- return new Promise((r, p) => {
342
- if (o) return r(o);
341
+ return new Promise((n, m) => {
342
+ if (t) return n(t);
343
343
  if (window.monaco)
344
- return o = window.monaco, r(o);
345
- const f = (u) => {
346
- if ([...document.styleSheets].some((h) => {
347
- var m;
348
- return (m = h == null ? void 0 : h.href) == null ? void 0 : m.includes(u);
344
+ return t = window.monaco, n(t);
345
+ const u = (c) => {
346
+ if ([...document.styleSheets].some((g) => {
347
+ var h;
348
+ return (h = g == null ? void 0 : g.href) == null ? void 0 : h.includes(c);
349
349
  })) return;
350
- const d = document.createElement("link");
351
- d.rel = "stylesheet", d.href = u, document.head.appendChild(d);
352
- }, C = (u) => new Promise((d, h) => {
353
- const m = document.createElement("script");
354
- m.src = u, m.onload = () => d(!0), m.onerror = h, document.body.appendChild(m);
350
+ const p = document.createElement("link");
351
+ p.rel = "stylesheet", p.href = c, document.head.appendChild(p);
352
+ }, d = (c) => new Promise((p, g) => {
353
+ const h = document.createElement("script");
354
+ h.src = c, h.onload = () => p(!0), h.onerror = g, document.body.appendChild(h);
355
355
  });
356
- f("https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs/editor/editor.main.min.css"), C("https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs/loader.min.js").then(() => {
356
+ u("https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs/editor/editor.main.min.css"), d("https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs/loader.min.js").then(() => {
357
357
  window.require.config({
358
358
  paths: { vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs" }
359
359
  }), window.require(["vs/editor/editor.main"], () => {
360
- o = window.monaco, r(o);
360
+ t = window.monaco, n(t);
361
361
  });
362
- }).catch(p);
362
+ }).catch(m);
363
363
  });
364
364
  }
365
- function y() {
366
- var p, f;
367
- if (!t.value || !o) return;
368
- e && e.dispose(), e = o.editor.create(t.value, {
369
- value: i.modelValue || "",
370
- language: i.language || "yaml",
365
+ function x() {
366
+ var c, p;
367
+ if (!o.value || !t) return;
368
+ e && e.dispose();
369
+ const n = i.language || "yaml", m = t.editor.createModel(i.modelValue || "", n), u = n === "cartocss" ? {
370
+ acceptSuggestionOnCommitCharacter: !1,
371
+ acceptSuggestionOnEnter: "off",
372
+ snippetSuggestions: "none",
373
+ tabCompletion: "off",
374
+ wordBasedSuggestions: "off"
375
+ } : {};
376
+ e = t.editor.create(o.value, {
377
+ model: m,
371
378
  theme: i.theme || "vs-light",
372
379
  automaticLayout: !0,
373
- minimap: { enabled: !1 }
374
- }), (i.language || "yaml") === "css" && ((f = (p = o.languages) == null ? void 0 : p.css) != null && f.cssDefaults) && o.languages.css.cssDefaults.setDiagnosticsOptions({
380
+ minimap: { enabled: !1 },
381
+ ...u
382
+ });
383
+ const d = n;
384
+ t.editor.setModelLanguage(m, d), d === "css" && ((p = (c = t.languages) == null ? void 0 : c.css) != null && p.cssDefaults) && t.languages.css.cssDefaults.setDiagnosticsOptions({
375
385
  validate: !1,
376
386
  lint: {}
377
387
  }), e.onDidChangeModelContent(() => {
378
- c || l("update:modelValue", e.getValue());
388
+ f || r("update:modelValue", e.getValue());
379
389
  });
380
390
  }
381
- return x(
391
+ return k(
382
392
  () => i.modelValue,
383
- (r) => {
393
+ (n) => {
384
394
  if (!e) return;
385
- const p = e.getValue();
386
- r !== p && (c = !0, e.setValue(r || ""), c = !1);
395
+ const m = e.getModel();
396
+ if (!m) return;
397
+ const u = m.getValue();
398
+ if (n !== u) {
399
+ const d = e.getPosition(), c = e.getSelection(), p = e.getScrollTop(), g = e.getScrollLeft();
400
+ f = !0, e.executeEdits("external-model-sync", [{
401
+ range: m.getFullModelRange(),
402
+ text: n || "",
403
+ forceMoveMarkers: !0
404
+ }]), c && e.setSelection(c), d && e.setPosition(d), e.setScrollTop(p), e.setScrollLeft(g), f = !1;
405
+ }
387
406
  }
388
- ), x(
407
+ ), k(
389
408
  () => i.language,
390
- (r) => {
391
- e && o && o.editor.setModelLanguage(e.getModel(), r || "yaml");
409
+ (n) => {
410
+ e && t && t.editor.setModelLanguage(e.getModel(), n || "yaml");
392
411
  }
393
- ), x(() => i.theme, (r) => {
394
- e && o && o.editor.setTheme(r || "vs-light");
412
+ ), k(() => i.theme, (n) => {
413
+ e && t && t.editor.setTheme(n || "vs-light");
395
414
  }), v(async () => {
396
- await s(), Z(o), y();
415
+ await s(), E(t), x();
397
416
  }), z(() => {
398
417
  e && e.dispose();
399
- }), (r, p) => (_(), A("div", {
418
+ }), (n, m) => (S(), _("div", {
400
419
  ref_key: "editorContainer",
401
- ref: t,
420
+ ref: o,
402
421
  class: "w-full h-full"
403
422
  }, null, 512));
404
423
  }
405
424
  });
406
425
  export {
407
- E as _
426
+ Z as _
408
427
  };