@commercelayer/app-elements 5.6.0 → 5.7.0
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--5lVbv6t.js +720 -0
- package/dist/InputDateComponent-NpCZmpgY.js +4887 -0
- package/dist/RuleEngineComponent-BbIy4caP.js +1404 -0
- package/dist/dictionaries/customers.d.ts +1 -1
- package/dist/dictionaries/orders.d.ts +7 -7
- package/dist/dictionaries/promotions.d.ts +2 -2
- package/dist/dictionaries/returns.d.ts +4 -4
- package/dist/dictionaries/shipments.d.ts +4 -4
- package/dist/dictionaries/stockTransfers.d.ts +4 -4
- package/dist/dictionaries/types.d.ts +2 -2
- package/dist/fetchCoreResourcesSuggestions-DLZhtrDX.js +124 -0
- package/dist/helpers/appsNavigation.d.ts +2 -2
- package/dist/helpers/attachments.d.ts +1 -1
- package/dist/helpers/date.d.ts +13 -13
- package/dist/helpers/downloadJsonAsFile.d.ts +1 -1
- package/dist/helpers/resources.d.ts +4 -4
- package/dist/helpers/tracking.d.ts +4 -4
- package/dist/hooks/useClickAway.d.ts +1 -1
- package/dist/hooks/useEditMetadataOverlay.d.ts +3 -3
- package/dist/hooks/useEditTagsOverlay.d.ts +2 -2
- package/dist/hooks/useIsChanged.d.ts +1 -1
- package/dist/{main-YD7ko8U-.js → main-BqlK85T7.js} +26914 -28733
- package/dist/main.d.ts +60 -60
- package/dist/main.js +1 -1
- package/dist/{parseISO-Cq_loYUP.js → parseISO-B-bk2SyC.js} +17 -17
- package/dist/providers/CoreSdkProvider/CoreSdkProvider.d.ts +1 -1
- package/dist/providers/CoreSdkProvider/makeSdkClient.d.ts +1 -1
- package/dist/providers/CoreSdkProvider/useCoreApi.d.ts +1 -1
- package/dist/providers/GTMProvider.d.ts +1 -1
- package/dist/providers/TokenProvider/MockTokenProvider.d.ts +1 -1
- package/dist/providers/TokenProvider/TokenProvider.d.ts +1 -1
- package/dist/providers/TokenProvider/getAccessTokenFromUrl.d.ts +1 -1
- package/dist/providers/TokenProvider/index.d.ts +1 -1
- package/dist/providers/TokenProvider/reducer.d.ts +2 -2
- package/dist/providers/TokenProvider/storage.d.ts +4 -4
- package/dist/providers/TokenProvider/types.d.ts +10 -10
- package/dist/providers/TokenProvider/url.d.ts +1 -1
- package/dist/providers/TokenProvider/validateToken.d.ts +2 -2
- package/dist/providers/createApp.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/tailwind.config.js +141 -142
- package/dist/ui/atoms/A.d.ts +1 -1
- package/dist/ui/atoms/Alert.d.ts +1 -1
- package/dist/ui/atoms/Avatar.d.ts +3 -3
- package/dist/ui/atoms/Avatar.utils.d.ts +18 -18
- package/dist/ui/atoms/AvatarLetter/colors.d.ts +1 -1
- package/dist/ui/atoms/Badge/Badge.d.ts +3 -3
- package/dist/ui/atoms/Badge/badgeVariants.d.ts +1 -1
- package/dist/ui/atoms/ButtonFilter.d.ts +1 -1
- package/dist/ui/atoms/Card.d.ts +15 -11
- package/dist/ui/atoms/CodeBlock.d.ts +1 -1
- package/dist/ui/atoms/EmptyState.d.ts +1 -1
- package/dist/ui/atoms/Grid.d.ts +6 -6
- package/dist/ui/atoms/Hint.d.ts +1 -1
- package/dist/ui/atoms/Hr.d.ts +2 -2
- package/dist/ui/atoms/Icon/Icon.d.ts +2 -2
- package/dist/ui/atoms/Icon/icons.d.ts +1 -1
- package/dist/ui/atoms/PageHeading/PageHeading.d.ts +3 -3
- package/dist/ui/atoms/PageHeading/PageHeadingToolbar.d.ts +2 -2
- package/dist/ui/atoms/Progress.d.ts +1 -1
- package/dist/ui/atoms/RadialProgress.d.ts +2 -2
- package/dist/ui/atoms/Section.d.ts +2 -2
- package/dist/ui/atoms/Skeleton.d.ts +1 -1
- package/dist/ui/atoms/Spacer.d.ts +3 -3
- package/dist/ui/atoms/StatusDot.d.ts +1 -1
- package/dist/ui/atoms/StatusIcon.d.ts +2 -2
- package/dist/ui/atoms/Table/Table.d.ts +1 -1
- package/dist/ui/atoms/Tag.d.ts +3 -3
- package/dist/ui/atoms/Text.d.ts +6 -6
- package/dist/ui/atoms/Tooltip.d.ts +2 -2
- package/dist/ui/composite/ActionButtons/ActionButtons.d.ts +2 -2
- package/dist/ui/composite/Address.d.ts +1 -1
- package/dist/ui/composite/Dropdown/Dropdown.d.ts +1 -1
- package/dist/ui/composite/Dropdown/DropdownItem.d.ts +11 -7
- package/dist/ui/composite/Dropdown/DropdownMenu.d.ts +3 -3
- package/dist/ui/composite/HomePageLayout.d.ts +3 -3
- package/dist/ui/composite/List.d.ts +2 -2
- package/dist/ui/composite/ListDetails.d.ts +2 -2
- package/dist/ui/composite/ListDetailsItem.d.ts +3 -3
- package/dist/ui/composite/ListItem.d.ts +7 -7
- package/dist/ui/composite/PageError.d.ts +2 -2
- package/dist/ui/composite/PageLayout.d.ts +6 -6
- package/dist/ui/composite/Routes/Routes.d.ts +3 -3
- package/dist/ui/composite/Routes/index.d.ts +2 -2
- package/dist/ui/composite/Routes/utils.d.ts +5 -5
- package/dist/ui/composite/SearchBar.d.ts +1 -1
- package/dist/ui/composite/Timeline.d.ts +1 -1
- package/dist/ui/composite/Toast.d.ts +1 -1
- package/dist/ui/composite/Toolbar.d.ts +6 -6
- package/dist/ui/forms/CodeEditor/CodeEditorComponent.d.ts +4 -4
- package/dist/ui/forms/CodeEditor/HookedCodeEditor.d.ts +1 -1
- package/dist/ui/forms/CodeEditor/fetchCoreResourcesSuggestions.d.ts +7 -7
- package/dist/ui/forms/CodeEditor/index.d.ts +1 -1
- package/dist/ui/forms/Input/Input.d.ts +2 -2
- package/dist/ui/forms/InputCheckbox/HookedInputCheckbox.d.ts +1 -1
- package/dist/ui/forms/InputCheckbox/InputCheckbox.d.ts +2 -2
- package/dist/ui/forms/InputCheckbox/index.d.ts +1 -1
- package/dist/ui/forms/InputCheckboxGroup/HookedInputCheckboxGroup.d.ts +1 -1
- package/dist/ui/forms/InputCheckboxGroup/InputCheckboxGroupItem.d.ts +2 -2
- package/dist/ui/forms/InputCheckboxGroup/index.d.ts +2 -2
- package/dist/ui/forms/InputCheckboxGroup/reducer.d.ts +3 -3
- package/dist/ui/forms/InputCurrency/HookedInputCurrency.d.ts +1 -1
- package/dist/ui/forms/InputCurrency/InputCurrency.d.ts +3 -3
- package/dist/ui/forms/InputCurrency/index.d.ts +1 -1
- package/dist/ui/forms/InputCurrency/utils.d.ts +1 -1
- package/dist/ui/forms/InputCurrencyRange.d.ts +3 -3
- package/dist/ui/forms/InputDate/HookedInputDate.d.ts +1 -1
- package/dist/ui/forms/InputDateRange/HookedInputDateRange.d.ts +1 -1
- package/dist/ui/forms/InputDateRange/InputDateRange.d.ts +5 -5
- package/dist/ui/forms/InputDateRange/index.d.ts +1 -1
- package/dist/ui/forms/InputFeedback.d.ts +1 -1
- package/dist/ui/forms/InputFile.d.ts +1 -1
- package/dist/ui/forms/InputJson.d.ts +1 -1
- package/dist/ui/forms/InputRadioGroup/HookedInputRadioGroup.d.ts +1 -1
- package/dist/ui/forms/InputRadioGroup/index.d.ts +1 -1
- package/dist/ui/forms/InputResourceGroup/FullList.d.ts +3 -3
- package/dist/ui/forms/InputResourceGroup/HookedInputResourceGroup.d.ts +1 -1
- package/dist/ui/forms/InputResourceGroup/InputResourceGroup.d.ts +1 -1
- package/dist/ui/forms/InputResourceGroup/index.d.ts +2 -2
- package/dist/ui/forms/InputResourceGroup/utils.d.ts +3 -3
- package/dist/ui/forms/InputSelect/CreatableComponent.d.ts +1 -1
- package/dist/ui/forms/InputSelect/GenericAsyncComponent.d.ts +1 -1
- package/dist/ui/forms/InputSelect/HookedInputSelect.d.ts +1 -1
- package/dist/ui/forms/InputSelect/InputSelect.d.ts +1 -1
- package/dist/ui/forms/InputSelect/SelectComponent.d.ts +1 -1
- package/dist/ui/forms/InputSelect/index.d.ts +3 -3
- package/dist/ui/forms/InputSelect/styles.d.ts +1 -1
- package/dist/ui/forms/InputSelect/utils.d.ts +1 -1
- package/dist/ui/forms/InputSimpleSelect/InputSimpleSelect.d.ts +1 -1
- package/dist/ui/forms/InputSimpleSelect/index.d.ts +2 -2
- package/dist/ui/forms/InputSpinner/HookedInputSpinner.d.ts +1 -1
- package/dist/ui/forms/InputSpinner/InputSpinner.d.ts +1 -1
- package/dist/ui/forms/InputSpinner/index.d.ts +1 -1
- package/dist/ui/forms/InputSwitch/InputSwitch.d.ts +1 -1
- package/dist/ui/forms/InputSwitch/index.d.ts +1 -1
- package/dist/ui/forms/InputTextArea/index.d.ts +1 -1
- package/dist/ui/forms/InputToggleButton/HookedInputToggleButton.d.ts +1 -1
- package/dist/ui/forms/InputToggleButton/InputToggleButton.d.ts +4 -4
- package/dist/ui/forms/InputToggleButton/index.d.ts +2 -2
- package/dist/ui/forms/MarketWithCurrencySelector/HookedMarketWithCurrencySelector.d.ts +2 -2
- package/dist/ui/forms/MarketWithCurrencySelector/index.d.ts +1 -1
- package/dist/ui/forms/ReactHookForm/HookedValidationApiError.d.ts +1 -1
- package/dist/ui/forms/ReactHookForm/setApiFormErrors.d.ts +1 -1
- package/dist/ui/forms/ReactHookForm/useValidationFeedback.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Action/ActionListItem.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Action/ActionValue.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Action/index.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ArrayMatch.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/ConditionListItem.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ConditionMatcher.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/ConditionValue.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/Connector.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/RangeInputs.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputArrayMatch.d.ts +2 -2
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputNumberRange.d.ts +2 -2
- package/dist/ui/forms/RuleEngine/Condition/ValueComponents/InputTextRange.d.ts +2 -2
- package/dist/ui/forms/RuleEngine/Condition/dictionaries.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/index.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/Condition/types.d.ts +0 -0
- package/dist/ui/forms/RuleEngine/Condition/utils.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/RuleEngineComponent.d.ts +4 -4
- package/dist/ui/forms/RuleEngine/RuleEngineContext.d.ts +1 -1
- package/dist/ui/forms/RuleEngine/utils.d.ts +6 -6
- package/dist/ui/internals/FlexRow.d.ts +1 -1
- package/dist/ui/internals/InputWrapper.d.ts +6 -6
- package/dist/ui/internals/InteractiveElement.className.d.ts +4 -4
- package/dist/ui/internals/Overlay.d.ts +1 -1
- package/dist/ui/resources/ResourceAddress/ResourceAddress.d.ts +2 -2
- package/dist/ui/resources/ResourceAddress/ResourceAddressFormFields.d.ts +1 -1
- package/dist/ui/resources/ResourceAddress/index.d.ts +1 -1
- package/dist/ui/resources/ResourceAddress/useResourceAddressOverlay.d.ts +2 -2
- package/dist/ui/resources/ResourceAttachments/index.d.ts +1 -1
- package/dist/ui/resources/ResourceDetails/useEditDetailsOverlay.d.ts +2 -2
- package/dist/ui/resources/ResourceLineItems/index.d.ts +1 -1
- package/dist/ui/resources/ResourceListItem/ResourceListItem.d.ts +2 -2
- package/dist/ui/resources/ResourceListItem/ResourceListItem.mocks.d.ts +9 -0
- package/dist/ui/resources/ResourceListItem/index.d.ts +1 -1
- package/dist/ui/resources/ResourceListItem/types.d.ts +3 -3
- package/dist/ui/resources/ResourceMetadata/ResourceMetadata.d.ts +2 -2
- package/dist/ui/resources/ResourceMetadata/index.d.ts +1 -1
- package/dist/ui/resources/ResourceOrderTimeline.d.ts +1 -1
- package/dist/ui/resources/ResourcePaymentMethod.d.ts +3 -3
- package/dist/ui/resources/ResourceShipmentParcels.mocks.d.ts +2 -2
- package/dist/ui/resources/ResourceTags.d.ts +3 -3
- package/dist/ui/resources/useResourceFilters/FieldCurrencyRange.d.ts +1 -2
- package/dist/ui/resources/useResourceFilters/FiltersForm.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/FiltersNav.d.ts +1 -2
- package/dist/ui/resources/useResourceFilters/FiltersSearchBar.d.ts +3 -3
- package/dist/ui/resources/useResourceFilters/adaptFormValuesToSdk.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adaptFormValuesToUrlQuery.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adaptSdkToMetrics.d.ts +4 -4
- package/dist/ui/resources/useResourceFilters/adaptSdkToUrlQuery.d.ts +2 -2
- package/dist/ui/resources/useResourceFilters/adaptUrlQueryToFormValues.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adaptUrlQueryToSdk.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adaptUrlQueryToUrlQuery.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/adapters.types.d.ts +8 -8
- package/dist/ui/resources/useResourceFilters/timeUtils.d.ts +1 -1
- package/dist/ui/resources/useResourceFilters/types.d.ts +18 -18
- package/dist/ui/resources/useResourceFilters/useResourceFilters.d.ts +10 -11
- package/dist/ui/resources/useResourceFilters/utils.d.ts +2 -2
- package/dist/ui/resources/useResourceList/adaptMetricsOrderToCore.d.ts +1 -1
- package/dist/ui/resources/useResourceList/index.d.ts +1 -1
- package/dist/ui/resources/useResourceList/infiniteFetcher.d.ts +5 -5
- package/dist/ui/resources/useResourceList/metricsApiClient.d.ts +4 -4
- package/dist/ui/resources/useResourceList/reducer.d.ts +5 -5
- package/dist/ui/resources/useResourceList/useResourceList.d.ts +10 -10
- package/dist/ui/resources/useResourceList/utils.d.ts +1 -1
- package/dist/utils/array.d.ts +1 -1
- package/dist/utils/htmltags.d.ts +1 -1
- package/dist/utils/pagination.d.ts +4 -4
- package/dist/vendor.css +1 -1
- package/package.json +32 -35
- package/dist/CodeEditorComponent-DhpbUF3I.js +0 -739
- package/dist/InputDateComponent-BZyuY3F6.js +0 -4964
- package/dist/RuleEngineComponent-UggkM5Zc.js +0 -1390
- package/dist/fetchCoreResourcesSuggestions-CZkDwjO2.js +0 -126
|
@@ -0,0 +1,720 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { u as Pe, j as le, I as Se } from "./main-BqlK85T7.js";
|
|
3
|
+
import R, { memo as oe, useState as V, useEffect as S, useRef as v, useCallback as ie, forwardRef as Ce } from "react";
|
|
4
|
+
import { f as Ee } from "./fetchCoreResourcesSuggestions-DLZhtrDX.js";
|
|
5
|
+
function Ie(e, t, r) {
|
|
6
|
+
return t in e ? Object.defineProperty(e, t, {
|
|
7
|
+
value: r,
|
|
8
|
+
enumerable: !0,
|
|
9
|
+
configurable: !0,
|
|
10
|
+
writable: !0
|
|
11
|
+
}) : e[t] = r, e;
|
|
12
|
+
}
|
|
13
|
+
function se(e, t) {
|
|
14
|
+
var r = Object.keys(e);
|
|
15
|
+
if (Object.getOwnPropertySymbols) {
|
|
16
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
17
|
+
t && (n = n.filter(function(i) {
|
|
18
|
+
return Object.getOwnPropertyDescriptor(e, i).enumerable;
|
|
19
|
+
})), r.push.apply(r, n);
|
|
20
|
+
}
|
|
21
|
+
return r;
|
|
22
|
+
}
|
|
23
|
+
function de(e) {
|
|
24
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
25
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
26
|
+
t % 2 ? se(Object(r), !0).forEach(function(n) {
|
|
27
|
+
Ie(e, n, r[n]);
|
|
28
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : se(Object(r)).forEach(function(n) {
|
|
29
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return e;
|
|
33
|
+
}
|
|
34
|
+
function Le(e, t) {
|
|
35
|
+
if (e == null) return {};
|
|
36
|
+
var r = {}, n = Object.keys(e), i, o;
|
|
37
|
+
for (o = 0; o < n.length; o++)
|
|
38
|
+
i = n[o], !(t.indexOf(i) >= 0) && (r[i] = e[i]);
|
|
39
|
+
return r;
|
|
40
|
+
}
|
|
41
|
+
function Te(e, t) {
|
|
42
|
+
if (e == null) return {};
|
|
43
|
+
var r = Le(e, t), n, i;
|
|
44
|
+
if (Object.getOwnPropertySymbols) {
|
|
45
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
46
|
+
for (i = 0; i < o.length; i++)
|
|
47
|
+
n = o[i], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(e, n) && (r[n] = e[n]);
|
|
48
|
+
}
|
|
49
|
+
return r;
|
|
50
|
+
}
|
|
51
|
+
function $e(e, t) {
|
|
52
|
+
return Ae(e) || De(e, t) || xe(e, t) || Re();
|
|
53
|
+
}
|
|
54
|
+
function Ae(e) {
|
|
55
|
+
if (Array.isArray(e)) return e;
|
|
56
|
+
}
|
|
57
|
+
function De(e, t) {
|
|
58
|
+
if (!(typeof Symbol > "u" || !(Symbol.iterator in Object(e)))) {
|
|
59
|
+
var r = [], n = !0, i = !1, o = void 0;
|
|
60
|
+
try {
|
|
61
|
+
for (var u = e[Symbol.iterator](), f; !(n = (f = u.next()).done) && (r.push(f.value), !(t && r.length === t)); n = !0)
|
|
62
|
+
;
|
|
63
|
+
} catch (p) {
|
|
64
|
+
i = !0, o = p;
|
|
65
|
+
} finally {
|
|
66
|
+
try {
|
|
67
|
+
!n && u.return != null && u.return();
|
|
68
|
+
} finally {
|
|
69
|
+
if (i) throw o;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return r;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function xe(e, t) {
|
|
76
|
+
if (e) {
|
|
77
|
+
if (typeof e == "string") return fe(e, t);
|
|
78
|
+
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
79
|
+
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
|
|
80
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return fe(e, t);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function fe(e, t) {
|
|
84
|
+
(t == null || t > e.length) && (t = e.length);
|
|
85
|
+
for (var r = 0, n = new Array(t); r < t; r++) n[r] = e[r];
|
|
86
|
+
return n;
|
|
87
|
+
}
|
|
88
|
+
function Re() {
|
|
89
|
+
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
90
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
91
|
+
}
|
|
92
|
+
function Ve(e, t, r) {
|
|
93
|
+
return t in e ? Object.defineProperty(e, t, {
|
|
94
|
+
value: r,
|
|
95
|
+
enumerable: !0,
|
|
96
|
+
configurable: !0,
|
|
97
|
+
writable: !0
|
|
98
|
+
}) : e[t] = r, e;
|
|
99
|
+
}
|
|
100
|
+
function pe(e, t) {
|
|
101
|
+
var r = Object.keys(e);
|
|
102
|
+
if (Object.getOwnPropertySymbols) {
|
|
103
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
104
|
+
t && (n = n.filter(function(i) {
|
|
105
|
+
return Object.getOwnPropertyDescriptor(e, i).enumerable;
|
|
106
|
+
})), r.push.apply(r, n);
|
|
107
|
+
}
|
|
108
|
+
return r;
|
|
109
|
+
}
|
|
110
|
+
function ge(e) {
|
|
111
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
112
|
+
var r = arguments[t] != null ? arguments[t] : {};
|
|
113
|
+
t % 2 ? pe(Object(r), !0).forEach(function(n) {
|
|
114
|
+
Ve(e, n, r[n]);
|
|
115
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : pe(Object(r)).forEach(function(n) {
|
|
116
|
+
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return e;
|
|
120
|
+
}
|
|
121
|
+
function Ne() {
|
|
122
|
+
for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
|
|
123
|
+
t[r] = arguments[r];
|
|
124
|
+
return function(n) {
|
|
125
|
+
return t.reduceRight(function(i, o) {
|
|
126
|
+
return o(i);
|
|
127
|
+
}, n);
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function U(e) {
|
|
131
|
+
return function t() {
|
|
132
|
+
for (var r = this, n = arguments.length, i = new Array(n), o = 0; o < n; o++)
|
|
133
|
+
i[o] = arguments[o];
|
|
134
|
+
return i.length >= e.length ? e.apply(this, i) : function() {
|
|
135
|
+
for (var u = arguments.length, f = new Array(u), p = 0; p < u; p++)
|
|
136
|
+
f[p] = arguments[p];
|
|
137
|
+
return t.apply(r, [].concat(i, f));
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function J(e) {
|
|
142
|
+
return {}.toString.call(e).includes("Object");
|
|
143
|
+
}
|
|
144
|
+
function qe(e) {
|
|
145
|
+
return !Object.keys(e).length;
|
|
146
|
+
}
|
|
147
|
+
function W(e) {
|
|
148
|
+
return typeof e == "function";
|
|
149
|
+
}
|
|
150
|
+
function ze(e, t) {
|
|
151
|
+
return Object.prototype.hasOwnProperty.call(e, t);
|
|
152
|
+
}
|
|
153
|
+
function Ue(e, t) {
|
|
154
|
+
return J(t) || T("changeType"), Object.keys(t).some(function(r) {
|
|
155
|
+
return !ze(e, r);
|
|
156
|
+
}) && T("changeField"), t;
|
|
157
|
+
}
|
|
158
|
+
function ke(e) {
|
|
159
|
+
W(e) || T("selectorType");
|
|
160
|
+
}
|
|
161
|
+
function Fe(e) {
|
|
162
|
+
W(e) || J(e) || T("handlerType"), J(e) && Object.values(e).some(function(t) {
|
|
163
|
+
return !W(t);
|
|
164
|
+
}) && T("handlersType");
|
|
165
|
+
}
|
|
166
|
+
function We(e) {
|
|
167
|
+
e || T("initialIsRequired"), J(e) || T("initialType"), qe(e) && T("initialContent");
|
|
168
|
+
}
|
|
169
|
+
function _e(e, t) {
|
|
170
|
+
throw new Error(e[t] || e.default);
|
|
171
|
+
}
|
|
172
|
+
var He = {
|
|
173
|
+
initialIsRequired: "initial state is required",
|
|
174
|
+
initialType: "initial state should be an object",
|
|
175
|
+
initialContent: "initial state shouldn't be an empty object",
|
|
176
|
+
handlerType: "handler should be an object or a function",
|
|
177
|
+
handlersType: "all handlers should be a functions",
|
|
178
|
+
selectorType: "selector should be a function",
|
|
179
|
+
changeType: "provided value of changes should be an object",
|
|
180
|
+
changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
|
|
181
|
+
default: "an unknown error accured in `state-local` package"
|
|
182
|
+
}, T = U(_e)(He), K = {
|
|
183
|
+
changes: Ue,
|
|
184
|
+
selector: ke,
|
|
185
|
+
handler: Fe,
|
|
186
|
+
initial: We
|
|
187
|
+
};
|
|
188
|
+
function Be(e) {
|
|
189
|
+
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
190
|
+
K.initial(e), K.handler(t);
|
|
191
|
+
var r = {
|
|
192
|
+
current: e
|
|
193
|
+
}, n = U(Je)(r, t), i = U(Ge)(r), o = U(K.changes)(e), u = U(Ke)(r);
|
|
194
|
+
function f() {
|
|
195
|
+
var s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(C) {
|
|
196
|
+
return C;
|
|
197
|
+
};
|
|
198
|
+
return K.selector(s), s(r.current);
|
|
199
|
+
}
|
|
200
|
+
function p(s) {
|
|
201
|
+
Ne(n, i, o, u)(s);
|
|
202
|
+
}
|
|
203
|
+
return [f, p];
|
|
204
|
+
}
|
|
205
|
+
function Ke(e, t) {
|
|
206
|
+
return W(t) ? t(e.current) : t;
|
|
207
|
+
}
|
|
208
|
+
function Ge(e, t) {
|
|
209
|
+
return e.current = ge(ge({}, e.current), t), t;
|
|
210
|
+
}
|
|
211
|
+
function Je(e, t, r) {
|
|
212
|
+
return W(t) ? t(e.current) : Object.keys(r).forEach(function(n) {
|
|
213
|
+
var i;
|
|
214
|
+
return (i = t[n]) === null || i === void 0 ? void 0 : i.call(t, e.current[n]);
|
|
215
|
+
}), r;
|
|
216
|
+
}
|
|
217
|
+
var Ye = {
|
|
218
|
+
create: Be
|
|
219
|
+
}, Qe = {
|
|
220
|
+
paths: {
|
|
221
|
+
vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
function Xe(e) {
|
|
225
|
+
return function t() {
|
|
226
|
+
for (var r = this, n = arguments.length, i = new Array(n), o = 0; o < n; o++)
|
|
227
|
+
i[o] = arguments[o];
|
|
228
|
+
return i.length >= e.length ? e.apply(this, i) : function() {
|
|
229
|
+
for (var u = arguments.length, f = new Array(u), p = 0; p < u; p++)
|
|
230
|
+
f[p] = arguments[p];
|
|
231
|
+
return t.apply(r, [].concat(i, f));
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function Ze(e) {
|
|
236
|
+
return {}.toString.call(e).includes("Object");
|
|
237
|
+
}
|
|
238
|
+
function et(e) {
|
|
239
|
+
return e || he("configIsRequired"), Ze(e) || he("configType"), e.urls ? (tt(), {
|
|
240
|
+
paths: {
|
|
241
|
+
vs: e.urls.monacoBase
|
|
242
|
+
}
|
|
243
|
+
}) : e;
|
|
244
|
+
}
|
|
245
|
+
function tt() {
|
|
246
|
+
console.warn(ve.deprecation);
|
|
247
|
+
}
|
|
248
|
+
function rt(e, t) {
|
|
249
|
+
throw new Error(e[t] || e.default);
|
|
250
|
+
}
|
|
251
|
+
var ve = {
|
|
252
|
+
configIsRequired: "the configuration object is required",
|
|
253
|
+
configType: "the configuration object should be an object",
|
|
254
|
+
default: "an unknown error accured in `@monaco-editor/loader` package",
|
|
255
|
+
deprecation: `Deprecation warning!
|
|
256
|
+
You are using deprecated way of configuration.
|
|
257
|
+
|
|
258
|
+
Instead of using
|
|
259
|
+
monaco.config({ urls: { monacoBase: '...' } })
|
|
260
|
+
use
|
|
261
|
+
monaco.config({ paths: { vs: '...' } })
|
|
262
|
+
|
|
263
|
+
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
264
|
+
`
|
|
265
|
+
}, he = Xe(rt)(ve), nt = {
|
|
266
|
+
config: et
|
|
267
|
+
}, it = function() {
|
|
268
|
+
for (var t = arguments.length, r = new Array(t), n = 0; n < t; n++)
|
|
269
|
+
r[n] = arguments[n];
|
|
270
|
+
return function(i) {
|
|
271
|
+
return r.reduceRight(function(o, u) {
|
|
272
|
+
return u(o);
|
|
273
|
+
}, i);
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
function be(e, t) {
|
|
277
|
+
return Object.keys(t).forEach(function(r) {
|
|
278
|
+
t[r] instanceof Object && e[r] && Object.assign(t[r], be(e[r], t[r]));
|
|
279
|
+
}), de(de({}, e), t);
|
|
280
|
+
}
|
|
281
|
+
var ot = {
|
|
282
|
+
type: "cancelation",
|
|
283
|
+
msg: "operation is manually canceled"
|
|
284
|
+
};
|
|
285
|
+
function te(e) {
|
|
286
|
+
var t = !1, r = new Promise(function(n, i) {
|
|
287
|
+
e.then(function(o) {
|
|
288
|
+
return t ? i(ot) : n(o);
|
|
289
|
+
}), e.catch(i);
|
|
290
|
+
});
|
|
291
|
+
return r.cancel = function() {
|
|
292
|
+
return t = !0;
|
|
293
|
+
}, r;
|
|
294
|
+
}
|
|
295
|
+
var at = Ye.create({
|
|
296
|
+
config: Qe,
|
|
297
|
+
isInitialized: !1,
|
|
298
|
+
resolve: null,
|
|
299
|
+
reject: null,
|
|
300
|
+
monaco: null
|
|
301
|
+
}), we = $e(at, 2), _ = we[0], Q = we[1];
|
|
302
|
+
function ut(e) {
|
|
303
|
+
var t = nt.config(e), r = t.monaco, n = Te(t, ["monaco"]);
|
|
304
|
+
Q(function(i) {
|
|
305
|
+
return {
|
|
306
|
+
config: be(i.config, n),
|
|
307
|
+
monaco: r
|
|
308
|
+
};
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function ct() {
|
|
312
|
+
var e = _(function(t) {
|
|
313
|
+
var r = t.monaco, n = t.isInitialized, i = t.resolve;
|
|
314
|
+
return {
|
|
315
|
+
monaco: r,
|
|
316
|
+
isInitialized: n,
|
|
317
|
+
resolve: i
|
|
318
|
+
};
|
|
319
|
+
});
|
|
320
|
+
if (!e.isInitialized) {
|
|
321
|
+
if (Q({
|
|
322
|
+
isInitialized: !0
|
|
323
|
+
}), e.monaco)
|
|
324
|
+
return e.resolve(e.monaco), te(re);
|
|
325
|
+
if (window.monaco && window.monaco.editor)
|
|
326
|
+
return ye(window.monaco), e.resolve(window.monaco), te(re);
|
|
327
|
+
it(lt, dt)(ft);
|
|
328
|
+
}
|
|
329
|
+
return te(re);
|
|
330
|
+
}
|
|
331
|
+
function lt(e) {
|
|
332
|
+
return document.body.appendChild(e);
|
|
333
|
+
}
|
|
334
|
+
function st(e) {
|
|
335
|
+
var t = document.createElement("script");
|
|
336
|
+
return e && (t.src = e), t;
|
|
337
|
+
}
|
|
338
|
+
function dt(e) {
|
|
339
|
+
var t = _(function(n) {
|
|
340
|
+
var i = n.config, o = n.reject;
|
|
341
|
+
return {
|
|
342
|
+
config: i,
|
|
343
|
+
reject: o
|
|
344
|
+
};
|
|
345
|
+
}), r = st("".concat(t.config.paths.vs, "/loader.js"));
|
|
346
|
+
return r.onload = function() {
|
|
347
|
+
return e();
|
|
348
|
+
}, r.onerror = t.reject, r;
|
|
349
|
+
}
|
|
350
|
+
function ft() {
|
|
351
|
+
var e = _(function(r) {
|
|
352
|
+
var n = r.config, i = r.resolve, o = r.reject;
|
|
353
|
+
return {
|
|
354
|
+
config: n,
|
|
355
|
+
resolve: i,
|
|
356
|
+
reject: o
|
|
357
|
+
};
|
|
358
|
+
}), t = window.require;
|
|
359
|
+
t.config(e.config), t(["vs/editor/editor.main"], function(r) {
|
|
360
|
+
ye(r), e.resolve(r);
|
|
361
|
+
}, function(r) {
|
|
362
|
+
e.reject(r);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
function ye(e) {
|
|
366
|
+
_().monaco || Q({
|
|
367
|
+
monaco: e
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
function pt() {
|
|
371
|
+
return _(function(e) {
|
|
372
|
+
var t = e.monaco;
|
|
373
|
+
return t;
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
var re = new Promise(function(e, t) {
|
|
377
|
+
return Q({
|
|
378
|
+
resolve: e,
|
|
379
|
+
reject: t
|
|
380
|
+
});
|
|
381
|
+
}), Y = {
|
|
382
|
+
config: ut,
|
|
383
|
+
init: ct,
|
|
384
|
+
__getMonacoInstance: pt
|
|
385
|
+
}, gt = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, ne = gt, ht = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, mt = ht;
|
|
386
|
+
function vt({ children: e }) {
|
|
387
|
+
return R.createElement("div", { style: mt.container }, e);
|
|
388
|
+
}
|
|
389
|
+
var bt = vt, wt = bt;
|
|
390
|
+
function yt({ width: e, height: t, isEditorReady: r, loading: n, _ref: i, className: o, wrapperProps: u }) {
|
|
391
|
+
return R.createElement("section", { style: { ...ne.wrapper, width: e, height: t }, ...u }, !r && R.createElement(wt, null, n), R.createElement("div", { ref: i, style: { ...ne.fullWidth, ...!r && ne.hide }, className: o }));
|
|
392
|
+
}
|
|
393
|
+
var Ot = yt, Oe = oe(Ot);
|
|
394
|
+
function jt(e) {
|
|
395
|
+
S(e, []);
|
|
396
|
+
}
|
|
397
|
+
var ae = jt;
|
|
398
|
+
function Mt(e, t, r = !0) {
|
|
399
|
+
let n = v(!0);
|
|
400
|
+
S(n.current || !r ? () => {
|
|
401
|
+
n.current = !1;
|
|
402
|
+
} : e, t);
|
|
403
|
+
}
|
|
404
|
+
var j = Mt;
|
|
405
|
+
function k() {
|
|
406
|
+
}
|
|
407
|
+
function x(e, t, r, n) {
|
|
408
|
+
return Pt(e, n) || St(e, t, r, n);
|
|
409
|
+
}
|
|
410
|
+
function Pt(e, t) {
|
|
411
|
+
return e.editor.getModel(je(e, t));
|
|
412
|
+
}
|
|
413
|
+
function St(e, t, r, n) {
|
|
414
|
+
return e.editor.createModel(t, r, n ? je(e, n) : void 0);
|
|
415
|
+
}
|
|
416
|
+
function je(e, t) {
|
|
417
|
+
return e.Uri.parse(t);
|
|
418
|
+
}
|
|
419
|
+
function Ct({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: i, originalModelPath: o, modifiedModelPath: u, keepCurrentOriginalModel: f = !1, keepCurrentModifiedModel: p = !1, theme: s = "light", loading: C = "Loading...", options: w = {}, height: N = "100%", width: q = "100%", className: E, wrapperProps: $ = {}, beforeMount: M = k, onMount: I = k }) {
|
|
420
|
+
let [b, A] = V(!1), [P, g] = V(!0), a = v(null), l = v(null), h = v(null), m = v(I), c = v(M), D = v(!1);
|
|
421
|
+
ae(() => {
|
|
422
|
+
let d = Y.init();
|
|
423
|
+
return d.then((y) => (l.current = y) && g(!1)).catch((y) => y?.type !== "cancelation" && console.error("Monaco initialization: error:", y)), () => a.current ? z() : d.cancel();
|
|
424
|
+
}), j(() => {
|
|
425
|
+
if (a.current && l.current) {
|
|
426
|
+
let d = a.current.getOriginalEditor(), y = x(l.current, e || "", n || r || "text", o || "");
|
|
427
|
+
y !== d.getModel() && d.setModel(y);
|
|
428
|
+
}
|
|
429
|
+
}, [o], b), j(() => {
|
|
430
|
+
if (a.current && l.current) {
|
|
431
|
+
let d = a.current.getModifiedEditor(), y = x(l.current, t || "", i || r || "text", u || "");
|
|
432
|
+
y !== d.getModel() && d.setModel(y);
|
|
433
|
+
}
|
|
434
|
+
}, [u], b), j(() => {
|
|
435
|
+
let d = a.current.getModifiedEditor();
|
|
436
|
+
d.getOption(l.current.editor.EditorOption.readOnly) ? d.setValue(t || "") : t !== d.getValue() && (d.executeEdits("", [{ range: d.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), d.pushUndoStop());
|
|
437
|
+
}, [t], b), j(() => {
|
|
438
|
+
a.current?.getModel()?.original.setValue(e || "");
|
|
439
|
+
}, [e], b), j(() => {
|
|
440
|
+
let { original: d, modified: y } = a.current.getModel();
|
|
441
|
+
l.current.editor.setModelLanguage(d, n || r || "text"), l.current.editor.setModelLanguage(y, i || r || "text");
|
|
442
|
+
}, [r, n, i], b), j(() => {
|
|
443
|
+
l.current?.editor.setTheme(s);
|
|
444
|
+
}, [s], b), j(() => {
|
|
445
|
+
a.current?.updateOptions(w);
|
|
446
|
+
}, [w], b);
|
|
447
|
+
let H = ie(() => {
|
|
448
|
+
if (!l.current) return;
|
|
449
|
+
c.current(l.current);
|
|
450
|
+
let d = x(l.current, e || "", n || r || "text", o || ""), y = x(l.current, t || "", i || r || "text", u || "");
|
|
451
|
+
a.current?.setModel({ original: d, modified: y });
|
|
452
|
+
}, [r, t, i, e, n, o, u]), B = ie(() => {
|
|
453
|
+
!D.current && h.current && (a.current = l.current.editor.createDiffEditor(h.current, { automaticLayout: !0, ...w }), H(), l.current?.editor.setTheme(s), A(!0), D.current = !0);
|
|
454
|
+
}, [w, s, H]);
|
|
455
|
+
S(() => {
|
|
456
|
+
b && m.current(a.current, l.current);
|
|
457
|
+
}, [b]), S(() => {
|
|
458
|
+
!P && !b && B();
|
|
459
|
+
}, [P, b, B]);
|
|
460
|
+
function z() {
|
|
461
|
+
let d = a.current?.getModel();
|
|
462
|
+
f || d?.original?.dispose(), p || d?.modified?.dispose(), a.current?.dispose();
|
|
463
|
+
}
|
|
464
|
+
return R.createElement(Oe, { width: q, height: N, isEditorReady: b, loading: C, _ref: h, className: E, wrapperProps: $ });
|
|
465
|
+
}
|
|
466
|
+
var Et = Ct;
|
|
467
|
+
oe(Et);
|
|
468
|
+
function It() {
|
|
469
|
+
let [e, t] = V(Y.__getMonacoInstance());
|
|
470
|
+
return ae(() => {
|
|
471
|
+
let r;
|
|
472
|
+
return e || (r = Y.init(), r.then((n) => {
|
|
473
|
+
t(n);
|
|
474
|
+
})), () => r?.cancel();
|
|
475
|
+
}), e;
|
|
476
|
+
}
|
|
477
|
+
var Lt = It;
|
|
478
|
+
function Tt(e) {
|
|
479
|
+
let t = v();
|
|
480
|
+
return S(() => {
|
|
481
|
+
t.current = e;
|
|
482
|
+
}, [e]), t.current;
|
|
483
|
+
}
|
|
484
|
+
var $t = Tt, G = /* @__PURE__ */ new Map();
|
|
485
|
+
function At({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: i, path: o, theme: u = "light", line: f, loading: p = "Loading...", options: s = {}, overrideServices: C = {}, saveViewState: w = !0, keepCurrentModel: N = !1, width: q = "100%", height: E = "100%", className: $, wrapperProps: M = {}, beforeMount: I = k, onMount: b = k, onChange: A, onValidate: P = k }) {
|
|
486
|
+
let [g, a] = V(!1), [l, h] = V(!0), m = v(null), c = v(null), D = v(null), H = v(b), B = v(I), z = v(), d = v(n), y = $t(o), ue = v(!1), X = v(!1);
|
|
487
|
+
ae(() => {
|
|
488
|
+
let O = Y.init();
|
|
489
|
+
return O.then((L) => (m.current = L) && h(!1)).catch((L) => L?.type !== "cancelation" && console.error("Monaco initialization: error:", L)), () => c.current ? Me() : O.cancel();
|
|
490
|
+
}), j(() => {
|
|
491
|
+
let O = x(m.current, e || n || "", t || i || "", o || r || "");
|
|
492
|
+
O !== c.current?.getModel() && (w && G.set(y, c.current?.saveViewState()), c.current?.setModel(O), w && c.current?.restoreViewState(G.get(o)));
|
|
493
|
+
}, [o], g), j(() => {
|
|
494
|
+
c.current?.updateOptions(s);
|
|
495
|
+
}, [s], g), j(() => {
|
|
496
|
+
!c.current || n === void 0 || (c.current.getOption(m.current.editor.EditorOption.readOnly) ? c.current.setValue(n) : n !== c.current.getValue() && (X.current = !0, c.current.executeEdits("", [{ range: c.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), c.current.pushUndoStop(), X.current = !1));
|
|
497
|
+
}, [n], g), j(() => {
|
|
498
|
+
let O = c.current?.getModel();
|
|
499
|
+
O && i && m.current?.editor.setModelLanguage(O, i);
|
|
500
|
+
}, [i], g), j(() => {
|
|
501
|
+
f !== void 0 && c.current?.revealLine(f);
|
|
502
|
+
}, [f], g), j(() => {
|
|
503
|
+
m.current?.editor.setTheme(u);
|
|
504
|
+
}, [u], g);
|
|
505
|
+
let ce = ie(() => {
|
|
506
|
+
if (!(!D.current || !m.current) && !ue.current) {
|
|
507
|
+
B.current(m.current);
|
|
508
|
+
let O = o || r, L = x(m.current, n || e || "", t || i || "", O || "");
|
|
509
|
+
c.current = m.current?.editor.create(D.current, { model: L, automaticLayout: !0, ...s }, C), w && c.current.restoreViewState(G.get(O)), m.current.editor.setTheme(u), f !== void 0 && c.current.revealLine(f), a(!0), ue.current = !0;
|
|
510
|
+
}
|
|
511
|
+
}, [e, t, r, n, i, o, s, C, w, u, f]);
|
|
512
|
+
S(() => {
|
|
513
|
+
g && H.current(c.current, m.current);
|
|
514
|
+
}, [g]), S(() => {
|
|
515
|
+
!l && !g && ce();
|
|
516
|
+
}, [l, g, ce]), d.current = n, S(() => {
|
|
517
|
+
g && A && (z.current?.dispose(), z.current = c.current?.onDidChangeModelContent((O) => {
|
|
518
|
+
X.current || A(c.current.getValue(), O);
|
|
519
|
+
}));
|
|
520
|
+
}, [g, A]), S(() => {
|
|
521
|
+
if (g) {
|
|
522
|
+
let O = m.current.editor.onDidChangeMarkers((L) => {
|
|
523
|
+
let Z = c.current.getModel()?.uri;
|
|
524
|
+
if (Z && L.find((ee) => ee.path === Z.path)) {
|
|
525
|
+
let ee = m.current.editor.getModelMarkers({ resource: Z });
|
|
526
|
+
P?.(ee);
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
return () => {
|
|
530
|
+
O?.dispose();
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
return () => {
|
|
534
|
+
};
|
|
535
|
+
}, [g, P]);
|
|
536
|
+
function Me() {
|
|
537
|
+
z.current?.dispose(), N ? w && G.set(o, c.current.saveViewState()) : c.current.getModel()?.dispose(), c.current.dispose();
|
|
538
|
+
}
|
|
539
|
+
return R.createElement(Oe, { width: q, height: E, isEditorReady: g, loading: p, _ref: D, className: $, wrapperProps: M });
|
|
540
|
+
}
|
|
541
|
+
var Dt = At, xt = oe(Dt), Rt = xt;
|
|
542
|
+
const Vt = qt(500), Nt = Ce(
|
|
543
|
+
({
|
|
544
|
+
feedback: e,
|
|
545
|
+
hint: t,
|
|
546
|
+
inline: r,
|
|
547
|
+
label: n,
|
|
548
|
+
defaultValue: i,
|
|
549
|
+
readOnly: o,
|
|
550
|
+
value: u,
|
|
551
|
+
language: f = "plaintext",
|
|
552
|
+
height: p = "220px",
|
|
553
|
+
jsonSchema: s = "none",
|
|
554
|
+
onValidate: C,
|
|
555
|
+
onValid: w,
|
|
556
|
+
onChange: N,
|
|
557
|
+
noRounding: q = !1,
|
|
558
|
+
...E
|
|
559
|
+
}, $) => {
|
|
560
|
+
const M = Lt(), I = v(null), [b, A] = V(
|
|
561
|
+
null
|
|
562
|
+
), {
|
|
563
|
+
settings: { domain: P }
|
|
564
|
+
} = Pe(), g = (a, l) => {
|
|
565
|
+
a != null && $ != null && typeof $ == "object" && ($.current = a), A(a), a.layout(), a.onDidPaste(() => {
|
|
566
|
+
a.getAction("editor.action.formatDocument")?.run();
|
|
567
|
+
}), a.onDidChangeModelContent(() => {
|
|
568
|
+
const h = a.getModel(), m = l.editor.getModelMarkers({
|
|
569
|
+
resource: h?.uri
|
|
570
|
+
}), c = a.getValue();
|
|
571
|
+
Vt(() => {
|
|
572
|
+
C?.(m.length > 0 ? m : null), N?.(c), m.length === 0 && w?.(c);
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
return S(() => ((async () => {
|
|
577
|
+
const a = b?.getModel()?.uri.toString();
|
|
578
|
+
if (M != null && a != null && s != null) {
|
|
579
|
+
I.current?.dispose();
|
|
580
|
+
const l = M.languages.json.jsonDefaults.diagnosticsOptions.schemas ?? [];
|
|
581
|
+
switch (s) {
|
|
582
|
+
case "none":
|
|
583
|
+
break;
|
|
584
|
+
case "organization-config": {
|
|
585
|
+
l.push({
|
|
586
|
+
schema: await fetch(
|
|
587
|
+
`https://provisioning.${P}/api/public/schemas/organization_config`
|
|
588
|
+
).then(async (h) => await h.json()).then((h) => F(h)),
|
|
589
|
+
uri: `file:///json-schema--${s}.json`,
|
|
590
|
+
fileMatch: [a]
|
|
591
|
+
});
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
case "order-rules": {
|
|
595
|
+
l.push({
|
|
596
|
+
schema: await fetch(
|
|
597
|
+
`https://core.${P}/api/public/schemas/order_rules`
|
|
598
|
+
).then(async (h) => await h.json()).then((h) => F(h)),
|
|
599
|
+
uri: `file:///json-schema--${s}.json`,
|
|
600
|
+
fileMatch: [a]
|
|
601
|
+
}), I.current = me(M, a, ["order"]);
|
|
602
|
+
break;
|
|
603
|
+
}
|
|
604
|
+
case "price-rules": {
|
|
605
|
+
l.push({
|
|
606
|
+
schema: await fetch(
|
|
607
|
+
`https://core.${P}/api/public/schemas/price_rules`
|
|
608
|
+
).then(async (h) => await h.json()).then((h) => F(h)),
|
|
609
|
+
uri: `file:///json-schema--${s}.json`,
|
|
610
|
+
fileMatch: [a]
|
|
611
|
+
}), I.current = me(M, a, ["price"]);
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
M.languages.json.jsonDefaults.setDiagnosticsOptions({
|
|
616
|
+
enableSchemaRequest: !0,
|
|
617
|
+
schemaRequest: "ignore",
|
|
618
|
+
schemaValidation: "error",
|
|
619
|
+
validate: !0,
|
|
620
|
+
schemas: l
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
})(), () => {
|
|
624
|
+
I.current?.dispose();
|
|
625
|
+
}), [M, b, s, P]), /* @__PURE__ */ le.jsx(
|
|
626
|
+
Se,
|
|
627
|
+
{
|
|
628
|
+
label: n,
|
|
629
|
+
hint: t,
|
|
630
|
+
feedback: e,
|
|
631
|
+
name: E.id ?? E.name,
|
|
632
|
+
inline: r,
|
|
633
|
+
className: "h-full [&>div:first-of-type]:h-full",
|
|
634
|
+
children: /* @__PURE__ */ le.jsx(
|
|
635
|
+
Rt,
|
|
636
|
+
{
|
|
637
|
+
defaultPath: E.id ?? E.name,
|
|
638
|
+
className: q ? void 0 : "[&>.monaco-editor]:rounded [&>.monaco-editor>.overflow-guard]:rounded",
|
|
639
|
+
theme: "vs-dark",
|
|
640
|
+
language: f,
|
|
641
|
+
height: p,
|
|
642
|
+
defaultValue: i,
|
|
643
|
+
value: u,
|
|
644
|
+
onMount: g,
|
|
645
|
+
options: {
|
|
646
|
+
quickSuggestions: !0,
|
|
647
|
+
readOnly: o,
|
|
648
|
+
domReadOnly: !0,
|
|
649
|
+
automaticLayout: !0,
|
|
650
|
+
insertSpaces: !0,
|
|
651
|
+
tabSize: 2,
|
|
652
|
+
lineNumbers: "on",
|
|
653
|
+
padding: { top: 18, bottom: 18 },
|
|
654
|
+
scrollBeyondLastLine: !1,
|
|
655
|
+
pasteAs: { enabled: !0 },
|
|
656
|
+
minimap: {
|
|
657
|
+
enabled: !1
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
)
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
Nt.displayName = "CodeEditor";
|
|
667
|
+
function qt(e = 100) {
|
|
668
|
+
let t = null;
|
|
669
|
+
return function(n) {
|
|
670
|
+
t !== null && clearTimeout(t), t = setTimeout(() => {
|
|
671
|
+
n(), t = null;
|
|
672
|
+
}, e);
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
function F(e, t) {
|
|
676
|
+
return typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map((r) => F(r)) : Object.entries(e).reduce((r, [n, i]) => t !== "properties" && ["examples", "default"].includes(n) ? r : {
|
|
677
|
+
...r,
|
|
678
|
+
[n]: F(i, n)
|
|
679
|
+
}, {});
|
|
680
|
+
}
|
|
681
|
+
function me(e, t, r) {
|
|
682
|
+
return e.languages.registerCompletionItemProvider("json", {
|
|
683
|
+
triggerCharacters: ['"', ":", "."],
|
|
684
|
+
provideCompletionItems: async (i, o) => {
|
|
685
|
+
if (i.uri.toString() !== t.toString())
|
|
686
|
+
return {
|
|
687
|
+
suggestions: []
|
|
688
|
+
};
|
|
689
|
+
const u = i.getWordUntilPosition(o), f = i.getLineContent(o.lineNumber).substring(0, o.column - 1);
|
|
690
|
+
if (/"(field|selector)"\s*:\s*"[^"]*$/.test(f)) {
|
|
691
|
+
const s = u.word;
|
|
692
|
+
if (s != null)
|
|
693
|
+
return {
|
|
694
|
+
incomplete: !1,
|
|
695
|
+
suggestions: (await Ee(
|
|
696
|
+
r,
|
|
697
|
+
s
|
|
698
|
+
)).map((w) => ({
|
|
699
|
+
kind: w.type === "relationship" ? e.languages.CompletionItemKind.Module : e.languages.CompletionItemKind.Value,
|
|
700
|
+
label: w.value,
|
|
701
|
+
insertText: w.value,
|
|
702
|
+
// documentation: `Field: ${suggestion}`,
|
|
703
|
+
range: {
|
|
704
|
+
startLineNumber: o.lineNumber,
|
|
705
|
+
startColumn: u.startColumn,
|
|
706
|
+
endLineNumber: o.lineNumber,
|
|
707
|
+
endColumn: u.endColumn
|
|
708
|
+
}
|
|
709
|
+
}))
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
return {
|
|
713
|
+
suggestions: []
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
export {
|
|
719
|
+
Nt as CodeEditor
|
|
720
|
+
};
|