@commercelayer/app-elements 3.0.0 → 3.0.2
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/dist/{CodeEditorComponent-DKQNsw4L.js → CodeEditorComponent-DeMNu7xm.js} +176 -174
- package/dist/{InputDateComponent-vJauylce.js → InputDateComponent-BOCz0EW8.js} +1 -1
- package/dist/{main-CJx2CWKA.js → main-BsOBR6bj.js} +2567 -2562
- package/dist/main.js +1 -1
- package/dist/providers/TokenProvider/extras.d.ts +5 -1
- package/dist/providers/TokenProvider/types.d.ts +2 -0
- package/dist/ui/forms/CodeEditor/CodeEditorComponent.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { j as se, I as Ee } from "./main-
|
|
3
|
-
import
|
|
4
|
-
function
|
|
2
|
+
import { j as se, I as Ee } from "./main-BsOBR6bj.js";
|
|
3
|
+
import z, { memo as ce, useState as U, useRef as w, useCallback as ue, useEffect as $, forwardRef as Ce } from "react";
|
|
4
|
+
function Ie(e, t, r) {
|
|
5
5
|
return t in e ? Object.defineProperty(e, t, {
|
|
6
6
|
value: r,
|
|
7
7
|
enumerable: !0,
|
|
@@ -23,7 +23,7 @@ function de(e) {
|
|
|
23
23
|
for (var t = 1; t < arguments.length; t++) {
|
|
24
24
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
25
25
|
t % 2 ? fe(Object(r), !0).forEach(function(n) {
|
|
26
|
-
|
|
26
|
+
Ie(e, n, r[n]);
|
|
27
27
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : fe(Object(r)).forEach(function(n) {
|
|
28
28
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
29
29
|
});
|
|
@@ -48,19 +48,19 @@ function Le(e, t) {
|
|
|
48
48
|
return r;
|
|
49
49
|
}
|
|
50
50
|
function Ae(e, t) {
|
|
51
|
-
return
|
|
51
|
+
return xe(e) || De(e, t) || Te(e, t) || Re();
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function xe(e) {
|
|
54
54
|
if (Array.isArray(e)) return e;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function De(e, t) {
|
|
57
57
|
if (!(typeof Symbol > "u" || !(Symbol.iterator in Object(e)))) {
|
|
58
58
|
var r = [], n = !0, i = !1, o = void 0;
|
|
59
59
|
try {
|
|
60
|
-
for (var a = e[Symbol.iterator](),
|
|
60
|
+
for (var a = e[Symbol.iterator](), l; !(n = (l = a.next()).done) && (r.push(l.value), !(t && r.length === t)); n = !0)
|
|
61
61
|
;
|
|
62
|
-
} catch (
|
|
63
|
-
i = !0, o =
|
|
62
|
+
} catch (p) {
|
|
63
|
+
i = !0, o = p;
|
|
64
64
|
} finally {
|
|
65
65
|
try {
|
|
66
66
|
!n && a.return != null && a.return();
|
|
@@ -131,9 +131,9 @@ function H(e) {
|
|
|
131
131
|
for (var r = this, n = arguments.length, i = new Array(n), o = 0; o < n; o++)
|
|
132
132
|
i[o] = arguments[o];
|
|
133
133
|
return i.length >= e.length ? e.apply(this, i) : function() {
|
|
134
|
-
for (var a = arguments.length,
|
|
135
|
-
|
|
136
|
-
return t.apply(r, [].concat(i,
|
|
134
|
+
for (var a = arguments.length, l = new Array(a), p = 0; p < a; p++)
|
|
135
|
+
l[p] = arguments[p];
|
|
136
|
+
return t.apply(r, [].concat(i, l));
|
|
137
137
|
};
|
|
138
138
|
};
|
|
139
139
|
}
|
|
@@ -150,20 +150,20 @@ function Ve(e, t) {
|
|
|
150
150
|
return Object.prototype.hasOwnProperty.call(e, t);
|
|
151
151
|
}
|
|
152
152
|
function ze(e, t) {
|
|
153
|
-
return ee(t) ||
|
|
153
|
+
return ee(t) || D("changeType"), Object.keys(t).some(function(r) {
|
|
154
154
|
return !Ve(e, r);
|
|
155
|
-
}) &&
|
|
155
|
+
}) && D("changeField"), t;
|
|
156
156
|
}
|
|
157
157
|
function Ue(e) {
|
|
158
|
-
K(e) ||
|
|
158
|
+
K(e) || D("selectorType");
|
|
159
159
|
}
|
|
160
160
|
function We(e) {
|
|
161
|
-
K(e) || ee(e) ||
|
|
161
|
+
K(e) || ee(e) || D("handlerType"), ee(e) && Object.values(e).some(function(t) {
|
|
162
162
|
return !K(t);
|
|
163
|
-
}) &&
|
|
163
|
+
}) && D("handlersType");
|
|
164
164
|
}
|
|
165
165
|
function Fe(e) {
|
|
166
|
-
e ||
|
|
166
|
+
e || D("initialIsRequired"), ee(e) || D("initialType"), qe(e) && D("initialContent");
|
|
167
167
|
}
|
|
168
168
|
function ke(e, t) {
|
|
169
169
|
throw new Error(e[t] || e.default);
|
|
@@ -178,7 +178,7 @@ var He = {
|
|
|
178
178
|
changeType: "provided value of changes should be an object",
|
|
179
179
|
changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
|
|
180
180
|
default: "an unknown error accured in `state-local` package"
|
|
181
|
-
},
|
|
181
|
+
}, D = H(ke)(He), Q = {
|
|
182
182
|
changes: ze,
|
|
183
183
|
selector: Ue,
|
|
184
184
|
handler: We,
|
|
@@ -190,16 +190,16 @@ function Be(e) {
|
|
|
190
190
|
var r = {
|
|
191
191
|
current: e
|
|
192
192
|
}, n = H(Je)(r, t), i = H(Ge)(r), o = H(Q.changes)(e), a = H(Ke)(r);
|
|
193
|
-
function
|
|
194
|
-
var
|
|
193
|
+
function l() {
|
|
194
|
+
var g = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(y) {
|
|
195
195
|
return y;
|
|
196
196
|
};
|
|
197
|
-
return Q.selector(
|
|
197
|
+
return Q.selector(g), g(r.current);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
_e(n, i, o, a)(
|
|
199
|
+
function p(g) {
|
|
200
|
+
_e(n, i, o, a)(g);
|
|
201
201
|
}
|
|
202
|
-
return [
|
|
202
|
+
return [l, p];
|
|
203
203
|
}
|
|
204
204
|
function Ke(e, t) {
|
|
205
205
|
return K(t) ? t(e.current) : t;
|
|
@@ -225,9 +225,9 @@ function Qe(e) {
|
|
|
225
225
|
for (var r = this, n = arguments.length, i = new Array(n), o = 0; o < n; o++)
|
|
226
226
|
i[o] = arguments[o];
|
|
227
227
|
return i.length >= e.length ? e.apply(this, i) : function() {
|
|
228
|
-
for (var a = arguments.length,
|
|
229
|
-
|
|
230
|
-
return t.apply(r, [].concat(i,
|
|
228
|
+
for (var a = arguments.length, l = new Array(a), p = 0; p < a; p++)
|
|
229
|
+
l[p] = arguments[p];
|
|
230
|
+
return t.apply(r, [].concat(i, l));
|
|
231
231
|
};
|
|
232
232
|
};
|
|
233
233
|
}
|
|
@@ -383,11 +383,11 @@ var oe = new Promise(function(e, t) {
|
|
|
383
383
|
__getMonacoInstance: pt
|
|
384
384
|
}, gt = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, ae = gt, ht = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, mt = ht;
|
|
385
385
|
function vt({ children: e }) {
|
|
386
|
-
return
|
|
386
|
+
return z.createElement("div", { style: mt.container }, e);
|
|
387
387
|
}
|
|
388
388
|
var bt = vt, wt = bt;
|
|
389
389
|
function yt({ width: e, height: t, isEditorReady: r, loading: n, _ref: i, className: o, wrapperProps: a }) {
|
|
390
|
-
return
|
|
390
|
+
return z.createElement("section", { style: { ...ae.wrapper, width: e, height: t }, ...a }, !r && z.createElement(wt, null, n), z.createElement("div", { ref: i, style: { ...ae.fullWidth, ...!r && ae.hide }, className: o }));
|
|
391
391
|
}
|
|
392
392
|
var Ot = yt, je = ce(Ot);
|
|
393
393
|
function jt(e) {
|
|
@@ -400,10 +400,10 @@ function Mt(e, t, r = !0) {
|
|
|
400
400
|
n.current = !1;
|
|
401
401
|
} : e, t);
|
|
402
402
|
}
|
|
403
|
-
var
|
|
403
|
+
var E = Mt;
|
|
404
404
|
function B() {
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function V(e, t, r, n) {
|
|
407
407
|
return St(e, n) || Pt(e, t, r, n);
|
|
408
408
|
}
|
|
409
409
|
function St(e, t) {
|
|
@@ -415,63 +415,63 @@ function Pt(e, t, r, n) {
|
|
|
415
415
|
function Me(e, t) {
|
|
416
416
|
return e.Uri.parse(t);
|
|
417
417
|
}
|
|
418
|
-
function Et({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: i, originalModelPath: o, modifiedModelPath: a, keepCurrentOriginalModel:
|
|
419
|
-
let [j,
|
|
418
|
+
function Et({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: i, originalModelPath: o, modifiedModelPath: a, keepCurrentOriginalModel: l = !1, keepCurrentModifiedModel: p = !1, theme: g = "light", loading: y = "Loading...", options: O = {}, height: T = "100%", width: L = "100%", className: J, wrapperProps: I = {}, beforeMount: C = B, onMount: A = B }) {
|
|
419
|
+
let [j, R] = U(!1), [m, b] = U(!0), d = w(null), s = w(null), M = w(null), S = w(A), f = w(C), N = w(!1);
|
|
420
420
|
le(() => {
|
|
421
421
|
let u = te.init();
|
|
422
|
-
return u.then((h) => (
|
|
423
|
-
}),
|
|
424
|
-
if (
|
|
425
|
-
let u =
|
|
422
|
+
return u.then((h) => (s.current = h) && b(!1)).catch((h) => (h == null ? void 0 : h.type) !== "cancelation" && console.error("Monaco initialization: error:", h)), () => d.current ? W() : u.cancel();
|
|
423
|
+
}), E(() => {
|
|
424
|
+
if (d.current && s.current) {
|
|
425
|
+
let u = d.current.getOriginalEditor(), h = V(s.current, e || "", n || r || "text", o || "");
|
|
426
426
|
h !== u.getModel() && u.setModel(h);
|
|
427
427
|
}
|
|
428
|
-
}, [o], j),
|
|
429
|
-
if (
|
|
430
|
-
let u =
|
|
428
|
+
}, [o], j), E(() => {
|
|
429
|
+
if (d.current && s.current) {
|
|
430
|
+
let u = d.current.getModifiedEditor(), h = V(s.current, t || "", i || r || "text", a || "");
|
|
431
431
|
h !== u.getModel() && u.setModel(h);
|
|
432
432
|
}
|
|
433
|
-
}, [a], j),
|
|
434
|
-
let u =
|
|
435
|
-
u.getOption(
|
|
436
|
-
}, [t], j),
|
|
433
|
+
}, [a], j), E(() => {
|
|
434
|
+
let u = d.current.getModifiedEditor();
|
|
435
|
+
u.getOption(s.current.editor.EditorOption.readOnly) ? u.setValue(t || "") : t !== u.getValue() && (u.executeEdits("", [{ range: u.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), u.pushUndoStop());
|
|
436
|
+
}, [t], j), E(() => {
|
|
437
437
|
var u, h;
|
|
438
|
-
(h = (u =
|
|
439
|
-
}, [e], j),
|
|
440
|
-
let { original: u, modified: h } =
|
|
441
|
-
|
|
442
|
-
}, [r, n, i], j),
|
|
438
|
+
(h = (u = d.current) == null ? void 0 : u.getModel()) == null || h.original.setValue(e || "");
|
|
439
|
+
}, [e], j), E(() => {
|
|
440
|
+
let { original: u, modified: h } = d.current.getModel();
|
|
441
|
+
s.current.editor.setModelLanguage(u, n || r || "text"), s.current.editor.setModelLanguage(h, i || r || "text");
|
|
442
|
+
}, [r, n, i], j), E(() => {
|
|
443
443
|
var u;
|
|
444
|
-
(u =
|
|
445
|
-
}, [
|
|
444
|
+
(u = s.current) == null || u.editor.setTheme(g);
|
|
445
|
+
}, [g], j), E(() => {
|
|
446
446
|
var u;
|
|
447
|
-
(u =
|
|
447
|
+
(u = d.current) == null || u.updateOptions(O);
|
|
448
448
|
}, [O], j);
|
|
449
449
|
let Y = ue(() => {
|
|
450
|
-
var
|
|
451
|
-
if (!
|
|
452
|
-
|
|
453
|
-
let u =
|
|
454
|
-
(
|
|
450
|
+
var x;
|
|
451
|
+
if (!s.current) return;
|
|
452
|
+
f.current(s.current);
|
|
453
|
+
let u = V(s.current, e || "", n || r || "text", o || ""), h = V(s.current, t || "", i || r || "text", a || "");
|
|
454
|
+
(x = d.current) == null || x.setModel({ original: u, modified: h });
|
|
455
455
|
}, [r, t, i, e, n, o, a]), Z = ue(() => {
|
|
456
456
|
var u;
|
|
457
|
-
!
|
|
458
|
-
}, [O,
|
|
457
|
+
!N.current && M.current && (d.current = s.current.editor.createDiffEditor(M.current, { automaticLayout: !0, ...O }), Y(), (u = s.current) == null || u.editor.setTheme(g), R(!0), N.current = !0);
|
|
458
|
+
}, [O, g, Y]);
|
|
459
459
|
$(() => {
|
|
460
|
-
j &&
|
|
460
|
+
j && S.current(d.current, s.current);
|
|
461
461
|
}, [j]), $(() => {
|
|
462
|
-
!
|
|
463
|
-
}, [
|
|
462
|
+
!m && !j && Z();
|
|
463
|
+
}, [m, j, Z]);
|
|
464
464
|
function W() {
|
|
465
|
-
var h,
|
|
466
|
-
let u = (h =
|
|
467
|
-
|
|
465
|
+
var h, x, _, F;
|
|
466
|
+
let u = (h = d.current) == null ? void 0 : h.getModel();
|
|
467
|
+
l || ((x = u == null ? void 0 : u.original) == null || x.dispose()), p || ((_ = u == null ? void 0 : u.modified) == null || _.dispose()), (F = d.current) == null || F.dispose();
|
|
468
468
|
}
|
|
469
|
-
return
|
|
469
|
+
return z.createElement(je, { width: L, height: T, isEditorReady: j, loading: y, _ref: M, className: J, wrapperProps: I });
|
|
470
470
|
}
|
|
471
|
-
var
|
|
472
|
-
ce(
|
|
473
|
-
function
|
|
474
|
-
let [e, t] =
|
|
471
|
+
var Ct = Et;
|
|
472
|
+
ce(Ct);
|
|
473
|
+
function It() {
|
|
474
|
+
let [e, t] = U(te.__getMonacoInstance());
|
|
475
475
|
return le(() => {
|
|
476
476
|
let r;
|
|
477
477
|
return e || (r = te.init(), r.then((n) => {
|
|
@@ -479,7 +479,7 @@ function Ct() {
|
|
|
479
479
|
})), () => r == null ? void 0 : r.cancel();
|
|
480
480
|
}), e;
|
|
481
481
|
}
|
|
482
|
-
var $t =
|
|
482
|
+
var $t = It;
|
|
483
483
|
function Lt(e) {
|
|
484
484
|
let t = w();
|
|
485
485
|
return $(() => {
|
|
@@ -487,72 +487,72 @@ function Lt(e) {
|
|
|
487
487
|
}, [e]), t.current;
|
|
488
488
|
}
|
|
489
489
|
var At = Lt, X = /* @__PURE__ */ new Map();
|
|
490
|
-
function
|
|
491
|
-
let [
|
|
490
|
+
function xt({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: i, path: o, theme: a = "light", line: l, loading: p = "Loading...", options: g = {}, overrideServices: y = {}, saveViewState: O = !0, keepCurrentModel: T = !1, width: L = "100%", height: J = "100%", className: I, wrapperProps: C = {}, beforeMount: A = B, onMount: j = B, onChange: R, onValidate: m = B }) {
|
|
491
|
+
let [b, d] = U(!1), [s, M] = U(!0), S = w(null), f = w(null), N = w(null), Y = w(j), Z = w(A), W = w(), u = w(n), h = At(o), x = w(!1), _ = w(!1);
|
|
492
492
|
le(() => {
|
|
493
|
-
let
|
|
494
|
-
return
|
|
495
|
-
}),
|
|
496
|
-
var
|
|
497
|
-
let
|
|
498
|
-
|
|
499
|
-
}, [o],
|
|
500
|
-
var
|
|
501
|
-
(
|
|
502
|
-
}, [
|
|
503
|
-
!
|
|
504
|
-
}, [n],
|
|
505
|
-
var
|
|
506
|
-
let
|
|
507
|
-
|
|
508
|
-
}, [i],
|
|
509
|
-
var
|
|
510
|
-
|
|
511
|
-
}, [
|
|
512
|
-
var
|
|
513
|
-
(
|
|
514
|
-
}, [a],
|
|
493
|
+
let c = te.init();
|
|
494
|
+
return c.then((v) => (S.current = v) && M(!1)).catch((v) => (v == null ? void 0 : v.type) !== "cancelation" && console.error("Monaco initialization: error:", v)), () => f.current ? Pe() : c.cancel();
|
|
495
|
+
}), E(() => {
|
|
496
|
+
var v, P, k, q;
|
|
497
|
+
let c = V(S.current, e || n || "", t || i || "", o || r || "");
|
|
498
|
+
c !== ((v = f.current) == null ? void 0 : v.getModel()) && (O && X.set(h, (P = f.current) == null ? void 0 : P.saveViewState()), (k = f.current) == null || k.setModel(c), O && ((q = f.current) == null || q.restoreViewState(X.get(o))));
|
|
499
|
+
}, [o], b), E(() => {
|
|
500
|
+
var c;
|
|
501
|
+
(c = f.current) == null || c.updateOptions(g);
|
|
502
|
+
}, [g], b), E(() => {
|
|
503
|
+
!f.current || n === void 0 || (f.current.getOption(S.current.editor.EditorOption.readOnly) ? f.current.setValue(n) : n !== f.current.getValue() && (_.current = !0, f.current.executeEdits("", [{ range: f.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), f.current.pushUndoStop(), _.current = !1));
|
|
504
|
+
}, [n], b), E(() => {
|
|
505
|
+
var v, P;
|
|
506
|
+
let c = (v = f.current) == null ? void 0 : v.getModel();
|
|
507
|
+
c && i && ((P = S.current) == null || P.editor.setModelLanguage(c, i));
|
|
508
|
+
}, [i], b), E(() => {
|
|
509
|
+
var c;
|
|
510
|
+
l !== void 0 && ((c = f.current) == null || c.revealLine(l));
|
|
511
|
+
}, [l], b), E(() => {
|
|
512
|
+
var c;
|
|
513
|
+
(c = S.current) == null || c.editor.setTheme(a);
|
|
514
|
+
}, [a], b);
|
|
515
515
|
let F = ue(() => {
|
|
516
|
-
var
|
|
517
|
-
if (!(!
|
|
518
|
-
Z.current(
|
|
519
|
-
let
|
|
520
|
-
|
|
516
|
+
var c;
|
|
517
|
+
if (!(!N.current || !S.current) && !x.current) {
|
|
518
|
+
Z.current(S.current);
|
|
519
|
+
let v = o || r, P = V(S.current, n || e || "", t || i || "", v || "");
|
|
520
|
+
f.current = (c = S.current) == null ? void 0 : c.editor.create(N.current, { model: P, automaticLayout: !0, ...g }, y), O && f.current.restoreViewState(X.get(v)), S.current.editor.setTheme(a), l !== void 0 && f.current.revealLine(l), d(!0), x.current = !0;
|
|
521
521
|
}
|
|
522
|
-
}, [e, t, r, n, i, o,
|
|
522
|
+
}, [e, t, r, n, i, o, g, y, O, a, l]);
|
|
523
523
|
$(() => {
|
|
524
|
-
|
|
525
|
-
}, [
|
|
526
|
-
!
|
|
527
|
-
}, [
|
|
528
|
-
var
|
|
529
|
-
|
|
530
|
-
|
|
524
|
+
b && Y.current(f.current, S.current);
|
|
525
|
+
}, [b]), $(() => {
|
|
526
|
+
!s && !b && F();
|
|
527
|
+
}, [s, b, F]), u.current = n, $(() => {
|
|
528
|
+
var c, v;
|
|
529
|
+
b && R && ((c = W.current) == null || c.dispose(), W.current = (v = f.current) == null ? void 0 : v.onDidChangeModelContent((P) => {
|
|
530
|
+
_.current || R(f.current.getValue(), P);
|
|
531
531
|
}));
|
|
532
|
-
}, [
|
|
533
|
-
if (
|
|
534
|
-
let
|
|
532
|
+
}, [b, R]), $(() => {
|
|
533
|
+
if (b) {
|
|
534
|
+
let c = S.current.editor.onDidChangeMarkers((v) => {
|
|
535
535
|
var k;
|
|
536
|
-
let
|
|
537
|
-
if (
|
|
538
|
-
let
|
|
539
|
-
|
|
536
|
+
let P = (k = f.current.getModel()) == null ? void 0 : k.uri;
|
|
537
|
+
if (P && v.find((q) => q.path === P.path)) {
|
|
538
|
+
let q = S.current.editor.getModelMarkers({ resource: P });
|
|
539
|
+
m == null || m(q);
|
|
540
540
|
}
|
|
541
541
|
});
|
|
542
542
|
return () => {
|
|
543
|
-
|
|
543
|
+
c == null || c.dispose();
|
|
544
544
|
};
|
|
545
545
|
}
|
|
546
546
|
return () => {
|
|
547
547
|
};
|
|
548
|
-
}, [
|
|
548
|
+
}, [b, m]);
|
|
549
549
|
function Pe() {
|
|
550
|
-
var
|
|
551
|
-
(
|
|
550
|
+
var c, v;
|
|
551
|
+
(c = W.current) == null || c.dispose(), T ? O && X.set(o, f.current.saveViewState()) : (v = f.current.getModel()) == null || v.dispose(), f.current.dispose();
|
|
552
552
|
}
|
|
553
|
-
return
|
|
553
|
+
return z.createElement(je, { width: L, height: J, isEditorReady: b, loading: p, _ref: N, className: I, wrapperProps: C });
|
|
554
554
|
}
|
|
555
|
-
var
|
|
555
|
+
var Dt = xt, Tt = ce(Dt), Rt = Tt;
|
|
556
556
|
const Nt = /* @__PURE__ */ (() => {
|
|
557
557
|
let e;
|
|
558
558
|
return async () => (e != null || (e = await fetch("https://core.commercelayer.io/api/public/resources").then(async (t) => await t.json()).then(
|
|
@@ -562,7 +562,7 @@ const Nt = /* @__PURE__ */ (() => {
|
|
|
562
562
|
fields: Object.entries(n.attributes.fields).filter(([a]) => !a.startsWith("_")),
|
|
563
563
|
relationships: Object.entries(n.attributes.relationships).filter(([a]) => !a.startsWith("_")).filter(
|
|
564
564
|
([, a]) => t.find(
|
|
565
|
-
(
|
|
565
|
+
(l) => l.id === Se(a.class_name)
|
|
566
566
|
) != null
|
|
567
567
|
)
|
|
568
568
|
}
|
|
@@ -595,16 +595,16 @@ async function qt(e, t) {
|
|
|
595
595
|
const r = await Nt(), n = e.replace(/\.$/, "").split("."), i = n.shift();
|
|
596
596
|
return t ?? (t = r[i ?? ""]), n.reduce(
|
|
597
597
|
(o, a) => {
|
|
598
|
-
var
|
|
599
|
-
const
|
|
598
|
+
var g, y;
|
|
599
|
+
const l = (y = (g = o.obj) == null ? void 0 : g.relationships.find(
|
|
600
600
|
([O]) => O === a
|
|
601
601
|
)) == null ? void 0 : y[1].class_name;
|
|
602
|
-
if (
|
|
602
|
+
if (l == null)
|
|
603
603
|
return o;
|
|
604
|
-
const
|
|
605
|
-
return
|
|
604
|
+
const p = r[Se(l)];
|
|
605
|
+
return p == null ? o : {
|
|
606
606
|
path: `${o.path == null ? "" : `${o.path}.`}${a}`,
|
|
607
|
-
obj:
|
|
607
|
+
obj: p
|
|
608
608
|
};
|
|
609
609
|
},
|
|
610
610
|
{ path: t != null ? i ?? "" : "", obj: t }
|
|
@@ -613,77 +613,78 @@ async function qt(e, t) {
|
|
|
613
613
|
function Se(e) {
|
|
614
614
|
return e.replace(/([A-Z])/g, "_$1").replace(/^_/, "").toLowerCase();
|
|
615
615
|
}
|
|
616
|
-
const Vt = Ut(500), zt =
|
|
616
|
+
const Vt = Ut(500), zt = Ce(
|
|
617
617
|
({
|
|
618
618
|
feedback: e,
|
|
619
619
|
hint: t,
|
|
620
620
|
inline: r,
|
|
621
621
|
label: n,
|
|
622
622
|
defaultValue: i,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
623
|
+
readOnly: o,
|
|
624
|
+
value: a,
|
|
625
|
+
language: l = "plaintext",
|
|
626
|
+
height: p = "220px",
|
|
627
|
+
jsonSchema: g = "none",
|
|
628
|
+
onValidate: y,
|
|
629
|
+
onValid: O,
|
|
630
|
+
onChange: T,
|
|
630
631
|
...L
|
|
631
632
|
}, J) => {
|
|
632
|
-
const
|
|
633
|
-
|
|
633
|
+
const I = $t(), C = w(), [A, j] = U(null), R = (m, b) => {
|
|
634
|
+
j(m), m.onDidPaste(() => {
|
|
634
635
|
var d;
|
|
635
|
-
(d =
|
|
636
|
-
}),
|
|
637
|
-
const d =
|
|
636
|
+
(d = m.getAction("editor.action.formatDocument")) == null || d.run();
|
|
637
|
+
}), m.onDidChangeModelContent(() => {
|
|
638
|
+
const d = m.getModel(), s = b.editor.getModelMarkers({
|
|
638
639
|
resource: d == null ? void 0 : d.uri
|
|
639
|
-
}),
|
|
640
|
+
}), M = m.getValue();
|
|
640
641
|
Vt(() => {
|
|
641
|
-
|
|
642
|
+
y == null || y(s.length > 0 ? s : null), T == null || T(M), s.length === 0 && (O == null || O(M));
|
|
642
643
|
});
|
|
643
644
|
});
|
|
644
645
|
};
|
|
645
646
|
return $(() => (async function() {
|
|
646
|
-
var
|
|
647
|
-
const
|
|
648
|
-
if (
|
|
649
|
-
(d =
|
|
650
|
-
const
|
|
651
|
-
switch (
|
|
647
|
+
var b, d;
|
|
648
|
+
const m = (b = A == null ? void 0 : A.getModel()) == null ? void 0 : b.uri.toString();
|
|
649
|
+
if (I != null && m != null && g != null) {
|
|
650
|
+
(d = C.current) == null || d.call(C);
|
|
651
|
+
const s = I.languages.json.jsonDefaults.diagnosticsOptions.schemas ?? [];
|
|
652
|
+
switch (g) {
|
|
652
653
|
case "none":
|
|
653
654
|
break;
|
|
654
655
|
case "order-rules": {
|
|
655
|
-
|
|
656
|
+
s.push({
|
|
656
657
|
schema: await fetch(
|
|
657
658
|
"https://core.commercelayer.io/api/public/schemas/order_rules"
|
|
658
|
-
).then(async (
|
|
659
|
-
uri: `file:///json-schema--${
|
|
660
|
-
fileMatch: [
|
|
661
|
-
}),
|
|
659
|
+
).then(async (M) => await M.json()).then((M) => re(M)),
|
|
660
|
+
uri: `file:///json-schema--${g}.json`,
|
|
661
|
+
fileMatch: [m]
|
|
662
|
+
}), C.current = ve(I, m, ["order"]);
|
|
662
663
|
break;
|
|
663
664
|
}
|
|
664
665
|
case "price-rules": {
|
|
665
|
-
|
|
666
|
+
s.push({
|
|
666
667
|
schema: await fetch(
|
|
667
668
|
"https://core.commercelayer.io/api/public/schemas/price_rules"
|
|
668
|
-
).then(async (
|
|
669
|
-
uri: `file:///json-schema--${
|
|
670
|
-
fileMatch: [
|
|
671
|
-
}),
|
|
669
|
+
).then(async (M) => await M.json()).then((M) => re(M)),
|
|
670
|
+
uri: `file:///json-schema--${g}.json`,
|
|
671
|
+
fileMatch: [m]
|
|
672
|
+
}), C.current = ve(I, m, ["price"]);
|
|
672
673
|
break;
|
|
673
674
|
}
|
|
674
675
|
}
|
|
675
|
-
|
|
676
|
+
I.languages.json.jsonDefaults.setDiagnosticsOptions({
|
|
676
677
|
enableSchemaRequest: !0,
|
|
677
678
|
schemaRequest: "ignore",
|
|
678
679
|
schemaValidation: "error",
|
|
679
680
|
validate: !0,
|
|
680
|
-
schemas:
|
|
681
|
+
schemas: s
|
|
681
682
|
});
|
|
682
683
|
}
|
|
683
684
|
}(), () => {
|
|
684
|
-
var
|
|
685
|
-
(
|
|
686
|
-
}), [
|
|
685
|
+
var m;
|
|
686
|
+
(m = C.current) == null || m.call(C);
|
|
687
|
+
}), [I, A, g]), /* @__PURE__ */ se.jsx(
|
|
687
688
|
Ee,
|
|
688
689
|
{
|
|
689
690
|
label: n,
|
|
@@ -697,14 +698,15 @@ const Vt = Ut(500), zt = Ie(
|
|
|
697
698
|
defaultPath: L.id ?? L.name,
|
|
698
699
|
className: "[&>.monaco-editor]:rounded [&>.monaco-editor>.overflow-guard]:rounded",
|
|
699
700
|
theme: "vs-dark",
|
|
700
|
-
language:
|
|
701
|
-
height:
|
|
701
|
+
language: l,
|
|
702
|
+
height: p,
|
|
702
703
|
defaultValue: i,
|
|
703
|
-
value:
|
|
704
|
-
onMount:
|
|
704
|
+
value: a,
|
|
705
|
+
onMount: R,
|
|
705
706
|
options: {
|
|
706
707
|
quickSuggestions: !0,
|
|
707
|
-
readOnly:
|
|
708
|
+
readOnly: o,
|
|
709
|
+
domReadOnly: !0,
|
|
708
710
|
automaticLayout: !0,
|
|
709
711
|
insertSpaces: !0,
|
|
710
712
|
tabSize: 2,
|
|
@@ -747,13 +749,13 @@ function ve(e, t, r) {
|
|
|
747
749
|
};
|
|
748
750
|
const o = n.getWordUntilPosition(i), a = n.getLineContent(i.lineNumber).substring(0, i.column - 1);
|
|
749
751
|
if (/"(field|selector)"\s*:\s*"[^"]*$/.test(a)) {
|
|
750
|
-
const
|
|
751
|
-
if (
|
|
752
|
+
const p = o.word;
|
|
753
|
+
if (p != null)
|
|
752
754
|
return {
|
|
753
755
|
incomplete: !1,
|
|
754
756
|
suggestions: (await _t(
|
|
755
757
|
r,
|
|
756
|
-
|
|
758
|
+
p
|
|
757
759
|
)).map((y) => ({
|
|
758
760
|
kind: y.type === "relationship" ? e.languages.CompletionItemKind.Module : e.languages.CompletionItemKind.Value,
|
|
759
761
|
label: y.value,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var un = Object.defineProperty;
|
|
3
3
|
var dn = (a, n, t) => n in a ? un(a, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[n] = t;
|
|
4
4
|
var y = (a, n, t) => dn(a, typeof n != "symbol" ? n + "" : n, t);
|
|
5
|
-
import { o as pn, f as fn, c as hn, a as Jt, g as mn, i as je, b as vn, j as Pe, I as gn, d as Dn, e as wn, w as yn, R as bn } from "./main-
|
|
5
|
+
import { o as pn, f as fn, c as hn, a as Jt, g as mn, i as je, b as vn, j as Pe, I as gn, d as Dn, e as wn, w as yn, R as bn } from "./main-BsOBR6bj.js";
|
|
6
6
|
import * as x from "react";
|
|
7
7
|
import h, { useLayoutEffect as Or, useEffect as Kt, createElement as _n, cloneElement as Yr, Component as Z, createRef as xe, useRef as Lt, useCallback as kn, forwardRef as Mn } from "react";
|
|
8
8
|
import * as Cn from "react-dom";
|