geostyler 18.2.0 → 18.2.1
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as l } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as de, useState as p, useMemo as me, useEffect as C, useCallback as pe } from "react";
|
|
3
3
|
import { useMonaco as fe, Editor as ue } from "@monaco-editor/react";
|
|
4
4
|
import { saveAs as ge } from "file-saver";
|
|
@@ -12,34 +12,34 @@ import { SldStyleParser as J } from "geostyler-sld-parser";
|
|
|
12
12
|
import { SLDUnitsSelect as ve } from "../Symbolizer/SLDUnitsSelect/SLDUnitsSelect.js";
|
|
13
13
|
import { usePrevious as B } from "../../hook/UsePrevious.js";
|
|
14
14
|
import { ParserFeedback as H } from "../ParserFeedback/ParserFeedback.js";
|
|
15
|
-
import { QGISStyleParser as ke } from "geostyler-qgis-parser";
|
|
16
15
|
import { MapboxStyleParser as I } from "geostyler-mapbox-parser";
|
|
17
|
-
import { useGeoStylerLocale as
|
|
18
|
-
|
|
16
|
+
import { useGeoStylerLocale as ke } from "../../context/GeoStylerContext/GeoStylerContext.js";
|
|
17
|
+
import { QGISStyleParser as Fe } from "geostyler-qgis-parser";
|
|
18
|
+
const $ = M.Option, G = "geostyler.json", Ne = D.$id, u = (r) => {
|
|
19
19
|
let c = {
|
|
20
20
|
extension: ".txt",
|
|
21
21
|
language: "plaintext",
|
|
22
22
|
mimeType: "text/plain"
|
|
23
23
|
};
|
|
24
|
-
return
|
|
24
|
+
return r && r.title === J.title ? c = {
|
|
25
25
|
extension: ".sld",
|
|
26
26
|
language: "xml",
|
|
27
27
|
mimeType: "text/xml"
|
|
28
|
-
} :
|
|
28
|
+
} : r && r.title === Fe.title ? c = {
|
|
29
29
|
extension: ".qml",
|
|
30
30
|
language: "xml",
|
|
31
31
|
mimeType: "text/xml"
|
|
32
|
-
} :
|
|
32
|
+
} : r && r.title === I.title ? c = {
|
|
33
33
|
extension: ".json",
|
|
34
34
|
language: "json",
|
|
35
35
|
mimeType: "application/json"
|
|
36
|
-
} :
|
|
36
|
+
} : r === void 0 && (c = {
|
|
37
37
|
extension: ".json",
|
|
38
38
|
language: "json",
|
|
39
39
|
mimeType: "application/json"
|
|
40
40
|
}), c;
|
|
41
41
|
}, Ve = ({
|
|
42
|
-
defaultParser:
|
|
42
|
+
defaultParser: r,
|
|
43
43
|
delay: c = 500,
|
|
44
44
|
onStyleChange: v = () => {
|
|
45
45
|
},
|
|
@@ -49,9 +49,9 @@ const $ = M.Option, G = "geostyler.json", Ne = D.$id, u = (m) => {
|
|
|
49
49
|
showUploadButton: W = !1,
|
|
50
50
|
showCopyButton: q = !1,
|
|
51
51
|
showSaveButton: _ = !1,
|
|
52
|
-
style:
|
|
52
|
+
style: d
|
|
53
53
|
}) => {
|
|
54
|
-
const
|
|
54
|
+
const m = ke("CodeEditor"), F = de(void 0), [o, z] = p(r), [g, f] = p(""), [n, N] = p(), [i, h] = p(), [T, Q] = p(!1), [K, X] = p(!1), w = B(d), j = B(o), b = fe(), Y = me(() => u(o).extension, [o]);
|
|
55
55
|
C(() => {
|
|
56
56
|
if (n != null && n.output) {
|
|
57
57
|
const t = u(o);
|
|
@@ -78,16 +78,16 @@ const $ = M.Option, G = "geostyler.json", Ne = D.$id, u = (m) => {
|
|
|
78
78
|
}
|
|
79
79
|
}, [o]);
|
|
80
80
|
if (C(() => {
|
|
81
|
-
(!P(w,
|
|
82
|
-
}, [o,
|
|
81
|
+
(!P(w, d) || !P(j, o)) && y(d);
|
|
82
|
+
}, [o, d, y, w, j]), K)
|
|
83
83
|
return /* @__PURE__ */ s("h1", { children: "An error occurred in the CodeEditor UI." });
|
|
84
84
|
const E = async (t) => {
|
|
85
85
|
f(t), h(void 0);
|
|
86
86
|
try {
|
|
87
87
|
let e;
|
|
88
88
|
if (o) {
|
|
89
|
-
let
|
|
90
|
-
o instanceof I ?
|
|
89
|
+
let a;
|
|
90
|
+
o instanceof I ? a = await o.readStyle(JSON.parse(t)) : a = await o.readStyle(t), h(a), v(a.output);
|
|
91
91
|
} else
|
|
92
92
|
e = JSON.parse(t), v(e);
|
|
93
93
|
} catch (e) {
|
|
@@ -96,12 +96,12 @@ const $ = M.Option, G = "geostyler.json", Ne = D.$id, u = (m) => {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
}, Z = (t) => {
|
|
99
|
-
const e = k.find((
|
|
99
|
+
const e = k.find((a) => a.title === t);
|
|
100
100
|
V(e), z(e);
|
|
101
101
|
}, R = (t) => {
|
|
102
102
|
if (o) {
|
|
103
103
|
const e = o;
|
|
104
|
-
e.symbolizerUnits = t, y(
|
|
104
|
+
e.symbolizerUnits = t, y(d);
|
|
105
105
|
}
|
|
106
106
|
}, ee = (t) => {
|
|
107
107
|
clearTimeout(F.current), F.current = window.setTimeout(
|
|
@@ -122,30 +122,30 @@ const $ = M.Option, G = "geostyler.json", Ne = D.$id, u = (m) => {
|
|
|
122
122
|
const te = (t) => {
|
|
123
123
|
const e = new FileReader();
|
|
124
124
|
e.onload = () => {
|
|
125
|
-
const
|
|
126
|
-
E(
|
|
125
|
+
const a = e.result;
|
|
126
|
+
E(a);
|
|
127
127
|
}, e.readAsText(t.fileList[0].originFileObj);
|
|
128
128
|
}, ne = () => {
|
|
129
|
-
if (
|
|
129
|
+
if (d) {
|
|
130
130
|
const t = u(o);
|
|
131
|
-
let e =
|
|
131
|
+
let e = d.name;
|
|
132
132
|
e += t.extension;
|
|
133
|
-
const
|
|
134
|
-
ge(
|
|
133
|
+
const a = `${t.mimeType};charset=utf-8`, ce = new Blob([g], { type: a });
|
|
134
|
+
ge(ce, e);
|
|
135
135
|
}
|
|
136
136
|
}, se = (t) => {
|
|
137
137
|
const e = document.createElement("textarea");
|
|
138
138
|
e.value = t, e.setAttribute("readonly", ""), e.style.position = "absolute", e.style.left = "-9999px", document.body.appendChild(e);
|
|
139
|
-
const
|
|
140
|
-
e.select(), document.execCommand("copy"), document.body.removeChild(e), Ce.info(
|
|
141
|
-
},
|
|
139
|
+
const a = document.getSelection().rangeCount > 0 ? document.getSelection().getRangeAt(0) : !1;
|
|
140
|
+
e.select(), document.execCommand("copy"), document.body.removeChild(e), Ce.info(m.styleCopied), a && (document.getSelection().removeAllRanges(), document.getSelection().addRange(a));
|
|
141
|
+
}, ie = () => {
|
|
142
142
|
se(g);
|
|
143
143
|
}, O = () => {
|
|
144
144
|
Q(!T);
|
|
145
|
-
},
|
|
146
|
-
return /* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
|
|
145
|
+
}, ae = o && o instanceof J && o.sldVersion !== "1.0.0", A = (n == null ? void 0 : n.errors) || (n == null ? void 0 : n.warnings) || (n == null ? void 0 : n.unsupportedProperties), L = (i == null ? void 0 : i.errors) || (i == null ? void 0 : i.warnings) || (i == null ? void 0 : i.unsupportedProperties), U = (n == null ? void 0 : n.errors) || (i == null ? void 0 : i.errors), re = L || A && !U, le = T ? "feedback-visible" : "feedback-hidden";
|
|
146
|
+
return /* @__PURE__ */ l("div", { className: "gs-code-editor", children: [
|
|
147
|
+
/* @__PURE__ */ l("div", { className: "gs-code-editor-toolbar", children: [
|
|
148
|
+
m.formatSelectLabel,
|
|
149
149
|
": ",
|
|
150
150
|
/* @__PURE__ */ s(
|
|
151
151
|
M,
|
|
@@ -156,7 +156,7 @@ const $ = M.Option, G = "geostyler.json", Ne = D.$id, u = (m) => {
|
|
|
156
156
|
children: x
|
|
157
157
|
}
|
|
158
158
|
),
|
|
159
|
-
|
|
159
|
+
ae && /* @__PURE__ */ s(ve, { changeHandler: R }),
|
|
160
160
|
W && /* @__PURE__ */ s(
|
|
161
161
|
xe,
|
|
162
162
|
{
|
|
@@ -170,7 +170,7 @@ const $ = M.Option, G = "geostyler.json", Ne = D.$id, u = (m) => {
|
|
|
170
170
|
className: "gs-code-editor-upload-button",
|
|
171
171
|
icon: /* @__PURE__ */ s(he, {}),
|
|
172
172
|
type: "primary",
|
|
173
|
-
children:
|
|
173
|
+
children: m.uploadButtonLabel
|
|
174
174
|
}
|
|
175
175
|
)
|
|
176
176
|
}
|
|
@@ -186,29 +186,29 @@ const $ = M.Option, G = "geostyler.json", Ne = D.$id, u = (m) => {
|
|
|
186
186
|
onChange: ee
|
|
187
187
|
}
|
|
188
188
|
),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
A && /* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */ s("span", { children: `${
|
|
189
|
+
/* @__PURE__ */ l("div", { className: `gs-code-editor-feedback ${le}`, children: [
|
|
190
|
+
A && /* @__PURE__ */ l("div", { className: "write-feedback", children: [
|
|
191
|
+
/* @__PURE__ */ s("span", { children: `${m.writeFeedback} ${o == null ? void 0 : o.title}` }),
|
|
192
192
|
/* @__PURE__ */ s(H, { feedback: n })
|
|
193
193
|
] }),
|
|
194
|
-
L && /* @__PURE__ */
|
|
195
|
-
/* @__PURE__ */ s("span", { children: `${
|
|
196
|
-
/* @__PURE__ */ s(H, { feedback:
|
|
194
|
+
L && /* @__PURE__ */ l("div", { className: "read-feedback", children: [
|
|
195
|
+
/* @__PURE__ */ s("span", { children: `${m.readFeedback} ${o == null ? void 0 : o.title}` }),
|
|
196
|
+
/* @__PURE__ */ s(H, { feedback: i })
|
|
197
197
|
] })
|
|
198
198
|
] }),
|
|
199
|
-
/* @__PURE__ */
|
|
200
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ l("div", { className: "gs-code-editor-bottombar", children: [
|
|
200
|
+
/* @__PURE__ */ l("div", { className: "left-items", children: [
|
|
201
201
|
U && /* @__PURE__ */ s(be, { twoToneColor: "#ff4d4f", onClick: O }),
|
|
202
202
|
re && /* @__PURE__ */ s(ye, { twoToneColor: "#faad14", onClick: O })
|
|
203
203
|
] }),
|
|
204
|
-
/* @__PURE__ */
|
|
204
|
+
/* @__PURE__ */ l("div", { className: "center-items", children: [
|
|
205
205
|
q && /* @__PURE__ */ s(
|
|
206
206
|
S,
|
|
207
207
|
{
|
|
208
208
|
className: "gs-code-editor-copy-button",
|
|
209
209
|
type: "primary",
|
|
210
|
-
onClick:
|
|
211
|
-
children:
|
|
210
|
+
onClick: ie,
|
|
211
|
+
children: m.copyButtonLabel
|
|
212
212
|
}
|
|
213
213
|
),
|
|
214
214
|
_ && /* @__PURE__ */ s(
|
|
@@ -217,7 +217,7 @@ const $ = M.Option, G = "geostyler.json", Ne = D.$id, u = (m) => {
|
|
|
217
217
|
className: "gs-code-editor-download-button",
|
|
218
218
|
type: "primary",
|
|
219
219
|
onClick: ne,
|
|
220
|
-
children:
|
|
220
|
+
children: m.downloadButtonLabel
|
|
221
221
|
}
|
|
222
222
|
)
|
|
223
223
|
] }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "geostyler",
|
|
3
|
-
"version": "18.2.
|
|
3
|
+
"version": "18.2.1",
|
|
4
4
|
"description": "Framework for styling geodata",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"replace-in-file": "^7.2.0",
|
|
145
145
|
"rimraf": "^5.0.7",
|
|
146
146
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
147
|
-
"semantic-release": "^
|
|
147
|
+
"semantic-release": "^25.0.2",
|
|
148
148
|
"stream": "^0.0.3",
|
|
149
149
|
"terser-webpack-plugin": "^5.3.10",
|
|
150
150
|
"ts-loader": "^9.5.1",
|