@tachybase/schema 0.23.41 → 0.23.47
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/lib/core/effects/index.d.ts +2 -0
- package/lib/core/effects/index.js +23 -0
- package/lib/core/effects/onFieldEffects.d.ts +27 -0
- package/lib/core/effects/onFieldEffects.js +158 -0
- package/lib/core/effects/onFormEffects.d.ts +24 -0
- package/lib/core/effects/onFormEffects.js +117 -0
- package/lib/core/global.d.js +0 -0
- package/lib/core/index.d.ts +4 -0
- package/lib/core/index.js +27 -0
- package/lib/core/models/ArrayField.d.ts +17 -0
- package/lib/core/models/ArrayField.js +145 -0
- package/lib/core/models/BaseField.d.ts +72 -0
- package/lib/core/models/BaseField.js +285 -0
- package/lib/core/models/Field.d.ts +70 -0
- package/lib/core/models/Field.js +426 -0
- package/lib/core/models/Form.d.ts +102 -0
- package/lib/core/models/Form.js +483 -0
- package/lib/core/models/Graph.d.ts +8 -0
- package/lib/core/models/Graph.js +77 -0
- package/lib/core/models/Heart.d.ts +16 -0
- package/lib/core/models/Heart.js +91 -0
- package/lib/core/models/LifeCycle.d.ts +14 -0
- package/lib/core/models/LifeCycle.js +64 -0
- package/lib/core/models/ObjectField.d.ts +12 -0
- package/lib/core/models/ObjectField.js +64 -0
- package/lib/core/models/Query.d.ts +18 -0
- package/lib/core/models/Query.js +105 -0
- package/lib/core/models/VoidField.d.ts +14 -0
- package/lib/core/models/VoidField.js +117 -0
- package/lib/core/models/index.d.ts +9 -0
- package/lib/core/models/index.js +37 -0
- package/lib/core/models/types.d.ts +9 -0
- package/lib/core/models/types.js +15 -0
- package/lib/core/shared/checkers.d.ts +117 -0
- package/lib/core/shared/checkers.js +109 -0
- package/lib/core/shared/constants.d.ts +48 -0
- package/lib/core/shared/constants.js +86 -0
- package/lib/core/shared/effective.d.ts +9 -0
- package/lib/core/shared/effective.js +91 -0
- package/lib/core/shared/externals.d.ts +8 -0
- package/lib/core/shared/externals.js +87 -0
- package/lib/core/shared/internals.d.ts +54 -0
- package/lib/core/shared/internals.js +956 -0
- package/lib/core/types.d.ts +275 -0
- package/lib/core/types.js +76 -0
- package/lib/grid/index.d.ts +67 -0
- package/lib/grid/index.js +378 -0
- package/lib/grid/observer.d.ts +19 -0
- package/lib/grid/observer.js +107 -0
- package/lib/index.d.ts +12 -24
- package/lib/index.js +27 -244
- package/lib/json-schema/compiler.d.ts +8 -0
- package/lib/json-schema/compiler.js +129 -0
- package/lib/json-schema/global.d.js +0 -0
- package/lib/json-schema/index.d.ts +2 -0
- package/lib/json-schema/index.js +23 -0
- package/lib/json-schema/patches.d.ts +5 -0
- package/lib/json-schema/patches.js +68 -0
- package/lib/json-schema/polyfills/SPECIFICATION_1_0.d.ts +2 -0
- package/lib/json-schema/polyfills/SPECIFICATION_1_0.js +132 -0
- package/lib/json-schema/polyfills/index.d.ts +1 -0
- package/lib/json-schema/polyfills/index.js +21 -0
- package/lib/json-schema/schema.d.ts +88 -0
- package/lib/json-schema/schema.js +231 -0
- package/lib/json-schema/shared.d.ts +62 -0
- package/lib/json-schema/shared.js +232 -0
- package/lib/json-schema/transformer.d.ts +4 -0
- package/lib/json-schema/transformer.js +238 -0
- package/lib/json-schema/types.d.ts +119 -0
- package/lib/json-schema/types.js +15 -0
- package/lib/path/contexts.d.ts +10 -0
- package/lib/path/contexts.js +49 -0
- package/lib/path/destructor.d.ts +15 -0
- package/lib/path/destructor.js +151 -0
- package/lib/path/index.d.ts +51 -0
- package/lib/path/index.js +513 -0
- package/lib/path/matcher.d.ts +33 -0
- package/lib/path/matcher.js +197 -0
- package/lib/path/parser.d.ts +33 -0
- package/lib/path/parser.js +379 -0
- package/lib/path/shared.d.ts +13 -0
- package/lib/path/shared.js +121 -0
- package/lib/path/tokenizer.d.ts +27 -0
- package/lib/path/tokenizer.js +269 -0
- package/lib/path/tokens.d.ts +27 -0
- package/lib/path/tokens.js +216 -0
- package/lib/path/types.d.ts +88 -0
- package/lib/path/types.js +63 -0
- package/lib/react/components/ArrayField.d.ts +6 -0
- package/lib/react/components/ArrayField.js +44 -0
- package/lib/react/components/ExpressionScope.d.ts +2 -0
- package/lib/react/components/ExpressionScope.js +35 -0
- package/lib/react/components/Field.d.ts +5 -0
- package/lib/react/components/Field.js +45 -0
- package/lib/react/components/FormConsumer.d.ts +2 -0
- package/lib/react/components/FormConsumer.js +36 -0
- package/lib/react/components/FormProvider.d.ts +2 -0
- package/lib/react/components/FormProvider.js +35 -0
- package/lib/react/components/ObjectField.d.ts +6 -0
- package/lib/react/components/ObjectField.js +39 -0
- package/lib/react/components/ReactiveField.d.ts +11 -0
- package/lib/react/components/ReactiveField.js +115 -0
- package/lib/react/components/RecordScope.d.ts +2 -0
- package/lib/react/components/RecordScope.js +65 -0
- package/lib/react/components/RecordsScope.d.ts +2 -0
- package/lib/react/components/RecordsScope.js +43 -0
- package/lib/react/components/RecursionField.d.ts +2 -0
- package/lib/react/components/RecursionField.js +105 -0
- package/lib/react/components/SchemaField.d.ts +41 -0
- package/lib/react/components/SchemaField.js +154 -0
- package/lib/react/components/VoidField.d.ts +5 -0
- package/lib/react/components/VoidField.js +39 -0
- package/lib/react/components/index.d.ts +11 -0
- package/lib/react/components/index.js +41 -0
- package/lib/react/global.d.js +0 -0
- package/lib/react/hooks/index.d.ts +6 -0
- package/lib/react/hooks/index.js +31 -0
- package/lib/react/hooks/useAttach.d.ts +6 -0
- package/lib/react/hooks/useAttach.js +35 -0
- package/lib/react/hooks/useExpressionScope.d.ts +1 -0
- package/lib/react/hooks/useExpressionScope.js +30 -0
- package/lib/react/hooks/useField.d.ts +2 -0
- package/lib/react/hooks/useField.js +32 -0
- package/lib/react/hooks/useFieldSchema.d.ts +2 -0
- package/lib/react/hooks/useFieldSchema.js +32 -0
- package/lib/react/hooks/useForm.d.ts +2 -0
- package/lib/react/hooks/useForm.js +32 -0
- package/lib/react/hooks/useFormEffects.d.ts +2 -0
- package/lib/react/hooks/useFormEffects.js +42 -0
- package/lib/react/hooks/useParentForm.d.ts +2 -0
- package/lib/react/hooks/useParentForm.js +40 -0
- package/lib/react/index.d.ts +5 -0
- package/lib/react/index.js +29 -0
- package/lib/react/shared/connect.d.ts +9 -0
- package/lib/react/shared/connect.js +118 -0
- package/lib/react/shared/context.d.ts +14 -0
- package/lib/react/shared/context.js +74 -0
- package/lib/react/shared/index.d.ts +2 -0
- package/lib/react/shared/index.js +23 -0
- package/lib/react/shared/render.d.ts +2 -0
- package/lib/react/shared/render.js +69 -0
- package/lib/react/types.d.ts +84 -0
- package/lib/react/types.js +15 -0
- package/lib/reactive/action.d.ts +2 -0
- package/lib/reactive/action.js +48 -0
- package/lib/reactive/annotations/box.d.ts +7 -0
- package/lib/reactive/annotations/box.js +76 -0
- package/lib/reactive/annotations/computed.d.ts +12 -0
- package/lib/reactive/annotations/computed.js +154 -0
- package/lib/reactive/annotations/index.d.ts +5 -0
- package/lib/reactive/annotations/index.js +29 -0
- package/lib/reactive/annotations/observable.d.ts +4 -0
- package/lib/reactive/annotations/observable.js +67 -0
- package/lib/reactive/annotations/ref.d.ts +6 -0
- package/lib/reactive/annotations/ref.js +78 -0
- package/lib/reactive/annotations/shallow.d.ts +2 -0
- package/lib/reactive/annotations/shallow.js +67 -0
- package/lib/reactive/array.d.ts +12 -0
- package/lib/reactive/array.js +83 -0
- package/lib/reactive/autorun.d.ts +7 -0
- package/lib/reactive/autorun.js +155 -0
- package/lib/reactive/batch.d.ts +2 -0
- package/lib/reactive/batch.js +40 -0
- package/lib/reactive/checkers.d.ts +10 -0
- package/lib/reactive/checkers.js +60 -0
- package/lib/reactive/environment.d.ts +28 -0
- package/lib/reactive/environment.js +76 -0
- package/lib/reactive/externals.d.ts +10 -0
- package/lib/reactive/externals.js +156 -0
- package/lib/reactive/global.d.js +0 -0
- package/lib/reactive/handlers.d.ts +4 -0
- package/lib/reactive/handlers.js +246 -0
- package/lib/reactive/index.d.ts +10 -0
- package/lib/reactive/index.js +39 -0
- package/lib/reactive/internals.d.ts +17 -0
- package/lib/reactive/internals.js +139 -0
- package/lib/reactive/model.d.ts +3 -0
- package/lib/reactive/model.js +68 -0
- package/lib/reactive/observable.d.ts +9 -0
- package/lib/reactive/observable.js +50 -0
- package/lib/reactive/observe.d.ts +2 -0
- package/lib/reactive/observe.js +58 -0
- package/lib/reactive/reaction.d.ts +21 -0
- package/lib/reactive/reaction.js +278 -0
- package/lib/reactive/tracker.d.ts +7 -0
- package/lib/reactive/tracker.js +63 -0
- package/lib/reactive/tree.d.ts +25 -0
- package/lib/reactive/tree.js +106 -0
- package/lib/reactive/types.d.ts +79 -0
- package/lib/reactive/types.js +21 -0
- package/lib/reactive/untracked.d.ts +4 -0
- package/lib/reactive/untracked.js +29 -0
- package/lib/reactive-react/hooks/index.d.ts +9 -0
- package/lib/reactive-react/hooks/index.js +48 -0
- package/lib/reactive-react/hooks/useCompatEffect.d.ts +2 -0
- package/lib/reactive-react/hooks/useCompatEffect.js +60 -0
- package/lib/reactive-react/hooks/useCompatFactory.d.ts +3 -0
- package/lib/reactive-react/hooks/useCompatFactory.js +74 -0
- package/lib/reactive-react/hooks/useDidUpdate.d.ts +1 -0
- package/lib/reactive-react/hooks/useDidUpdate.js +38 -0
- package/lib/reactive-react/hooks/useForceUpdate.d.ts +1 -0
- package/lib/reactive-react/hooks/useForceUpdate.js +76 -0
- package/lib/reactive-react/hooks/useLayoutEffect.d.ts +2 -0
- package/lib/reactive-react/hooks/useLayoutEffect.js +28 -0
- package/lib/reactive-react/hooks/useObserver.d.ts +2 -0
- package/lib/reactive-react/hooks/useObserver.js +43 -0
- package/lib/reactive-react/index.d.ts +3 -0
- package/lib/reactive-react/index.js +25 -0
- package/lib/reactive-react/observer.d.ts +8 -0
- package/lib/reactive-react/observer.js +64 -0
- package/lib/reactive-react/shared/gc.d.ts +8 -0
- package/lib/reactive-react/shared/gc.js +59 -0
- package/lib/reactive-react/shared/global.d.ts +1 -0
- package/lib/reactive-react/shared/global.js +50 -0
- package/lib/reactive-react/shared/immediate.d.ts +1 -0
- package/lib/reactive-react/shared/immediate.js +40 -0
- package/lib/reactive-react/shared/index.d.ts +2 -0
- package/lib/reactive-react/shared/index.js +23 -0
- package/lib/reactive-react/types.d.ts +14 -0
- package/lib/reactive-react/types.js +15 -0
- package/lib/shared/array.d.ts +35 -0
- package/lib/shared/array.js +189 -0
- package/lib/shared/case.d.ts +6 -0
- package/lib/shared/case.js +39 -0
- package/lib/shared/checkers.d.ts +21 -0
- package/lib/shared/checkers.js +77 -0
- package/lib/shared/clone.d.ts +2 -0
- package/lib/shared/clone.js +97 -0
- package/lib/shared/compare.d.ts +1 -0
- package/lib/shared/compare.js +129 -0
- package/lib/shared/defaults.d.ts +6 -0
- package/lib/shared/defaults.js +63 -0
- package/lib/shared/deprecate.d.ts +1 -0
- package/lib/shared/deprecate.js +42 -0
- package/lib/shared/global.d.ts +1 -0
- package/lib/shared/global.js +50 -0
- package/lib/shared/index.d.ts +16 -0
- package/lib/shared/index.js +51 -0
- package/lib/shared/instanceof.d.ts +1 -0
- package/lib/shared/instanceof.js +36 -0
- package/lib/shared/isEmpty.d.ts +3 -0
- package/lib/shared/isEmpty.js +94 -0
- package/lib/shared/merge.d.ts +12 -0
- package/lib/shared/merge.js +214 -0
- package/lib/shared/middleware.d.ts +4 -0
- package/lib/shared/middleware.js +41 -0
- package/lib/shared/path.d.ts +3 -0
- package/lib/shared/path.js +27 -0
- package/lib/shared/string.d.ts +1 -0
- package/lib/shared/string.js +38 -0
- package/lib/shared/subscribable.d.ts +11 -0
- package/lib/shared/subscribable.js +74 -0
- package/lib/shared/uid.d.ts +1 -0
- package/lib/shared/uid.js +35 -0
- package/lib/validator/formats.d.ts +16 -0
- package/lib/validator/formats.js +40 -0
- package/lib/validator/index.d.ts +4 -0
- package/lib/validator/index.js +27 -0
- package/lib/validator/locale.d.ts +219 -0
- package/lib/validator/locale.js +240 -0
- package/lib/validator/parser.d.ts +5 -0
- package/lib/validator/parser.js +153 -0
- package/lib/validator/registry.d.ts +15 -0
- package/lib/validator/registry.js +116 -0
- package/lib/validator/rules.d.ts +3 -0
- package/lib/validator/rules.js +154 -0
- package/lib/validator/template.d.ts +2 -0
- package/lib/validator/template.js +42 -0
- package/lib/validator/types.d.ts +62 -0
- package/lib/validator/types.js +28 -0
- package/lib/validator/validator.d.ts +2 -0
- package/lib/validator/validator.js +63 -0
- package/package.json +16 -10
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var box_exports = {};
|
|
20
|
+
__export(box_exports, {
|
|
21
|
+
box: () => box
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(box_exports);
|
|
24
|
+
var import_environment = require("../environment");
|
|
25
|
+
var import_internals = require("../internals");
|
|
26
|
+
var import_reaction = require("../reaction");
|
|
27
|
+
var import_tree = require("../tree");
|
|
28
|
+
const box = (0, import_internals.createAnnotation)(({ target, key, value }) => {
|
|
29
|
+
const store = {
|
|
30
|
+
value: target ? target[key] : value
|
|
31
|
+
};
|
|
32
|
+
const proxy = {
|
|
33
|
+
set,
|
|
34
|
+
get
|
|
35
|
+
};
|
|
36
|
+
import_environment.ProxyRaw.set(proxy, store);
|
|
37
|
+
import_environment.RawProxy.set(store, proxy);
|
|
38
|
+
(0, import_tree.buildDataTree)(target, key, store);
|
|
39
|
+
function get() {
|
|
40
|
+
(0, import_reaction.bindTargetKeyWithCurrentReaction)({
|
|
41
|
+
target: store,
|
|
42
|
+
key,
|
|
43
|
+
type: "get"
|
|
44
|
+
});
|
|
45
|
+
return store.value;
|
|
46
|
+
}
|
|
47
|
+
__name(get, "get");
|
|
48
|
+
function set(value2) {
|
|
49
|
+
const oldValue = store.value;
|
|
50
|
+
store.value = value2;
|
|
51
|
+
if (oldValue !== value2) {
|
|
52
|
+
(0, import_reaction.runReactionsFromTargetKey)({
|
|
53
|
+
target: store,
|
|
54
|
+
key,
|
|
55
|
+
type: "set",
|
|
56
|
+
oldValue,
|
|
57
|
+
value: value2
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
__name(set, "set");
|
|
62
|
+
if (target) {
|
|
63
|
+
Object.defineProperty(target, key, {
|
|
64
|
+
value: proxy,
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: false,
|
|
67
|
+
writable: false
|
|
68
|
+
});
|
|
69
|
+
return target;
|
|
70
|
+
}
|
|
71
|
+
return proxy;
|
|
72
|
+
});
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
box
|
|
76
|
+
});
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var computed_exports = {};
|
|
20
|
+
__export(computed_exports, {
|
|
21
|
+
computed: () => computed
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(computed_exports);
|
|
24
|
+
var import_checkers = require("../checkers");
|
|
25
|
+
var import_environment = require("../environment");
|
|
26
|
+
var import_internals = require("../internals");
|
|
27
|
+
var import_reaction = require("../reaction");
|
|
28
|
+
var import_tree = require("../tree");
|
|
29
|
+
const getDescriptor = Object.getOwnPropertyDescriptor;
|
|
30
|
+
const getProto = Object.getPrototypeOf;
|
|
31
|
+
const ClassDescriptorSymbol = Symbol("ClassDescriptorSymbol");
|
|
32
|
+
function getPropertyDescriptor(obj, key) {
|
|
33
|
+
if (!obj) return;
|
|
34
|
+
return getDescriptor(obj, key) || getPropertyDescriptor(getProto(obj), key);
|
|
35
|
+
}
|
|
36
|
+
__name(getPropertyDescriptor, "getPropertyDescriptor");
|
|
37
|
+
function getPropertyDescriptorCache(obj, key) {
|
|
38
|
+
const constructor = obj.constructor;
|
|
39
|
+
if (constructor === Object || constructor === Array) return getPropertyDescriptor(obj, key);
|
|
40
|
+
const cache = constructor[ClassDescriptorSymbol] || {};
|
|
41
|
+
const descriptor = cache[key];
|
|
42
|
+
if (descriptor) return descriptor;
|
|
43
|
+
const newDesc = getPropertyDescriptor(obj, key);
|
|
44
|
+
constructor[ClassDescriptorSymbol] = cache;
|
|
45
|
+
cache[key] = newDesc;
|
|
46
|
+
return newDesc;
|
|
47
|
+
}
|
|
48
|
+
__name(getPropertyDescriptorCache, "getPropertyDescriptorCache");
|
|
49
|
+
function getPrototypeDescriptor(target, key, value) {
|
|
50
|
+
if (!target) {
|
|
51
|
+
if (value) {
|
|
52
|
+
if ((0, import_checkers.isFn)(value)) {
|
|
53
|
+
return { get: value };
|
|
54
|
+
} else {
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {};
|
|
59
|
+
}
|
|
60
|
+
const descriptor = getPropertyDescriptorCache(target, key);
|
|
61
|
+
if (descriptor) {
|
|
62
|
+
return descriptor;
|
|
63
|
+
}
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
__name(getPrototypeDescriptor, "getPrototypeDescriptor");
|
|
67
|
+
const computed = (0, import_internals.createAnnotation)(({ target, key, value }) => {
|
|
68
|
+
const store = {};
|
|
69
|
+
const proxy = {};
|
|
70
|
+
const context = target ? target : store;
|
|
71
|
+
const property = target ? key : "value";
|
|
72
|
+
const descriptor = getPrototypeDescriptor(target, property, value);
|
|
73
|
+
function compute() {
|
|
74
|
+
var _a;
|
|
75
|
+
store.value = (_a = descriptor.get) == null ? void 0 : _a.call(context);
|
|
76
|
+
}
|
|
77
|
+
__name(compute, "compute");
|
|
78
|
+
function reaction() {
|
|
79
|
+
if (import_environment.ReactionStack.indexOf(reaction) === -1) {
|
|
80
|
+
(0, import_reaction.releaseBindingReactions)(reaction);
|
|
81
|
+
try {
|
|
82
|
+
import_environment.ReactionStack.push(reaction);
|
|
83
|
+
compute();
|
|
84
|
+
} finally {
|
|
85
|
+
import_environment.ReactionStack.pop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
__name(reaction, "reaction");
|
|
90
|
+
reaction._name = "ComputedReaction";
|
|
91
|
+
reaction._scheduler = () => {
|
|
92
|
+
reaction._dirty = true;
|
|
93
|
+
(0, import_reaction.runReactionsFromTargetKey)({
|
|
94
|
+
target: context,
|
|
95
|
+
key: property,
|
|
96
|
+
value: store.value,
|
|
97
|
+
type: "set"
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
reaction._isComputed = true;
|
|
101
|
+
reaction._dirty = true;
|
|
102
|
+
reaction._context = context;
|
|
103
|
+
reaction._property = property;
|
|
104
|
+
function get() {
|
|
105
|
+
if ((0, import_reaction.hasRunningReaction)()) {
|
|
106
|
+
(0, import_reaction.bindComputedReactions)(reaction);
|
|
107
|
+
}
|
|
108
|
+
if (!(0, import_reaction.isUntracking)()) {
|
|
109
|
+
if (reaction._dirty) {
|
|
110
|
+
reaction();
|
|
111
|
+
reaction._dirty = false;
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
compute();
|
|
115
|
+
}
|
|
116
|
+
(0, import_reaction.bindTargetKeyWithCurrentReaction)({
|
|
117
|
+
target: context,
|
|
118
|
+
key: property,
|
|
119
|
+
type: "get"
|
|
120
|
+
});
|
|
121
|
+
return store.value;
|
|
122
|
+
}
|
|
123
|
+
__name(get, "get");
|
|
124
|
+
function set(value2) {
|
|
125
|
+
var _a;
|
|
126
|
+
try {
|
|
127
|
+
(0, import_reaction.batchStart)();
|
|
128
|
+
(_a = descriptor.set) == null ? void 0 : _a.call(context, value2);
|
|
129
|
+
} finally {
|
|
130
|
+
(0, import_reaction.batchEnd)();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
__name(set, "set");
|
|
134
|
+
if (target) {
|
|
135
|
+
Object.defineProperty(target, key, {
|
|
136
|
+
get,
|
|
137
|
+
set,
|
|
138
|
+
enumerable: true
|
|
139
|
+
});
|
|
140
|
+
return target;
|
|
141
|
+
} else {
|
|
142
|
+
Object.defineProperty(proxy, "value", {
|
|
143
|
+
set,
|
|
144
|
+
get
|
|
145
|
+
});
|
|
146
|
+
(0, import_tree.buildDataTree)(target, key, store);
|
|
147
|
+
proxy[import_environment.ObModelSymbol] = store;
|
|
148
|
+
}
|
|
149
|
+
return proxy;
|
|
150
|
+
});
|
|
151
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
152
|
+
0 && (module.exports = {
|
|
153
|
+
computed
|
|
154
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var annotations_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(annotations_exports);
|
|
17
|
+
__reExport(annotations_exports, require("./observable"), module.exports);
|
|
18
|
+
__reExport(annotations_exports, require("./box"), module.exports);
|
|
19
|
+
__reExport(annotations_exports, require("./ref"), module.exports);
|
|
20
|
+
__reExport(annotations_exports, require("./shallow"), module.exports);
|
|
21
|
+
__reExport(annotations_exports, require("./computed"), module.exports);
|
|
22
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
23
|
+
0 && (module.exports = {
|
|
24
|
+
...require("./observable"),
|
|
25
|
+
...require("./box"),
|
|
26
|
+
...require("./ref"),
|
|
27
|
+
...require("./shallow"),
|
|
28
|
+
...require("./computed")
|
|
29
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var observable_exports = {};
|
|
20
|
+
__export(observable_exports, {
|
|
21
|
+
observable: () => observable
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(observable_exports);
|
|
24
|
+
var import_internals = require("../internals");
|
|
25
|
+
var import_reaction = require("../reaction");
|
|
26
|
+
const observable = (0, import_internals.createAnnotation)(({ target, key, value }) => {
|
|
27
|
+
const store = {
|
|
28
|
+
value: (0, import_internals.createObservable)(target, key, target ? target[key] : value)
|
|
29
|
+
};
|
|
30
|
+
function get() {
|
|
31
|
+
(0, import_reaction.bindTargetKeyWithCurrentReaction)({
|
|
32
|
+
target,
|
|
33
|
+
key,
|
|
34
|
+
type: "get"
|
|
35
|
+
});
|
|
36
|
+
return store.value;
|
|
37
|
+
}
|
|
38
|
+
__name(get, "get");
|
|
39
|
+
function set(value2) {
|
|
40
|
+
const oldValue = store.value;
|
|
41
|
+
value2 = (0, import_internals.createObservable)(target, key, value2);
|
|
42
|
+
store.value = value2;
|
|
43
|
+
if (oldValue === value2) return;
|
|
44
|
+
(0, import_reaction.runReactionsFromTargetKey)({
|
|
45
|
+
target,
|
|
46
|
+
key,
|
|
47
|
+
type: "set",
|
|
48
|
+
oldValue,
|
|
49
|
+
value: value2
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
__name(set, "set");
|
|
53
|
+
if (target) {
|
|
54
|
+
Object.defineProperty(target, key, {
|
|
55
|
+
set,
|
|
56
|
+
get,
|
|
57
|
+
enumerable: true,
|
|
58
|
+
configurable: false
|
|
59
|
+
});
|
|
60
|
+
return target;
|
|
61
|
+
}
|
|
62
|
+
return store.value;
|
|
63
|
+
});
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
observable
|
|
67
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ref_exports = {};
|
|
20
|
+
__export(ref_exports, {
|
|
21
|
+
ref: () => ref
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ref_exports);
|
|
24
|
+
var import_environment = require("../environment");
|
|
25
|
+
var import_internals = require("../internals");
|
|
26
|
+
var import_reaction = require("../reaction");
|
|
27
|
+
var import_tree = require("../tree");
|
|
28
|
+
const ref = (0, import_internals.createAnnotation)(({ target, key, value }) => {
|
|
29
|
+
const store = {
|
|
30
|
+
value: target ? target[key] : value
|
|
31
|
+
};
|
|
32
|
+
const proxy = {};
|
|
33
|
+
const context = target ? target : store;
|
|
34
|
+
const property = target ? key : "value";
|
|
35
|
+
function get() {
|
|
36
|
+
(0, import_reaction.bindTargetKeyWithCurrentReaction)({
|
|
37
|
+
target: context,
|
|
38
|
+
key: property,
|
|
39
|
+
type: "get"
|
|
40
|
+
});
|
|
41
|
+
return store.value;
|
|
42
|
+
}
|
|
43
|
+
__name(get, "get");
|
|
44
|
+
function set(value2) {
|
|
45
|
+
const oldValue = store.value;
|
|
46
|
+
store.value = value2;
|
|
47
|
+
if (oldValue !== value2) {
|
|
48
|
+
(0, import_reaction.runReactionsFromTargetKey)({
|
|
49
|
+
target: context,
|
|
50
|
+
key: property,
|
|
51
|
+
type: "set",
|
|
52
|
+
oldValue,
|
|
53
|
+
value: value2
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
__name(set, "set");
|
|
58
|
+
if (target) {
|
|
59
|
+
Object.defineProperty(target, key, {
|
|
60
|
+
get,
|
|
61
|
+
set,
|
|
62
|
+
enumerable: true
|
|
63
|
+
});
|
|
64
|
+
return target;
|
|
65
|
+
} else {
|
|
66
|
+
Object.defineProperty(proxy, "value", {
|
|
67
|
+
set,
|
|
68
|
+
get
|
|
69
|
+
});
|
|
70
|
+
(0, import_tree.buildDataTree)(target, key, store);
|
|
71
|
+
proxy[import_environment.ObModelSymbol] = store;
|
|
72
|
+
}
|
|
73
|
+
return proxy;
|
|
74
|
+
});
|
|
75
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
+
0 && (module.exports = {
|
|
77
|
+
ref
|
|
78
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var shallow_exports = {};
|
|
20
|
+
__export(shallow_exports, {
|
|
21
|
+
shallow: () => shallow
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(shallow_exports);
|
|
24
|
+
var import_internals = require("../internals");
|
|
25
|
+
var import_reaction = require("../reaction");
|
|
26
|
+
const shallow = (0, import_internals.createAnnotation)(({ target, key, value }) => {
|
|
27
|
+
const store = {
|
|
28
|
+
value: (0, import_internals.createObservable)(target, key, target ? target[key] : value, true)
|
|
29
|
+
};
|
|
30
|
+
function get() {
|
|
31
|
+
(0, import_reaction.bindTargetKeyWithCurrentReaction)({
|
|
32
|
+
target,
|
|
33
|
+
key,
|
|
34
|
+
type: "get"
|
|
35
|
+
});
|
|
36
|
+
return store.value;
|
|
37
|
+
}
|
|
38
|
+
__name(get, "get");
|
|
39
|
+
function set(value2) {
|
|
40
|
+
const oldValue = store.value;
|
|
41
|
+
value2 = (0, import_internals.createObservable)(target, key, value2, true);
|
|
42
|
+
store.value = value2;
|
|
43
|
+
if (oldValue === value2) return;
|
|
44
|
+
(0, import_reaction.runReactionsFromTargetKey)({
|
|
45
|
+
target,
|
|
46
|
+
key,
|
|
47
|
+
type: "set",
|
|
48
|
+
oldValue,
|
|
49
|
+
value: value2
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
__name(set, "set");
|
|
53
|
+
if (target) {
|
|
54
|
+
Object.defineProperty(target, key, {
|
|
55
|
+
set,
|
|
56
|
+
get,
|
|
57
|
+
enumerable: true,
|
|
58
|
+
configurable: false
|
|
59
|
+
});
|
|
60
|
+
return target;
|
|
61
|
+
}
|
|
62
|
+
return store.value;
|
|
63
|
+
});
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
shallow
|
|
67
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const toArray: (value: any) => any[];
|
|
2
|
+
export declare class ArraySet<T> {
|
|
3
|
+
value: T[];
|
|
4
|
+
forEachIndex: number;
|
|
5
|
+
constructor(value?: T[]);
|
|
6
|
+
add(item: T): void;
|
|
7
|
+
has(item: T): boolean;
|
|
8
|
+
delete(item: T): void;
|
|
9
|
+
forEach(callback: (value: T) => void): void;
|
|
10
|
+
batchDelete(callback: (value: T) => void): void;
|
|
11
|
+
clear(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var array_exports = {};
|
|
20
|
+
__export(array_exports, {
|
|
21
|
+
ArraySet: () => ArraySet,
|
|
22
|
+
toArray: () => toArray
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(array_exports);
|
|
25
|
+
const toArray = /* @__PURE__ */ __name((value) => {
|
|
26
|
+
return Array.isArray(value) ? value : value !== void 0 && value !== null ? [value] : [];
|
|
27
|
+
}, "toArray");
|
|
28
|
+
const _ArraySet = class _ArraySet {
|
|
29
|
+
constructor(value = []) {
|
|
30
|
+
this.forEachIndex = 0;
|
|
31
|
+
this.value = value;
|
|
32
|
+
}
|
|
33
|
+
add(item) {
|
|
34
|
+
if (!this.has(item)) {
|
|
35
|
+
this.value.push(item);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
has(item) {
|
|
39
|
+
return this.value.indexOf(item) > -1;
|
|
40
|
+
}
|
|
41
|
+
delete(item) {
|
|
42
|
+
const len = this.value.length;
|
|
43
|
+
if (len === 0) return;
|
|
44
|
+
if (len === 1 && this.value[0] === item) {
|
|
45
|
+
this.value = [];
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const findIndex = this.value.indexOf(item);
|
|
49
|
+
if (findIndex > -1) {
|
|
50
|
+
this.value.splice(findIndex, 1);
|
|
51
|
+
if (findIndex <= this.forEachIndex) {
|
|
52
|
+
this.forEachIndex -= 1;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
forEach(callback) {
|
|
57
|
+
if (this.value.length === 0) return;
|
|
58
|
+
this.forEachIndex = 0;
|
|
59
|
+
for (; this.forEachIndex < this.value.length; this.forEachIndex++) {
|
|
60
|
+
callback(this.value[this.forEachIndex]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
batchDelete(callback) {
|
|
64
|
+
if (this.value.length === 0) return;
|
|
65
|
+
this.forEachIndex = 0;
|
|
66
|
+
for (; this.forEachIndex < this.value.length; this.forEachIndex++) {
|
|
67
|
+
const value = this.value[this.forEachIndex];
|
|
68
|
+
this.value.splice(this.forEachIndex, 1);
|
|
69
|
+
this.forEachIndex--;
|
|
70
|
+
callback(value);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
clear() {
|
|
74
|
+
this.value.length = 0;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
__name(_ArraySet, "ArraySet");
|
|
78
|
+
let ArraySet = _ArraySet;
|
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
80
|
+
0 && (module.exports = {
|
|
81
|
+
ArraySet,
|
|
82
|
+
toArray
|
|
83
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Dispose, IReactionOptions, Reaction } from './types';
|
|
2
|
+
export declare const autorun: {
|
|
3
|
+
(tracker: Reaction, name?: string): () => void;
|
|
4
|
+
memo<T>(callback: () => T, dependencies?: any[]): T;
|
|
5
|
+
effect(callback: () => void | Dispose, dependencies?: any[]): void;
|
|
6
|
+
};
|
|
7
|
+
export declare const reaction: <T>(tracker: () => T, subscriber?: (value: T, oldValue: T) => void, options?: IReactionOptions<T>) => () => void;
|