@tachybase/schema 0.23.41 → 0.23.48

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.
Files changed (273) hide show
  1. package/lib/core/effects/index.d.ts +2 -0
  2. package/lib/core/effects/index.js +23 -0
  3. package/lib/core/effects/onFieldEffects.d.ts +27 -0
  4. package/lib/core/effects/onFieldEffects.js +158 -0
  5. package/lib/core/effects/onFormEffects.d.ts +24 -0
  6. package/lib/core/effects/onFormEffects.js +117 -0
  7. package/lib/core/global.d.js +0 -0
  8. package/lib/core/index.d.ts +4 -0
  9. package/lib/core/index.js +27 -0
  10. package/lib/core/models/ArrayField.d.ts +17 -0
  11. package/lib/core/models/ArrayField.js +145 -0
  12. package/lib/core/models/BaseField.d.ts +72 -0
  13. package/lib/core/models/BaseField.js +285 -0
  14. package/lib/core/models/Field.d.ts +70 -0
  15. package/lib/core/models/Field.js +426 -0
  16. package/lib/core/models/Form.d.ts +102 -0
  17. package/lib/core/models/Form.js +483 -0
  18. package/lib/core/models/Graph.d.ts +8 -0
  19. package/lib/core/models/Graph.js +77 -0
  20. package/lib/core/models/Heart.d.ts +16 -0
  21. package/lib/core/models/Heart.js +91 -0
  22. package/lib/core/models/LifeCycle.d.ts +14 -0
  23. package/lib/core/models/LifeCycle.js +64 -0
  24. package/lib/core/models/ObjectField.d.ts +12 -0
  25. package/lib/core/models/ObjectField.js +64 -0
  26. package/lib/core/models/Query.d.ts +18 -0
  27. package/lib/core/models/Query.js +105 -0
  28. package/lib/core/models/VoidField.d.ts +14 -0
  29. package/lib/core/models/VoidField.js +117 -0
  30. package/lib/core/models/index.d.ts +9 -0
  31. package/lib/core/models/index.js +37 -0
  32. package/lib/core/models/types.d.ts +9 -0
  33. package/lib/core/models/types.js +15 -0
  34. package/lib/core/shared/checkers.d.ts +117 -0
  35. package/lib/core/shared/checkers.js +109 -0
  36. package/lib/core/shared/constants.d.ts +48 -0
  37. package/lib/core/shared/constants.js +86 -0
  38. package/lib/core/shared/effective.d.ts +9 -0
  39. package/lib/core/shared/effective.js +91 -0
  40. package/lib/core/shared/externals.d.ts +8 -0
  41. package/lib/core/shared/externals.js +87 -0
  42. package/lib/core/shared/internals.d.ts +54 -0
  43. package/lib/core/shared/internals.js +956 -0
  44. package/lib/core/types.d.ts +275 -0
  45. package/lib/core/types.js +76 -0
  46. package/lib/grid/index.d.ts +67 -0
  47. package/lib/grid/index.js +378 -0
  48. package/lib/grid/observer.d.ts +19 -0
  49. package/lib/grid/observer.js +107 -0
  50. package/lib/index.d.ts +12 -24
  51. package/lib/index.js +27 -244
  52. package/lib/json-schema/compiler.d.ts +8 -0
  53. package/lib/json-schema/compiler.js +129 -0
  54. package/lib/json-schema/global.d.js +0 -0
  55. package/lib/json-schema/index.d.ts +2 -0
  56. package/lib/json-schema/index.js +23 -0
  57. package/lib/json-schema/patches.d.ts +5 -0
  58. package/lib/json-schema/patches.js +68 -0
  59. package/lib/json-schema/polyfills/SPECIFICATION_1_0.d.ts +2 -0
  60. package/lib/json-schema/polyfills/SPECIFICATION_1_0.js +132 -0
  61. package/lib/json-schema/polyfills/index.d.ts +1 -0
  62. package/lib/json-schema/polyfills/index.js +21 -0
  63. package/lib/json-schema/schema.d.ts +88 -0
  64. package/lib/json-schema/schema.js +231 -0
  65. package/lib/json-schema/shared.d.ts +62 -0
  66. package/lib/json-schema/shared.js +232 -0
  67. package/lib/json-schema/transformer.d.ts +4 -0
  68. package/lib/json-schema/transformer.js +238 -0
  69. package/lib/json-schema/types.d.ts +119 -0
  70. package/lib/json-schema/types.js +15 -0
  71. package/lib/path/contexts.d.ts +10 -0
  72. package/lib/path/contexts.js +49 -0
  73. package/lib/path/destructor.d.ts +15 -0
  74. package/lib/path/destructor.js +151 -0
  75. package/lib/path/index.d.ts +51 -0
  76. package/lib/path/index.js +513 -0
  77. package/lib/path/matcher.d.ts +33 -0
  78. package/lib/path/matcher.js +197 -0
  79. package/lib/path/parser.d.ts +33 -0
  80. package/lib/path/parser.js +379 -0
  81. package/lib/path/shared.d.ts +13 -0
  82. package/lib/path/shared.js +121 -0
  83. package/lib/path/tokenizer.d.ts +27 -0
  84. package/lib/path/tokenizer.js +269 -0
  85. package/lib/path/tokens.d.ts +27 -0
  86. package/lib/path/tokens.js +216 -0
  87. package/lib/path/types.d.ts +88 -0
  88. package/lib/path/types.js +63 -0
  89. package/lib/react/components/ArrayField.d.ts +6 -0
  90. package/lib/react/components/ArrayField.js +44 -0
  91. package/lib/react/components/ExpressionScope.d.ts +2 -0
  92. package/lib/react/components/ExpressionScope.js +35 -0
  93. package/lib/react/components/Field.d.ts +5 -0
  94. package/lib/react/components/Field.js +45 -0
  95. package/lib/react/components/FormConsumer.d.ts +2 -0
  96. package/lib/react/components/FormConsumer.js +36 -0
  97. package/lib/react/components/FormProvider.d.ts +2 -0
  98. package/lib/react/components/FormProvider.js +35 -0
  99. package/lib/react/components/ObjectField.d.ts +6 -0
  100. package/lib/react/components/ObjectField.js +39 -0
  101. package/lib/react/components/ReactiveField.d.ts +11 -0
  102. package/lib/react/components/ReactiveField.js +115 -0
  103. package/lib/react/components/RecordScope.d.ts +2 -0
  104. package/lib/react/components/RecordScope.js +65 -0
  105. package/lib/react/components/RecordsScope.d.ts +2 -0
  106. package/lib/react/components/RecordsScope.js +43 -0
  107. package/lib/react/components/RecursionField.d.ts +2 -0
  108. package/lib/react/components/RecursionField.js +105 -0
  109. package/lib/react/components/SchemaField.d.ts +41 -0
  110. package/lib/react/components/SchemaField.js +154 -0
  111. package/lib/react/components/VoidField.d.ts +5 -0
  112. package/lib/react/components/VoidField.js +39 -0
  113. package/lib/react/components/index.d.ts +11 -0
  114. package/lib/react/components/index.js +41 -0
  115. package/lib/react/global.d.js +0 -0
  116. package/lib/react/hooks/index.d.ts +6 -0
  117. package/lib/react/hooks/index.js +31 -0
  118. package/lib/react/hooks/useAttach.d.ts +6 -0
  119. package/lib/react/hooks/useAttach.js +35 -0
  120. package/lib/react/hooks/useExpressionScope.d.ts +1 -0
  121. package/lib/react/hooks/useExpressionScope.js +30 -0
  122. package/lib/react/hooks/useField.d.ts +2 -0
  123. package/lib/react/hooks/useField.js +32 -0
  124. package/lib/react/hooks/useFieldSchema.d.ts +2 -0
  125. package/lib/react/hooks/useFieldSchema.js +32 -0
  126. package/lib/react/hooks/useForm.d.ts +2 -0
  127. package/lib/react/hooks/useForm.js +32 -0
  128. package/lib/react/hooks/useFormEffects.d.ts +2 -0
  129. package/lib/react/hooks/useFormEffects.js +42 -0
  130. package/lib/react/hooks/useParentForm.d.ts +2 -0
  131. package/lib/react/hooks/useParentForm.js +40 -0
  132. package/lib/react/index.d.ts +5 -0
  133. package/lib/react/index.js +29 -0
  134. package/lib/react/shared/connect.d.ts +9 -0
  135. package/lib/react/shared/connect.js +118 -0
  136. package/lib/react/shared/context.d.ts +14 -0
  137. package/lib/react/shared/context.js +74 -0
  138. package/lib/react/shared/index.d.ts +2 -0
  139. package/lib/react/shared/index.js +23 -0
  140. package/lib/react/shared/render.d.ts +2 -0
  141. package/lib/react/shared/render.js +69 -0
  142. package/lib/react/types.d.ts +84 -0
  143. package/lib/react/types.js +15 -0
  144. package/lib/reactive/action.d.ts +2 -0
  145. package/lib/reactive/action.js +48 -0
  146. package/lib/reactive/annotations/box.d.ts +7 -0
  147. package/lib/reactive/annotations/box.js +76 -0
  148. package/lib/reactive/annotations/computed.d.ts +12 -0
  149. package/lib/reactive/annotations/computed.js +154 -0
  150. package/lib/reactive/annotations/index.d.ts +5 -0
  151. package/lib/reactive/annotations/index.js +29 -0
  152. package/lib/reactive/annotations/observable.d.ts +4 -0
  153. package/lib/reactive/annotations/observable.js +67 -0
  154. package/lib/reactive/annotations/ref.d.ts +6 -0
  155. package/lib/reactive/annotations/ref.js +78 -0
  156. package/lib/reactive/annotations/shallow.d.ts +2 -0
  157. package/lib/reactive/annotations/shallow.js +67 -0
  158. package/lib/reactive/array.d.ts +12 -0
  159. package/lib/reactive/array.js +83 -0
  160. package/lib/reactive/autorun.d.ts +7 -0
  161. package/lib/reactive/autorun.js +155 -0
  162. package/lib/reactive/batch.d.ts +2 -0
  163. package/lib/reactive/batch.js +40 -0
  164. package/lib/reactive/checkers.d.ts +10 -0
  165. package/lib/reactive/checkers.js +60 -0
  166. package/lib/reactive/environment.d.ts +28 -0
  167. package/lib/reactive/environment.js +76 -0
  168. package/lib/reactive/externals.d.ts +10 -0
  169. package/lib/reactive/externals.js +156 -0
  170. package/lib/reactive/global.d.js +0 -0
  171. package/lib/reactive/handlers.d.ts +4 -0
  172. package/lib/reactive/handlers.js +246 -0
  173. package/lib/reactive/index.d.ts +10 -0
  174. package/lib/reactive/index.js +39 -0
  175. package/lib/reactive/internals.d.ts +17 -0
  176. package/lib/reactive/internals.js +139 -0
  177. package/lib/reactive/model.d.ts +3 -0
  178. package/lib/reactive/model.js +68 -0
  179. package/lib/reactive/observable.d.ts +9 -0
  180. package/lib/reactive/observable.js +50 -0
  181. package/lib/reactive/observe.d.ts +2 -0
  182. package/lib/reactive/observe.js +58 -0
  183. package/lib/reactive/reaction.d.ts +21 -0
  184. package/lib/reactive/reaction.js +278 -0
  185. package/lib/reactive/tracker.d.ts +7 -0
  186. package/lib/reactive/tracker.js +63 -0
  187. package/lib/reactive/tree.d.ts +25 -0
  188. package/lib/reactive/tree.js +106 -0
  189. package/lib/reactive/types.d.ts +79 -0
  190. package/lib/reactive/types.js +21 -0
  191. package/lib/reactive/untracked.d.ts +4 -0
  192. package/lib/reactive/untracked.js +29 -0
  193. package/lib/reactive-react/hooks/index.d.ts +9 -0
  194. package/lib/reactive-react/hooks/index.js +48 -0
  195. package/lib/reactive-react/hooks/useCompatEffect.d.ts +2 -0
  196. package/lib/reactive-react/hooks/useCompatEffect.js +60 -0
  197. package/lib/reactive-react/hooks/useCompatFactory.d.ts +3 -0
  198. package/lib/reactive-react/hooks/useCompatFactory.js +74 -0
  199. package/lib/reactive-react/hooks/useDidUpdate.d.ts +1 -0
  200. package/lib/reactive-react/hooks/useDidUpdate.js +38 -0
  201. package/lib/reactive-react/hooks/useForceUpdate.d.ts +1 -0
  202. package/lib/reactive-react/hooks/useForceUpdate.js +76 -0
  203. package/lib/reactive-react/hooks/useLayoutEffect.d.ts +2 -0
  204. package/lib/reactive-react/hooks/useLayoutEffect.js +28 -0
  205. package/lib/reactive-react/hooks/useObserver.d.ts +2 -0
  206. package/lib/reactive-react/hooks/useObserver.js +43 -0
  207. package/lib/reactive-react/index.d.ts +3 -0
  208. package/lib/reactive-react/index.js +25 -0
  209. package/lib/reactive-react/observer.d.ts +8 -0
  210. package/lib/reactive-react/observer.js +64 -0
  211. package/lib/reactive-react/shared/gc.d.ts +8 -0
  212. package/lib/reactive-react/shared/gc.js +59 -0
  213. package/lib/reactive-react/shared/global.d.ts +1 -0
  214. package/lib/reactive-react/shared/global.js +50 -0
  215. package/lib/reactive-react/shared/immediate.d.ts +1 -0
  216. package/lib/reactive-react/shared/immediate.js +40 -0
  217. package/lib/reactive-react/shared/index.d.ts +2 -0
  218. package/lib/reactive-react/shared/index.js +23 -0
  219. package/lib/reactive-react/types.d.ts +14 -0
  220. package/lib/reactive-react/types.js +15 -0
  221. package/lib/shared/array.d.ts +35 -0
  222. package/lib/shared/array.js +189 -0
  223. package/lib/shared/case.d.ts +6 -0
  224. package/lib/shared/case.js +39 -0
  225. package/lib/shared/checkers.d.ts +21 -0
  226. package/lib/shared/checkers.js +77 -0
  227. package/lib/shared/clone.d.ts +2 -0
  228. package/lib/shared/clone.js +97 -0
  229. package/lib/shared/compare.d.ts +1 -0
  230. package/lib/shared/compare.js +129 -0
  231. package/lib/shared/defaults.d.ts +6 -0
  232. package/lib/shared/defaults.js +63 -0
  233. package/lib/shared/deprecate.d.ts +1 -0
  234. package/lib/shared/deprecate.js +42 -0
  235. package/lib/shared/global.d.ts +1 -0
  236. package/lib/shared/global.js +50 -0
  237. package/lib/shared/index.d.ts +16 -0
  238. package/lib/shared/index.js +51 -0
  239. package/lib/shared/instanceof.d.ts +1 -0
  240. package/lib/shared/instanceof.js +36 -0
  241. package/lib/shared/isEmpty.d.ts +3 -0
  242. package/lib/shared/isEmpty.js +94 -0
  243. package/lib/shared/merge.d.ts +12 -0
  244. package/lib/shared/merge.js +214 -0
  245. package/lib/shared/middleware.d.ts +4 -0
  246. package/lib/shared/middleware.js +41 -0
  247. package/lib/shared/path.d.ts +3 -0
  248. package/lib/shared/path.js +27 -0
  249. package/lib/shared/string.d.ts +1 -0
  250. package/lib/shared/string.js +38 -0
  251. package/lib/shared/subscribable.d.ts +11 -0
  252. package/lib/shared/subscribable.js +74 -0
  253. package/lib/shared/uid.d.ts +1 -0
  254. package/lib/shared/uid.js +35 -0
  255. package/lib/validator/formats.d.ts +16 -0
  256. package/lib/validator/formats.js +40 -0
  257. package/lib/validator/index.d.ts +4 -0
  258. package/lib/validator/index.js +27 -0
  259. package/lib/validator/locale.d.ts +219 -0
  260. package/lib/validator/locale.js +240 -0
  261. package/lib/validator/parser.d.ts +5 -0
  262. package/lib/validator/parser.js +153 -0
  263. package/lib/validator/registry.d.ts +15 -0
  264. package/lib/validator/registry.js +116 -0
  265. package/lib/validator/rules.d.ts +3 -0
  266. package/lib/validator/rules.js +154 -0
  267. package/lib/validator/template.d.ts +2 -0
  268. package/lib/validator/template.js +42 -0
  269. package/lib/validator/types.d.ts +62 -0
  270. package/lib/validator/types.js +28 -0
  271. package/lib/validator/validator.d.ts +2 -0
  272. package/lib/validator/validator.js +63 -0
  273. package/package.json +16 -10
@@ -0,0 +1,155 @@
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 autorun_exports = {};
20
+ __export(autorun_exports, {
21
+ autorun: () => autorun,
22
+ reaction: () => reaction
23
+ });
24
+ module.exports = __toCommonJS(autorun_exports);
25
+ var import_array = require("./array");
26
+ var import_checkers = require("./checkers");
27
+ var import_environment = require("./environment");
28
+ var import_reaction = require("./reaction");
29
+ const autorun = /* @__PURE__ */ __name((tracker, name = "AutoRun") => {
30
+ const reaction2 = /* @__PURE__ */ __name(() => {
31
+ if (!(0, import_checkers.isFn)(tracker)) return;
32
+ if (reaction2._boundary > 0) return;
33
+ if (import_environment.ReactionStack.indexOf(reaction2) === -1) {
34
+ (0, import_reaction.releaseBindingReactions)(reaction2);
35
+ try {
36
+ (0, import_reaction.batchStart)();
37
+ import_environment.ReactionStack.push(reaction2);
38
+ tracker();
39
+ } finally {
40
+ import_environment.ReactionStack.pop();
41
+ reaction2._boundary++;
42
+ (0, import_reaction.batchEnd)();
43
+ reaction2._boundary = 0;
44
+ reaction2._memos.cursor = 0;
45
+ reaction2._effects.cursor = 0;
46
+ }
47
+ }
48
+ }, "reaction");
49
+ const cleanRefs = /* @__PURE__ */ __name(() => {
50
+ reaction2._memos = {
51
+ queue: [],
52
+ cursor: 0
53
+ };
54
+ reaction2._effects = {
55
+ queue: [],
56
+ cursor: 0
57
+ };
58
+ }, "cleanRefs");
59
+ reaction2._boundary = 0;
60
+ reaction2._name = name;
61
+ cleanRefs();
62
+ reaction2();
63
+ return () => {
64
+ (0, import_reaction.disposeBindingReactions)(reaction2);
65
+ (0, import_reaction.disposeEffects)(reaction2);
66
+ cleanRefs();
67
+ };
68
+ }, "autorun");
69
+ autorun.memo = (callback, dependencies) => {
70
+ if (!(0, import_checkers.isFn)(callback)) return;
71
+ const current = import_environment.ReactionStack[import_environment.ReactionStack.length - 1];
72
+ if (!current || !current._memos) throw new Error("autorun.memo must used in autorun function body.");
73
+ const deps = (0, import_array.toArray)(dependencies || []);
74
+ const id = current._memos.cursor++;
75
+ const old = current._memos.queue[id];
76
+ if (!old || (0, import_reaction.hasDepsChange)(deps, old.deps)) {
77
+ const value = callback();
78
+ current._memos.queue[id] = {
79
+ value,
80
+ deps
81
+ };
82
+ return value;
83
+ }
84
+ return old.value;
85
+ };
86
+ autorun.effect = (callback, dependencies) => {
87
+ if (!(0, import_checkers.isFn)(callback)) return;
88
+ const current = import_environment.ReactionStack[import_environment.ReactionStack.length - 1];
89
+ if (!current || !current._effects) throw new Error("autorun.effect must used in autorun function body.");
90
+ const effects = current._effects;
91
+ const deps = (0, import_array.toArray)(dependencies || [{}]);
92
+ const id = effects.cursor++;
93
+ const old = effects.queue[id];
94
+ if (!old || (0, import_reaction.hasDepsChange)(deps, old.deps)) {
95
+ Promise.resolve(0).then(() => {
96
+ if (current._disposed) return;
97
+ const dispose = callback();
98
+ if ((0, import_checkers.isFn)(dispose)) {
99
+ effects.queue[id].dispose = dispose;
100
+ }
101
+ });
102
+ effects.queue[id] = {
103
+ deps
104
+ };
105
+ }
106
+ };
107
+ const reaction = /* @__PURE__ */ __name((tracker, subscriber, options) => {
108
+ const realOptions = {
109
+ name: "Reaction",
110
+ ...options
111
+ };
112
+ const value = {};
113
+ const dirtyCheck = /* @__PURE__ */ __name(() => {
114
+ if ((0, import_checkers.isFn)(realOptions.equals)) return !realOptions.equals(value.oldValue, value.currentValue);
115
+ return value.oldValue !== value.currentValue;
116
+ }, "dirtyCheck");
117
+ const fireAction = /* @__PURE__ */ __name(() => {
118
+ try {
119
+ (0, import_reaction.batchStart)();
120
+ if ((0, import_checkers.isFn)(subscriber)) subscriber(value.currentValue, value.oldValue);
121
+ } finally {
122
+ (0, import_reaction.batchEnd)();
123
+ }
124
+ }, "fireAction");
125
+ const reaction2 = /* @__PURE__ */ __name(() => {
126
+ if (import_environment.ReactionStack.indexOf(reaction2) === -1) {
127
+ (0, import_reaction.releaseBindingReactions)(reaction2);
128
+ try {
129
+ import_environment.ReactionStack.push(reaction2);
130
+ value.currentValue = tracker();
131
+ } finally {
132
+ import_environment.ReactionStack.pop();
133
+ }
134
+ }
135
+ }, "reaction");
136
+ reaction2._scheduler = (looping) => {
137
+ looping();
138
+ if (dirtyCheck()) fireAction();
139
+ value.oldValue = value.currentValue;
140
+ };
141
+ reaction2._name = realOptions.name;
142
+ reaction2();
143
+ value.oldValue = value.currentValue;
144
+ if (realOptions.fireImmediately) {
145
+ fireAction();
146
+ }
147
+ return () => {
148
+ (0, import_reaction.disposeBindingReactions)(reaction2);
149
+ };
150
+ }, "reaction");
151
+ // Annotate the CommonJS export names for ESM import in node:
152
+ 0 && (module.exports = {
153
+ autorun,
154
+ reaction
155
+ });
@@ -0,0 +1,2 @@
1
+ import { IBatch } from './types';
2
+ export declare const batch: IBatch;
@@ -0,0 +1,40 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var batch_exports = {};
19
+ __export(batch_exports, {
20
+ batch: () => batch
21
+ });
22
+ module.exports = __toCommonJS(batch_exports);
23
+ var import_checkers = require("./checkers");
24
+ var import_environment = require("./environment");
25
+ var import_internals = require("./internals");
26
+ var import_reaction = require("./reaction");
27
+ const batch = (0, import_internals.createBoundaryAnnotation)(import_reaction.batchStart, import_reaction.batchEnd);
28
+ batch.scope = (0, import_internals.createBoundaryAnnotation)(import_reaction.batchScopeStart, import_reaction.batchScopeEnd);
29
+ batch.endpoint = (callback) => {
30
+ if (!(0, import_checkers.isFn)(callback)) return;
31
+ if (import_environment.BatchCount.value === 0) {
32
+ callback();
33
+ } else {
34
+ import_environment.BatchEndpoints.add(callback);
35
+ }
36
+ };
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ batch
40
+ });
@@ -0,0 +1,10 @@
1
+ export declare const isMap: (val: any) => val is Map<any, any>;
2
+ export declare const isSet: (val: any) => val is Set<any>;
3
+ export declare const isWeakMap: (val: any) => val is WeakMap<any, any>;
4
+ export declare const isWeakSet: (val: any) => val is WeakSet<any>;
5
+ export declare const isFn: (val: any) => val is Function;
6
+ export declare const isArr: (arg: any) => arg is any[];
7
+ export declare const isPlainObj: (val: any) => val is object;
8
+ export declare const isValid: (val: any) => boolean;
9
+ export declare const isCollectionType: (target: any) => target is Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any>;
10
+ export declare const isNormalType: (target: any) => target is object | any[];
@@ -0,0 +1,60 @@
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 checkers_exports = {};
20
+ __export(checkers_exports, {
21
+ isArr: () => isArr,
22
+ isCollectionType: () => isCollectionType,
23
+ isFn: () => isFn,
24
+ isMap: () => isMap,
25
+ isNormalType: () => isNormalType,
26
+ isPlainObj: () => isPlainObj,
27
+ isSet: () => isSet,
28
+ isValid: () => isValid,
29
+ isWeakMap: () => isWeakMap,
30
+ isWeakSet: () => isWeakSet
31
+ });
32
+ module.exports = __toCommonJS(checkers_exports);
33
+ const toString = Object.prototype.toString;
34
+ const isMap = /* @__PURE__ */ __name((val) => val && val instanceof Map, "isMap");
35
+ const isSet = /* @__PURE__ */ __name((val) => val && val instanceof Set, "isSet");
36
+ const isWeakMap = /* @__PURE__ */ __name((val) => val && val instanceof WeakMap, "isWeakMap");
37
+ const isWeakSet = /* @__PURE__ */ __name((val) => val && val instanceof WeakSet, "isWeakSet");
38
+ const isFn = /* @__PURE__ */ __name((val) => typeof val === "function", "isFn");
39
+ const isArr = Array.isArray;
40
+ const isPlainObj = /* @__PURE__ */ __name((val) => toString.call(val) === "[object Object]", "isPlainObj");
41
+ const isValid = /* @__PURE__ */ __name((val) => val !== null && val !== void 0, "isValid");
42
+ const isCollectionType = /* @__PURE__ */ __name((target) => {
43
+ return isMap(target) || isWeakMap(target) || isSet(target) || isWeakSet(target);
44
+ }, "isCollectionType");
45
+ const isNormalType = /* @__PURE__ */ __name((target) => {
46
+ return isPlainObj(target) || isArr(target);
47
+ }, "isNormalType");
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ isArr,
51
+ isCollectionType,
52
+ isFn,
53
+ isMap,
54
+ isNormalType,
55
+ isPlainObj,
56
+ isSet,
57
+ isValid,
58
+ isWeakMap,
59
+ isWeakSet
60
+ });
@@ -0,0 +1,28 @@
1
+ import { ArraySet } from './array';
2
+ import { DataNode } from './tree';
3
+ import { ObservableListener, Reaction, ReactionsMap } from './types';
4
+ export declare const ProxyRaw: WeakMap<WeakKey, any>;
5
+ export declare const RawProxy: WeakMap<WeakKey, any>;
6
+ export declare const RawShallowProxy: WeakMap<WeakKey, any>;
7
+ export declare const RawNode: WeakMap<object, DataNode>;
8
+ export declare const RawReactionsMap: WeakMap<object, ReactionsMap>;
9
+ export declare const ReactionStack: Reaction[];
10
+ export declare const BatchCount: {
11
+ value: number;
12
+ };
13
+ export declare const UntrackCount: {
14
+ value: number;
15
+ };
16
+ export declare const BatchScope: {
17
+ value: boolean;
18
+ };
19
+ export declare const DependencyCollected: {
20
+ value: boolean;
21
+ };
22
+ export declare const PendingReactions: ArraySet<Reaction>;
23
+ export declare const PendingScopeReactions: ArraySet<Reaction>;
24
+ export declare const BatchEndpoints: ArraySet<() => void>;
25
+ export declare const ObserverListeners: ArraySet<ObservableListener>;
26
+ export declare const MakeObModelSymbol: unique symbol;
27
+ export declare const ObModelSymbol: unique symbol;
28
+ export declare const ObModelNodeSymbol: unique symbol;
@@ -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 __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var environment_exports = {};
19
+ __export(environment_exports, {
20
+ BatchCount: () => BatchCount,
21
+ BatchEndpoints: () => BatchEndpoints,
22
+ BatchScope: () => BatchScope,
23
+ DependencyCollected: () => DependencyCollected,
24
+ MakeObModelSymbol: () => MakeObModelSymbol,
25
+ ObModelNodeSymbol: () => ObModelNodeSymbol,
26
+ ObModelSymbol: () => ObModelSymbol,
27
+ ObserverListeners: () => ObserverListeners,
28
+ PendingReactions: () => PendingReactions,
29
+ PendingScopeReactions: () => PendingScopeReactions,
30
+ ProxyRaw: () => ProxyRaw,
31
+ RawNode: () => RawNode,
32
+ RawProxy: () => RawProxy,
33
+ RawReactionsMap: () => RawReactionsMap,
34
+ RawShallowProxy: () => RawShallowProxy,
35
+ ReactionStack: () => ReactionStack,
36
+ UntrackCount: () => UntrackCount
37
+ });
38
+ module.exports = __toCommonJS(environment_exports);
39
+ var import_array = require("./array");
40
+ const ProxyRaw = /* @__PURE__ */ new WeakMap();
41
+ const RawProxy = /* @__PURE__ */ new WeakMap();
42
+ const RawShallowProxy = /* @__PURE__ */ new WeakMap();
43
+ const RawNode = /* @__PURE__ */ new WeakMap();
44
+ const RawReactionsMap = /* @__PURE__ */ new WeakMap();
45
+ const ReactionStack = [];
46
+ const BatchCount = { value: 0 };
47
+ const UntrackCount = { value: 0 };
48
+ const BatchScope = { value: false };
49
+ const DependencyCollected = { value: false };
50
+ const PendingReactions = new import_array.ArraySet();
51
+ const PendingScopeReactions = new import_array.ArraySet();
52
+ const BatchEndpoints = new import_array.ArraySet();
53
+ const ObserverListeners = new import_array.ArraySet();
54
+ const MakeObModelSymbol = Symbol("MakeObModelSymbol");
55
+ const ObModelSymbol = Symbol("ObModelSymbol");
56
+ const ObModelNodeSymbol = Symbol("ObModelNodeSymbol");
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ BatchCount,
60
+ BatchEndpoints,
61
+ BatchScope,
62
+ DependencyCollected,
63
+ MakeObModelSymbol,
64
+ ObModelNodeSymbol,
65
+ ObModelSymbol,
66
+ ObserverListeners,
67
+ PendingReactions,
68
+ PendingScopeReactions,
69
+ ProxyRaw,
70
+ RawNode,
71
+ RawProxy,
72
+ RawReactionsMap,
73
+ RawShallowProxy,
74
+ ReactionStack,
75
+ UntrackCount
76
+ });
@@ -0,0 +1,10 @@
1
+ import { Annotation } from './types';
2
+ export declare const isObservable: (target: any) => boolean;
3
+ export declare const isAnnotation: (target: any) => target is Annotation;
4
+ export declare const isSupportObservable: (target: any) => boolean;
5
+ export declare const markRaw: <T>(target: T) => T;
6
+ export declare const markObservable: <T>(target: T) => T;
7
+ export declare const raw: <T>(target: T) => T;
8
+ export declare const toJS: <T>(values: T) => T;
9
+ export declare const contains: (target: any, property: any) => any;
10
+ export declare const hasCollected: (callback?: () => void) => boolean;
@@ -0,0 +1,156 @@
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 externals_exports = {};
20
+ __export(externals_exports, {
21
+ contains: () => contains,
22
+ hasCollected: () => hasCollected,
23
+ isAnnotation: () => isAnnotation,
24
+ isObservable: () => isObservable,
25
+ isSupportObservable: () => isSupportObservable,
26
+ markObservable: () => markObservable,
27
+ markRaw: () => markRaw,
28
+ raw: () => raw,
29
+ toJS: () => toJS
30
+ });
31
+ module.exports = __toCommonJS(externals_exports);
32
+ var import_checkers = require("./checkers");
33
+ var import_environment = require("./environment");
34
+ var import_tree = require("./tree");
35
+ const RAW_TYPE = Symbol("RAW_TYPE");
36
+ const OBSERVABLE_TYPE = Symbol("OBSERVABLE_TYPE");
37
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
38
+ const isObservable = /* @__PURE__ */ __name((target) => {
39
+ return import_environment.ProxyRaw.has(target) || !!(target == null ? void 0 : target[import_environment.ObModelSymbol]);
40
+ }, "isObservable");
41
+ const isAnnotation = /* @__PURE__ */ __name((target) => {
42
+ return target && !!target[import_environment.MakeObModelSymbol];
43
+ }, "isAnnotation");
44
+ const isSupportObservable = /* @__PURE__ */ __name((target) => {
45
+ if (!(0, import_checkers.isValid)(target)) return false;
46
+ if ((0, import_checkers.isArr)(target)) return true;
47
+ if ((0, import_checkers.isPlainObj)(target)) {
48
+ if (target[RAW_TYPE]) {
49
+ return false;
50
+ }
51
+ if (target[OBSERVABLE_TYPE]) {
52
+ return true;
53
+ }
54
+ if ("$$typeof" in target && "_owner" in target) {
55
+ return false;
56
+ }
57
+ if (target["_isAMomentObject"]) {
58
+ return false;
59
+ }
60
+ if (target["_isJSONSchemaObject"]) {
61
+ return false;
62
+ }
63
+ if ((0, import_checkers.isFn)(target["toJS"])) {
64
+ return false;
65
+ }
66
+ if ((0, import_checkers.isFn)(target["toJSON"])) {
67
+ return false;
68
+ }
69
+ return true;
70
+ }
71
+ if ((0, import_checkers.isMap)(target) || (0, import_checkers.isWeakMap)(target) || (0, import_checkers.isSet)(target) || (0, import_checkers.isWeakSet)(target)) return true;
72
+ return false;
73
+ }, "isSupportObservable");
74
+ const markRaw = /* @__PURE__ */ __name((target) => {
75
+ if (!target) return;
76
+ if ((0, import_checkers.isFn)(target)) {
77
+ target.prototype[RAW_TYPE] = true;
78
+ } else {
79
+ target[RAW_TYPE] = true;
80
+ }
81
+ return target;
82
+ }, "markRaw");
83
+ const markObservable = /* @__PURE__ */ __name((target) => {
84
+ if (!target) return;
85
+ if ((0, import_checkers.isFn)(target)) {
86
+ target.prototype[OBSERVABLE_TYPE] = true;
87
+ } else {
88
+ target[OBSERVABLE_TYPE] = true;
89
+ }
90
+ return target;
91
+ }, "markObservable");
92
+ const raw = /* @__PURE__ */ __name((target) => {
93
+ if (target == null ? void 0 : target[import_environment.ObModelSymbol]) return target[import_environment.ObModelSymbol];
94
+ return import_environment.ProxyRaw.get(target) || target;
95
+ }, "raw");
96
+ const toJS = /* @__PURE__ */ __name((values) => {
97
+ const visited = /* @__PURE__ */ new WeakSet();
98
+ const _toJS = /* @__PURE__ */ __name((values2) => {
99
+ if (visited.has(values2)) {
100
+ return values2;
101
+ }
102
+ if (values2 && values2[RAW_TYPE]) return values2;
103
+ if ((0, import_checkers.isArr)(values2)) {
104
+ if (isObservable(values2)) {
105
+ visited.add(values2);
106
+ const res = [];
107
+ values2.forEach((item) => {
108
+ res.push(_toJS(item));
109
+ });
110
+ visited.delete(values2);
111
+ return res;
112
+ }
113
+ } else if ((0, import_checkers.isPlainObj)(values2)) {
114
+ if (isObservable(values2)) {
115
+ visited.add(values2);
116
+ const res = {};
117
+ for (const key in values2) {
118
+ if (hasOwnProperty.call(values2, key)) {
119
+ res[key] = _toJS(values2[key]);
120
+ }
121
+ }
122
+ visited.delete(values2);
123
+ return res;
124
+ }
125
+ }
126
+ return values2;
127
+ }, "_toJS");
128
+ return _toJS(values);
129
+ }, "toJS");
130
+ const contains = /* @__PURE__ */ __name((target, property) => {
131
+ const targetRaw = raw(target);
132
+ const propertyRaw = raw(property);
133
+ if (targetRaw === propertyRaw) return true;
134
+ const targetNode = (0, import_tree.getDataNode)(targetRaw);
135
+ const propertyNode = (0, import_tree.getDataNode)(propertyRaw);
136
+ if (!targetNode) return false;
137
+ if (!propertyNode) return false;
138
+ return targetNode.contains(propertyNode);
139
+ }, "contains");
140
+ const hasCollected = /* @__PURE__ */ __name((callback) => {
141
+ import_environment.DependencyCollected.value = false;
142
+ callback == null ? void 0 : callback();
143
+ return import_environment.DependencyCollected.value;
144
+ }, "hasCollected");
145
+ // Annotate the CommonJS export names for ESM import in node:
146
+ 0 && (module.exports = {
147
+ contains,
148
+ hasCollected,
149
+ isAnnotation,
150
+ isObservable,
151
+ isSupportObservable,
152
+ markObservable,
153
+ markRaw,
154
+ raw,
155
+ toJS
156
+ });
File without changes
@@ -0,0 +1,4 @@
1
+ export declare const collectionHandlers: {
2
+ get(target: any, key: PropertyKey, receiver: any): any;
3
+ };
4
+ export declare const baseHandlers: ProxyHandler<any>;