@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
|
@@ -1,739 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { u as Se, j as se, I as Ee } from "./main-YD7ko8U-.js";
|
|
3
|
-
import U, { memo as ce, useState as k, useEffect as L, useRef as y, useCallback as ue, forwardRef as Ie } from "react";
|
|
4
|
-
import { f as Ce } from "./fetchCoreResourcesSuggestions-CZkDwjO2.js";
|
|
5
|
-
function Le(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 fe(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 ? fe(Object(r), !0).forEach(function(n) {
|
|
27
|
-
Le(e, n, r[n]);
|
|
28
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : fe(Object(r)).forEach(function(n) {
|
|
29
|
-
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return e;
|
|
33
|
-
}
|
|
34
|
-
function $e(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 Ae(e, t) {
|
|
42
|
-
if (e == null) return {};
|
|
43
|
-
var r = $e(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 De(e, t) {
|
|
52
|
-
return Te(e) || xe(e, t) || Ne(e, t) || Re();
|
|
53
|
-
}
|
|
54
|
-
function Te(e) {
|
|
55
|
-
if (Array.isArray(e)) return e;
|
|
56
|
-
}
|
|
57
|
-
function xe(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 s = e[Symbol.iterator](), h; !(n = (h = s.next()).done) && (r.push(h.value), !(t && r.length === t)); n = !0)
|
|
62
|
-
;
|
|
63
|
-
} catch (m) {
|
|
64
|
-
i = !0, o = m;
|
|
65
|
-
} finally {
|
|
66
|
-
try {
|
|
67
|
-
!n && s.return != null && s.return();
|
|
68
|
-
} finally {
|
|
69
|
-
if (i) throw o;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
return r;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function Ne(e, t) {
|
|
76
|
-
if (e) {
|
|
77
|
-
if (typeof e == "string") return pe(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 pe(e, t);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function pe(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 qe(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 ge(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 he(e) {
|
|
111
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
112
|
-
var r = arguments[t] != null ? arguments[t] : {};
|
|
113
|
-
t % 2 ? ge(Object(r), !0).forEach(function(n) {
|
|
114
|
-
qe(e, n, r[n]);
|
|
115
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ge(Object(r)).forEach(function(n) {
|
|
116
|
-
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
return e;
|
|
120
|
-
}
|
|
121
|
-
function ze() {
|
|
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 B(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 s = arguments.length, h = new Array(s), m = 0; m < s; m++)
|
|
136
|
-
h[m] = arguments[m];
|
|
137
|
-
return t.apply(r, [].concat(i, h));
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function te(e) {
|
|
142
|
-
return {}.toString.call(e).includes("Object");
|
|
143
|
-
}
|
|
144
|
-
function Ve(e) {
|
|
145
|
-
return !Object.keys(e).length;
|
|
146
|
-
}
|
|
147
|
-
function J(e) {
|
|
148
|
-
return typeof e == "function";
|
|
149
|
-
}
|
|
150
|
-
function Ue(e, t) {
|
|
151
|
-
return Object.prototype.hasOwnProperty.call(e, t);
|
|
152
|
-
}
|
|
153
|
-
function ke(e, t) {
|
|
154
|
-
return te(t) || D("changeType"), Object.keys(t).some(function(r) {
|
|
155
|
-
return !Ue(e, r);
|
|
156
|
-
}) && D("changeField"), t;
|
|
157
|
-
}
|
|
158
|
-
function Fe(e) {
|
|
159
|
-
J(e) || D("selectorType");
|
|
160
|
-
}
|
|
161
|
-
function We(e) {
|
|
162
|
-
J(e) || te(e) || D("handlerType"), te(e) && Object.values(e).some(function(t) {
|
|
163
|
-
return !J(t);
|
|
164
|
-
}) && D("handlersType");
|
|
165
|
-
}
|
|
166
|
-
function _e(e) {
|
|
167
|
-
e || D("initialIsRequired"), te(e) || D("initialType"), Ve(e) && D("initialContent");
|
|
168
|
-
}
|
|
169
|
-
function He(e, t) {
|
|
170
|
-
throw new Error(e[t] || e.default);
|
|
171
|
-
}
|
|
172
|
-
var Be = {
|
|
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
|
-
}, D = B(He)(Be), Z = {
|
|
183
|
-
changes: ke,
|
|
184
|
-
selector: Fe,
|
|
185
|
-
handler: We,
|
|
186
|
-
initial: _e
|
|
187
|
-
};
|
|
188
|
-
function Ke(e) {
|
|
189
|
-
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
190
|
-
Z.initial(e), Z.handler(t);
|
|
191
|
-
var r = {
|
|
192
|
-
current: e
|
|
193
|
-
}, n = B(Ye)(r, t), i = B(Je)(r), o = B(Z.changes)(e), s = B(Ge)(r);
|
|
194
|
-
function h() {
|
|
195
|
-
var v = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(j) {
|
|
196
|
-
return j;
|
|
197
|
-
};
|
|
198
|
-
return Z.selector(v), v(r.current);
|
|
199
|
-
}
|
|
200
|
-
function m(v) {
|
|
201
|
-
ze(n, i, o, s)(v);
|
|
202
|
-
}
|
|
203
|
-
return [h, m];
|
|
204
|
-
}
|
|
205
|
-
function Ge(e, t) {
|
|
206
|
-
return J(t) ? t(e.current) : t;
|
|
207
|
-
}
|
|
208
|
-
function Je(e, t) {
|
|
209
|
-
return e.current = he(he({}, e.current), t), t;
|
|
210
|
-
}
|
|
211
|
-
function Ye(e, t, r) {
|
|
212
|
-
return J(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 Qe = {
|
|
218
|
-
create: Ke
|
|
219
|
-
}, Xe = {
|
|
220
|
-
paths: {
|
|
221
|
-
vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
function Ze(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 s = arguments.length, h = new Array(s), m = 0; m < s; m++)
|
|
230
|
-
h[m] = arguments[m];
|
|
231
|
-
return t.apply(r, [].concat(i, h));
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
function et(e) {
|
|
236
|
-
return {}.toString.call(e).includes("Object");
|
|
237
|
-
}
|
|
238
|
-
function tt(e) {
|
|
239
|
-
return e || me("configIsRequired"), et(e) || me("configType"), e.urls ? (rt(), {
|
|
240
|
-
paths: {
|
|
241
|
-
vs: e.urls.monacoBase
|
|
242
|
-
}
|
|
243
|
-
}) : e;
|
|
244
|
-
}
|
|
245
|
-
function rt() {
|
|
246
|
-
console.warn(be.deprecation);
|
|
247
|
-
}
|
|
248
|
-
function nt(e, t) {
|
|
249
|
-
throw new Error(e[t] || e.default);
|
|
250
|
-
}
|
|
251
|
-
var be = {
|
|
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
|
-
}, me = Ze(nt)(be), it = {
|
|
266
|
-
config: tt
|
|
267
|
-
}, ot = 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, s) {
|
|
272
|
-
return s(o);
|
|
273
|
-
}, i);
|
|
274
|
-
};
|
|
275
|
-
};
|
|
276
|
-
function we(e, t) {
|
|
277
|
-
return Object.keys(t).forEach(function(r) {
|
|
278
|
-
t[r] instanceof Object && e[r] && Object.assign(t[r], we(e[r], t[r]));
|
|
279
|
-
}), de(de({}, e), t);
|
|
280
|
-
}
|
|
281
|
-
var at = {
|
|
282
|
-
type: "cancelation",
|
|
283
|
-
msg: "operation is manually canceled"
|
|
284
|
-
};
|
|
285
|
-
function ie(e) {
|
|
286
|
-
var t = !1, r = new Promise(function(n, i) {
|
|
287
|
-
e.then(function(o) {
|
|
288
|
-
return t ? i(at) : n(o);
|
|
289
|
-
}), e.catch(i);
|
|
290
|
-
});
|
|
291
|
-
return r.cancel = function() {
|
|
292
|
-
return t = !0;
|
|
293
|
-
}, r;
|
|
294
|
-
}
|
|
295
|
-
var ut = Qe.create({
|
|
296
|
-
config: Xe,
|
|
297
|
-
isInitialized: !1,
|
|
298
|
-
resolve: null,
|
|
299
|
-
reject: null,
|
|
300
|
-
monaco: null
|
|
301
|
-
}), ye = De(ut, 2), Y = ye[0], ne = ye[1];
|
|
302
|
-
function ct(e) {
|
|
303
|
-
var t = it.config(e), r = t.monaco, n = Ae(t, ["monaco"]);
|
|
304
|
-
ne(function(i) {
|
|
305
|
-
return {
|
|
306
|
-
config: we(i.config, n),
|
|
307
|
-
monaco: r
|
|
308
|
-
};
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
function lt() {
|
|
312
|
-
var e = Y(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 (ne({
|
|
322
|
-
isInitialized: !0
|
|
323
|
-
}), e.monaco)
|
|
324
|
-
return e.resolve(e.monaco), ie(oe);
|
|
325
|
-
if (window.monaco && window.monaco.editor)
|
|
326
|
-
return Oe(window.monaco), e.resolve(window.monaco), ie(oe);
|
|
327
|
-
ot(st, dt)(pt);
|
|
328
|
-
}
|
|
329
|
-
return ie(oe);
|
|
330
|
-
}
|
|
331
|
-
function st(e) {
|
|
332
|
-
return document.body.appendChild(e);
|
|
333
|
-
}
|
|
334
|
-
function ft(e) {
|
|
335
|
-
var t = document.createElement("script");
|
|
336
|
-
return e && (t.src = e), t;
|
|
337
|
-
}
|
|
338
|
-
function dt(e) {
|
|
339
|
-
var t = Y(function(n) {
|
|
340
|
-
var i = n.config, o = n.reject;
|
|
341
|
-
return {
|
|
342
|
-
config: i,
|
|
343
|
-
reject: o
|
|
344
|
-
};
|
|
345
|
-
}), r = ft("".concat(t.config.paths.vs, "/loader.js"));
|
|
346
|
-
return r.onload = function() {
|
|
347
|
-
return e();
|
|
348
|
-
}, r.onerror = t.reject, r;
|
|
349
|
-
}
|
|
350
|
-
function pt() {
|
|
351
|
-
var e = Y(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
|
-
Oe(r), e.resolve(r);
|
|
361
|
-
}, function(r) {
|
|
362
|
-
e.reject(r);
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
function Oe(e) {
|
|
366
|
-
Y().monaco || ne({
|
|
367
|
-
monaco: e
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
function gt() {
|
|
371
|
-
return Y(function(e) {
|
|
372
|
-
var t = e.monaco;
|
|
373
|
-
return t;
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
var oe = new Promise(function(e, t) {
|
|
377
|
-
return ne({
|
|
378
|
-
resolve: e,
|
|
379
|
-
reject: t
|
|
380
|
-
});
|
|
381
|
-
}), re = {
|
|
382
|
-
config: ct,
|
|
383
|
-
init: lt,
|
|
384
|
-
__getMonacoInstance: gt
|
|
385
|
-
}, ht = { wrapper: { display: "flex", position: "relative", textAlign: "initial" }, fullWidth: { width: "100%" }, hide: { display: "none" } }, ae = ht, mt = { container: { display: "flex", height: "100%", width: "100%", justifyContent: "center", alignItems: "center" } }, vt = mt;
|
|
386
|
-
function bt({ children: e }) {
|
|
387
|
-
return U.createElement("div", { style: vt.container }, e);
|
|
388
|
-
}
|
|
389
|
-
var wt = bt, yt = wt;
|
|
390
|
-
function Ot({ width: e, height: t, isEditorReady: r, loading: n, _ref: i, className: o, wrapperProps: s }) {
|
|
391
|
-
return U.createElement("section", { style: { ...ae.wrapper, width: e, height: t }, ...s }, !r && U.createElement(yt, null, n), U.createElement("div", { ref: i, style: { ...ae.fullWidth, ...!r && ae.hide }, className: o }));
|
|
392
|
-
}
|
|
393
|
-
var jt = Ot, je = ce(jt);
|
|
394
|
-
function Mt(e) {
|
|
395
|
-
L(e, []);
|
|
396
|
-
}
|
|
397
|
-
var le = Mt;
|
|
398
|
-
function Pt(e, t, r = !0) {
|
|
399
|
-
let n = y(!0);
|
|
400
|
-
L(n.current || !r ? () => {
|
|
401
|
-
n.current = !1;
|
|
402
|
-
} : e, t);
|
|
403
|
-
}
|
|
404
|
-
var S = Pt;
|
|
405
|
-
function K() {
|
|
406
|
-
}
|
|
407
|
-
function V(e, t, r, n) {
|
|
408
|
-
return St(e, n) || Et(e, t, r, n);
|
|
409
|
-
}
|
|
410
|
-
function St(e, t) {
|
|
411
|
-
return e.editor.getModel(Me(e, t));
|
|
412
|
-
}
|
|
413
|
-
function Et(e, t, r, n) {
|
|
414
|
-
return e.editor.createModel(t, r, n ? Me(e, n) : void 0);
|
|
415
|
-
}
|
|
416
|
-
function Me(e, t) {
|
|
417
|
-
return e.Uri.parse(t);
|
|
418
|
-
}
|
|
419
|
-
function It({ original: e, modified: t, language: r, originalLanguage: n, modifiedLanguage: i, originalModelPath: o, modifiedModelPath: s, keepCurrentOriginalModel: h = !1, keepCurrentModifiedModel: m = !1, theme: v = "light", loading: j = "Loading...", options: M = {}, height: T = "100%", width: F = "100%", className: $, wrapperProps: x = {}, beforeMount: C = K, onMount: E = K }) {
|
|
420
|
-
let [b, N] = k(!1), [I, w] = k(!0), c = y(null), f = y(null), O = y(null), d = y(E), a = y(C), R = y(!1);
|
|
421
|
-
le(() => {
|
|
422
|
-
let u = re.init();
|
|
423
|
-
return u.then((p) => (f.current = p) && w(!1)).catch((p) => (p == null ? void 0 : p.type) !== "cancelation" && console.error("Monaco initialization: error:", p)), () => c.current ? W() : u.cancel();
|
|
424
|
-
}), S(() => {
|
|
425
|
-
if (c.current && f.current) {
|
|
426
|
-
let u = c.current.getOriginalEditor(), p = V(f.current, e || "", n || r || "text", o || "");
|
|
427
|
-
p !== u.getModel() && u.setModel(p);
|
|
428
|
-
}
|
|
429
|
-
}, [o], b), S(() => {
|
|
430
|
-
if (c.current && f.current) {
|
|
431
|
-
let u = c.current.getModifiedEditor(), p = V(f.current, t || "", i || r || "text", s || "");
|
|
432
|
-
p !== u.getModel() && u.setModel(p);
|
|
433
|
-
}
|
|
434
|
-
}, [s], b), S(() => {
|
|
435
|
-
let u = c.current.getModifiedEditor();
|
|
436
|
-
u.getOption(f.current.editor.EditorOption.readOnly) ? u.setValue(t || "") : t !== u.getValue() && (u.executeEdits("", [{ range: u.getModel().getFullModelRange(), text: t || "", forceMoveMarkers: !0 }]), u.pushUndoStop());
|
|
437
|
-
}, [t], b), S(() => {
|
|
438
|
-
var u, p;
|
|
439
|
-
(p = (u = c.current) == null ? void 0 : u.getModel()) == null || p.original.setValue(e || "");
|
|
440
|
-
}, [e], b), S(() => {
|
|
441
|
-
let { original: u, modified: p } = c.current.getModel();
|
|
442
|
-
f.current.editor.setModelLanguage(u, n || r || "text"), f.current.editor.setModelLanguage(p, i || r || "text");
|
|
443
|
-
}, [r, n, i], b), S(() => {
|
|
444
|
-
var u;
|
|
445
|
-
(u = f.current) == null || u.editor.setTheme(v);
|
|
446
|
-
}, [v], b), S(() => {
|
|
447
|
-
var u;
|
|
448
|
-
(u = c.current) == null || u.updateOptions(M);
|
|
449
|
-
}, [M], b);
|
|
450
|
-
let Q = ue(() => {
|
|
451
|
-
var A;
|
|
452
|
-
if (!f.current) return;
|
|
453
|
-
a.current(f.current);
|
|
454
|
-
let u = V(f.current, e || "", n || r || "text", o || ""), p = V(f.current, t || "", i || r || "text", s || "");
|
|
455
|
-
(A = c.current) == null || A.setModel({ original: u, modified: p });
|
|
456
|
-
}, [r, t, i, e, n, o, s]), X = ue(() => {
|
|
457
|
-
var u;
|
|
458
|
-
!R.current && O.current && (c.current = f.current.editor.createDiffEditor(O.current, { automaticLayout: !0, ...M }), Q(), (u = f.current) == null || u.editor.setTheme(v), N(!0), R.current = !0);
|
|
459
|
-
}, [M, v, Q]);
|
|
460
|
-
L(() => {
|
|
461
|
-
b && d.current(c.current, f.current);
|
|
462
|
-
}, [b]), L(() => {
|
|
463
|
-
!I && !b && X();
|
|
464
|
-
}, [I, b, X]);
|
|
465
|
-
function W() {
|
|
466
|
-
var p, A, q, _;
|
|
467
|
-
let u = (p = c.current) == null ? void 0 : p.getModel();
|
|
468
|
-
h || ((A = u == null ? void 0 : u.original) == null || A.dispose()), m || ((q = u == null ? void 0 : u.modified) == null || q.dispose()), (_ = c.current) == null || _.dispose();
|
|
469
|
-
}
|
|
470
|
-
return U.createElement(je, { width: F, height: T, isEditorReady: b, loading: j, _ref: O, className: $, wrapperProps: x });
|
|
471
|
-
}
|
|
472
|
-
var Ct = It;
|
|
473
|
-
ce(Ct);
|
|
474
|
-
function Lt() {
|
|
475
|
-
let [e, t] = k(re.__getMonacoInstance());
|
|
476
|
-
return le(() => {
|
|
477
|
-
let r;
|
|
478
|
-
return e || (r = re.init(), r.then((n) => {
|
|
479
|
-
t(n);
|
|
480
|
-
})), () => r == null ? void 0 : r.cancel();
|
|
481
|
-
}), e;
|
|
482
|
-
}
|
|
483
|
-
var $t = Lt;
|
|
484
|
-
function At(e) {
|
|
485
|
-
let t = y();
|
|
486
|
-
return L(() => {
|
|
487
|
-
t.current = e;
|
|
488
|
-
}, [e]), t.current;
|
|
489
|
-
}
|
|
490
|
-
var Dt = At, ee = /* @__PURE__ */ new Map();
|
|
491
|
-
function Tt({ defaultValue: e, defaultLanguage: t, defaultPath: r, value: n, language: i, path: o, theme: s = "light", line: h, loading: m = "Loading...", options: v = {}, overrideServices: j = {}, saveViewState: M = !0, keepCurrentModel: T = !1, width: F = "100%", height: $ = "100%", className: x, wrapperProps: C = {}, beforeMount: E = K, onMount: b = K, onChange: N, onValidate: I = K }) {
|
|
492
|
-
let [w, c] = k(!1), [f, O] = k(!0), d = y(null), a = y(null), R = y(null), Q = y(b), X = y(E), W = y(), u = y(n), p = Dt(o), A = y(!1), q = y(!1);
|
|
493
|
-
le(() => {
|
|
494
|
-
let l = re.init();
|
|
495
|
-
return l.then((g) => (d.current = g) && O(!1)).catch((g) => (g == null ? void 0 : g.type) !== "cancelation" && console.error("Monaco initialization: error:", g)), () => a.current ? Pe() : l.cancel();
|
|
496
|
-
}), S(() => {
|
|
497
|
-
var g, P, H, z;
|
|
498
|
-
let l = V(d.current, e || n || "", t || i || "", o || r || "");
|
|
499
|
-
l !== ((g = a.current) == null ? void 0 : g.getModel()) && (M && ee.set(p, (P = a.current) == null ? void 0 : P.saveViewState()), (H = a.current) == null || H.setModel(l), M && ((z = a.current) == null || z.restoreViewState(ee.get(o))));
|
|
500
|
-
}, [o], w), S(() => {
|
|
501
|
-
var l;
|
|
502
|
-
(l = a.current) == null || l.updateOptions(v);
|
|
503
|
-
}, [v], w), S(() => {
|
|
504
|
-
!a.current || n === void 0 || (a.current.getOption(d.current.editor.EditorOption.readOnly) ? a.current.setValue(n) : n !== a.current.getValue() && (q.current = !0, a.current.executeEdits("", [{ range: a.current.getModel().getFullModelRange(), text: n, forceMoveMarkers: !0 }]), a.current.pushUndoStop(), q.current = !1));
|
|
505
|
-
}, [n], w), S(() => {
|
|
506
|
-
var g, P;
|
|
507
|
-
let l = (g = a.current) == null ? void 0 : g.getModel();
|
|
508
|
-
l && i && ((P = d.current) == null || P.editor.setModelLanguage(l, i));
|
|
509
|
-
}, [i], w), S(() => {
|
|
510
|
-
var l;
|
|
511
|
-
h !== void 0 && ((l = a.current) == null || l.revealLine(h));
|
|
512
|
-
}, [h], w), S(() => {
|
|
513
|
-
var l;
|
|
514
|
-
(l = d.current) == null || l.editor.setTheme(s);
|
|
515
|
-
}, [s], w);
|
|
516
|
-
let _ = ue(() => {
|
|
517
|
-
var l;
|
|
518
|
-
if (!(!R.current || !d.current) && !A.current) {
|
|
519
|
-
X.current(d.current);
|
|
520
|
-
let g = o || r, P = V(d.current, n || e || "", t || i || "", g || "");
|
|
521
|
-
a.current = (l = d.current) == null ? void 0 : l.editor.create(R.current, { model: P, automaticLayout: !0, ...v }, j), M && a.current.restoreViewState(ee.get(g)), d.current.editor.setTheme(s), h !== void 0 && a.current.revealLine(h), c(!0), A.current = !0;
|
|
522
|
-
}
|
|
523
|
-
}, [e, t, r, n, i, o, v, j, M, s, h]);
|
|
524
|
-
L(() => {
|
|
525
|
-
w && Q.current(a.current, d.current);
|
|
526
|
-
}, [w]), L(() => {
|
|
527
|
-
!f && !w && _();
|
|
528
|
-
}, [f, w, _]), u.current = n, L(() => {
|
|
529
|
-
var l, g;
|
|
530
|
-
w && N && ((l = W.current) == null || l.dispose(), W.current = (g = a.current) == null ? void 0 : g.onDidChangeModelContent((P) => {
|
|
531
|
-
q.current || N(a.current.getValue(), P);
|
|
532
|
-
}));
|
|
533
|
-
}, [w, N]), L(() => {
|
|
534
|
-
if (w) {
|
|
535
|
-
let l = d.current.editor.onDidChangeMarkers((g) => {
|
|
536
|
-
var H;
|
|
537
|
-
let P = (H = a.current.getModel()) == null ? void 0 : H.uri;
|
|
538
|
-
if (P && g.find((z) => z.path === P.path)) {
|
|
539
|
-
let z = d.current.editor.getModelMarkers({ resource: P });
|
|
540
|
-
I == null || I(z);
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
return () => {
|
|
544
|
-
l == null || l.dispose();
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
return () => {
|
|
548
|
-
};
|
|
549
|
-
}, [w, I]);
|
|
550
|
-
function Pe() {
|
|
551
|
-
var l, g;
|
|
552
|
-
(l = W.current) == null || l.dispose(), T ? M && ee.set(o, a.current.saveViewState()) : (g = a.current.getModel()) == null || g.dispose(), a.current.dispose();
|
|
553
|
-
}
|
|
554
|
-
return U.createElement(je, { width: F, height: $, isEditorReady: w, loading: m, _ref: R, className: x, wrapperProps: C });
|
|
555
|
-
}
|
|
556
|
-
var xt = Tt, Nt = ce(xt), Rt = Nt;
|
|
557
|
-
const qt = Vt(500), zt = Ie(
|
|
558
|
-
({
|
|
559
|
-
feedback: e,
|
|
560
|
-
hint: t,
|
|
561
|
-
inline: r,
|
|
562
|
-
label: n,
|
|
563
|
-
defaultValue: i,
|
|
564
|
-
readOnly: o,
|
|
565
|
-
value: s,
|
|
566
|
-
language: h = "plaintext",
|
|
567
|
-
height: m = "220px",
|
|
568
|
-
jsonSchema: v = "none",
|
|
569
|
-
onValidate: j,
|
|
570
|
-
onValid: M,
|
|
571
|
-
onChange: T,
|
|
572
|
-
noRounding: F = !1,
|
|
573
|
-
...$
|
|
574
|
-
}, x) => {
|
|
575
|
-
const C = $t(), E = y(null), [b, N] = k(
|
|
576
|
-
null
|
|
577
|
-
), {
|
|
578
|
-
settings: { domain: I }
|
|
579
|
-
} = Se(), w = (c, f) => {
|
|
580
|
-
c != null && x != null && typeof x == "object" && (x.current = c), N(c), c.layout(), c.onDidPaste(() => {
|
|
581
|
-
var O;
|
|
582
|
-
(O = c.getAction("editor.action.formatDocument")) == null || O.run();
|
|
583
|
-
}), c.onDidChangeModelContent(() => {
|
|
584
|
-
const O = c.getModel(), d = f.editor.getModelMarkers({
|
|
585
|
-
resource: O == null ? void 0 : O.uri
|
|
586
|
-
}), a = c.getValue();
|
|
587
|
-
qt(() => {
|
|
588
|
-
j == null || j(d.length > 0 ? d : null), T == null || T(a), d.length === 0 && (M == null || M(a));
|
|
589
|
-
});
|
|
590
|
-
});
|
|
591
|
-
};
|
|
592
|
-
return L(() => (async function() {
|
|
593
|
-
var f, O;
|
|
594
|
-
const c = (f = b == null ? void 0 : b.getModel()) == null ? void 0 : f.uri.toString();
|
|
595
|
-
if (C != null && c != null && v != null) {
|
|
596
|
-
(O = E.current) == null || O.call(E);
|
|
597
|
-
const d = C.languages.json.jsonDefaults.diagnosticsOptions.schemas ?? [];
|
|
598
|
-
switch (v) {
|
|
599
|
-
case "none":
|
|
600
|
-
break;
|
|
601
|
-
case "organization-config": {
|
|
602
|
-
d.push({
|
|
603
|
-
schema: await fetch(
|
|
604
|
-
`https://provisioning.${I}/api/public/schemas/organization_config`
|
|
605
|
-
).then(async (a) => await a.json()).then((a) => G(a)),
|
|
606
|
-
uri: `file:///json-schema--${v}.json`,
|
|
607
|
-
fileMatch: [c]
|
|
608
|
-
});
|
|
609
|
-
break;
|
|
610
|
-
}
|
|
611
|
-
case "order-rules": {
|
|
612
|
-
d.push({
|
|
613
|
-
schema: await fetch(
|
|
614
|
-
`https://core.${I}/api/public/schemas/order_rules`
|
|
615
|
-
).then(async (a) => await a.json()).then((a) => G(a)),
|
|
616
|
-
uri: `file:///json-schema--${v}.json`,
|
|
617
|
-
fileMatch: [c]
|
|
618
|
-
}), E.current = ve(C, c, ["order"]);
|
|
619
|
-
break;
|
|
620
|
-
}
|
|
621
|
-
case "price-rules": {
|
|
622
|
-
d.push({
|
|
623
|
-
schema: await fetch(
|
|
624
|
-
`https://core.${I}/api/public/schemas/price_rules`
|
|
625
|
-
).then(async (a) => await a.json()).then((a) => G(a)),
|
|
626
|
-
uri: `file:///json-schema--${v}.json`,
|
|
627
|
-
fileMatch: [c]
|
|
628
|
-
}), E.current = ve(C, c, ["price"]);
|
|
629
|
-
break;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
C.languages.json.jsonDefaults.setDiagnosticsOptions({
|
|
633
|
-
enableSchemaRequest: !0,
|
|
634
|
-
schemaRequest: "ignore",
|
|
635
|
-
schemaValidation: "error",
|
|
636
|
-
validate: !0,
|
|
637
|
-
schemas: d
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
}(), () => {
|
|
641
|
-
var c;
|
|
642
|
-
(c = E.current) == null || c.call(E);
|
|
643
|
-
}), [C, b, v, I]), /* @__PURE__ */ se.jsx(
|
|
644
|
-
Ee,
|
|
645
|
-
{
|
|
646
|
-
label: n,
|
|
647
|
-
hint: t,
|
|
648
|
-
feedback: e,
|
|
649
|
-
name: $.id ?? $.name,
|
|
650
|
-
inline: r,
|
|
651
|
-
className: "h-full [&>div:first-of-type]:h-full",
|
|
652
|
-
children: /* @__PURE__ */ se.jsx(
|
|
653
|
-
Rt,
|
|
654
|
-
{
|
|
655
|
-
defaultPath: $.id ?? $.name,
|
|
656
|
-
className: F ? void 0 : "[&>.monaco-editor]:rounded [&>.monaco-editor>.overflow-guard]:rounded",
|
|
657
|
-
theme: "vs-dark",
|
|
658
|
-
language: h,
|
|
659
|
-
height: m,
|
|
660
|
-
defaultValue: i,
|
|
661
|
-
value: s,
|
|
662
|
-
onMount: w,
|
|
663
|
-
options: {
|
|
664
|
-
quickSuggestions: !0,
|
|
665
|
-
readOnly: o,
|
|
666
|
-
domReadOnly: !0,
|
|
667
|
-
automaticLayout: !0,
|
|
668
|
-
insertSpaces: !0,
|
|
669
|
-
tabSize: 2,
|
|
670
|
-
lineNumbers: "on",
|
|
671
|
-
padding: { top: 18, bottom: 18 },
|
|
672
|
-
scrollBeyondLastLine: !1,
|
|
673
|
-
pasteAs: { enabled: !0 },
|
|
674
|
-
minimap: {
|
|
675
|
-
enabled: !1
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
)
|
|
680
|
-
}
|
|
681
|
-
);
|
|
682
|
-
}
|
|
683
|
-
);
|
|
684
|
-
zt.displayName = "CodeEditor";
|
|
685
|
-
function Vt(e = 100) {
|
|
686
|
-
let t = null;
|
|
687
|
-
return function(n) {
|
|
688
|
-
t !== null && clearTimeout(t), t = setTimeout(() => {
|
|
689
|
-
n(), t = null;
|
|
690
|
-
}, e);
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
|
-
function G(e, t) {
|
|
694
|
-
return typeof e != "object" || e === null ? e : Array.isArray(e) ? e.map((r) => G(r)) : Object.entries(e).reduce((r, [n, i]) => t !== "properties" && ["examples", "default"].includes(n) ? r : {
|
|
695
|
-
...r,
|
|
696
|
-
[n]: G(i, n)
|
|
697
|
-
}, {});
|
|
698
|
-
}
|
|
699
|
-
function ve(e, t, r) {
|
|
700
|
-
return e.languages.registerCompletionItemProvider("json", {
|
|
701
|
-
triggerCharacters: ['"', ":", "."],
|
|
702
|
-
provideCompletionItems: async function(n, i) {
|
|
703
|
-
if (n.uri.toString() !== t.toString())
|
|
704
|
-
return {
|
|
705
|
-
suggestions: []
|
|
706
|
-
};
|
|
707
|
-
const o = n.getWordUntilPosition(i), s = n.getLineContent(i.lineNumber).substring(0, i.column - 1);
|
|
708
|
-
if (/"(field|selector)"\s*:\s*"[^"]*$/.test(s)) {
|
|
709
|
-
const m = o.word;
|
|
710
|
-
if (m != null)
|
|
711
|
-
return {
|
|
712
|
-
incomplete: !1,
|
|
713
|
-
suggestions: (await Ce(
|
|
714
|
-
r,
|
|
715
|
-
m
|
|
716
|
-
)).map((j) => ({
|
|
717
|
-
kind: j.type === "relationship" ? e.languages.CompletionItemKind.Module : e.languages.CompletionItemKind.Value,
|
|
718
|
-
label: j.value,
|
|
719
|
-
insertText: j.value,
|
|
720
|
-
// documentation: `Field: ${suggestion}`,
|
|
721
|
-
range: {
|
|
722
|
-
startLineNumber: i.lineNumber,
|
|
723
|
-
startColumn: o.startColumn,
|
|
724
|
-
endLineNumber: i.lineNumber,
|
|
725
|
-
endColumn: o.endColumn
|
|
726
|
-
}
|
|
727
|
-
}))
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
return {
|
|
731
|
-
suggestions: []
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
}).dispose = () => {
|
|
735
|
-
};
|
|
736
|
-
}
|
|
737
|
-
export {
|
|
738
|
-
zt as CodeEditor
|
|
739
|
-
};
|