react-antd-xform 1.0.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/LICENSE +21 -0
- package/README.md +2 -0
- package/dist/_virtual/_commonjsHelpers.js +8 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/jsx-runtime.js +4 -0
- package/dist/_virtual/react-jsx-runtime.development.js +4 -0
- package/dist/_virtual/react-jsx-runtime.production.min.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +4 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +4 -0
- package/dist/form/array-helper.d.ts +12 -0
- package/dist/form/array-helper.js +115 -0
- package/dist/form/common-utils.d.ts +12 -0
- package/dist/form/common-utils.js +90 -0
- package/dist/form/context/formEnvContext.d.ts +6 -0
- package/dist/form/context/formEnvContext.js +23 -0
- package/dist/form/context/modelContext.d.ts +4 -0
- package/dist/form/context/modelContext.js +11 -0
- package/dist/form/enum.d.ts +9 -0
- package/dist/form/enum.js +15 -0
- package/dist/form/form-item.d.ts +15 -0
- package/dist/form/form-item.js +286 -0
- package/dist/form/index.d.ts +22 -0
- package/dist/form/index.js +73 -0
- package/dist/form/layout.d.ts +4 -0
- package/dist/form/layout.js +180 -0
- package/dist/form/model-utils.d.ts +23 -0
- package/dist/form/model-utils.js +171 -0
- package/dist/form/model.d.ts +103 -0
- package/dist/form/model.js +504 -0
- package/dist/form/type.d.ts +289 -0
- package/dist/form-ui/common-utils.d.ts +9 -0
- package/dist/form-ui/common-utils.js +17 -0
- package/dist/form-ui/default-button.d.ts +3 -0
- package/dist/form-ui/default-button.js +39 -0
- package/dist/form-ui/default-component.d.ts +2 -0
- package/dist/form-ui/default-component.js +63 -0
- package/dist/form-ui/type.d.ts +2 -0
- package/dist/helpers/AsyncValue.d.ts +38 -0
- package/dist/helpers/AsyncValue.js +154 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +20 -0
- package/dist/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js +63 -0
- package/dist/node_modules/.pnpm/get-own-enumerable-keys@1.0.0/node_modules/get-own-enumerable-keys/index.js +10 -0
- package/dist/node_modules/.pnpm/invariant@2.2.4/node_modules/invariant/browser.js +32 -0
- package/dist/node_modules/.pnpm/is-obj@3.0.0/node_modules/is-obj/index.js +7 -0
- package/dist/node_modules/.pnpm/is-regexp@3.1.0/node_modules/is-regexp/index.js +7 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Hash.js +23 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_ListCache.js +23 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Map.js +8 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js +23 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +7 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_apply.js +17 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js +11 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayPush.js +11 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js +18 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseFlatten.js +25 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +16 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseHasIn.js +7 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsArguments.js +11 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNative.js +24 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePick.js +12 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePickBy.js +18 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSet.js +33 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSetToString.js +16 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js +23 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_coreJsData.js +7 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js +14 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_flatRest.js +11 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +6 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMapData.js +10 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js +11 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +27 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getValue.js +7 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasPath.js +27 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashClear.js +10 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashDelete.js +9 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashGet.js +17 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashHas.js +12 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashSet.js +13 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isFlattenable.js +12 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js +11 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js +18 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKeyable.js +8 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isMasked.js +13 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js +8 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js +22 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js +10 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js +9 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js +16 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js +16 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js +11 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js +9 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js +9 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js +12 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_memoizeCapped.js +17 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeCreate.js +7 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +9 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_overRest.js +23 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +8 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_setToString.js +8 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_shortOut.js +21 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToPath.js +18 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js +13 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toSource.js +19 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/constant.js +9 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js +7 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/flatten.js +10 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/hasIn.js +10 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/identity.js +7 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArguments.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js +5 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isFunction.js +15 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isLength.js +8 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +8 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +7 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js +11 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js +24 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/pick.js +12 -0
- package/dist/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js +9 -0
- package/dist/node_modules/.pnpm/mobx-react-lite@4.1.0_mobx@6.13.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/mobx-react-lite/es/ObserverComponent.js +5 -0
- package/dist/node_modules/.pnpm/mobx-react-lite@4.1.0_mobx@6.13.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/mobx-react-lite/es/index.js +18 -0
- package/dist/node_modules/.pnpm/mobx-react-lite@4.1.0_mobx@6.13.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/mobx-react-lite/es/observer.js +84 -0
- package/dist/node_modules/.pnpm/mobx-react-lite@4.1.0_mobx@6.13.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/mobx-react-lite/es/useObserver.js +72 -0
- package/dist/node_modules/.pnpm/mobx-react-lite@4.1.0_mobx@6.13.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/mobx-react-lite/es/utils/UniversalFinalizationRegistry.js +96 -0
- package/dist/node_modules/.pnpm/mobx-react-lite@4.1.0_mobx@6.13.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/mobx-react-lite/es/utils/assertEnvironment.js +8 -0
- package/dist/node_modules/.pnpm/mobx-react-lite@4.1.0_mobx@6.13.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/mobx-react-lite/es/utils/observerBatching.js +17 -0
- package/dist/node_modules/.pnpm/mobx-react-lite@4.1.0_mobx@6.13.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/mobx-react-lite/es/utils/observerFinalizationRegistry.js +9 -0
- package/dist/node_modules/.pnpm/mobx-react-lite@4.1.0_mobx@6.13.7_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/mobx-react-lite/es/utils/printDebugValue.js +7 -0
- package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.development.js +890 -0
- package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js +33 -0
- package/dist/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js +12 -0
- package/dist/node_modules/.pnpm/stringify-object@5.0.0/node_modules/stringify-object/index.js +94 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@18.3.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +77 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@18.3.1/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +62 -0
- package/dist/node_modules/.pnpm/use-sync-external-store@1.5.0_react@18.3.1/node_modules/use-sync-external-store/shim/index.js +12 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +58 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "./utils/assertEnvironment.js";
|
|
2
|
+
import { unstable_batchedUpdates } from "react-dom";
|
|
3
|
+
import { observerBatching } from "./utils/observerBatching.js";
|
|
4
|
+
import "mobx";
|
|
5
|
+
import "react";
|
|
6
|
+
import { observerFinalizationRegistry } from "./utils/observerFinalizationRegistry.js";
|
|
7
|
+
import "../../../../use-sync-external-store@1.5.0_react@18.3.1/node_modules/use-sync-external-store/shim/index.js";
|
|
8
|
+
import { observer } from "./observer.js";
|
|
9
|
+
import "./ObserverComponent.js";
|
|
10
|
+
var _a;
|
|
11
|
+
observerBatching(unstable_batchedUpdates);
|
|
12
|
+
(_a = observerFinalizationRegistry["finalizeAllImmediately"]) !== null && _a !== void 0 ? _a : function() {
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
observerFinalizationRegistry as _observerFinalizationRegistry,
|
|
16
|
+
observer,
|
|
17
|
+
observerBatching
|
|
18
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { forwardRef, memo } from "react";
|
|
2
|
+
import { useObserver } from "./useObserver.js";
|
|
3
|
+
var _a, _b;
|
|
4
|
+
var warnObserverOptionsDeprecated = true;
|
|
5
|
+
var warnLegacyContextTypes = true;
|
|
6
|
+
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
7
|
+
var isFunctionNameConfigurable = (_b = (_a = Object.getOwnPropertyDescriptor(function() {
|
|
8
|
+
}, "name")) === null || _a === void 0 ? void 0 : _a.configurable) !== null && _b !== void 0 ? _b : false;
|
|
9
|
+
var ReactForwardRefSymbol = hasSymbol ? Symbol.for("react.forward_ref") : typeof forwardRef === "function" && forwardRef(function(props) {
|
|
10
|
+
return null;
|
|
11
|
+
})["$$typeof"];
|
|
12
|
+
var ReactMemoSymbol = hasSymbol ? Symbol.for("react.memo") : typeof memo === "function" && memo(function(props) {
|
|
13
|
+
return null;
|
|
14
|
+
})["$$typeof"];
|
|
15
|
+
function observer(baseComponent, options) {
|
|
16
|
+
var _a2;
|
|
17
|
+
if (process.env.NODE_ENV !== "production" && warnObserverOptionsDeprecated && options) ;
|
|
18
|
+
if (ReactMemoSymbol && baseComponent["$$typeof"] === ReactMemoSymbol) {
|
|
19
|
+
throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");
|
|
20
|
+
}
|
|
21
|
+
var useForwardRef = (_a2 = void 0) !== null && _a2 !== void 0 ? _a2 : false;
|
|
22
|
+
var render = baseComponent;
|
|
23
|
+
var baseComponentName = baseComponent.displayName || baseComponent.name;
|
|
24
|
+
if (ReactForwardRefSymbol && baseComponent["$$typeof"] === ReactForwardRefSymbol) {
|
|
25
|
+
useForwardRef = true;
|
|
26
|
+
render = baseComponent["render"];
|
|
27
|
+
if (typeof render !== "function") {
|
|
28
|
+
throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var observerComponent = function(props, ref) {
|
|
32
|
+
return useObserver(function() {
|
|
33
|
+
return render(props, ref);
|
|
34
|
+
}, baseComponentName);
|
|
35
|
+
};
|
|
36
|
+
observerComponent.displayName = baseComponent.displayName;
|
|
37
|
+
if (isFunctionNameConfigurable) {
|
|
38
|
+
Object.defineProperty(observerComponent, "name", {
|
|
39
|
+
value: baseComponent.name,
|
|
40
|
+
writable: true,
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (baseComponent.contextTypes) {
|
|
45
|
+
observerComponent.contextTypes = baseComponent.contextTypes;
|
|
46
|
+
if (process.env.NODE_ENV !== "production" && warnLegacyContextTypes) {
|
|
47
|
+
warnLegacyContextTypes = false;
|
|
48
|
+
console.warn("[mobx-react-lite] Support for Legacy Context in function components will be removed in the next major release.");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (useForwardRef) {
|
|
52
|
+
observerComponent = forwardRef(observerComponent);
|
|
53
|
+
}
|
|
54
|
+
observerComponent = memo(observerComponent);
|
|
55
|
+
copyStaticProperties(baseComponent, observerComponent);
|
|
56
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
57
|
+
Object.defineProperty(observerComponent, "contextTypes", {
|
|
58
|
+
set: function() {
|
|
59
|
+
var _a3, _b2;
|
|
60
|
+
throw new Error("[mobx-react-lite] `".concat(this.displayName || ((_a3 = this.type) === null || _a3 === void 0 ? void 0 : _a3.displayName) || ((_b2 = this.type) === null || _b2 === void 0 ? void 0 : _b2.name) || "Component", ".contextTypes` must be set before applying `observer`."));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return observerComponent;
|
|
65
|
+
}
|
|
66
|
+
var hoistBlackList = {
|
|
67
|
+
$$typeof: true,
|
|
68
|
+
render: true,
|
|
69
|
+
compare: true,
|
|
70
|
+
type: true,
|
|
71
|
+
// Don't redefine `displayName`,
|
|
72
|
+
// it's defined as getter-setter pair on `memo` (see #3192).
|
|
73
|
+
displayName: true
|
|
74
|
+
};
|
|
75
|
+
function copyStaticProperties(base, target) {
|
|
76
|
+
Object.keys(base).forEach(function(key) {
|
|
77
|
+
if (!hoistBlackList[key]) {
|
|
78
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export {
|
|
83
|
+
observer
|
|
84
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Reaction } from "mobx";
|
|
2
|
+
import require$$0 from "react";
|
|
3
|
+
import { printDebugValue } from "./utils/printDebugValue.js";
|
|
4
|
+
import { observerFinalizationRegistry } from "./utils/observerFinalizationRegistry.js";
|
|
5
|
+
import { s as shimExports } from "../../../../use-sync-external-store@1.5.0_react@18.3.1/node_modules/use-sync-external-store/shim/index.js";
|
|
6
|
+
function createReaction(adm) {
|
|
7
|
+
adm.reaction = new Reaction("observer".concat(adm.name), function() {
|
|
8
|
+
var _a;
|
|
9
|
+
adm.stateVersion = Symbol();
|
|
10
|
+
(_a = adm.onStoreChange) === null || _a === void 0 ? void 0 : _a.call(adm);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function useObserver(render, baseComponentName) {
|
|
14
|
+
if (baseComponentName === void 0) {
|
|
15
|
+
baseComponentName = "observed";
|
|
16
|
+
}
|
|
17
|
+
var admRef = require$$0.useRef(null);
|
|
18
|
+
if (!admRef.current) {
|
|
19
|
+
var adm_1 = {
|
|
20
|
+
reaction: null,
|
|
21
|
+
onStoreChange: null,
|
|
22
|
+
stateVersion: Symbol(),
|
|
23
|
+
name: baseComponentName,
|
|
24
|
+
subscribe: function(onStoreChange) {
|
|
25
|
+
observerFinalizationRegistry.unregister(adm_1);
|
|
26
|
+
adm_1.onStoreChange = onStoreChange;
|
|
27
|
+
if (!adm_1.reaction) {
|
|
28
|
+
createReaction(adm_1);
|
|
29
|
+
adm_1.stateVersion = Symbol();
|
|
30
|
+
}
|
|
31
|
+
return function() {
|
|
32
|
+
var _a;
|
|
33
|
+
adm_1.onStoreChange = null;
|
|
34
|
+
(_a = adm_1.reaction) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
35
|
+
adm_1.reaction = null;
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
getSnapshot: function() {
|
|
39
|
+
return adm_1.stateVersion;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
admRef.current = adm_1;
|
|
43
|
+
}
|
|
44
|
+
var adm = admRef.current;
|
|
45
|
+
if (!adm.reaction) {
|
|
46
|
+
createReaction(adm);
|
|
47
|
+
observerFinalizationRegistry.register(admRef, adm, adm);
|
|
48
|
+
}
|
|
49
|
+
require$$0.useDebugValue(adm.reaction, printDebugValue);
|
|
50
|
+
shimExports.useSyncExternalStore(
|
|
51
|
+
// Both of these must be stable, otherwise it would keep resubscribing every render.
|
|
52
|
+
adm.subscribe,
|
|
53
|
+
adm.getSnapshot,
|
|
54
|
+
adm.getSnapshot
|
|
55
|
+
);
|
|
56
|
+
var renderResult;
|
|
57
|
+
var exception;
|
|
58
|
+
adm.reaction.track(function() {
|
|
59
|
+
try {
|
|
60
|
+
renderResult = render();
|
|
61
|
+
} catch (e) {
|
|
62
|
+
exception = e;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (exception) {
|
|
66
|
+
throw exception;
|
|
67
|
+
}
|
|
68
|
+
return renderResult;
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
useObserver
|
|
72
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
var REGISTRY_FINALIZE_AFTER = 1e4;
|
|
2
|
+
var REGISTRY_SWEEP_INTERVAL = 1e4;
|
|
3
|
+
var TimerBasedFinalizationRegistry = (
|
|
4
|
+
/** @class */
|
|
5
|
+
function() {
|
|
6
|
+
function TimerBasedFinalizationRegistry2(finalize) {
|
|
7
|
+
var _this = this;
|
|
8
|
+
Object.defineProperty(this, "finalize", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: finalize
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(this, "registrations", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: /* @__PURE__ */ new Map()
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "sweepTimeout", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "sweep", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: function(maxAge) {
|
|
31
|
+
if (maxAge === void 0) {
|
|
32
|
+
maxAge = REGISTRY_FINALIZE_AFTER;
|
|
33
|
+
}
|
|
34
|
+
clearTimeout(_this.sweepTimeout);
|
|
35
|
+
_this.sweepTimeout = void 0;
|
|
36
|
+
var now = Date.now();
|
|
37
|
+
_this.registrations.forEach(function(registration, token) {
|
|
38
|
+
if (now - registration.registeredAt >= maxAge) {
|
|
39
|
+
_this.finalize(registration.value);
|
|
40
|
+
_this.registrations.delete(token);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
if (_this.registrations.size > 0) {
|
|
44
|
+
_this.scheduleSweep();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(this, "finalizeAllImmediately", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: function() {
|
|
53
|
+
_this.sweep(0);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
Object.defineProperty(TimerBasedFinalizationRegistry2.prototype, "register", {
|
|
58
|
+
enumerable: false,
|
|
59
|
+
configurable: true,
|
|
60
|
+
writable: true,
|
|
61
|
+
value: function(target, value, token) {
|
|
62
|
+
this.registrations.set(token, {
|
|
63
|
+
value,
|
|
64
|
+
registeredAt: Date.now()
|
|
65
|
+
});
|
|
66
|
+
this.scheduleSweep();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
Object.defineProperty(TimerBasedFinalizationRegistry2.prototype, "unregister", {
|
|
70
|
+
enumerable: false,
|
|
71
|
+
configurable: true,
|
|
72
|
+
writable: true,
|
|
73
|
+
value: function(token) {
|
|
74
|
+
this.registrations.delete(token);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
Object.defineProperty(TimerBasedFinalizationRegistry2.prototype, "scheduleSweep", {
|
|
78
|
+
enumerable: false,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: function() {
|
|
82
|
+
if (this.sweepTimeout === void 0) {
|
|
83
|
+
this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return TimerBasedFinalizationRegistry2;
|
|
88
|
+
}()
|
|
89
|
+
);
|
|
90
|
+
var UniversalFinalizationRegistry = typeof FinalizationRegistry !== "undefined" ? FinalizationRegistry : TimerBasedFinalizationRegistry;
|
|
91
|
+
export {
|
|
92
|
+
REGISTRY_FINALIZE_AFTER,
|
|
93
|
+
REGISTRY_SWEEP_INTERVAL,
|
|
94
|
+
TimerBasedFinalizationRegistry,
|
|
95
|
+
UniversalFinalizationRegistry
|
|
96
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { makeObservable } from "mobx";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
if (!useState) {
|
|
4
|
+
throw new Error("mobx-react-lite requires React with Hooks support");
|
|
5
|
+
}
|
|
6
|
+
if (!makeObservable) {
|
|
7
|
+
throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { configure } from "mobx";
|
|
2
|
+
function defaultNoopBatch(callback) {
|
|
3
|
+
callback();
|
|
4
|
+
}
|
|
5
|
+
function observerBatching(reactionScheduler) {
|
|
6
|
+
if (!reactionScheduler) {
|
|
7
|
+
reactionScheduler = defaultNoopBatch;
|
|
8
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
9
|
+
console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
configure({ reactionScheduler });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
defaultNoopBatch,
|
|
16
|
+
observerBatching
|
|
17
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UniversalFinalizationRegistry } from "./UniversalFinalizationRegistry.js";
|
|
2
|
+
var observerFinalizationRegistry = new UniversalFinalizationRegistry(function(adm) {
|
|
3
|
+
var _a;
|
|
4
|
+
(_a = adm.reaction) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
5
|
+
adm.reaction = null;
|
|
6
|
+
});
|
|
7
|
+
export {
|
|
8
|
+
observerFinalizationRegistry
|
|
9
|
+
};
|