@contember/react-binding 2.0.0-alpha.16 → 2.0.0-alpha.18

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 (400) hide show
  1. package/dist/development/index.cjs +2 -9
  2. package/dist/development/index.cjs.map +1 -1
  3. package/dist/development/index.js +1 -8
  4. package/dist/development/index.js.map +1 -1
  5. package/dist/development/src/accessorPropagation/AccessorProvider.cjs +1 -1
  6. package/dist/development/src/accessorPropagation/AccessorProvider.cjs.map +1 -1
  7. package/dist/development/src/accessorPropagation/AccessorProvider.js +1 -1
  8. package/dist/development/src/accessorPropagation/AccessorProvider.js.map +1 -1
  9. package/dist/development/src/accessorPropagation/BindingOperationsContext.cjs +2 -1
  10. package/dist/development/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
  11. package/dist/development/src/accessorPropagation/BindingOperationsContext.js +2 -1
  12. package/dist/development/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
  13. package/dist/development/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
  14. package/dist/development/src/accessorPropagation/EntityKeyContext.js.map +1 -1
  15. package/dist/development/src/accessorPropagation/EntityKeyProvider.cjs +1 -1
  16. package/dist/development/src/accessorPropagation/EntityKeyProvider.cjs.map +1 -1
  17. package/dist/development/src/accessorPropagation/EntityKeyProvider.js +1 -1
  18. package/dist/development/src/accessorPropagation/EntityKeyProvider.js.map +1 -1
  19. package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.cjs +14 -37
  20. package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.cjs.map +1 -1
  21. package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.js +15 -38
  22. package/dist/development/src/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  23. package/dist/development/src/accessorPropagation/useEntity.cjs +4 -4
  24. package/dist/development/src/accessorPropagation/useEntity.cjs.map +1 -1
  25. package/dist/development/src/accessorPropagation/useEntity.js +4 -4
  26. package/dist/development/src/accessorPropagation/useEntity.js.map +1 -1
  27. package/dist/development/src/accessorPropagation/useEntityKey.cjs.map +1 -1
  28. package/dist/development/src/accessorPropagation/useEntityKey.js.map +1 -1
  29. package/dist/development/src/accessorPropagation/useEntityList.cjs +3 -3
  30. package/dist/development/src/accessorPropagation/useEntityList.cjs.map +1 -1
  31. package/dist/development/src/accessorPropagation/useEntityList.js +3 -3
  32. package/dist/development/src/accessorPropagation/useEntityList.js.map +1 -1
  33. package/dist/development/src/accessorPropagation/useEntityListSubTree.cjs +1 -1
  34. package/dist/development/src/accessorPropagation/useEntityListSubTree.cjs.map +1 -1
  35. package/dist/development/src/accessorPropagation/useEntityListSubTree.js +1 -1
  36. package/dist/development/src/accessorPropagation/useEntityListSubTree.js.map +1 -1
  37. package/dist/development/src/accessorPropagation/useEntitySubTree.cjs +1 -1
  38. package/dist/development/src/accessorPropagation/useEntitySubTree.cjs.map +1 -1
  39. package/dist/development/src/accessorPropagation/useEntitySubTree.js +1 -1
  40. package/dist/development/src/accessorPropagation/useEntitySubTree.js.map +1 -1
  41. package/dist/development/src/accessorPropagation/useField.cjs +3 -3
  42. package/dist/development/src/accessorPropagation/useField.cjs.map +1 -1
  43. package/dist/development/src/accessorPropagation/useField.js +3 -3
  44. package/dist/development/src/accessorPropagation/useField.js.map +1 -1
  45. package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.cjs +2 -2
  46. package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
  47. package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.js +2 -2
  48. package/dist/development/src/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  49. package/dist/development/src/accessorSorting/addEntityAtIndex.cjs +1 -1
  50. package/dist/development/src/accessorSorting/addEntityAtIndex.cjs.map +1 -1
  51. package/dist/development/src/accessorSorting/addEntityAtIndex.js +1 -1
  52. package/dist/development/src/accessorSorting/addEntityAtIndex.js.map +1 -1
  53. package/dist/development/src/accessorSorting/repairEntitiesOrder.cjs +1 -1
  54. package/dist/development/src/accessorSorting/repairEntitiesOrder.cjs.map +1 -1
  55. package/dist/development/src/accessorSorting/repairEntitiesOrder.js +1 -1
  56. package/dist/development/src/accessorSorting/repairEntitiesOrder.js.map +1 -1
  57. package/dist/development/src/accessorSorting/sortEntities.cjs +2 -2
  58. package/dist/development/src/accessorSorting/sortEntities.cjs.map +1 -1
  59. package/dist/development/src/accessorSorting/sortEntities.js +2 -2
  60. package/dist/development/src/accessorSorting/sortEntities.js.map +1 -1
  61. package/dist/development/src/accessorTree/AccessorTree.cjs +16 -6
  62. package/dist/development/src/accessorTree/AccessorTree.cjs.map +1 -1
  63. package/dist/development/src/accessorTree/AccessorTree.js +16 -6
  64. package/dist/development/src/accessorTree/AccessorTree.js.map +1 -1
  65. package/dist/development/src/accessorTree/useDataBinding.cjs +23 -36
  66. package/dist/development/src/accessorTree/useDataBinding.cjs.map +1 -1
  67. package/dist/development/src/accessorTree/useDataBinding.js +26 -39
  68. package/dist/development/src/accessorTree/useDataBinding.js.map +1 -1
  69. package/dist/development/src/accessorTree/useEnvironmentWithSchema.cjs +31 -0
  70. package/dist/development/src/accessorTree/useEnvironmentWithSchema.cjs.map +1 -0
  71. package/dist/development/src/accessorTree/useEnvironmentWithSchema.js +31 -0
  72. package/dist/development/src/accessorTree/useEnvironmentWithSchema.js.map +1 -0
  73. package/dist/development/src/coreComponents/Component.cjs.map +1 -1
  74. package/dist/development/src/coreComponents/Component.js.map +1 -1
  75. package/dist/development/src/coreComponents/DataBindingProvider.cjs +4 -14
  76. package/dist/development/src/coreComponents/DataBindingProvider.cjs.map +1 -1
  77. package/dist/development/src/coreComponents/DataBindingProvider.js +4 -14
  78. package/dist/development/src/coreComponents/DataBindingProvider.js.map +1 -1
  79. package/dist/development/src/coreComponents/EntityListSubTree.cjs +5 -14
  80. package/dist/development/src/coreComponents/EntityListSubTree.cjs.map +1 -1
  81. package/dist/development/src/coreComponents/EntityListSubTree.js +5 -14
  82. package/dist/development/src/coreComponents/EntityListSubTree.js.map +1 -1
  83. package/dist/development/src/coreComponents/EntitySubTree.cjs +7 -16
  84. package/dist/development/src/coreComponents/EntitySubTree.cjs.map +1 -1
  85. package/dist/development/src/coreComponents/EntitySubTree.js +7 -16
  86. package/dist/development/src/coreComponents/EntitySubTree.js.map +1 -1
  87. package/dist/development/src/entityEvents/useDerivedField.cjs +3 -3
  88. package/dist/development/src/entityEvents/useDerivedField.cjs.map +1 -1
  89. package/dist/development/src/entityEvents/useDerivedField.js +3 -3
  90. package/dist/development/src/entityEvents/useDerivedField.js.map +1 -1
  91. package/dist/development/src/helperComponents/DeferredSubTrees.cjs +2 -3
  92. package/dist/development/src/helperComponents/DeferredSubTrees.cjs.map +1 -1
  93. package/dist/development/src/helperComponents/DeferredSubTrees.js +3 -4
  94. package/dist/development/src/helperComponents/DeferredSubTrees.js.map +1 -1
  95. package/dist/development/src/helperComponents/FieldView.cjs +1 -1
  96. package/dist/development/src/helperComponents/FieldView.cjs.map +1 -1
  97. package/dist/development/src/helperComponents/FieldView.js +1 -1
  98. package/dist/development/src/helperComponents/FieldView.js.map +1 -1
  99. package/dist/development/src/markers/IncrementalMarkerBuilder.cjs +56 -0
  100. package/dist/development/src/markers/IncrementalMarkerBuilder.cjs.map +1 -0
  101. package/dist/development/src/markers/IncrementalMarkerBuilder.js +56 -0
  102. package/dist/development/src/markers/IncrementalMarkerBuilder.js.map +1 -0
  103. package/dist/development/src/markers/MarkerStaticAnalyzer.cjs +110 -0
  104. package/dist/development/src/markers/MarkerStaticAnalyzer.cjs.map +1 -0
  105. package/dist/development/src/markers/MarkerStaticAnalyzer.js +110 -0
  106. package/dist/development/src/markers/MarkerStaticAnalyzer.js.map +1 -0
  107. package/dist/development/src/markers/MarkerTreeGenerator.cjs +52 -0
  108. package/dist/development/src/markers/MarkerTreeGenerator.cjs.map +1 -0
  109. package/dist/development/src/markers/MarkerTreeGenerator.js +52 -0
  110. package/dist/development/src/markers/MarkerTreeGenerator.js.map +1 -0
  111. package/dist/production/index.cjs +2 -9
  112. package/dist/production/index.cjs.map +1 -1
  113. package/dist/production/index.js +1 -8
  114. package/dist/production/index.js.map +1 -1
  115. package/dist/production/src/accessorPropagation/AccessorProvider.cjs +1 -1
  116. package/dist/production/src/accessorPropagation/AccessorProvider.cjs.map +1 -1
  117. package/dist/production/src/accessorPropagation/AccessorProvider.js +1 -1
  118. package/dist/production/src/accessorPropagation/AccessorProvider.js.map +1 -1
  119. package/dist/production/src/accessorPropagation/BindingOperationsContext.cjs +2 -1
  120. package/dist/production/src/accessorPropagation/BindingOperationsContext.cjs.map +1 -1
  121. package/dist/production/src/accessorPropagation/BindingOperationsContext.js +2 -1
  122. package/dist/production/src/accessorPropagation/BindingOperationsContext.js.map +1 -1
  123. package/dist/production/src/accessorPropagation/EntityKeyContext.cjs.map +1 -1
  124. package/dist/production/src/accessorPropagation/EntityKeyContext.js.map +1 -1
  125. package/dist/production/src/accessorPropagation/EntityKeyProvider.cjs.map +1 -1
  126. package/dist/production/src/accessorPropagation/EntityKeyProvider.js.map +1 -1
  127. package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.cjs +14 -37
  128. package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.cjs.map +1 -1
  129. package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.js +15 -38
  130. package/dist/production/src/accessorPropagation/useAccessorUpdateSubscription.js.map +1 -1
  131. package/dist/production/src/accessorPropagation/useEntity.cjs +4 -4
  132. package/dist/production/src/accessorPropagation/useEntity.cjs.map +1 -1
  133. package/dist/production/src/accessorPropagation/useEntity.js +4 -4
  134. package/dist/production/src/accessorPropagation/useEntity.js.map +1 -1
  135. package/dist/production/src/accessorPropagation/useEntityKey.cjs.map +1 -1
  136. package/dist/production/src/accessorPropagation/useEntityKey.js.map +1 -1
  137. package/dist/production/src/accessorPropagation/useEntityList.cjs +3 -3
  138. package/dist/production/src/accessorPropagation/useEntityList.cjs.map +1 -1
  139. package/dist/production/src/accessorPropagation/useEntityList.js +3 -3
  140. package/dist/production/src/accessorPropagation/useEntityList.js.map +1 -1
  141. package/dist/production/src/accessorPropagation/useEntityListSubTree.cjs +1 -1
  142. package/dist/production/src/accessorPropagation/useEntityListSubTree.cjs.map +1 -1
  143. package/dist/production/src/accessorPropagation/useEntityListSubTree.js +1 -1
  144. package/dist/production/src/accessorPropagation/useEntityListSubTree.js.map +1 -1
  145. package/dist/production/src/accessorPropagation/useEntitySubTree.cjs +1 -1
  146. package/dist/production/src/accessorPropagation/useEntitySubTree.cjs.map +1 -1
  147. package/dist/production/src/accessorPropagation/useEntitySubTree.js +1 -1
  148. package/dist/production/src/accessorPropagation/useEntitySubTree.js.map +1 -1
  149. package/dist/production/src/accessorPropagation/useField.cjs +3 -3
  150. package/dist/production/src/accessorPropagation/useField.cjs.map +1 -1
  151. package/dist/production/src/accessorPropagation/useField.js +3 -3
  152. package/dist/production/src/accessorPropagation/useField.js.map +1 -1
  153. package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.cjs +2 -2
  154. package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.cjs.map +1 -1
  155. package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.js +2 -2
  156. package/dist/production/src/accessorSorting/SetOrderFieldOnCreate.js.map +1 -1
  157. package/dist/production/src/accessorSorting/addEntityAtIndex.cjs +1 -1
  158. package/dist/production/src/accessorSorting/addEntityAtIndex.cjs.map +1 -1
  159. package/dist/production/src/accessorSorting/addEntityAtIndex.js +1 -1
  160. package/dist/production/src/accessorSorting/addEntityAtIndex.js.map +1 -1
  161. package/dist/production/src/accessorSorting/repairEntitiesOrder.cjs +1 -1
  162. package/dist/production/src/accessorSorting/repairEntitiesOrder.cjs.map +1 -1
  163. package/dist/production/src/accessorSorting/repairEntitiesOrder.js +1 -1
  164. package/dist/production/src/accessorSorting/repairEntitiesOrder.js.map +1 -1
  165. package/dist/production/src/accessorSorting/sortEntities.cjs +2 -2
  166. package/dist/production/src/accessorSorting/sortEntities.cjs.map +1 -1
  167. package/dist/production/src/accessorSorting/sortEntities.js +2 -2
  168. package/dist/production/src/accessorSorting/sortEntities.js.map +1 -1
  169. package/dist/production/src/accessorTree/AccessorTree.cjs +3 -1
  170. package/dist/production/src/accessorTree/AccessorTree.cjs.map +1 -1
  171. package/dist/production/src/accessorTree/AccessorTree.js +3 -1
  172. package/dist/production/src/accessorTree/AccessorTree.js.map +1 -1
  173. package/dist/production/src/accessorTree/useDataBinding.cjs +23 -36
  174. package/dist/production/src/accessorTree/useDataBinding.cjs.map +1 -1
  175. package/dist/production/src/accessorTree/useDataBinding.js +26 -39
  176. package/dist/production/src/accessorTree/useDataBinding.js.map +1 -1
  177. package/dist/production/src/accessorTree/useEnvironmentWithSchema.cjs +31 -0
  178. package/dist/production/src/accessorTree/useEnvironmentWithSchema.cjs.map +1 -0
  179. package/dist/production/src/accessorTree/useEnvironmentWithSchema.js +31 -0
  180. package/dist/production/src/accessorTree/useEnvironmentWithSchema.js.map +1 -0
  181. package/dist/production/src/coreComponents/Component.cjs.map +1 -1
  182. package/dist/production/src/coreComponents/Component.js.map +1 -1
  183. package/dist/production/src/coreComponents/DataBindingProvider.cjs +3 -5
  184. package/dist/production/src/coreComponents/DataBindingProvider.cjs.map +1 -1
  185. package/dist/production/src/coreComponents/DataBindingProvider.js +3 -5
  186. package/dist/production/src/coreComponents/DataBindingProvider.js.map +1 -1
  187. package/dist/production/src/coreComponents/EntityListSubTree.cjs +2 -11
  188. package/dist/production/src/coreComponents/EntityListSubTree.cjs.map +1 -1
  189. package/dist/production/src/coreComponents/EntityListSubTree.js +2 -11
  190. package/dist/production/src/coreComponents/EntityListSubTree.js.map +1 -1
  191. package/dist/production/src/coreComponents/EntitySubTree.cjs +2 -11
  192. package/dist/production/src/coreComponents/EntitySubTree.cjs.map +1 -1
  193. package/dist/production/src/coreComponents/EntitySubTree.js +2 -11
  194. package/dist/production/src/coreComponents/EntitySubTree.js.map +1 -1
  195. package/dist/production/src/entityEvents/useDerivedField.cjs +3 -3
  196. package/dist/production/src/entityEvents/useDerivedField.cjs.map +1 -1
  197. package/dist/production/src/entityEvents/useDerivedField.js +3 -3
  198. package/dist/production/src/entityEvents/useDerivedField.js.map +1 -1
  199. package/dist/production/src/helperComponents/DeferredSubTrees.cjs +2 -3
  200. package/dist/production/src/helperComponents/DeferredSubTrees.cjs.map +1 -1
  201. package/dist/production/src/helperComponents/DeferredSubTrees.js +3 -4
  202. package/dist/production/src/helperComponents/DeferredSubTrees.js.map +1 -1
  203. package/dist/production/src/helperComponents/FieldView.cjs +1 -1
  204. package/dist/production/src/helperComponents/FieldView.cjs.map +1 -1
  205. package/dist/production/src/helperComponents/FieldView.js +1 -1
  206. package/dist/production/src/helperComponents/FieldView.js.map +1 -1
  207. package/dist/production/src/markers/IncrementalMarkerBuilder.cjs +56 -0
  208. package/dist/production/src/markers/IncrementalMarkerBuilder.cjs.map +1 -0
  209. package/dist/production/src/markers/IncrementalMarkerBuilder.js +56 -0
  210. package/dist/production/src/markers/IncrementalMarkerBuilder.js.map +1 -0
  211. package/dist/production/src/markers/MarkerStaticAnalyzer.cjs +110 -0
  212. package/dist/production/src/markers/MarkerStaticAnalyzer.cjs.map +1 -0
  213. package/dist/production/src/markers/MarkerStaticAnalyzer.js +110 -0
  214. package/dist/production/src/markers/MarkerStaticAnalyzer.js.map +1 -0
  215. package/dist/production/src/markers/MarkerTreeGenerator.cjs +52 -0
  216. package/dist/production/src/markers/MarkerTreeGenerator.cjs.map +1 -0
  217. package/dist/production/src/markers/MarkerTreeGenerator.js +52 -0
  218. package/dist/production/src/markers/MarkerTreeGenerator.js.map +1 -0
  219. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts +1 -1
  220. package/dist/types/accessorPropagation/BindingOperationsContext.d.ts.map +1 -1
  221. package/dist/types/accessorPropagation/EntityKeyContext.d.ts +2 -1
  222. package/dist/types/accessorPropagation/EntityKeyContext.d.ts.map +1 -1
  223. package/dist/types/accessorPropagation/EntityKeyProvider.d.ts +2 -1
  224. package/dist/types/accessorPropagation/EntityKeyProvider.d.ts.map +1 -1
  225. package/dist/types/accessorPropagation/EnvironmentContext.d.ts +2 -2
  226. package/dist/types/accessorPropagation/EnvironmentContext.d.ts.map +1 -1
  227. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts +1 -1
  228. package/dist/types/accessorPropagation/TreeRootIdContext.d.ts.map +1 -1
  229. package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts +7 -12
  230. package/dist/types/accessorPropagation/useAccessorUpdateSubscription.d.ts.map +1 -1
  231. package/dist/types/accessorPropagation/useEntityKey.d.ts +2 -1
  232. package/dist/types/accessorPropagation/useEntityKey.d.ts.map +1 -1
  233. package/dist/types/accessorPropagation/useEntitySubTree.d.ts +1 -2
  234. package/dist/types/accessorPropagation/useEntitySubTree.d.ts.map +1 -1
  235. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts +1 -1
  236. package/dist/types/accessorSorting/SetOrderFieldOnCreate.d.ts.map +1 -1
  237. package/dist/types/accessorSorting/index.d.ts +0 -2
  238. package/dist/types/accessorSorting/index.d.ts.map +1 -1
  239. package/dist/types/accessorTree/AccessorTree.d.ts.map +1 -1
  240. package/dist/types/accessorTree/AccessorTreeState.d.ts +1 -4
  241. package/dist/types/accessorTree/AccessorTreeState.d.ts.map +1 -1
  242. package/dist/types/accessorTree/AccessorTreeStateContext.d.ts +1 -1
  243. package/dist/types/accessorTree/AccessorTreeStateContext.d.ts.map +1 -1
  244. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts +0 -2
  245. package/dist/types/accessorTree/AccessorTreeStateOptions.d.ts.map +1 -1
  246. package/dist/types/accessorTree/DirtinessContext.d.ts +1 -1
  247. package/dist/types/accessorTree/DirtinessContext.d.ts.map +1 -1
  248. package/dist/types/accessorTree/MutationStateContext.d.ts +1 -1
  249. package/dist/types/accessorTree/MutationStateContext.d.ts.map +1 -1
  250. package/dist/types/accessorTree/index.d.ts +0 -1
  251. package/dist/types/accessorTree/index.d.ts.map +1 -1
  252. package/dist/types/accessorTree/useDataBinding.d.ts +6 -2
  253. package/dist/types/accessorTree/useDataBinding.d.ts.map +1 -1
  254. package/dist/types/accessorTree/useEnvironmentWithSchema.d.ts +3 -0
  255. package/dist/types/accessorTree/useEnvironmentWithSchema.d.ts.map +1 -0
  256. package/dist/types/coreComponents/Component.d.ts +1 -1
  257. package/dist/types/coreComponents/Component.d.ts.map +1 -1
  258. package/dist/types/coreComponents/DataBindingProvider.d.ts +8 -8
  259. package/dist/types/coreComponents/DataBindingProvider.d.ts.map +1 -1
  260. package/dist/types/coreComponents/Entity.d.ts +1 -1
  261. package/dist/types/coreComponents/Entity.d.ts.map +1 -1
  262. package/dist/types/coreComponents/EntityListSubTree.d.ts +1 -1
  263. package/dist/types/coreComponents/EntityListSubTree.d.ts.map +1 -1
  264. package/dist/types/coreComponents/EntitySubTree.d.ts +1 -1
  265. package/dist/types/coreComponents/EntitySubTree.d.ts.map +1 -1
  266. package/dist/types/coreComponents/ParentEntity.d.ts +1 -1
  267. package/dist/types/coreComponents/ParentEntity.d.ts.map +1 -1
  268. package/dist/types/coreComponents/index.d.ts +0 -1
  269. package/dist/types/coreComponents/index.d.ts.map +1 -1
  270. package/dist/types/helperComponents/DeferredSubTrees.d.ts +1 -1
  271. package/dist/types/helperComponents/DeferredSubTrees.d.ts.map +1 -1
  272. package/dist/types/helperComponents/If.d.ts +1 -1
  273. package/dist/types/helperComponents/If.d.ts.map +1 -1
  274. package/dist/types/helperComponents/LabelMiddleware.d.ts +1 -1
  275. package/dist/types/helperComponents/LabelMiddleware.d.ts.map +1 -1
  276. package/dist/types/helperComponents/StaticRender.d.ts +1 -1
  277. package/dist/types/helperComponents/StaticRender.d.ts.map +1 -1
  278. package/dist/types/helperComponents/Variable.d.ts +1 -1
  279. package/dist/types/helperComponents/Variable.d.ts.map +1 -1
  280. package/dist/types/index.d.ts +1 -1
  281. package/dist/types/index.d.ts.map +1 -1
  282. package/dist/types/markers/IncrementalMarkerBuilder.d.ts +5 -0
  283. package/dist/types/markers/IncrementalMarkerBuilder.d.ts.map +1 -0
  284. package/dist/types/{coreComponents → markers}/MarkerProvider.d.ts +1 -2
  285. package/dist/types/markers/MarkerProvider.d.ts.map +1 -0
  286. package/dist/types/markers/MarkerStaticAnalyzer.d.ts +14 -0
  287. package/dist/types/markers/MarkerStaticAnalyzer.d.ts.map +1 -0
  288. package/dist/types/markers/MarkerTreeGenerator.d.ts +10 -0
  289. package/dist/types/markers/MarkerTreeGenerator.d.ts.map +1 -0
  290. package/dist/types/markers/index.d.ts +3 -0
  291. package/dist/types/markers/index.d.ts.map +1 -0
  292. package/dist/types/tsconfig.tsbuildinfo +1 -1
  293. package/package.json +8 -7
  294. package/src/accessorPropagation/AccessorProvider.tsx +1 -1
  295. package/src/accessorPropagation/BindingOperationsContext.ts +1 -0
  296. package/src/accessorPropagation/EntityKeyContext.ts +2 -1
  297. package/src/accessorPropagation/EntityKeyProvider.tsx +2 -1
  298. package/src/accessorPropagation/useAccessorUpdateSubscription.ts +19 -87
  299. package/src/accessorPropagation/useEntity.ts +4 -4
  300. package/src/accessorPropagation/useEntityKey.ts +2 -2
  301. package/src/accessorPropagation/useEntityList.ts +3 -3
  302. package/src/accessorPropagation/useEntityListSubTree.ts +1 -1
  303. package/src/accessorPropagation/useEntitySubTree.ts +3 -4
  304. package/src/accessorPropagation/useField.ts +3 -3
  305. package/src/accessorSorting/SetOrderFieldOnCreate.tsx +2 -2
  306. package/src/accessorSorting/addEntityAtIndex.ts +1 -1
  307. package/src/accessorSorting/index.ts +0 -2
  308. package/src/accessorSorting/repairEntitiesOrder.ts +1 -1
  309. package/src/accessorSorting/sortEntities.ts +2 -2
  310. package/src/accessorTree/AccessorTree.tsx +17 -12
  311. package/src/accessorTree/AccessorTreeState.ts +1 -4
  312. package/src/accessorTree/AccessorTreeStateOptions.ts +0 -2
  313. package/src/accessorTree/index.ts +0 -1
  314. package/src/accessorTree/useDataBinding.ts +35 -44
  315. package/src/accessorTree/useEnvironmentWithSchema.ts +31 -0
  316. package/src/coreComponents/Component.tsx +2 -2
  317. package/src/coreComponents/DataBindingProvider.tsx +22 -35
  318. package/src/coreComponents/EntityListSubTree.tsx +4 -18
  319. package/src/coreComponents/EntitySubTree.tsx +5 -20
  320. package/src/coreComponents/index.ts +0 -1
  321. package/src/entityEvents/useDerivedField.ts +3 -3
  322. package/src/helperComponents/DeferredSubTrees.tsx +1 -5
  323. package/src/helperComponents/FieldView.tsx +1 -1
  324. package/src/index.ts +1 -1
  325. package/src/markers/IncrementalMarkerBuilder.ts +60 -0
  326. package/src/{coreComponents → markers}/MarkerProvider.ts +2 -2
  327. package/src/markers/MarkerStaticAnalyzer.ts +132 -0
  328. package/src/markers/MarkerTreeGenerator.ts +72 -0
  329. package/src/markers/index.ts +2 -0
  330. package/src/tsconfig.json +2 -1
  331. package/src/typings/react-fix.d.ts +12 -0
  332. package/tests/cases/unit/model/markerTreeGenerator.spec.tsx +44 -9
  333. package/tests/lib/bindingFactory.ts +1 -1
  334. package/dist/development/src/MarkerTreeGenerator.cjs +0 -89
  335. package/dist/development/src/MarkerTreeGenerator.cjs.map +0 -1
  336. package/dist/development/src/MarkerTreeGenerator.js +0 -89
  337. package/dist/development/src/MarkerTreeGenerator.js.map +0 -1
  338. package/dist/development/src/accessorSorting/errors.cjs +0 -10
  339. package/dist/development/src/accessorSorting/errors.cjs.map +0 -1
  340. package/dist/development/src/accessorSorting/errors.js +0 -10
  341. package/dist/development/src/accessorSorting/errors.js.map +0 -1
  342. package/dist/development/src/accessorSorting/moveEntity.cjs +0 -42
  343. package/dist/development/src/accessorSorting/moveEntity.cjs.map +0 -1
  344. package/dist/development/src/accessorSorting/moveEntity.js +0 -42
  345. package/dist/development/src/accessorSorting/moveEntity.js.map +0 -1
  346. package/dist/development/src/accessorSorting/useSortedEntities.cjs +0 -80
  347. package/dist/development/src/accessorSorting/useSortedEntities.cjs.map +0 -1
  348. package/dist/development/src/accessorSorting/useSortedEntities.js +0 -80
  349. package/dist/development/src/accessorSorting/useSortedEntities.js.map +0 -1
  350. package/dist/development/src/accessorTree/accessorTreeStateReducer.cjs +0 -34
  351. package/dist/development/src/accessorTree/accessorTreeStateReducer.cjs.map +0 -1
  352. package/dist/development/src/accessorTree/accessorTreeStateReducer.js +0 -34
  353. package/dist/development/src/accessorTree/accessorTreeStateReducer.js.map +0 -1
  354. package/dist/development/src/core/IncrementalMarkerBuilder.cjs +0 -63
  355. package/dist/development/src/core/IncrementalMarkerBuilder.cjs.map +0 -1
  356. package/dist/development/src/core/IncrementalMarkerBuilder.js +0 -63
  357. package/dist/development/src/core/IncrementalMarkerBuilder.js.map +0 -1
  358. package/dist/production/src/MarkerTreeGenerator.cjs +0 -89
  359. package/dist/production/src/MarkerTreeGenerator.cjs.map +0 -1
  360. package/dist/production/src/MarkerTreeGenerator.js +0 -89
  361. package/dist/production/src/MarkerTreeGenerator.js.map +0 -1
  362. package/dist/production/src/accessorSorting/errors.cjs +0 -10
  363. package/dist/production/src/accessorSorting/errors.cjs.map +0 -1
  364. package/dist/production/src/accessorSorting/errors.js +0 -10
  365. package/dist/production/src/accessorSorting/errors.js.map +0 -1
  366. package/dist/production/src/accessorSorting/moveEntity.cjs +0 -42
  367. package/dist/production/src/accessorSorting/moveEntity.cjs.map +0 -1
  368. package/dist/production/src/accessorSorting/moveEntity.js +0 -42
  369. package/dist/production/src/accessorSorting/moveEntity.js.map +0 -1
  370. package/dist/production/src/accessorSorting/useSortedEntities.cjs +0 -80
  371. package/dist/production/src/accessorSorting/useSortedEntities.cjs.map +0 -1
  372. package/dist/production/src/accessorSorting/useSortedEntities.js +0 -80
  373. package/dist/production/src/accessorSorting/useSortedEntities.js.map +0 -1
  374. package/dist/production/src/accessorTree/accessorTreeStateReducer.cjs +0 -34
  375. package/dist/production/src/accessorTree/accessorTreeStateReducer.cjs.map +0 -1
  376. package/dist/production/src/accessorTree/accessorTreeStateReducer.js +0 -34
  377. package/dist/production/src/accessorTree/accessorTreeStateReducer.js.map +0 -1
  378. package/dist/production/src/core/IncrementalMarkerBuilder.cjs +0 -63
  379. package/dist/production/src/core/IncrementalMarkerBuilder.cjs.map +0 -1
  380. package/dist/production/src/core/IncrementalMarkerBuilder.js +0 -63
  381. package/dist/production/src/core/IncrementalMarkerBuilder.js.map +0 -1
  382. package/dist/types/MarkerTreeGenerator.d.ts +0 -14
  383. package/dist/types/MarkerTreeGenerator.d.ts.map +0 -1
  384. package/dist/types/accessorSorting/errors.d.ts +0 -3
  385. package/dist/types/accessorSorting/errors.d.ts.map +0 -1
  386. package/dist/types/accessorSorting/moveEntity.d.ts +0 -4
  387. package/dist/types/accessorSorting/moveEntity.d.ts.map +0 -1
  388. package/dist/types/accessorSorting/useSortedEntities.d.ts +0 -5
  389. package/dist/types/accessorSorting/useSortedEntities.d.ts.map +0 -1
  390. package/dist/types/accessorTree/accessorTreeStateReducer.d.ts +0 -4
  391. package/dist/types/accessorTree/accessorTreeStateReducer.d.ts.map +0 -1
  392. package/dist/types/core/IncrementalMarkerBuilder.d.ts +0 -7
  393. package/dist/types/core/IncrementalMarkerBuilder.d.ts.map +0 -1
  394. package/dist/types/coreComponents/MarkerProvider.d.ts.map +0 -1
  395. package/src/MarkerTreeGenerator.ts +0 -121
  396. package/src/accessorSorting/errors.ts +0 -9
  397. package/src/accessorSorting/moveEntity.ts +0 -65
  398. package/src/accessorSorting/useSortedEntities.ts +0 -102
  399. package/src/accessorTree/accessorTreeStateReducer.ts +0 -36
  400. package/src/core/IncrementalMarkerBuilder.ts +0 -64
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const MarkerTreeGenerator = require("./src/MarkerTreeGenerator.cjs");
4
3
  const binding = require("@contember/binding");
5
4
  const AccessorTree = require("./src/accessorTree/AccessorTree.cjs");
6
- const accessorTreeStateReducer = require("./src/accessorTree/accessorTreeStateReducer.cjs");
7
5
  const DirtinessContext = require("./src/accessorTree/DirtinessContext.cjs");
8
6
  const MutationStateContext = require("./src/accessorTree/MutationStateContext.cjs");
9
7
  const useAccessorTreeState = require("./src/accessorTree/useAccessorTreeState.cjs");
@@ -40,11 +38,9 @@ const useGetTreeFilters = require("./src/accessorPropagation/useGetTreeFilters.c
40
38
  const usePersist = require("./src/accessorPropagation/usePersist.cjs");
41
39
  const useTreeRootId = require("./src/accessorPropagation/useTreeRootId.cjs");
42
40
  const addEntityAtIndex = require("./src/accessorSorting/addEntityAtIndex.cjs");
43
- const moveEntity = require("./src/accessorSorting/moveEntity.cjs");
44
41
  const repairEntitiesOrder = require("./src/accessorSorting/repairEntitiesOrder.cjs");
45
42
  const SetOrderFieldOnCreate = require("./src/accessorSorting/SetOrderFieldOnCreate.cjs");
46
43
  const sortEntities = require("./src/accessorSorting/sortEntities.cjs");
47
- const useSortedEntities = require("./src/accessorSorting/useSortedEntities.cjs");
48
44
  const Component = require("./src/coreComponents/Component.cjs");
49
45
  const DataBindingProvider = require("./src/coreComponents/DataBindingProvider.cjs");
50
46
  const Entity = require("./src/coreComponents/Entity.cjs");
@@ -71,9 +67,8 @@ const LabelMiddleware = require("./src/helperComponents/LabelMiddleware.cjs");
71
67
  const StaticRender = require("./src/helperComponents/StaticRender.cjs");
72
68
  const SugaredField = require("./src/helperComponents/SugaredField.cjs");
73
69
  const Variable = require("./src/helperComponents/Variable.cjs");
74
- exports.MarkerTreeGenerator = MarkerTreeGenerator.MarkerTreeGenerator;
70
+ const MarkerTreeGenerator = require("./src/markers/MarkerTreeGenerator.cjs");
75
71
  exports.AccessorTree = AccessorTree.AccessorTree;
76
- exports.accessorTreeStateReducer = accessorTreeStateReducer.accessorTreeStateReducer;
77
72
  exports.DirtinessContext = DirtinessContext.DirtinessContext;
78
73
  exports.MutationStateContext = MutationStateContext.MutationStateContext;
79
74
  exports.useAccessorTreeState = useAccessorTreeState.useAccessorTreeState;
@@ -112,12 +107,9 @@ exports.useGetTreeFilters = useGetTreeFilters.useGetTreeFilters;
112
107
  exports.usePersist = usePersist.usePersist;
113
108
  exports.useTreeRootId = useTreeRootId.useTreeRootId;
114
109
  exports.addEntityAtIndex = addEntityAtIndex.addEntityAtIndex;
115
- exports.moveEntity = moveEntity.moveEntity;
116
- exports.moveEntityInArray = moveEntity.moveEntityInArray;
117
110
  exports.repairEntitiesOrder = repairEntitiesOrder.repairEntitiesOrder;
118
111
  exports.SetOrderFieldOnCreate = SetOrderFieldOnCreate.SetOrderFieldOnCreate;
119
112
  exports.sortEntities = sortEntities.sortEntities;
120
- exports.useSortedEntities = useSortedEntities.useSortedEntities;
121
113
  exports.Component = Component.Component;
122
114
  exports.DataBindingProvider = DataBindingProvider.DataBindingProvider;
123
115
  exports.Entity = Entity.Entity;
@@ -146,6 +138,7 @@ exports.useLabelMiddleware = LabelMiddleware.useLabelMiddleware;
146
138
  exports.StaticRender = StaticRender.StaticRender;
147
139
  exports.SugaredField = SugaredField.SugaredField;
148
140
  exports.Variable = Variable.Variable;
141
+ exports.MarkerTreeGenerator = MarkerTreeGenerator.MarkerTreeGenerator;
149
142
  Object.keys(binding).forEach((k) => {
150
143
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
151
144
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,5 @@
1
- import { MarkerTreeGenerator } from "./src/MarkerTreeGenerator.js";
2
1
  export * from "@contember/binding";
3
2
  import { AccessorTree } from "./src/accessorTree/AccessorTree.js";
4
- import { accessorTreeStateReducer } from "./src/accessorTree/accessorTreeStateReducer.js";
5
3
  import { DirtinessContext } from "./src/accessorTree/DirtinessContext.js";
6
4
  import { MutationStateContext } from "./src/accessorTree/MutationStateContext.js";
7
5
  import { useAccessorTreeState } from "./src/accessorTree/useAccessorTreeState.js";
@@ -38,11 +36,9 @@ import { useGetTreeFilters } from "./src/accessorPropagation/useGetTreeFilters.j
38
36
  import { usePersist } from "./src/accessorPropagation/usePersist.js";
39
37
  import { useTreeRootId } from "./src/accessorPropagation/useTreeRootId.js";
40
38
  import { addEntityAtIndex } from "./src/accessorSorting/addEntityAtIndex.js";
41
- import { moveEntity, moveEntityInArray } from "./src/accessorSorting/moveEntity.js";
42
39
  import { repairEntitiesOrder } from "./src/accessorSorting/repairEntitiesOrder.js";
43
40
  import { SetOrderFieldOnCreate } from "./src/accessorSorting/SetOrderFieldOnCreate.js";
44
41
  import { sortEntities } from "./src/accessorSorting/sortEntities.js";
45
- import { useSortedEntities } from "./src/accessorSorting/useSortedEntities.js";
46
42
  import { Component } from "./src/coreComponents/Component.js";
47
43
  import { DataBindingProvider } from "./src/coreComponents/DataBindingProvider.js";
48
44
  import { Entity } from "./src/coreComponents/Entity.js";
@@ -69,6 +65,7 @@ import { LabelMiddlewareContext, LabelMiddlewareProvider, useLabelMiddleware } f
69
65
  import { StaticRender } from "./src/helperComponents/StaticRender.js";
70
66
  import { SugaredField } from "./src/helperComponents/SugaredField.js";
71
67
  import { Variable } from "./src/helperComponents/Variable.js";
68
+ import { MarkerTreeGenerator } from "./src/markers/MarkerTreeGenerator.js";
72
69
  export {
73
70
  AccessorProvider,
74
71
  AccessorTree,
@@ -102,10 +99,7 @@ export {
102
99
  SugaredField,
103
100
  TreeRootIdProvider,
104
101
  Variable,
105
- accessorTreeStateReducer,
106
102
  addEntityAtIndex,
107
- moveEntity,
108
- moveEntityInArray,
109
103
  repairEntitiesOrder,
110
104
  sortEntities,
111
105
  useAccessorTreeState,
@@ -143,7 +137,6 @@ export {
143
137
  useMutationState,
144
138
  useOnConnectionUpdate,
145
139
  usePersist,
146
- useSortedEntities,
147
140
  useTreeRootId
148
141
  };
149
142
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,7 +4,7 @@ const jsxDevRuntime = require("react/jsx-dev-runtime");
4
4
  const EntityKeyContext = require("./EntityKeyContext.cjs");
5
5
  const EnvironmentContext = require("./EnvironmentContext.cjs");
6
6
  function AccessorProvider(props) {
7
- return /* @__PURE__ */ jsxDevRuntime.jsxDEV(EntityKeyContext.EntityKeyContext.Provider, { value: props.accessor.key, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(EnvironmentContext.EnvironmentContext.Provider, { value: props.accessor.environment, children: props.children }, void 0, false, {
7
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV(EntityKeyContext.EntityKeyContext.Provider, { value: props.accessor.key ?? props.accessor.getAccessor, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(EnvironmentContext.EnvironmentContext.Provider, { value: props.accessor.environment, children: props.children }, void 0, false, {
8
8
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/AccessorProvider.tsx",
9
9
  lineNumber: 14,
10
10
  columnNumber: 4
@@ -1 +1 @@
1
- {"version":3,"file":"AccessorProvider.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/AccessorProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport interface EntityProviderProps {\n\taccessor: EntityAccessor\n\tchildren: ReactNode\n}\n\nexport function AccessorProvider(props: EntityProviderProps) {\n\treturn (\n\t\t<EntityKeyContext.Provider value={props.accessor.key}>\n\t\t\t<EnvironmentContext.Provider value={props.accessor.environment}>{props.children}</EnvironmentContext.Provider>\n\t\t</EntityKeyContext.Provider>\n\t)\n}\n"],"names":["EntityKeyContext","jsxDEV","EnvironmentContext"],"mappings":";;;;;AAUO,SAAS,iBAAiB,OAA4B;AAC5D,8CACEA,iBAAAA,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,SAAS,KAChD,UAACC,8BAAAA,OAAAC,mBAAA,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,SAAS,aAAc,gBAAM,SAAvE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAAgF,EADjF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAA,IAAA;AAEF;;"}
1
+ {"version":3,"file":"AccessorProvider.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/AccessorProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport interface EntityProviderProps {\n\taccessor: EntityAccessor\n\tchildren: ReactNode\n}\n\nexport function AccessorProvider(props: EntityProviderProps) {\n\treturn (\n\t\t<EntityKeyContext.Provider value={props.accessor.key ?? props.accessor.getAccessor}>\n\t\t\t<EnvironmentContext.Provider value={props.accessor.environment}>{props.children}</EnvironmentContext.Provider>\n\t\t</EntityKeyContext.Provider>\n\t)\n}\n"],"names":["jsxDEV","EntityKeyContext","EnvironmentContext"],"mappings":";;;;;AAUO,SAAS,iBAAiB,OAA4B;AAE3D,SAAAA,qCAACC,iBAAAA,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,SAAS,OAAO,MAAM,SAAS,aACtE,UAACD,8BAAAA,OAAAE,mBAAA,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,SAAS,aAAc,gBAAM,SAAvE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAAgF,EADjF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAA,IAAA;AAEF;;"}
@@ -2,7 +2,7 @@ import { jsxDEV } from "react/jsx-dev-runtime";
2
2
  import { EntityKeyContext } from "./EntityKeyContext.js";
3
3
  import { EnvironmentContext } from "./EnvironmentContext.js";
4
4
  function AccessorProvider(props) {
5
- return /* @__PURE__ */ jsxDEV(EntityKeyContext.Provider, { value: props.accessor.key, children: /* @__PURE__ */ jsxDEV(EnvironmentContext.Provider, { value: props.accessor.environment, children: props.children }, void 0, false, {
5
+ return /* @__PURE__ */ jsxDEV(EntityKeyContext.Provider, { value: props.accessor.key ?? props.accessor.getAccessor, children: /* @__PURE__ */ jsxDEV(EnvironmentContext.Provider, { value: props.accessor.environment, children: props.children }, void 0, false, {
6
6
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/AccessorProvider.tsx",
7
7
  lineNumber: 14,
8
8
  columnNumber: 4
@@ -1 +1 @@
1
- {"version":3,"file":"AccessorProvider.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/AccessorProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport interface EntityProviderProps {\n\taccessor: EntityAccessor\n\tchildren: ReactNode\n}\n\nexport function AccessorProvider(props: EntityProviderProps) {\n\treturn (\n\t\t<EntityKeyContext.Provider value={props.accessor.key}>\n\t\t\t<EnvironmentContext.Provider value={props.accessor.environment}>{props.children}</EnvironmentContext.Provider>\n\t\t</EntityKeyContext.Provider>\n\t)\n}\n"],"names":[],"mappings":";;;AAUO,SAAS,iBAAiB,OAA4B;AAC5D,gCACE,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,SAAS,KAChD,UAAC,uBAAA,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,SAAS,aAAc,gBAAM,SAAvE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAAgF,EADjF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAA,IAAA;AAEF;"}
1
+ {"version":3,"file":"AccessorProvider.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/AccessorProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EnvironmentContext } from './EnvironmentContext'\n\nexport interface EntityProviderProps {\n\taccessor: EntityAccessor\n\tchildren: ReactNode\n}\n\nexport function AccessorProvider(props: EntityProviderProps) {\n\treturn (\n\t\t<EntityKeyContext.Provider value={props.accessor.key ?? props.accessor.getAccessor}>\n\t\t\t<EnvironmentContext.Provider value={props.accessor.environment}>{props.children}</EnvironmentContext.Provider>\n\t\t</EntityKeyContext.Provider>\n\t)\n}\n"],"names":[],"mappings":";;;AAUO,SAAS,iBAAiB,OAA4B;AAE3D,SAAA,uBAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,SAAS,OAAO,MAAM,SAAS,aACtE,UAAC,uBAAA,mBAAmB,UAAnB,EAA4B,OAAO,MAAM,SAAS,aAAc,gBAAM,SAAvE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,IAAgF,EADjF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAA,IAAA;AAEF;"}
@@ -23,7 +23,8 @@ const defaultBindingOperations = Object.freeze({
23
23
  getTreeFilters: getRejecter("retrieve tree filters"),
24
24
  batchDeferredUpdates: getRejecter("batch deferred updates"),
25
25
  extendTree: getRejecter("extendTree"),
26
- persist: getRejecter("persist")
26
+ persist: getRejecter("persist"),
27
+ fetchData: getRejecter("fetchData")
27
28
  });
28
29
  const BindingOperationsContext = React.createContext(defaultBindingOperations);
29
30
  exports.BindingOperationsContext = BindingOperationsContext;
@@ -1 +1 @@
1
- {"version":3,"file":"BindingOperationsContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":["BindingError","createContext"],"mappings":";;;;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAIA,QAAA;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAC/B,CAAC;AAEY,MAAA,2BAA2BC,oBAA4C,wBAAwB;;;"}
1
+ {"version":3,"file":"BindingOperationsContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":["BindingError","createContext"],"mappings":";;;;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAIA,QAAA;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2BC,oBAA4C,wBAAwB;;;"}
@@ -21,7 +21,8 @@ const defaultBindingOperations = Object.freeze({
21
21
  getTreeFilters: getRejecter("retrieve tree filters"),
22
22
  batchDeferredUpdates: getRejecter("batch deferred updates"),
23
23
  extendTree: getRejecter("extendTree"),
24
- persist: getRejecter("persist")
24
+ persist: getRejecter("persist"),
25
+ fetchData: getRejecter("fetchData")
25
26
  });
26
27
  const BindingOperationsContext = createContext(defaultBindingOperations);
27
28
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"BindingOperationsContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":[],"mappings":";;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAI;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAC/B,CAAC;AAEY,MAAA,2BAA2B,cAA4C,wBAAwB;"}
1
+ {"version":3,"file":"BindingOperationsContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/BindingOperationsContext.ts"],"sourcesContent":["import { createContext, ReactNode } from 'react'\nimport type { BindingOperations } from '@contember/binding'\nimport { BindingError } from '@contember/binding'\n\nconst getRejecter = (operation: string) => () => {\n\tthrow new BindingError(\n\t\t`Trying to ${operation} but data binding is unavailable. You likely used a bound component outside ` +\n\t\t\t`<DataBindingProvider /> or it tried to reach its accessor whilst the tree was in an non-interactive state ` +\n\t\t\t`(e.g. still loading).`,\n\t)\n}\n\nexport const defaultBindingOperations = Object.freeze<BindingOperations<ReactNode>>({\n\tget contentClient() {\n\t\treturn getRejecter('retrieve the content api client')()\n\t},\n\tget systemClient() {\n\t\treturn getRejecter('retrieve the system api client')()\n\t},\n\tget tenantClient() {\n\t\treturn getRejecter('retrieve the tenant api client')()\n\t},\n\tgetEntityListSubTree: getRejecter('retrieve an entity list sub tree'),\n\tgetEntitySubTree: getRejecter('retrieve a single entity sub tree'),\n\tgetEntityByKey: getRejecter('retrieve an entity by key'),\n\tgetTreeFilters: getRejecter('retrieve tree filters'),\n\tbatchDeferredUpdates: getRejecter('batch deferred updates'),\n\textendTree: getRejecter('extendTree'),\n\tpersist: getRejecter('persist'),\n\tfetchData: getRejecter('fetchData'),\n})\n\nexport const BindingOperationsContext = createContext<BindingOperations<ReactNode>>(defaultBindingOperations)\n"],"names":[],"mappings":";;AAIA,MAAM,cAAc,CAAC,cAAsB,MAAM;AAChD,QAAM,IAAI;AAAA,IACT,aAAa,SAAS;AAAA,EAAA;AAIxB;AAEa,MAAA,2BAA2B,OAAO,OAAqC;AAAA,EACnF,IAAI,gBAAgB;AACZ,WAAA,YAAY,iCAAiC;EACrD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,IAAI,eAAe;AACX,WAAA,YAAY,gCAAgC;EACpD;AAAA,EACA,sBAAsB,YAAY,kCAAkC;AAAA,EACpE,kBAAkB,YAAY,mCAAmC;AAAA,EACjE,gBAAgB,YAAY,2BAA2B;AAAA,EACvD,gBAAgB,YAAY,uBAAuB;AAAA,EACnD,sBAAsB,YAAY,wBAAwB;AAAA,EAC1D,YAAY,YAAY,YAAY;AAAA,EACpC,SAAS,YAAY,SAAS;AAAA,EAC9B,WAAW,YAAY,WAAW;AACnC,CAAC;AAEY,MAAA,2BAA2B,cAA4C,wBAAwB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":["createContext"],"mappings":";;;AAEa,MAAA,mBAAmBA,MAAAA,cAAkC,MAAS;AAC3E,iBAAiB,cAAc;;"}
1
+ {"version":3,"file":"EntityKeyContext.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { EntityAccessor } from '@contember/binding-common'\nimport { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string | (() => EntityAccessor)>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":["createContext"],"mappings":";;;AAGa,MAAA,mBAAmBA,MAAAA,cAA2D,MAAS;AACpG,iBAAiB,cAAc;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":[],"mappings":";AAEa,MAAA,mBAAmB,cAAkC,MAAS;AAC3E,iBAAiB,cAAc;"}
1
+ {"version":3,"file":"EntityKeyContext.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyContext.ts"],"sourcesContent":["import { EntityAccessor } from '@contember/binding-common'\nimport { createContext } from 'react'\n\nexport const EntityKeyContext = createContext<undefined | string | (() => EntityAccessor)>(undefined)\nEntityKeyContext.displayName = 'EntityKeyContext'\n"],"names":[],"mappings":";AAGa,MAAA,mBAAmB,cAA2D,MAAS;AACpG,iBAAiB,cAAc;"}
@@ -5,7 +5,7 @@ const EntityKeyContext = require("./EntityKeyContext.cjs");
5
5
  function EntityKeyProvider(props) {
6
6
  return /* @__PURE__ */ jsxDevRuntime.jsxDEV(EntityKeyContext.EntityKeyContext.Provider, { value: props.entityKey, children: props.children }, void 0, false, {
7
7
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx",
8
- lineNumber: 10,
8
+ lineNumber: 11,
9
9
  columnNumber: 9
10
10
  }, this);
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyProvider.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport interface EntityKeyProviderProps {\n\tentityKey: string\n\tchildren: ReactNode\n}\n\nexport function EntityKeyProvider(props: EntityKeyProviderProps) {\n\treturn <EntityKeyContext.Provider value={props.entityKey}>{props.children}</EntityKeyContext.Provider>\n}\n"],"names":["jsxDEV","EntityKeyContext"],"mappings":";;;;AAQO,SAAS,kBAAkB,OAA+B;AACzD,SAAAA,8BAAA,OAACC,kCAAiB,UAAjB,EAA0B,OAAO,MAAM,WAAY,gBAAM,SAA1D,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAmE,GAAA,IAAA;AAC3E;;"}
1
+ {"version":3,"file":"EntityKeyProvider.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EntityAccessor } from '@contember/binding'\n\nexport interface EntityKeyProviderProps {\n\tentityKey: string | (() => EntityAccessor)\n\tchildren: ReactNode\n}\n\nexport function EntityKeyProvider(props: EntityKeyProviderProps) {\n\treturn <EntityKeyContext.Provider value={props.entityKey}>{props.children}</EntityKeyContext.Provider>\n}\n"],"names":["jsxDEV","EntityKeyContext"],"mappings":";;;;AASO,SAAS,kBAAkB,OAA+B;AACzD,SAAAA,8BAAA,OAACC,kCAAiB,UAAjB,EAA0B,OAAO,MAAM,WAAY,gBAAM,SAA1D,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAmE,GAAA,IAAA;AAC3E;;"}
@@ -3,7 +3,7 @@ import { EntityKeyContext } from "./EntityKeyContext.js";
3
3
  function EntityKeyProvider(props) {
4
4
  return /* @__PURE__ */ jsxDEV(EntityKeyContext.Provider, { value: props.entityKey, children: props.children }, void 0, false, {
5
5
  fileName: "/home/runner/work/contember/contember/packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx",
6
- lineNumber: 10,
6
+ lineNumber: 11,
7
7
  columnNumber: 9
8
8
  }, this);
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EntityKeyProvider.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport interface EntityKeyProviderProps {\n\tentityKey: string\n\tchildren: ReactNode\n}\n\nexport function EntityKeyProvider(props: EntityKeyProviderProps) {\n\treturn <EntityKeyContext.Provider value={props.entityKey}>{props.children}</EntityKeyContext.Provider>\n}\n"],"names":[],"mappings":";;AAQO,SAAS,kBAAkB,OAA+B;AACzD,SAAA,uBAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,WAAY,gBAAM,SAA1D,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAmE,GAAA,IAAA;AAC3E;"}
1
+ {"version":3,"file":"EntityKeyProvider.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/EntityKeyProvider.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { EntityKeyContext } from './EntityKeyContext'\nimport { EntityAccessor } from '@contember/binding'\n\nexport interface EntityKeyProviderProps {\n\tentityKey: string | (() => EntityAccessor)\n\tchildren: ReactNode\n}\n\nexport function EntityKeyProvider(props: EntityKeyProviderProps) {\n\treturn <EntityKeyContext.Provider value={props.entityKey}>{props.children}</EntityKeyContext.Provider>\n}\n"],"names":[],"mappings":";;AASO,SAAS,kBAAkB,OAA+B;AACzD,SAAA,uBAAC,iBAAiB,UAAjB,EAA0B,OAAO,MAAM,WAAY,gBAAM,SAA1D,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAmE,GAAA,IAAA;AAC3E;"}
@@ -1,55 +1,32 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const reactUtils = require("@contember/react-utils");
4
3
  const React = require("react");
5
- function useAccessorUpdateSubscription(getAccessor, withForceUpdate) {
6
- const [state, setState] = React.useState(() => ({
7
- accessor: getAccessor(),
8
- getAccessor
9
- }));
10
- reactUtils.useConstantValueInvariant(withForceUpdate, "useAccessorUpdateSubscription: cannot change the withForceUpdate value!");
11
- let accessor = state.accessor;
12
- if (state.getAccessor !== getAccessor) {
13
- setState({
14
- accessor: getAccessor(),
15
- getAccessor
16
- });
4
+ const useAccessorUpdateSubscription = (getAccessor) => {
5
+ const [state, setState] = React.useState(() => getAccessor());
6
+ const getterRef = React.useRef(getAccessor);
7
+ let accessor = state;
8
+ if (getterRef.current !== getAccessor) {
17
9
  accessor = getAccessor();
18
- }
19
- let forceUpdate = void 0;
20
- if (withForceUpdate) {
21
- forceUpdate = React.useCallback(() => {
22
- setState({
23
- accessor: getAccessor(),
24
- getAccessor
25
- });
26
- }, [getAccessor]);
10
+ setState(accessor);
11
+ getterRef.current = getAccessor;
27
12
  }
28
13
  React.useEffect(() => {
29
14
  let isStillSubscribed = true;
30
15
  const unsubscribe = getAccessor().addEventListener({ type: "update" }, (newAccessor) => {
31
- if (!isStillSubscribed) {
16
+ if (!isStillSubscribed || getterRef.current !== getAccessor) {
32
17
  return;
33
18
  }
34
- setState((prevState) => {
35
- if (prevState.getAccessor !== getAccessor || prevState.accessor === newAccessor) {
36
- return prevState;
37
- }
38
- return {
39
- accessor: newAccessor,
40
- getAccessor
41
- };
42
- });
19
+ setState(newAccessor);
43
20
  });
44
21
  return () => {
45
22
  isStillSubscribed = false;
46
23
  unsubscribe();
47
24
  };
48
25
  }, [getAccessor]);
49
- if (withForceUpdate && forceUpdate) {
50
- return [accessor, forceUpdate];
51
- }
52
- return accessor;
53
- }
26
+ const update = React.useCallback(() => {
27
+ setState(getAccessor());
28
+ }, [getAccessor]);
29
+ return [accessor, { update }];
30
+ };
54
31
  exports.useAccessorUpdateSubscription = useAccessorUpdateSubscription;
55
32
  //# sourceMappingURL=useAccessorUpdateSubscription.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAccessorUpdateSubscription.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useAccessorUpdateSubscription.ts"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { EntityAccessor, EntityListAccessor, FieldAccessor } from '@contember/binding'\nimport type { FieldValue } from '@contember/binding'\n\nexport type ForceAccessorUpdate = () => void\n\n/**\n * It is VERY IMPORTANT for the parameter to be referentially stable!\n */\nfunction useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(\n\tgetFieldAccessor: () => FieldAccessor<Value>,\n): FieldAccessor<Value>\nfunction useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor): EntityAccessor\nfunction useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor): EntityListAccessor\nfunction useAccessorUpdateSubscription(\n\tgetAccessor: () => EntityListAccessor | EntityAccessor,\n): EntityListAccessor | EntityAccessor\nfunction useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(\n\tgetFieldAccessor: () => FieldAccessor<Value>,\n\twithForceUpdate: true,\n): [FieldAccessor<Value>, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetEntityAccessor: () => EntityAccessor,\n\twithForceUpdate: true,\n): [EntityAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetListAccessor: () => EntityListAccessor,\n\twithForceUpdate: true,\n): [EntityListAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetAccessor: () => EntityListAccessor | EntityAccessor,\n\twithForceUpdate: true,\n): [EntityListAccessor | EntityAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription<\n\tA extends FieldAccessor<Value> | EntityListAccessor | EntityAccessor,\n\tValue extends FieldValue = FieldValue,\n>(getAccessor: () => A, withForceUpdate?: true): A | [A, ForceAccessorUpdate] {\n\t// This is *HEAVILY* adopted from https://github.com/facebook/react/blob/master/packages/use-subscription/src/useSubscription.js\n\tconst [state, setState] = useState<{\n\t\taccessor: A\n\t\tgetAccessor: () => A\n\t}>(() => ({\n\t\t\t\taccessor: getAccessor(),\n\t\t\t\tgetAccessor,\n\t\t\t}))\n\n\tuseConstantValueInvariant(withForceUpdate, 'useAccessorUpdateSubscription: cannot change the withForceUpdate value!')\n\n\tlet accessor = state.accessor\n\n\tif (state.getAccessor !== getAccessor) {\n\t\tsetState({\n\t\t\taccessor: getAccessor(),\n\t\t\tgetAccessor,\n\t\t})\n\t\taccessor = getAccessor()\n\t}\n\n\tlet forceUpdate: ForceAccessorUpdate | undefined = undefined\n\tif (withForceUpdate) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tforceUpdate = useCallback(() => {\n\t\t\tsetState({\n\t\t\t\taccessor: getAccessor(),\n\t\t\t\tgetAccessor,\n\t\t\t})\n\t\t}, [getAccessor])\n\t}\n\n\tuseEffect(() => {\n\t\tlet isStillSubscribed = true\n\n\t\tconst unsubscribe = (\n\t\t\tgetAccessor().addEventListener as (\n\t\t\t\teventType: { type: 'update' },\n\t\t\t\thandler: (newAccessor: FieldAccessor<Value> | EntityListAccessor | EntityAccessor) => void,\n\t\t\t) => () => void\n\t\t)({ type: 'update' }, newAccessor => {\n\t\t\tif (!isStillSubscribed) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsetState(prevState => {\n\t\t\t\tif (prevState.getAccessor !== getAccessor || prevState.accessor === newAccessor) {\n\t\t\t\t\treturn prevState\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\taccessor: newAccessor as A,\n\t\t\t\t\tgetAccessor,\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\treturn () => {\n\t\t\tisStillSubscribed = false\n\t\t\tunsubscribe()\n\t\t}\n\t}, [getAccessor])\n\n\tif (withForceUpdate && forceUpdate) {\n\t\treturn [accessor, forceUpdate]\n\t}\n\treturn accessor\n}\nexport { useAccessorUpdateSubscription }\n"],"names":["useState","useConstantValueInvariant","useCallback","useEffect"],"mappings":";;;;AAkCA,SAAS,8BAGP,aAAsB,iBAAsD;AAE7E,QAAM,CAAC,OAAO,QAAQ,IAAIA,eAGvB,OAAO;AAAA,IACP,UAAU,YAAY;AAAA,IACtB;AAAA,EACC,EAAA;AAEJC,uCAA0B,iBAAiB,yEAAyE;AAEpH,MAAI,WAAW,MAAM;AAEjB,MAAA,MAAM,gBAAgB,aAAa;AAC7B,aAAA;AAAA,MACR,UAAU,YAAY;AAAA,MACtB;AAAA,IAAA,CACA;AACD,eAAW,YAAY;AAAA,EACxB;AAEA,MAAI,cAA+C;AACnD,MAAI,iBAAiB;AAEpB,kBAAcC,kBAAY,MAAM;AACtB,eAAA;AAAA,QACR,UAAU,YAAY;AAAA,QACtB;AAAA,MAAA,CACA;AAAA,IAAA,GACC,CAAC,WAAW,CAAC;AAAA,EACjB;AAEAC,QAAAA,UAAU,MAAM;AACf,QAAI,oBAAoB;AAElB,UAAA,cACL,cAAc,iBAIb,EAAE,MAAM,SAAA,GAAY,CAAe,gBAAA;AACpC,UAAI,CAAC,mBAAmB;AACvB;AAAA,MACD;AAEA,eAAS,CAAa,cAAA;AACrB,YAAI,UAAU,gBAAgB,eAAe,UAAU,aAAa,aAAa;AACzE,iBAAA;AAAA,QACR;AAEO,eAAA;AAAA,UACN,UAAU;AAAA,UACV;AAAA,QAAA;AAAA,MACD,CACA;AAAA,IAAA,CACD;AAED,WAAO,MAAM;AACQ,0BAAA;AACR;IAAA;AAAA,EACb,GACE,CAAC,WAAW,CAAC;AAEhB,MAAI,mBAAmB,aAAa;AAC5B,WAAA,CAAC,UAAU,WAAW;AAAA,EAC9B;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"useAccessorUpdateSubscription.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useAccessorUpdateSubscription.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\n/**\n * It is VERY IMPORTANT for the parameter to be referentially stable!\n */\nexport const useAccessorUpdateSubscription = <Accessor extends {\n\taddEventListener: (event: { type: 'update' }, cb: (accessor: Accessor) => void) => () => void\n}>(getAccessor: () => Accessor): [Accessor, {update: () => void}] => {\n\tconst [state, setState] = useState<Accessor>(() => getAccessor())\n\tconst getterRef = useRef(getAccessor)\n\n\tlet accessor = state\n\tif (getterRef.current !== getAccessor) {\n\t\taccessor = getAccessor()\n\t\tsetState(accessor)\n\t\tgetterRef.current = getAccessor\n\t}\n\n\tuseEffect(() => {\n\t\tlet isStillSubscribed = true\n\t\tconst unsubscribe = getAccessor().addEventListener({ type: 'update' }, newAccessor => {\n\t\t\tif (!isStillSubscribed || getterRef.current !== getAccessor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetState(newAccessor)\n\t\t})\n\n\t\treturn () => {\n\t\t\tisStillSubscribed = false\n\t\t\tunsubscribe()\n\t\t}\n\t}, [getAccessor])\n\n\tconst update = useCallback(() => {\n\t\tsetState(getAccessor())\n\t}, [getAccessor])\n\n\treturn [accessor, { update }]\n}\n"],"names":["useState","useRef","useEffect","useCallback"],"mappings":";;;AAKa,MAAA,gCAAgC,CAE1C,gBAAkE;AACpE,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAmB,MAAM,aAAa;AAC1D,QAAA,YAAYC,aAAO,WAAW;AAEpC,MAAI,WAAW;AACX,MAAA,UAAU,YAAY,aAAa;AACtC,eAAW,YAAY;AACvB,aAAS,QAAQ;AACjB,cAAU,UAAU;AAAA,EACrB;AAEAC,QAAAA,UAAU,MAAM;AACf,QAAI,oBAAoB;AAClB,UAAA,cAAc,cAAc,iBAAiB,EAAE,MAAM,SAAA,GAAY,CAAe,gBAAA;AACrF,UAAI,CAAC,qBAAqB,UAAU,YAAY,aAAa;AAC5D;AAAA,MACD;AACA,eAAS,WAAW;AAAA,IAAA,CACpB;AAED,WAAO,MAAM;AACQ,0BAAA;AACR;IAAA;AAAA,EACb,GACE,CAAC,WAAW,CAAC;AAEV,QAAA,SAASC,MAAAA,YAAY,MAAM;AAChC,aAAS,aAAa;AAAA,EAAA,GACpB,CAAC,WAAW,CAAC;AAEhB,SAAO,CAAC,UAAU,EAAE,OAAA,CAAQ;AAC7B;;"}
@@ -1,54 +1,31 @@
1
- import { useConstantValueInvariant } from "@contember/react-utils";
2
- import { useState, useCallback, useEffect } from "react";
3
- function useAccessorUpdateSubscription(getAccessor, withForceUpdate) {
4
- const [state, setState] = useState(() => ({
5
- accessor: getAccessor(),
6
- getAccessor
7
- }));
8
- useConstantValueInvariant(withForceUpdate, "useAccessorUpdateSubscription: cannot change the withForceUpdate value!");
9
- let accessor = state.accessor;
10
- if (state.getAccessor !== getAccessor) {
11
- setState({
12
- accessor: getAccessor(),
13
- getAccessor
14
- });
1
+ import { useState, useRef, useEffect, useCallback } from "react";
2
+ const useAccessorUpdateSubscription = (getAccessor) => {
3
+ const [state, setState] = useState(() => getAccessor());
4
+ const getterRef = useRef(getAccessor);
5
+ let accessor = state;
6
+ if (getterRef.current !== getAccessor) {
15
7
  accessor = getAccessor();
16
- }
17
- let forceUpdate = void 0;
18
- if (withForceUpdate) {
19
- forceUpdate = useCallback(() => {
20
- setState({
21
- accessor: getAccessor(),
22
- getAccessor
23
- });
24
- }, [getAccessor]);
8
+ setState(accessor);
9
+ getterRef.current = getAccessor;
25
10
  }
26
11
  useEffect(() => {
27
12
  let isStillSubscribed = true;
28
13
  const unsubscribe = getAccessor().addEventListener({ type: "update" }, (newAccessor) => {
29
- if (!isStillSubscribed) {
14
+ if (!isStillSubscribed || getterRef.current !== getAccessor) {
30
15
  return;
31
16
  }
32
- setState((prevState) => {
33
- if (prevState.getAccessor !== getAccessor || prevState.accessor === newAccessor) {
34
- return prevState;
35
- }
36
- return {
37
- accessor: newAccessor,
38
- getAccessor
39
- };
40
- });
17
+ setState(newAccessor);
41
18
  });
42
19
  return () => {
43
20
  isStillSubscribed = false;
44
21
  unsubscribe();
45
22
  };
46
23
  }, [getAccessor]);
47
- if (withForceUpdate && forceUpdate) {
48
- return [accessor, forceUpdate];
49
- }
50
- return accessor;
51
- }
24
+ const update = useCallback(() => {
25
+ setState(getAccessor());
26
+ }, [getAccessor]);
27
+ return [accessor, { update }];
28
+ };
52
29
  export {
53
30
  useAccessorUpdateSubscription
54
31
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useAccessorUpdateSubscription.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useAccessorUpdateSubscription.ts"],"sourcesContent":["import { useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback, useEffect, useState } from 'react'\nimport type { EntityAccessor, EntityListAccessor, FieldAccessor } from '@contember/binding'\nimport type { FieldValue } from '@contember/binding'\n\nexport type ForceAccessorUpdate = () => void\n\n/**\n * It is VERY IMPORTANT for the parameter to be referentially stable!\n */\nfunction useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(\n\tgetFieldAccessor: () => FieldAccessor<Value>,\n): FieldAccessor<Value>\nfunction useAccessorUpdateSubscription(getEntityAccessor: () => EntityAccessor): EntityAccessor\nfunction useAccessorUpdateSubscription(getListAccessor: () => EntityListAccessor): EntityListAccessor\nfunction useAccessorUpdateSubscription(\n\tgetAccessor: () => EntityListAccessor | EntityAccessor,\n): EntityListAccessor | EntityAccessor\nfunction useAccessorUpdateSubscription<Value extends FieldValue = FieldValue>(\n\tgetFieldAccessor: () => FieldAccessor<Value>,\n\twithForceUpdate: true,\n): [FieldAccessor<Value>, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetEntityAccessor: () => EntityAccessor,\n\twithForceUpdate: true,\n): [EntityAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetListAccessor: () => EntityListAccessor,\n\twithForceUpdate: true,\n): [EntityListAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription(\n\tgetAccessor: () => EntityListAccessor | EntityAccessor,\n\twithForceUpdate: true,\n): [EntityListAccessor | EntityAccessor, ForceAccessorUpdate]\nfunction useAccessorUpdateSubscription<\n\tA extends FieldAccessor<Value> | EntityListAccessor | EntityAccessor,\n\tValue extends FieldValue = FieldValue,\n>(getAccessor: () => A, withForceUpdate?: true): A | [A, ForceAccessorUpdate] {\n\t// This is *HEAVILY* adopted from https://github.com/facebook/react/blob/master/packages/use-subscription/src/useSubscription.js\n\tconst [state, setState] = useState<{\n\t\taccessor: A\n\t\tgetAccessor: () => A\n\t}>(() => ({\n\t\t\t\taccessor: getAccessor(),\n\t\t\t\tgetAccessor,\n\t\t\t}))\n\n\tuseConstantValueInvariant(withForceUpdate, 'useAccessorUpdateSubscription: cannot change the withForceUpdate value!')\n\n\tlet accessor = state.accessor\n\n\tif (state.getAccessor !== getAccessor) {\n\t\tsetState({\n\t\t\taccessor: getAccessor(),\n\t\t\tgetAccessor,\n\t\t})\n\t\taccessor = getAccessor()\n\t}\n\n\tlet forceUpdate: ForceAccessorUpdate | undefined = undefined\n\tif (withForceUpdate) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tforceUpdate = useCallback(() => {\n\t\t\tsetState({\n\t\t\t\taccessor: getAccessor(),\n\t\t\t\tgetAccessor,\n\t\t\t})\n\t\t}, [getAccessor])\n\t}\n\n\tuseEffect(() => {\n\t\tlet isStillSubscribed = true\n\n\t\tconst unsubscribe = (\n\t\t\tgetAccessor().addEventListener as (\n\t\t\t\teventType: { type: 'update' },\n\t\t\t\thandler: (newAccessor: FieldAccessor<Value> | EntityListAccessor | EntityAccessor) => void,\n\t\t\t) => () => void\n\t\t)({ type: 'update' }, newAccessor => {\n\t\t\tif (!isStillSubscribed) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsetState(prevState => {\n\t\t\t\tif (prevState.getAccessor !== getAccessor || prevState.accessor === newAccessor) {\n\t\t\t\t\treturn prevState\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\taccessor: newAccessor as A,\n\t\t\t\t\tgetAccessor,\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\n\t\treturn () => {\n\t\t\tisStillSubscribed = false\n\t\t\tunsubscribe()\n\t\t}\n\t}, [getAccessor])\n\n\tif (withForceUpdate && forceUpdate) {\n\t\treturn [accessor, forceUpdate]\n\t}\n\treturn accessor\n}\nexport { useAccessorUpdateSubscription }\n"],"names":[],"mappings":";;AAkCA,SAAS,8BAGP,aAAsB,iBAAsD;AAE7E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAGvB,OAAO;AAAA,IACP,UAAU,YAAY;AAAA,IACtB;AAAA,EACC,EAAA;AAEJ,4BAA0B,iBAAiB,yEAAyE;AAEpH,MAAI,WAAW,MAAM;AAEjB,MAAA,MAAM,gBAAgB,aAAa;AAC7B,aAAA;AAAA,MACR,UAAU,YAAY;AAAA,MACtB;AAAA,IAAA,CACA;AACD,eAAW,YAAY;AAAA,EACxB;AAEA,MAAI,cAA+C;AACnD,MAAI,iBAAiB;AAEpB,kBAAc,YAAY,MAAM;AACtB,eAAA;AAAA,QACR,UAAU,YAAY;AAAA,QACtB;AAAA,MAAA,CACA;AAAA,IAAA,GACC,CAAC,WAAW,CAAC;AAAA,EACjB;AAEA,YAAU,MAAM;AACf,QAAI,oBAAoB;AAElB,UAAA,cACL,cAAc,iBAIb,EAAE,MAAM,SAAA,GAAY,CAAe,gBAAA;AACpC,UAAI,CAAC,mBAAmB;AACvB;AAAA,MACD;AAEA,eAAS,CAAa,cAAA;AACrB,YAAI,UAAU,gBAAgB,eAAe,UAAU,aAAa,aAAa;AACzE,iBAAA;AAAA,QACR;AAEO,eAAA;AAAA,UACN,UAAU;AAAA,UACV;AAAA,QAAA;AAAA,MACD,CACA;AAAA,IAAA,CACD;AAED,WAAO,MAAM;AACQ,0BAAA;AACR;IAAA;AAAA,EACb,GACE,CAAC,WAAW,CAAC;AAEhB,MAAI,mBAAmB,aAAa;AAC5B,WAAA,CAAC,UAAU,WAAW;AAAA,EAC9B;AACO,SAAA;AACR;"}
1
+ {"version":3,"file":"useAccessorUpdateSubscription.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useAccessorUpdateSubscription.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react'\n\n/**\n * It is VERY IMPORTANT for the parameter to be referentially stable!\n */\nexport const useAccessorUpdateSubscription = <Accessor extends {\n\taddEventListener: (event: { type: 'update' }, cb: (accessor: Accessor) => void) => () => void\n}>(getAccessor: () => Accessor): [Accessor, {update: () => void}] => {\n\tconst [state, setState] = useState<Accessor>(() => getAccessor())\n\tconst getterRef = useRef(getAccessor)\n\n\tlet accessor = state\n\tif (getterRef.current !== getAccessor) {\n\t\taccessor = getAccessor()\n\t\tsetState(accessor)\n\t\tgetterRef.current = getAccessor\n\t}\n\n\tuseEffect(() => {\n\t\tlet isStillSubscribed = true\n\t\tconst unsubscribe = getAccessor().addEventListener({ type: 'update' }, newAccessor => {\n\t\t\tif (!isStillSubscribed || getterRef.current !== getAccessor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetState(newAccessor)\n\t\t})\n\n\t\treturn () => {\n\t\t\tisStillSubscribed = false\n\t\t\tunsubscribe()\n\t\t}\n\t}, [getAccessor])\n\n\tconst update = useCallback(() => {\n\t\tsetState(getAccessor())\n\t}, [getAccessor])\n\n\treturn [accessor, { update }]\n}\n"],"names":[],"mappings":";AAKa,MAAA,gCAAgC,CAE1C,gBAAkE;AACpE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAmB,MAAM,aAAa;AAC1D,QAAA,YAAY,OAAO,WAAW;AAEpC,MAAI,WAAW;AACX,MAAA,UAAU,YAAY,aAAa;AACtC,eAAW,YAAY;AACvB,aAAS,QAAQ;AACjB,cAAU,UAAU;AAAA,EACrB;AAEA,YAAU,MAAM;AACf,QAAI,oBAAoB;AAClB,UAAA,cAAc,cAAc,iBAAiB,EAAE,MAAM,SAAA,GAAY,CAAe,gBAAA;AACrF,UAAI,CAAC,qBAAqB,UAAU,YAAY,aAAa;AAC5D;AAAA,MACD;AACA,eAAS,WAAW;AAAA,IAAA,CACpB;AAED,WAAO,MAAM;AACQ,0BAAA;AACR;IAAA;AAAA,EACb,GACE,CAAC,WAAW,CAAC;AAEV,QAAA,SAAS,YAAY,MAAM;AAChC,aAAS,aAAa;AAAA,EAAA,GACpB,CAAC,WAAW,CAAC;AAEhB,SAAO,CAAC,UAAU,EAAE,OAAA,CAAQ;AAC7B;"}
@@ -13,22 +13,22 @@ function useEntity(...entity) {
13
13
  const getEntityByKey = useGetEntityByKey.useGetEntityByKey();
14
14
  if (entity.length === 0) {
15
15
  const getEntityAccessor = React.useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey]);
16
- return useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntityAccessor);
16
+ return useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntityAccessor)[0];
17
17
  }
18
18
  const sugaredRelativeSingleEntity = entity[0];
19
19
  const relativeSingleEntity = useDesugaredRelativeSingleEntity.useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity);
20
20
  const getEntity = React.useCallback(() => {
21
21
  const parent = getEntityByKey(entityKey);
22
- return parent.getRelativeSingleEntity(relativeSingleEntity);
22
+ return parent.getEntity(relativeSingleEntity);
23
23
  }, [entityKey, getEntityByKey, relativeSingleEntity]);
24
24
  if (relativeSingleEntity) {
25
25
  reactUtils.useConstantLengthInvariant(
26
26
  relativeSingleEntity.hasOneRelationPath,
27
27
  "Cannot change the length of the hasOneRelation path!"
28
28
  );
29
- const [entity2, forceUpdate] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntity, true);
29
+ const [entity2, { update }] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntity);
30
30
  if (relativeSingleEntity.hasOneRelationPath.length) {
31
- useOnConnectionUpdate.useOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate);
31
+ useOnConnectionUpdate.useOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, update);
32
32
  }
33
33
  return entity2;
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useEntity.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeSingleEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entity, forceUpdate] = useAccessorUpdateSubscription(getEntity, true)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":["useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useAccessorUpdateSubscription","useDesugaredRelativeSingleEntity","useConstantLengthInvariant","entity","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAcA,SAAS,aAAa,QAA6F;AACxFA,aAAAA,0BAAA,OAAO,QAAQ,0EAA0E;AAEnH,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AAEnB,MAAA,OAAO,WAAW,GAAG;AAElB,UAAA,oBAAoBC,kBAAY,MAAM,eAAe,SAAS,GAAG,CAAC,WAAW,cAAc,CAAC;AAElG,WAAOC,8BAAAA,8BAA8B,iBAAiB;AAAA,EACvD;AACM,QAAA,8BAA8B,OAAO,CAAC;AAGtC,QAAA,uBAAuBC,kEAAiC,2BAA2B;AAEnF,QAAA,YAAYF,MAAAA,YAAY,MAAM;AAC7B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,wBAAwB,oBAAqB;AAAA,EACzD,GAAA,CAAC,WAAW,gBAAgB,oBAAoB,CAAC;AAEpD,MAAI,sBAAsB;AAEzBG,eAAA;AAAA,MACC,qBAAqB;AAAA,MACrB;AAAA,IAAA;AAGD,UAAM,CAACC,SAAQ,WAAW,IAAIH,8BAAAA,8BAA8B,WAAW,IAAI;AAEvE,QAAA,qBAAqB,mBAAmB,QAAQ;AAEnDI,4BAAA,sBAAsB,qBAAqB,mBAAmB,CAAC,EAAE,OAAO,WAAW;AAAA,IACpF;AAEOD,WAAAA;AAAAA,EACR;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"useEntity.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)[0]\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entity, { update }] = useAccessorUpdateSubscription(getEntity)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":["useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useAccessorUpdateSubscription","useDesugaredRelativeSingleEntity","useConstantLengthInvariant","entity","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAcA,SAAS,aAAa,QAA6F;AACxFA,aAAAA,0BAAA,OAAO,QAAQ,0EAA0E;AAEnH,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AAEnB,MAAA,OAAO,WAAW,GAAG;AAElB,UAAA,oBAAoBC,kBAAY,MAAM,eAAe,SAAS,GAAG,CAAC,WAAW,cAAc,CAAC;AAE3F,WAAAC,4DAA8B,iBAAiB,EAAE,CAAC;AAAA,EAC1D;AACM,QAAA,8BAA8B,OAAO,CAAC;AAGtC,QAAA,uBAAuBC,kEAAiC,2BAA2B;AAEnF,QAAA,YAAYF,MAAAA,YAAY,MAAM;AAC7B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,UAAU,oBAAqB;AAAA,EAC3C,GAAA,CAAC,WAAW,gBAAgB,oBAAoB,CAAC;AAEpD,MAAI,sBAAsB;AAEzBG,eAAA;AAAA,MACC,qBAAqB;AAAA,MACrB;AAAA,IAAA;AAGD,UAAM,CAACC,SAAQ,EAAE,OAAQ,CAAA,IAAIH,8BAAAA,8BAA8B,SAAS;AAEhE,QAAA,qBAAqB,mBAAmB,QAAQ;AAEnDI,4BAAA,sBAAsB,qBAAqB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAC/E;AAEOD,WAAAA;AAAAA,EACR;AACO,SAAA;AACR;;"}
@@ -11,22 +11,22 @@ function useEntity(...entity) {
11
11
  const getEntityByKey = useGetEntityByKey();
12
12
  if (entity.length === 0) {
13
13
  const getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey]);
14
- return useAccessorUpdateSubscription(getEntityAccessor);
14
+ return useAccessorUpdateSubscription(getEntityAccessor)[0];
15
15
  }
16
16
  const sugaredRelativeSingleEntity = entity[0];
17
17
  const relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity);
18
18
  const getEntity = useCallback(() => {
19
19
  const parent = getEntityByKey(entityKey);
20
- return parent.getRelativeSingleEntity(relativeSingleEntity);
20
+ return parent.getEntity(relativeSingleEntity);
21
21
  }, [entityKey, getEntityByKey, relativeSingleEntity]);
22
22
  if (relativeSingleEntity) {
23
23
  useConstantLengthInvariant(
24
24
  relativeSingleEntity.hasOneRelationPath,
25
25
  "Cannot change the length of the hasOneRelation path!"
26
26
  );
27
- const [entity2, forceUpdate] = useAccessorUpdateSubscription(getEntity, true);
27
+ const [entity2, { update }] = useAccessorUpdateSubscription(getEntity);
28
28
  if (relativeSingleEntity.hasOneRelationPath.length) {
29
- useOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate);
29
+ useOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, update);
30
30
  }
31
31
  return entity2;
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useEntity.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeSingleEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entity, forceUpdate] = useAccessorUpdateSubscription(getEntity, true)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":["entity"],"mappings":";;;;;;;AAcA,SAAS,aAAa,QAA6F;AACxF,4BAAA,OAAO,QAAQ,0EAA0E;AAEnH,QAAM,YAAY;AAClB,QAAM,iBAAiB;AAEnB,MAAA,OAAO,WAAW,GAAG;AAElB,UAAA,oBAAoB,YAAY,MAAM,eAAe,SAAS,GAAG,CAAC,WAAW,cAAc,CAAC;AAElG,WAAO,8BAA8B,iBAAiB;AAAA,EACvD;AACM,QAAA,8BAA8B,OAAO,CAAC;AAGtC,QAAA,uBAAuB,iCAAiC,2BAA2B;AAEnF,QAAA,YAAY,YAAY,MAAM;AAC7B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,wBAAwB,oBAAqB;AAAA,EACzD,GAAA,CAAC,WAAW,gBAAgB,oBAAoB,CAAC;AAEpD,MAAI,sBAAsB;AAEzB;AAAA,MACC,qBAAqB;AAAA,MACrB;AAAA,IAAA;AAGD,UAAM,CAACA,SAAQ,WAAW,IAAI,8BAA8B,WAAW,IAAI;AAEvE,QAAA,qBAAqB,mBAAmB,QAAQ;AAEnD,4BAAsB,qBAAqB,mBAAmB,CAAC,EAAE,OAAO,WAAW;AAAA,IACpF;AAEOA,WAAAA;AAAAA,EACR;AACO,SAAA;AACR;"}
1
+ {"version":3,"file":"useEntity.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntity.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeSingleEntity } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeSingleEntity } from './useDesugaredRelativeSingleEntity'\n\nfunction useEntity(): EntityAccessor\nfunction useEntity(sugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity): EntityAccessor\nfunction useEntity(\n\tsugaredRelativeSingleEntity: string | SugaredRelativeSingleEntity | undefined,\n): EntityAccessor | undefined\nfunction useEntity(...entity: [] | [string | SugaredRelativeSingleEntity | undefined]): EntityAccessor | undefined {\n\tuseConstantValueInvariant(entity.length, 'useEntity: cannot alternate between providing and omitting the argument.')\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\n\tif (entity.length === 0) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst getEntityAccessor = useCallback(() => getEntityByKey(entityKey), [entityKey, getEntityByKey])\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\treturn useAccessorUpdateSubscription(getEntityAccessor)[0]\n\t}\n\tconst sugaredRelativeSingleEntity = entity[0]\n\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst relativeSingleEntity = useDesugaredRelativeSingleEntity(sugaredRelativeSingleEntity)\n\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\tconst getEntity = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getEntity(relativeSingleEntity!)\n\t}, [entityKey, getEntityByKey, relativeSingleEntity])\n\n\tif (relativeSingleEntity) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeSingleEntity.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entity, { update }] = useAccessorUpdateSubscription(getEntity)\n\n\t\tif (relativeSingleEntity.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeSingleEntity.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn entity\n\t}\n\treturn undefined\n}\n\nexport { useEntity }\n"],"names":["entity"],"mappings":";;;;;;;AAcA,SAAS,aAAa,QAA6F;AACxF,4BAAA,OAAO,QAAQ,0EAA0E;AAEnH,QAAM,YAAY;AAClB,QAAM,iBAAiB;AAEnB,MAAA,OAAO,WAAW,GAAG;AAElB,UAAA,oBAAoB,YAAY,MAAM,eAAe,SAAS,GAAG,CAAC,WAAW,cAAc,CAAC;AAE3F,WAAA,8BAA8B,iBAAiB,EAAE,CAAC;AAAA,EAC1D;AACM,QAAA,8BAA8B,OAAO,CAAC;AAGtC,QAAA,uBAAuB,iCAAiC,2BAA2B;AAEnF,QAAA,YAAY,YAAY,MAAM;AAC7B,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,UAAU,oBAAqB;AAAA,EAC3C,GAAA,CAAC,WAAW,gBAAgB,oBAAoB,CAAC;AAEpD,MAAI,sBAAsB;AAEzB;AAAA,MACC,qBAAqB;AAAA,MACrB;AAAA,IAAA;AAGD,UAAM,CAACA,SAAQ,EAAE,OAAQ,CAAA,IAAI,8BAA8B,SAAS;AAEhE,QAAA,qBAAqB,mBAAmB,QAAQ;AAEnD,4BAAsB,qBAAqB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAC/E;AAEOA,WAAAA;AAAAA,EACR;AACO,SAAA;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityKey.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":["useContext","EntityKeyContext","BindingError"],"mappings":";;;;;AAIO,MAAM,eAAe,MAAc;AACnC,QAAA,YAAYA,iBAAWC,iBAAAA,gBAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAIC,QAAA;AAAA,MACT;AAAA,IAAA;AAAA,EAGF;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"useEntityKey.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError, EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string | (() => EntityAccessor) => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":["useContext","EntityKeyContext","BindingError"],"mappings":";;;;;AAIO,MAAM,eAAe,MAAuC;AAC5D,QAAA,YAAYA,iBAAWC,iBAAAA,gBAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAIC,QAAA;AAAA,MACT;AAAA,IAAA;AAAA,EAGF;AACO,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityKey.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,MAAc;AACnC,QAAA,YAAY,WAAW,gBAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAAA,EAGF;AACO,SAAA;AACR;"}
1
+ {"version":3,"file":"useEntityKey.js","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityKey.ts"],"sourcesContent":["import { useContext } from 'react'\nimport { BindingError, EntityAccessor } from '@contember/binding'\nimport { EntityKeyContext } from './EntityKeyContext'\n\nexport const useEntityKey = (): string | (() => EntityAccessor) => {\n\tconst entityKey = useContext(EntityKeyContext)\n\n\tif (entityKey === undefined) {\n\t\tthrow new BindingError(\n\t\t\t`Trying to use a data bound component outside a correct parent. You likely forgot to use <DataBindingProvider /> ` +\n\t\t\t\t`or a SubTree.`,\n\t\t)\n\t}\n\treturn entityKey\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,eAAe,MAAuC;AAC5D,QAAA,YAAY,WAAW,gBAAgB;AAE7C,MAAI,cAAc,QAAW;AAC5B,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAAA,EAGF;AACO,SAAA;AACR;"}
@@ -17,16 +17,16 @@ function useEntityList(sugaredRelativeEntityList) {
17
17
  const getEntityByKey = useGetEntityByKey.useGetEntityByKey();
18
18
  const getEntityList = React.useCallback(() => {
19
19
  const parent = getEntityByKey(entityKey);
20
- return parent.getRelativeEntityList(relativeEntityList);
20
+ return parent.getEntityList(relativeEntityList);
21
21
  }, [entityKey, getEntityByKey, relativeEntityList]);
22
22
  if (relativeEntityList) {
23
23
  reactUtils.useConstantLengthInvariant(
24
24
  relativeEntityList.hasOneRelationPath,
25
25
  "Cannot change the length of the hasOneRelation path!"
26
26
  );
27
- const [entityList, forceUpdate] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntityList, true);
27
+ const [entityList, { update }] = useAccessorUpdateSubscription.useAccessorUpdateSubscription(getEntityList);
28
28
  if (relativeEntityList.hasOneRelationPath.length) {
29
- useOnConnectionUpdate.useOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, forceUpdate);
29
+ useOnConnectionUpdate.useOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, update);
30
30
  }
31
31
  return entityList;
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useEntityList.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityList.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeEntityList } from './useDesugaredRelativeEntityList'\n\nfunction useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined {\n\tconst relativeEntityList = useDesugaredRelativeEntityList(sugaredRelativeEntityList)\n\tuseConstantValueInvariant(\n\t\t!!relativeEntityList,\n\t\t'useEntityList: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getEntityList = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getRelativeEntityList(relativeEntityList!)\n\t}, [entityKey, getEntityByKey, relativeEntityList])\n\n\tif (relativeEntityList) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeEntityList.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entityList, forceUpdate] = useAccessorUpdateSubscription(getEntityList, true)\n\n\t\tif (relativeEntityList.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, forceUpdate)\n\t\t}\n\n\t\treturn entityList\n\t}\n\treturn undefined\n}\n\nexport { useEntityList }\n"],"names":["useDesugaredRelativeEntityList","useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useConstantLengthInvariant","useAccessorUpdateSubscription","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAaA,SAAS,cACR,2BACiC;AAC3B,QAAA,qBAAqBA,8DAA+B,yBAAyB;AACnFC,aAAA;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AACjB,QAAA,gBAAgBC,MAAAA,YAAY,MAAM;AACjC,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,sBAAsB,kBAAmB;AAAA,EACrD,GAAA,CAAC,WAAW,gBAAgB,kBAAkB,CAAC;AAElD,MAAI,oBAAoB;AAEvBC,eAAA;AAAA,MACC,mBAAmB;AAAA,MACnB;AAAA,IAAA;AAGD,UAAM,CAAC,YAAY,WAAW,IAAIC,8BAAAA,8BAA8B,eAAe,IAAI;AAE/E,QAAA,mBAAmB,mBAAmB,QAAQ;AAEjDC,4BAAA,sBAAsB,mBAAmB,mBAAmB,CAAC,EAAE,OAAO,WAAW;AAAA,IAClF;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"useEntityList.cjs","sources":["../../../../../packages/react-binding/src/accessorPropagation/useEntityList.ts"],"sourcesContent":["import { useConstantLengthInvariant, useConstantValueInvariant } from '@contember/react-utils'\nimport { useCallback } from 'react'\nimport { useEntityKey, useGetEntityByKey } from './index'\nimport type { EntityListAccessor } from '@contember/binding'\nimport { useOnConnectionUpdate } from '../entityEvents'\nimport type { SugaredRelativeEntityList } from '@contember/binding'\nimport { useAccessorUpdateSubscription } from './useAccessorUpdateSubscription'\nimport { useDesugaredRelativeEntityList } from './useDesugaredRelativeEntityList'\n\nfunction useEntityList(sugaredRelativeEntityList: string | SugaredRelativeEntityList): EntityListAccessor\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined\nfunction useEntityList(\n\tsugaredRelativeEntityList: string | SugaredRelativeEntityList | undefined,\n): EntityListAccessor | undefined {\n\tconst relativeEntityList = useDesugaredRelativeEntityList(sugaredRelativeEntityList)\n\tuseConstantValueInvariant(\n\t\t!!relativeEntityList,\n\t\t'useEntityList: cannot alternate between providing and omitting the argument.',\n\t)\n\n\tconst entityKey = useEntityKey()\n\tconst getEntityByKey = useGetEntityByKey()\n\tconst getEntityList = useCallback(() => {\n\t\tconst parent = getEntityByKey(entityKey)\n\t\treturn parent.getEntityList(relativeEntityList!)\n\t}, [entityKey, getEntityByKey, relativeEntityList])\n\n\tif (relativeEntityList) {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tuseConstantLengthInvariant(\n\t\t\trelativeEntityList.hasOneRelationPath,\n\t\t\t'Cannot change the length of the hasOneRelation path!',\n\t\t)\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst [entityList, { update }] = useAccessorUpdateSubscription(getEntityList)\n\n\t\tif (relativeEntityList.hasOneRelationPath.length) {\n\t\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\t\tuseOnConnectionUpdate(relativeEntityList.hasOneRelationPath[0].field, update)\n\t\t}\n\n\t\treturn entityList\n\t}\n\treturn undefined\n}\n\nexport { useEntityList }\n"],"names":["useDesugaredRelativeEntityList","useConstantValueInvariant","useEntityKey","useGetEntityByKey","useCallback","useConstantLengthInvariant","useAccessorUpdateSubscription","useOnConnectionUpdate"],"mappings":";;;;;;;;;AAaA,SAAS,cACR,2BACiC;AAC3B,QAAA,qBAAqBA,8DAA+B,yBAAyB;AACnFC,aAAA;AAAA,IACC,CAAC,CAAC;AAAA,IACF;AAAA,EAAA;AAGD,QAAM,YAAYC,aAAAA;AAClB,QAAM,iBAAiBC,kBAAAA;AACjB,QAAA,gBAAgBC,MAAAA,YAAY,MAAM;AACjC,UAAA,SAAS,eAAe,SAAS;AAChC,WAAA,OAAO,cAAc,kBAAmB;AAAA,EAC7C,GAAA,CAAC,WAAW,gBAAgB,kBAAkB,CAAC;AAElD,MAAI,oBAAoB;AAEvBC,eAAA;AAAA,MACC,mBAAmB;AAAA,MACnB;AAAA,IAAA;AAGD,UAAM,CAAC,YAAY,EAAE,OAAQ,CAAA,IAAIC,8BAAAA,8BAA8B,aAAa;AAExE,QAAA,mBAAmB,mBAAmB,QAAQ;AAEjDC,4BAAA,sBAAsB,mBAAmB,mBAAmB,CAAC,EAAE,OAAO,MAAM;AAAA,IAC7E;AAEO,WAAA;AAAA,EACR;AACO,SAAA;AACR;;"}