cx 23.4.2 → 23.4.3

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 (811) hide show
  1. package/LICENSE-THIRD-PARTY.md +91 -91
  2. package/LICENSE.md +7 -7
  3. package/README.md +46 -46
  4. package/index.js +17 -17
  5. package/locale/de-de.js +69 -69
  6. package/locale/en-us.js +71 -71
  7. package/locale/es-es.js +69 -69
  8. package/locale/fr-fr.js +70 -70
  9. package/locale/nl-nl.js +75 -75
  10. package/locale/pt-pt.js +63 -63
  11. package/locale/sr-latn-ba.js +70 -70
  12. package/package.json +32 -30
  13. package/src/charts/Bar.d.ts +27 -27
  14. package/src/charts/Bar.js +89 -89
  15. package/src/charts/Bar.scss +26 -26
  16. package/src/charts/BarGraph.d.ts +16 -16
  17. package/src/charts/BarGraph.js +110 -110
  18. package/src/charts/BarGraph.scss +27 -27
  19. package/src/charts/BubbleGraph.js +92 -92
  20. package/src/charts/BubbleGraph.scss +29 -29
  21. package/src/charts/Chart.d.ts +12 -12
  22. package/src/charts/Chart.js +77 -77
  23. package/src/charts/ColorMap.d.ts +21 -21
  24. package/src/charts/ColorMap.js +98 -98
  25. package/src/charts/Column.d.ts +27 -27
  26. package/src/charts/Column.js +88 -88
  27. package/src/charts/Column.scss +26 -26
  28. package/src/charts/ColumnBarBase.d.ts +61 -61
  29. package/src/charts/ColumnBarBase.js +169 -169
  30. package/src/charts/ColumnBarGraphBase.d.ts +71 -71
  31. package/src/charts/ColumnBarGraphBase.js +119 -119
  32. package/src/charts/ColumnGraph.d.ts +19 -19
  33. package/src/charts/ColumnGraph.js +114 -114
  34. package/src/charts/ColumnGraph.scss +27 -27
  35. package/src/charts/Grid.js +5 -5
  36. package/src/charts/Gridlines.d.ts +24 -24
  37. package/src/charts/Gridlines.js +48 -48
  38. package/src/charts/Gridlines.scss +22 -22
  39. package/src/charts/Legend.d.ts +26 -26
  40. package/src/charts/Legend.js +142 -142
  41. package/src/charts/Legend.scss +41 -41
  42. package/src/charts/LegendEntry.d.ts +37 -37
  43. package/src/charts/LegendEntry.js +117 -117
  44. package/src/charts/LegendEntry.scss +30 -30
  45. package/src/charts/LineGraph.d.ts +92 -92
  46. package/src/charts/LineGraph.js +211 -211
  47. package/src/charts/LineGraph.scss +23 -23
  48. package/src/charts/Marker.d.ts +87 -87
  49. package/src/charts/Marker.js +287 -287
  50. package/src/charts/Marker.scss +41 -41
  51. package/src/charts/MarkerLine.d.ts +57 -57
  52. package/src/charts/MarkerLine.js +128 -128
  53. package/src/charts/MarkerLine.scss +17 -17
  54. package/src/charts/MouseTracker.d.ts +16 -16
  55. package/src/charts/MouseTracker.js +80 -80
  56. package/src/charts/Pie.js +8 -8
  57. package/src/charts/PieChart.d.ts +80 -80
  58. package/src/charts/PieChart.js +370 -370
  59. package/src/charts/PieChart.scss +26 -26
  60. package/src/charts/PieLabel.d.ts +26 -26
  61. package/src/charts/PieLabel.js +65 -65
  62. package/src/charts/PieLabelsContainer.d.ts +3 -3
  63. package/src/charts/PieLabelsContainer.js +55 -55
  64. package/src/charts/Range.d.ts +74 -74
  65. package/src/charts/Range.js +205 -205
  66. package/src/charts/Range.scss +18 -18
  67. package/src/charts/ScatterGraph.d.ts +65 -65
  68. package/src/charts/ScatterGraph.js +155 -155
  69. package/src/charts/ScatterGraph.scss +21 -21
  70. package/src/charts/axis/Axis.d.ts +82 -82
  71. package/src/charts/axis/Axis.js +222 -222
  72. package/src/charts/axis/Axis.scss +22 -22
  73. package/src/charts/axis/CategoryAxis.d.ts +21 -21
  74. package/src/charts/axis/CategoryAxis.js +224 -224
  75. package/src/charts/axis/CategoryAxis.scss +32 -32
  76. package/src/charts/axis/NumericAxis.d.ts +46 -46
  77. package/src/charts/axis/NumericAxis.js +347 -347
  78. package/src/charts/axis/NumericAxis.scss +32 -32
  79. package/src/charts/axis/Stack.d.ts +10 -10
  80. package/src/charts/axis/Stack.js +58 -58
  81. package/src/charts/axis/TimeAxis.d.ts +23 -23
  82. package/src/charts/axis/TimeAxis.js +510 -510
  83. package/src/charts/axis/TimeAxis.scss +32 -32
  84. package/src/charts/axis/index.d.ts +3 -3
  85. package/src/charts/axis/index.js +3 -3
  86. package/src/charts/axis/index.scss +5 -5
  87. package/src/charts/axis/variables.scss +2 -2
  88. package/src/charts/helpers/MinMaxFinder.d.ts +22 -22
  89. package/src/charts/helpers/MinMaxFinder.js +36 -36
  90. package/src/charts/helpers/PointReducer.d.ts +15 -15
  91. package/src/charts/helpers/PointReducer.js +39 -39
  92. package/src/charts/helpers/SnapPointFinder.d.ts +24 -24
  93. package/src/charts/helpers/SnapPointFinder.js +46 -46
  94. package/src/charts/helpers/ValueAtFinder.d.ts +16 -16
  95. package/src/charts/helpers/ValueAtFinder.js +41 -41
  96. package/src/charts/helpers/index.d.ts +4 -4
  97. package/src/charts/helpers/index.js +4 -4
  98. package/src/charts/index.d.ts +23 -23
  99. package/src/charts/index.js +31 -31
  100. package/src/charts/index.scss +20 -20
  101. package/src/charts/palette.scss +95 -95
  102. package/src/charts/shapes.d.ts +22 -22
  103. package/src/charts/shapes.js +79 -79
  104. package/src/charts/variables.scss +14 -14
  105. package/src/core.d.ts +270 -270
  106. package/src/data/AggregateFunction.d.ts +17 -17
  107. package/src/data/AggregateFunction.js +148 -148
  108. package/src/data/ArrayElementView.d.ts +13 -13
  109. package/src/data/ArrayElementView.js +46 -46
  110. package/src/data/ArrayElementView.spec.js +70 -70
  111. package/src/data/ArrayRef.d.ts +14 -14
  112. package/src/data/ArrayRef.js +34 -34
  113. package/src/data/AugmentedViewBase.d.ts +18 -18
  114. package/src/data/AugmentedViewBase.js +67 -67
  115. package/src/data/Binding.d.ts +17 -17
  116. package/src/data/Binding.js +86 -76
  117. package/src/data/Binding.spec.js +51 -61
  118. package/src/data/ExposedRecordView.d.ts +14 -14
  119. package/src/data/ExposedRecordView.js +69 -69
  120. package/src/data/ExposedValueView.d.ts +19 -19
  121. package/src/data/ExposedValueView.js +72 -72
  122. package/src/data/Expression.d.ts +16 -16
  123. package/src/data/Expression.js +211 -211
  124. package/src/data/Expression.spec.js +164 -164
  125. package/src/data/Grouper.d.ts +21 -21
  126. package/src/data/Grouper.js +120 -120
  127. package/src/data/Grouper.spec.js +22 -22
  128. package/src/data/NestedDataView.d.ts +19 -19
  129. package/src/data/NestedDataView.js +22 -22
  130. package/src/data/ReadOnlyDataView.d.ts +14 -14
  131. package/src/data/ReadOnlyDataView.js +26 -26
  132. package/src/data/Ref.d.ts +24 -24
  133. package/src/data/Ref.js +79 -79
  134. package/src/data/Ref.spec.js +79 -79
  135. package/src/data/Store.d.ts +14 -14
  136. package/src/data/Store.js +46 -46
  137. package/src/data/Store.spec.js +22 -22
  138. package/src/data/StoreProxy.d.ts +4 -4
  139. package/src/data/StoreProxy.js +16 -16
  140. package/src/data/StoreRef.js +54 -54
  141. package/src/data/StoreRef.spec.js +24 -24
  142. package/src/data/StringTemplate.d.ts +13 -13
  143. package/src/data/StringTemplate.js +85 -85
  144. package/src/data/StringTemplate.spec.js +95 -95
  145. package/src/data/StructuredDataAccessor.d.ts +7 -7
  146. package/src/data/StructuredSelector.d.ts +17 -17
  147. package/src/data/StructuredSelector.js +131 -131
  148. package/src/data/StructuredSelector.spec.js +113 -113
  149. package/src/data/SubscribableView.d.ts +11 -11
  150. package/src/data/SubscribableView.js +54 -54
  151. package/src/data/View.d.ts +131 -131
  152. package/src/data/View.js +182 -182
  153. package/src/data/View.spec.js +60 -60
  154. package/src/data/ZoomIntoPropertyView.d.ts +11 -11
  155. package/src/data/ZoomIntoPropertyView.js +33 -33
  156. package/src/data/ZoomIntoPropertyView.spec.js +65 -65
  157. package/src/data/comparer.d.ts +7 -7
  158. package/src/data/comparer.js +54 -54
  159. package/src/data/comparer.spec.js +60 -60
  160. package/src/data/computable.d.ts +125 -125
  161. package/src/data/computable.js +56 -56
  162. package/src/data/computable.spec.js +55 -55
  163. package/src/data/createAccessorModelProxy.d.ts +6 -6
  164. package/src/data/createAccessorModelProxy.js +43 -43
  165. package/src/data/createAccessorModelProxy.spec.tsx +38 -44
  166. package/src/data/createStructuredSelector.d.ts +2 -2
  167. package/src/data/createStructuredSelector.js +43 -43
  168. package/src/data/createStructuredSelector.spec.js +46 -46
  169. package/src/data/defaultCompare.js +14 -14
  170. package/src/data/diff/diffArrays.d.ts +15 -15
  171. package/src/data/diff/diffArrays.js +41 -41
  172. package/src/data/diff/diffs.spec.js +49 -49
  173. package/src/data/diff/index.d.ts +1 -1
  174. package/src/data/diff/index.js +1 -1
  175. package/src/data/enableFatArrowExpansion.d.ts +1 -1
  176. package/src/data/enableFatArrowExpansion.js +6 -6
  177. package/src/data/getAccessor.d.ts +8 -8
  178. package/src/data/getAccessor.js +61 -61
  179. package/src/data/getSelector.d.ts +3 -3
  180. package/src/data/getSelector.js +48 -48
  181. package/src/data/getSelector.spec.js +43 -43
  182. package/src/data/index.d.ts +30 -30
  183. package/src/data/index.js +28 -28
  184. package/src/data/isSelector.d.ts +1 -1
  185. package/src/data/isSelector.js +26 -26
  186. package/src/data/ops/append.d.ts +1 -1
  187. package/src/data/ops/append.js +7 -7
  188. package/src/data/ops/append.spec.js +28 -28
  189. package/src/data/ops/filter.d.ts +1 -1
  190. package/src/data/ops/filter.js +8 -8
  191. package/src/data/ops/filter.spec.js +29 -29
  192. package/src/data/ops/findTreeNode.d.ts +1 -1
  193. package/src/data/ops/findTreeNode.js +15 -15
  194. package/src/data/ops/findTreeNode.spec.js +24 -24
  195. package/src/data/ops/findTreePath.d.ts +6 -6
  196. package/src/data/ops/findTreePath.js +16 -16
  197. package/src/data/ops/index.d.ts +10 -10
  198. package/src/data/ops/index.js +11 -11
  199. package/src/data/ops/insertElement.d.ts +1 -1
  200. package/src/data/ops/insertElement.js +2 -2
  201. package/src/data/ops/merge.d.ts +3 -3
  202. package/src/data/ops/merge.js +9 -9
  203. package/src/data/ops/merge.spec.js +27 -27
  204. package/src/data/ops/moveElement.d.ts +1 -1
  205. package/src/data/ops/moveElement.js +13 -13
  206. package/src/data/ops/removeTreeNodes.d.ts +5 -5
  207. package/src/data/ops/removeTreeNodes.js +5 -5
  208. package/src/data/ops/removeTreeNodes.spec.js +28 -28
  209. package/src/data/ops/updateArray.d.ts +5 -5
  210. package/src/data/ops/updateArray.js +24 -24
  211. package/src/data/ops/updateArray.spec.js +38 -38
  212. package/src/data/ops/updateTree.d.ts +7 -7
  213. package/src/data/ops/updateTree.js +25 -25
  214. package/src/data/ops/updateTree.spec.js +34 -34
  215. package/src/global.scss +13 -13
  216. package/src/hooks/createLocalStorageRef.d.ts +2 -2
  217. package/src/hooks/createLocalStorageRef.js +22 -22
  218. package/src/hooks/index.d.ts +8 -8
  219. package/src/hooks/index.js +7 -7
  220. package/src/hooks/invokeCallback.d.ts +5 -5
  221. package/src/hooks/invokeCallback.js +6 -6
  222. package/src/hooks/invokeCallback.spec.js +53 -53
  223. package/src/hooks/resolveCallback.d.ts +3 -3
  224. package/src/hooks/resolveCallback.js +11 -11
  225. package/src/hooks/resolveCallback.spec.js +54 -54
  226. package/src/hooks/store.d.ts +7 -7
  227. package/src/hooks/store.js +32 -32
  228. package/src/hooks/store.spec.js +73 -73
  229. package/src/hooks/useEffect.d.ts +2 -2
  230. package/src/hooks/useEffect.js +14 -14
  231. package/src/hooks/useInterval.js +7 -7
  232. package/src/hooks/useState.d.ts +2 -2
  233. package/src/hooks/useState.js +15 -15
  234. package/src/hooks/useTrigger.d.ts +4 -4
  235. package/src/hooks/useTrigger.js +20 -20
  236. package/src/hooks/useTrigger.spec.js +102 -102
  237. package/src/index.js +7 -7
  238. package/src/index.scss +6 -6
  239. package/src/svg/BoundedObject.d.ts +22 -22
  240. package/src/svg/BoundedObject.js +59 -59
  241. package/src/svg/ClipRect.d.ts +4 -4
  242. package/src/svg/ClipRect.js +23 -23
  243. package/src/svg/Ellipse.d.ts +23 -23
  244. package/src/svg/Ellipse.js +36 -36
  245. package/src/svg/Line.d.ts +20 -20
  246. package/src/svg/Line.js +32 -32
  247. package/src/svg/NonOverlappingRect.d.ts +5 -5
  248. package/src/svg/NonOverlappingRect.js +14 -14
  249. package/src/svg/NonOverlappingRectGroup.d.ts +3 -3
  250. package/src/svg/NonOverlappingRectGroup.js +36 -36
  251. package/src/svg/Rectangle.d.ts +23 -23
  252. package/src/svg/Rectangle.js +36 -36
  253. package/src/svg/Svg.d.ts +32 -32
  254. package/src/svg/Svg.js +177 -177
  255. package/src/svg/Svg.scss +26 -26
  256. package/src/svg/Text.d.ts +38 -38
  257. package/src/svg/Text.js +61 -61
  258. package/src/svg/TextualBoundedObject.d.ts +6 -6
  259. package/src/svg/TextualBoundedObject.js +28 -28
  260. package/src/svg/index.d.ts +11 -11
  261. package/src/svg/index.js +17 -17
  262. package/src/svg/index.scss +8 -8
  263. package/src/svg/util/Rect.d.ts +40 -40
  264. package/src/svg/util/Rect.js +108 -108
  265. package/src/ui/CSS.d.ts +19 -19
  266. package/src/ui/CSS.js +79 -79
  267. package/src/ui/CSSHelper.d.ts +10 -10
  268. package/src/ui/CSSHelper.js +17 -17
  269. package/src/ui/Container.d.ts +18 -18
  270. package/src/ui/Container.js +183 -183
  271. package/src/ui/ContentResolver.d.ts +12 -12
  272. package/src/ui/ContentResolver.js +78 -78
  273. package/src/ui/Controller.d.ts +180 -180
  274. package/src/ui/Controller.js +114 -114
  275. package/src/ui/Controller.spec.js +414 -414
  276. package/src/ui/Culture.d.ts +22 -22
  277. package/src/ui/Culture.js +65 -65
  278. package/src/ui/Cx.d.ts +18 -18
  279. package/src/ui/Cx.js +313 -313
  280. package/src/ui/Cx.spec.js +193 -193
  281. package/src/ui/DataProxy.d.ts +11 -11
  282. package/src/ui/DataProxy.js +44 -44
  283. package/src/ui/DataProxy.spec.js +335 -335
  284. package/src/ui/DetachedScope.d.ts +21 -21
  285. package/src/ui/DetachedScope.js +93 -93
  286. package/src/ui/FocusManager.d.ts +29 -29
  287. package/src/ui/FocusManager.js +171 -171
  288. package/src/ui/Format.d.ts +2 -2
  289. package/src/ui/Format.js +89 -89
  290. package/src/ui/HoverSync.d.ts +13 -13
  291. package/src/ui/HoverSync.js +147 -147
  292. package/src/ui/Instance.d.ts +69 -69
  293. package/src/ui/Instance.js +610 -610
  294. package/src/ui/IsolatedScope.d.ts +16 -16
  295. package/src/ui/IsolatedScope.js +29 -29
  296. package/src/ui/IsolatedScope.spec.js +62 -62
  297. package/src/ui/Localization.d.ts +17 -17
  298. package/src/ui/Localization.js +72 -72
  299. package/src/ui/PureContainer.d.ts +16 -16
  300. package/src/ui/PureContainer.js +7 -7
  301. package/src/ui/RenderingContext.d.ts +9 -9
  302. package/src/ui/RenderingContext.js +88 -88
  303. package/src/ui/Repeater.d.ts +52 -52
  304. package/src/ui/Repeater.js +98 -98
  305. package/src/ui/Repeater.spec.js +143 -143
  306. package/src/ui/Rescope.d.ts +10 -10
  307. package/src/ui/Rescope.js +31 -31
  308. package/src/ui/Rescope.spec.js +195 -195
  309. package/src/ui/ResizeManager.d.ts +9 -9
  310. package/src/ui/ResizeManager.js +30 -30
  311. package/src/ui/Restate.d.ts +15 -15
  312. package/src/ui/Restate.js +4 -1
  313. package/src/ui/Restate.spec.js +422 -422
  314. package/src/ui/StaticText.d.ts +8 -8
  315. package/src/ui/StaticText.js +9 -9
  316. package/src/ui/StructuredInstanceDataAccessor.d.ts +16 -16
  317. package/src/ui/StructuredInstanceDataAccessor.js +26 -26
  318. package/src/ui/Text.d.ts +10 -10
  319. package/src/ui/Text.js +27 -27
  320. package/src/ui/VDOM.d.ts +3 -3
  321. package/src/ui/VDOM.js +2 -2
  322. package/src/ui/Widget.d.ts +14 -14
  323. package/src/ui/Widget.js +200 -200
  324. package/src/ui/ZIndexManager.d.ts +7 -7
  325. package/src/ui/ZIndexManager.js +11 -11
  326. package/src/ui/adapter/ArrayAdapter.d.ts +17 -17
  327. package/src/ui/adapter/ArrayAdapter.js +142 -142
  328. package/src/ui/adapter/ArrayAdapter.spec.js +55 -55
  329. package/src/ui/adapter/DataAdapter.d.ts +28 -28
  330. package/src/ui/adapter/DataAdapter.js +19 -19
  331. package/src/ui/adapter/GroupAdapter.d.ts +4 -4
  332. package/src/ui/adapter/GroupAdapter.js +138 -138
  333. package/src/ui/adapter/TreeAdapter.d.ts +4 -4
  334. package/src/ui/adapter/TreeAdapter.js +100 -100
  335. package/src/ui/adapter/TreeAdapter.spec.js +67 -67
  336. package/src/ui/adapter/index.d.ts +4 -4
  337. package/src/ui/adapter/index.js +4 -4
  338. package/src/ui/app/History.d.ts +17 -17
  339. package/src/ui/app/History.js +114 -114
  340. package/src/ui/app/Url.d.ts +21 -21
  341. package/src/ui/app/Url.js +103 -103
  342. package/src/ui/app/Url.spec.js +51 -51
  343. package/src/ui/app/index.d.ts +4 -4
  344. package/src/ui/app/index.js +5 -5
  345. package/src/ui/app/startAppLoop.d.ts +3 -3
  346. package/src/ui/app/startAppLoop.js +57 -57
  347. package/src/ui/app/startHotAppLoop.d.ts +6 -6
  348. package/src/ui/app/startHotAppLoop.js +25 -25
  349. package/src/ui/batchUpdates.d.ts +10 -10
  350. package/src/ui/batchUpdates.js +67 -67
  351. package/src/ui/bind.d.ts +4 -4
  352. package/src/ui/bind.js +7 -7
  353. package/src/ui/createFunctionalComponent.d.ts +1 -1
  354. package/src/ui/createFunctionalComponent.js +68 -68
  355. package/src/ui/createFunctionalComponent.spec.js +400 -400
  356. package/src/ui/expr.d.ts +24 -24
  357. package/src/ui/expr.js +17 -17
  358. package/src/ui/flattenProps.js +21 -21
  359. package/src/ui/index.d.ts +42 -42
  360. package/src/ui/index.js +44 -44
  361. package/src/ui/index.scss +2 -2
  362. package/src/ui/keyboardShortcuts.d.ts +4 -4
  363. package/src/ui/keyboardShortcuts.js +32 -32
  364. package/src/ui/layout/Content.d.ts +14 -14
  365. package/src/ui/layout/Content.js +16 -16
  366. package/src/ui/layout/ContentPlaceholder.d.ts +17 -17
  367. package/src/ui/layout/ContentPlaceholder.js +79 -79
  368. package/src/ui/layout/ContentPlaceholder.spec.js +368 -368
  369. package/src/ui/layout/FirstVisibleChildLayout.d.ts +4 -4
  370. package/src/ui/layout/FirstVisibleChildLayout.js +65 -65
  371. package/src/ui/layout/FirstVisibleChildLayout.spec.js +196 -196
  372. package/src/ui/layout/LabelsLeftLayout.d.ts +11 -11
  373. package/src/ui/layout/LabelsLeftLayout.js +59 -59
  374. package/src/ui/layout/LabelsLeftLayout.scss +44 -44
  375. package/src/ui/layout/LabelsTopLayout.d.ts +15 -15
  376. package/src/ui/layout/LabelsTopLayout.js +134 -134
  377. package/src/ui/layout/LabelsTopLayout.scss +63 -63
  378. package/src/ui/layout/UseParentLayout.d.ts +4 -4
  379. package/src/ui/layout/UseParentLayout.js +6 -6
  380. package/src/ui/layout/exploreChildren.d.ts +14 -14
  381. package/src/ui/layout/exploreChildren.js +40 -40
  382. package/src/ui/layout/index.d.ts +10 -10
  383. package/src/ui/layout/index.js +10 -10
  384. package/src/ui/layout/index.scss +3 -3
  385. package/src/ui/layout/variables.scss +2 -2
  386. package/src/ui/selection/KeySelection.d.ts +17 -17
  387. package/src/ui/selection/KeySelection.js +129 -129
  388. package/src/ui/selection/PropertySelection.d.ts +17 -17
  389. package/src/ui/selection/PropertySelection.js +57 -57
  390. package/src/ui/selection/Selection.d.ts +27 -27
  391. package/src/ui/selection/Selection.js +93 -93
  392. package/src/ui/selection/index.d.ts +3 -3
  393. package/src/ui/selection/index.js +3 -3
  394. package/src/ui/tpl.d.ts +2 -2
  395. package/src/ui/tpl.js +4 -4
  396. package/src/ui/variables.scss +1 -1
  397. package/src/util/Component.d.ts +41 -41
  398. package/src/util/Component.js +107 -107
  399. package/src/util/Console.d.ts +9 -9
  400. package/src/util/Console.js +11 -11
  401. package/src/util/DOM.d.ts +33 -33
  402. package/src/util/DOM.js +72 -72
  403. package/src/util/Debug.d.ts +10 -10
  404. package/src/util/Debug.js +45 -45
  405. package/src/util/Format.d.ts +13 -13
  406. package/src/util/Format.js +241 -241
  407. package/src/util/Format.spec.js +69 -69
  408. package/src/util/GlobalCacheIdentifier.js +11 -11
  409. package/src/util/GlobalCacheldentifier.d.ts +6 -6
  410. package/src/util/KeyCode.d.ts +21 -21
  411. package/src/util/KeyCode.js +21 -21
  412. package/src/util/SubscriberList.d.ts +41 -41
  413. package/src/util/SubscriberList.js +57 -57
  414. package/src/util/Timing.d.ts +13 -13
  415. package/src/util/Timing.js +57 -57
  416. package/src/util/TraversalStack.js +42 -42
  417. package/src/util/TraversalStack.spec.js +46 -46
  418. package/src/util/addEventListenerWithOptions.d.ts +6 -6
  419. package/src/util/addEventListenerWithOptions.js +9 -9
  420. package/src/util/browserSupportsPassiveEventHandlers.d.ts +4 -4
  421. package/src/util/browserSupportsPassiveEventHandlers.js +18 -18
  422. package/src/util/calculateNaturalElementHeight.d.ts +1 -1
  423. package/src/util/calculateNaturalElementHeight.js +22 -22
  424. package/src/util/call-once.scss +6 -6
  425. package/src/util/coalesce.d.ts +1 -1
  426. package/src/util/coalesce.js +6 -6
  427. package/src/util/color/hslToRgb.d.ts +8 -8
  428. package/src/util/color/hslToRgb.js +27 -27
  429. package/src/util/color/index.d.ts +3 -3
  430. package/src/util/color/index.js +4 -4
  431. package/src/util/color/parseColor.d.ts +59 -59
  432. package/src/util/color/parseColor.js +119 -119
  433. package/src/util/color/rgbToHex.d.ts +8 -8
  434. package/src/util/color/rgbToHex.js +7 -7
  435. package/src/util/color/rgbToHsl.d.ts +8 -8
  436. package/src/util/color/rgbToHsl.js +27 -27
  437. package/src/util/date/dateDiff.d.ts +7 -7
  438. package/src/util/date/dateDiff.js +3 -3
  439. package/src/util/date/diff.d.ts +7 -7
  440. package/src/util/date/diff.js +7 -7
  441. package/src/util/date/encodeDateWithTimezoneOffset.js +18 -18
  442. package/src/util/date/index.d.ts +8 -8
  443. package/src/util/date/index.js +9 -9
  444. package/src/util/date/lowerBoundCheck.d.ts +7 -7
  445. package/src/util/date/lowerBoundCheck.js +6 -6
  446. package/src/util/date/maxDate.d.ts +5 -5
  447. package/src/util/date/maxDate.js +9 -9
  448. package/src/util/date/minDate.d.ts +5 -5
  449. package/src/util/date/minDate.js +9 -9
  450. package/src/util/date/monthStart.d.ts +5 -5
  451. package/src/util/date/monthStart.js +3 -3
  452. package/src/util/date/sameDate.d.ts +6 -6
  453. package/src/util/date/sameDate.js +5 -5
  454. package/src/util/date/upperBoundCheck.d.ts +7 -7
  455. package/src/util/date/upperBoundCheck.js +6 -6
  456. package/src/util/date/upperBoundCheck.spec.js +30 -30
  457. package/src/util/date/zeroTime.d.ts +6 -6
  458. package/src/util/date/zeroTime.js +3 -3
  459. package/src/util/debounce.d.ts +9 -9
  460. package/src/util/debounce.js +18 -18
  461. package/src/util/dummyCallback.d.ts +1 -1
  462. package/src/util/dummyCallback.js +1 -1
  463. package/src/util/escapeSpecialRegexCharacters.d.ts +6 -6
  464. package/src/util/escapeSpecialRegexCharacters.js +3 -3
  465. package/src/util/eventCallbacks.d.ts +4 -4
  466. package/src/util/eventCallbacks.js +2 -2
  467. package/src/util/expandFatArrows.js +118 -118
  468. package/src/util/findScrollableParent.js +16 -16
  469. package/src/util/getActiveElement.js +3 -3
  470. package/src/util/getParentFrameBoundingClientRect.js +18 -18
  471. package/src/util/getScrollerBoundingClientRect.js +21 -21
  472. package/src/util/getSearchQueryPredicate.js +58 -58
  473. package/src/util/getSearchQueryPredicate.spec.js +40 -40
  474. package/src/util/getTopLevelBoundingClientRect.js +13 -13
  475. package/src/util/getVendorPrefix.js +26 -26
  476. package/src/util/index.d.ts +50 -50
  477. package/src/util/index.js +52 -52
  478. package/src/util/index.scss +10 -10
  479. package/src/util/innerTextTrim.d.ts +6 -6
  480. package/src/util/innerTextTrim.js +5 -5
  481. package/src/util/isArray.d.ts +1 -1
  482. package/src/util/isArray.js +3 -3
  483. package/src/util/isDefined.js +3 -3
  484. package/src/util/isDigit.d.ts +6 -6
  485. package/src/util/isDigit.js +3 -3
  486. package/src/util/isFunction.d.ts +1 -1
  487. package/src/util/isFunction.js +3 -3
  488. package/src/util/isNonEmptyArray.d.ts +1 -1
  489. package/src/util/isNonEmptyArray.js +3 -3
  490. package/src/util/isNumber.d.ts +1 -1
  491. package/src/util/isNumber.js +3 -3
  492. package/src/util/isObject.d.ts +1 -1
  493. package/src/util/isObject.js +3 -3
  494. package/src/util/isPromise.d.ts +1 -1
  495. package/src/util/isPromise.js +6 -6
  496. package/src/util/isString.d.ts +1 -1
  497. package/src/util/isString.js +3 -3
  498. package/src/util/isTextInputElement.d.ts +1 -1
  499. package/src/util/isTextInputElement.js +2 -2
  500. package/src/util/isTouchDevice.d.ts +1 -1
  501. package/src/util/isTouchDevice.js +7 -7
  502. package/src/util/isTouchEvent.d.ts +3 -3
  503. package/src/util/isTouchEvent.js +64 -64
  504. package/src/util/isUndefined.d.ts +1 -1
  505. package/src/util/isUndefined.js +3 -3
  506. package/src/util/onIdleCallback.js +13 -13
  507. package/src/util/parseStyle.d.ts +3 -3
  508. package/src/util/parseStyle.js +27 -27
  509. package/src/util/quote.d.ts +2 -2
  510. package/src/util/quote.js +4 -4
  511. package/src/util/reverseSlice.js +9 -9
  512. package/src/util/routeAppend.js +15 -15
  513. package/src/util/routeAppend.spec.js +19 -19
  514. package/src/util/scrollElementIntoView.d.ts +7 -7
  515. package/src/util/scrollElementIntoView.js +34 -34
  516. package/src/util/scss/add-rules.scss +39 -39
  517. package/src/util/scss/calc.scss +40 -40
  518. package/src/util/scss/call-once.scss +10 -10
  519. package/src/util/scss/clockwise.scss +47 -47
  520. package/src/util/scss/colors.scss +7 -7
  521. package/src/util/scss/deep-get.scss +9 -9
  522. package/src/util/scss/deep-merge.scss +18 -18
  523. package/src/util/scss/divide.scss +3 -3
  524. package/src/util/scss/include.scss +47 -47
  525. package/src/util/scss/index.scss +9 -9
  526. package/src/util/shallowEquals.js +43 -43
  527. package/src/util/throttle.d.ts +8 -8
  528. package/src/util/throttle.js +14 -14
  529. package/src/util/validatedDebounce.js +19 -19
  530. package/src/variables.scss +217 -217
  531. package/src/widgets/AccessorBindings.spec.tsx +66 -66
  532. package/src/widgets/Button.d.ts +58 -58
  533. package/src/widgets/Button.js +118 -118
  534. package/src/widgets/Button.scss +117 -117
  535. package/src/widgets/Button.variables.scss +107 -107
  536. package/src/widgets/CxCredit.d.ts +12 -12
  537. package/src/widgets/CxCredit.js +31 -31
  538. package/src/widgets/CxCredit.scss +41 -41
  539. package/src/widgets/DocumentTitle.d.ts +11 -11
  540. package/src/widgets/DocumentTitle.js +68 -68
  541. package/src/widgets/FlexBox.d.ts +69 -69
  542. package/src/widgets/FlexBox.js +92 -92
  543. package/src/widgets/FlexBox.scss +146 -146
  544. package/src/widgets/Heading.d.ts +16 -16
  545. package/src/widgets/Heading.js +32 -32
  546. package/src/widgets/Heading.scss +38 -38
  547. package/src/widgets/HighlightedSearchText.d.ts +9 -9
  548. package/src/widgets/HighlightedSearchText.js +36 -36
  549. package/src/widgets/HighlightedSearchText.scss +18 -18
  550. package/src/widgets/HtmlElement.d.ts +26 -26
  551. package/src/widgets/HtmlElement.js +273 -273
  552. package/src/widgets/HtmlElement.spec.js +57 -57
  553. package/src/widgets/Icon.d.ts +34 -34
  554. package/src/widgets/Icon.js +50 -50
  555. package/src/widgets/Icon.scss +20 -20
  556. package/src/widgets/List.d.ts +95 -95
  557. package/src/widgets/List.js +587 -587
  558. package/src/widgets/List.scss +92 -92
  559. package/src/widgets/ProgressBar.d.ts +17 -17
  560. package/src/widgets/ProgressBar.js +46 -46
  561. package/src/widgets/ProgressBar.scss +49 -49
  562. package/src/widgets/Resizer.d.ts +27 -27
  563. package/src/widgets/Resizer.js +151 -151
  564. package/src/widgets/Resizer.scss +42 -42
  565. package/src/widgets/Sandbox.d.ts +16 -16
  566. package/src/widgets/Sandbox.js +62 -62
  567. package/src/widgets/Section.d.ts +52 -52
  568. package/src/widgets/Section.js +139 -139
  569. package/src/widgets/Section.scss +54 -54
  570. package/src/widgets/animations.scss +10 -10
  571. package/src/widgets/autoFocus.d.ts +1 -1
  572. package/src/widgets/autoFocus.js +9 -9
  573. package/src/widgets/cx.d.ts +1 -1
  574. package/src/widgets/cx.js +71 -71
  575. package/src/widgets/drag-drop/DragClone.scss +33 -33
  576. package/src/widgets/drag-drop/DragHandle.d.ts +10 -10
  577. package/src/widgets/drag-drop/DragHandle.js +37 -37
  578. package/src/widgets/drag-drop/DragHandle.scss +16 -16
  579. package/src/widgets/drag-drop/DragSource.d.ts +45 -45
  580. package/src/widgets/drag-drop/DragSource.js +160 -160
  581. package/src/widgets/drag-drop/DragSource.scss +24 -24
  582. package/src/widgets/drag-drop/DropZone.d.ts +98 -98
  583. package/src/widgets/drag-drop/DropZone.js +213 -213
  584. package/src/widgets/drag-drop/DropZone.scss +74 -74
  585. package/src/widgets/drag-drop/index.d.ts +4 -4
  586. package/src/widgets/drag-drop/index.js +4 -4
  587. package/src/widgets/drag-drop/index.scss +3 -3
  588. package/src/widgets/drag-drop/ops.d.ts +56 -56
  589. package/src/widgets/drag-drop/ops.js +344 -344
  590. package/src/widgets/drag-drop/variables.scss +11 -11
  591. package/src/widgets/enableAllInternalDependencies.d.ts +1 -1
  592. package/src/widgets/enableAllInternalDependencies.js +11 -11
  593. package/src/widgets/form/Calendar.d.ts +86 -86
  594. package/src/widgets/form/Calendar.js +527 -527
  595. package/src/widgets/form/Calendar.scss +164 -164
  596. package/src/widgets/form/Calendar.variables.scss +63 -63
  597. package/src/widgets/form/Checkbox.d.ts +43 -43
  598. package/src/widgets/form/Checkbox.js +200 -200
  599. package/src/widgets/form/Checkbox.scss +125 -125
  600. package/src/widgets/form/Checkbox.variables.scss +39 -39
  601. package/src/widgets/form/ColorField.d.ts +43 -43
  602. package/src/widgets/form/ColorField.js +392 -392
  603. package/src/widgets/form/ColorField.scss +92 -92
  604. package/src/widgets/form/ColorPicker.d.ts +23 -23
  605. package/src/widgets/form/ColorPicker.js +451 -451
  606. package/src/widgets/form/ColorPicker.scss +184 -184
  607. package/src/widgets/form/ColorPicker.variables.scss +20 -20
  608. package/src/widgets/form/DateField.d.ts +6 -6
  609. package/src/widgets/form/DateField.js +12 -12
  610. package/src/widgets/form/DateTimeField.d.ts +83 -83
  611. package/src/widgets/form/DateTimeField.js +571 -571
  612. package/src/widgets/form/DateTimeField.scss +90 -90
  613. package/src/widgets/form/DateTimePicker.js +391 -391
  614. package/src/widgets/form/DateTimePicker.scss +44 -44
  615. package/src/widgets/form/Field.d.ts +112 -112
  616. package/src/widgets/form/Field.js +419 -419
  617. package/src/widgets/form/Field.scss +162 -162
  618. package/src/widgets/form/FieldGroup.d.ts +6 -6
  619. package/src/widgets/form/FieldGroup.js +5 -5
  620. package/src/widgets/form/HelpText.d.ts +10 -10
  621. package/src/widgets/form/HelpText.js +9 -9
  622. package/src/widgets/form/HelpText.scss +23 -23
  623. package/src/widgets/form/Label.d.ts +25 -25
  624. package/src/widgets/form/Label.js +86 -86
  625. package/src/widgets/form/Label.scss +36 -36
  626. package/src/widgets/form/LabeledContainer.d.ts +17 -17
  627. package/src/widgets/form/LabeledContainer.js +59 -59
  628. package/src/widgets/form/LookupField.d.ts +171 -171
  629. package/src/widgets/form/LookupField.js +1126 -1126
  630. package/src/widgets/form/LookupField.scss +219 -219
  631. package/src/widgets/form/MonthField.d.ts +88 -88
  632. package/src/widgets/form/MonthField.js +512 -512
  633. package/src/widgets/form/MonthField.scss +99 -99
  634. package/src/widgets/form/MonthPicker.d.ts +68 -68
  635. package/src/widgets/form/MonthPicker.js +631 -631
  636. package/src/widgets/form/MonthPicker.scss +120 -120
  637. package/src/widgets/form/NumberField.d.ts +96 -96
  638. package/src/widgets/form/NumberField.js +459 -459
  639. package/src/widgets/form/NumberField.scss +65 -65
  640. package/src/widgets/form/Radio.d.ts +37 -37
  641. package/src/widgets/form/Radio.js +188 -188
  642. package/src/widgets/form/Radio.scss +122 -122
  643. package/src/widgets/form/Radio.variables.scss +45 -45
  644. package/src/widgets/form/Select.d.ts +73 -73
  645. package/src/widgets/form/Select.js +274 -274
  646. package/src/widgets/form/Select.scss +98 -98
  647. package/src/widgets/form/Slider.d.ts +65 -65
  648. package/src/widgets/form/Slider.js +351 -351
  649. package/src/widgets/form/Slider.scss +119 -119
  650. package/src/widgets/form/Switch.d.ts +38 -38
  651. package/src/widgets/form/Switch.js +118 -118
  652. package/src/widgets/form/Switch.scss +140 -140
  653. package/src/widgets/form/TextArea.d.ts +17 -17
  654. package/src/widgets/form/TextArea.js +182 -182
  655. package/src/widgets/form/TextArea.scss +60 -60
  656. package/src/widgets/form/TextField.d.ts +78 -78
  657. package/src/widgets/form/TextField.js +285 -285
  658. package/src/widgets/form/TextField.scss +55 -55
  659. package/src/widgets/form/TimeField.d.ts +6 -6
  660. package/src/widgets/form/TimeField.js +11 -11
  661. package/src/widgets/form/TimeList.js +84 -84
  662. package/src/widgets/form/UploadButton.d.ts +34 -34
  663. package/src/widgets/form/UploadButton.js +213 -213
  664. package/src/widgets/form/UploadButton.scss +47 -47
  665. package/src/widgets/form/ValidationError.d.ts +10 -10
  666. package/src/widgets/form/ValidationError.js +44 -44
  667. package/src/widgets/form/ValidationError.scss +21 -21
  668. package/src/widgets/form/ValidationGroup.d.ts +38 -38
  669. package/src/widgets/form/ValidationGroup.js +65 -65
  670. package/src/widgets/form/ValidationGroup.spec.js +148 -148
  671. package/src/widgets/form/Validator.d.ts +8 -8
  672. package/src/widgets/form/Validator.js +21 -21
  673. package/src/widgets/form/Wheel.js +261 -261
  674. package/src/widgets/form/Wheel.scss +150 -150
  675. package/src/widgets/form/index.d.ts +26 -26
  676. package/src/widgets/form/index.js +29 -29
  677. package/src/widgets/form/index.scss +24 -24
  678. package/src/widgets/form/variables.scss +352 -352
  679. package/src/widgets/grid/Grid.d.ts +403 -403
  680. package/src/widgets/grid/Grid.js +3255 -3255
  681. package/src/widgets/grid/Grid.scss +680 -680
  682. package/src/widgets/grid/GridCell.d.ts +29 -29
  683. package/src/widgets/grid/GridCell.js +70 -70
  684. package/src/widgets/grid/GridCellEditor.js +41 -41
  685. package/src/widgets/grid/GridRow.js +228 -228
  686. package/src/widgets/grid/GridRowLine.js +24 -24
  687. package/src/widgets/grid/Pagination.d.ts +14 -14
  688. package/src/widgets/grid/Pagination.js +94 -94
  689. package/src/widgets/grid/Pagination.scss +113 -113
  690. package/src/widgets/grid/TreeNode.d.ts +25 -25
  691. package/src/widgets/grid/TreeNode.js +102 -102
  692. package/src/widgets/grid/TreeNode.scss +89 -89
  693. package/src/widgets/grid/index.d.ts +3 -3
  694. package/src/widgets/grid/index.js +14 -14
  695. package/src/widgets/grid/index.scss +3 -3
  696. package/src/widgets/grid/variables.scss +88 -88
  697. package/src/widgets/icons/arrow-down.svg +3 -3
  698. package/src/widgets/icons/arrow-right.svg +2 -2
  699. package/src/widgets/icons/base.svg +104 -104
  700. package/src/widgets/icons/calendar-old.svg +169 -169
  701. package/src/widgets/icons/calendar.js +16 -16
  702. package/src/widgets/icons/calendar.svg +187 -187
  703. package/src/widgets/icons/check.js +12 -12
  704. package/src/widgets/icons/clear.js +14 -14
  705. package/src/widgets/icons/clear.svg +74 -74
  706. package/src/widgets/icons/close.js +19 -19
  707. package/src/widgets/icons/close.svg +74 -74
  708. package/src/widgets/icons/cx.js +37 -37
  709. package/src/widgets/icons/drop-down.js +14 -14
  710. package/src/widgets/icons/dropdown-arrow.svg +61 -61
  711. package/src/widgets/icons/file.js +12 -12
  712. package/src/widgets/icons/file.svg +4 -4
  713. package/src/widgets/icons/folder-open.js +14 -14
  714. package/src/widgets/icons/folder-open.svg +5 -5
  715. package/src/widgets/icons/folder.js +12 -12
  716. package/src/widgets/icons/folder.svg +58 -58
  717. package/src/widgets/icons/forward.js +21 -21
  718. package/src/widgets/icons/forward.svg +67 -67
  719. package/src/widgets/icons/index.js +14 -14
  720. package/src/widgets/icons/loading.js +23 -23
  721. package/src/widgets/icons/loading.svg +4 -4
  722. package/src/widgets/icons/menu.js +16 -16
  723. package/src/widgets/icons/registry.js +53 -53
  724. package/src/widgets/icons/search.js +12 -12
  725. package/src/widgets/icons/search.svg +107 -107
  726. package/src/widgets/icons/sort-asc.js +13 -13
  727. package/src/widgets/icons/sort-asc.svg +3 -3
  728. package/src/widgets/icons/square.js +17 -17
  729. package/src/widgets/index.d.ts +55 -55
  730. package/src/widgets/index.js +57 -57
  731. package/src/widgets/index.scss +16 -16
  732. package/src/widgets/nav/Link.d.ts +26 -26
  733. package/src/widgets/nav/Link.js +7 -7
  734. package/src/widgets/nav/Link.scss +18 -18
  735. package/src/widgets/nav/LinkButton.d.ts +31 -31
  736. package/src/widgets/nav/LinkButton.js +127 -127
  737. package/src/widgets/nav/Menu.d.ts +27 -27
  738. package/src/widgets/nav/Menu.js +406 -406
  739. package/src/widgets/nav/Menu.scss +74 -74
  740. package/src/widgets/nav/Menu.variables.scss +17 -17
  741. package/src/widgets/nav/MenuItem.d.ts +31 -31
  742. package/src/widgets/nav/MenuItem.js +445 -445
  743. package/src/widgets/nav/MenuItem.scss +128 -128
  744. package/src/widgets/nav/MenuSpacer.d.ts +5 -5
  745. package/src/widgets/nav/MenuSpacer.js +12 -12
  746. package/src/widgets/nav/RedirectRoute.d.ts +9 -9
  747. package/src/widgets/nav/RedirectRoute.js +40 -40
  748. package/src/widgets/nav/Route.d.ts +21 -21
  749. package/src/widgets/nav/Route.js +105 -105
  750. package/src/widgets/nav/Route.spec.js +27 -27
  751. package/src/widgets/nav/Scroller.d.ts +17 -17
  752. package/src/widgets/nav/Scroller.js +214 -214
  753. package/src/widgets/nav/Scroller.scss +146 -146
  754. package/src/widgets/nav/Submenu.d.ts +6 -6
  755. package/src/widgets/nav/Submenu.js +6 -6
  756. package/src/widgets/nav/Tab.d.ts +33 -33
  757. package/src/widgets/nav/Tab.js +82 -82
  758. package/src/widgets/nav/Tab.scss +81 -81
  759. package/src/widgets/nav/Tab.variables.scss +80 -80
  760. package/src/widgets/nav/cover.scss +21 -21
  761. package/src/widgets/nav/index.d.ts +10 -10
  762. package/src/widgets/nav/index.js +10 -10
  763. package/src/widgets/nav/index.scss +5 -5
  764. package/src/widgets/nav/variables.scss +25 -25
  765. package/src/widgets/overlay/ContextMenu.d.ts +10 -10
  766. package/src/widgets/overlay/ContextMenu.js +29 -29
  767. package/src/widgets/overlay/Dropdown.d.ts +31 -31
  768. package/src/widgets/overlay/Dropdown.js +612 -612
  769. package/src/widgets/overlay/Dropdown.scss +184 -184
  770. package/src/widgets/overlay/FlyweightTooltipTracker.d.ts +8 -8
  771. package/src/widgets/overlay/FlyweightTooltipTracker.js +36 -36
  772. package/src/widgets/overlay/MsgBox.d.ts +16 -16
  773. package/src/widgets/overlay/MsgBox.js +116 -116
  774. package/src/widgets/overlay/Overlay.d.ts +69 -69
  775. package/src/widgets/overlay/Overlay.js +747 -747
  776. package/src/widgets/overlay/Overlay.scss +66 -66
  777. package/src/widgets/overlay/Toast.d.ts +30 -30
  778. package/src/widgets/overlay/Toast.js +92 -92
  779. package/src/widgets/overlay/Toast.scss +162 -162
  780. package/src/widgets/overlay/Tooltip.d.ts +50 -50
  781. package/src/widgets/overlay/Tooltip.js +288 -288
  782. package/src/widgets/overlay/Tooltip.scss +175 -175
  783. package/src/widgets/overlay/Window.d.ts +39 -39
  784. package/src/widgets/overlay/Window.js +195 -195
  785. package/src/widgets/overlay/Window.scss +112 -112
  786. package/src/widgets/overlay/Window.variables.scss +67 -67
  787. package/src/widgets/overlay/alerts.d.ts +7 -7
  788. package/src/widgets/overlay/alerts.js +39 -39
  789. package/src/widgets/overlay/captureMouse.d.ts +53 -53
  790. package/src/widgets/overlay/captureMouse.js +132 -132
  791. package/src/widgets/overlay/captureMouse.scss +13 -13
  792. package/src/widgets/overlay/index.d.ts +10 -10
  793. package/src/widgets/overlay/index.js +10 -10
  794. package/src/widgets/overlay/index.scss +15 -15
  795. package/src/widgets/overlay/tooltip-ops.d.ts +8 -8
  796. package/src/widgets/overlay/tooltip-ops.js +24 -24
  797. package/src/widgets/overlay/variables.scss +82 -82
  798. package/src/widgets/variables.scss +144 -144
  799. package/dist/charts.css +0 -649
  800. package/dist/charts.js +0 -5598
  801. package/dist/data.js +0 -2508
  802. package/dist/hooks.js +0 -157
  803. package/dist/manifest.js +0 -1373
  804. package/dist/reset.css +0 -89
  805. package/dist/reset.js +0 -1
  806. package/dist/svg.css +0 -19
  807. package/dist/svg.js +0 -919
  808. package/dist/ui.js +0 -5249
  809. package/dist/util.js +0 -1723
  810. package/dist/widgets.css +0 -5242
  811. package/dist/widgets.js +0 -22050
package/dist/data.js DELETED
@@ -1,2508 +0,0 @@
1
- import {
2
- isObject,
3
- isString,
4
- isFunction,
5
- Format,
6
- isDigit,
7
- quoteStr,
8
- Component,
9
- isArray,
10
- isDefined,
11
- SubscriberList,
12
- isUndefined,
13
- expandFatArrows
14
- } from "cx/util";
15
-
16
- var emptyFn = function emptyFn() {};
17
-
18
- function createAccessorModelProxy(chain) {
19
- if (chain === void 0) {
20
- chain = "";
21
- }
22
-
23
- var lastOp = null;
24
- var proxy = new Proxy(emptyFn, {
25
- get: function get(_, name) {
26
- if (typeof name !== "string") return proxy;
27
-
28
- switch (name) {
29
- case "isAccessorChain":
30
- return true;
31
-
32
- case "toString":
33
- case "valueOf":
34
- case "nameOf":
35
- lastOp = name;
36
- return proxy;
37
- }
38
-
39
- var newChain = chain;
40
- if (newChain.length > 0) newChain += ".";
41
- newChain += name;
42
- return createAccessorModelProxy(newChain);
43
- },
44
- apply: function apply() {
45
- switch (lastOp) {
46
- case "nameOf":
47
- var lastDotIndex = chain.lastIndexOf(".");
48
- return lastDotIndex > 0 ? chain.substring(lastDotIndex + 1) : chain;
49
-
50
- default:
51
- return chain;
52
- }
53
- }
54
- });
55
- return proxy;
56
- }
57
- function isAccessorChain(value) {
58
- return value != null && !!value.isAccessorChain;
59
- }
60
-
61
- var bindingCache = {};
62
- var Binding = /*#__PURE__*/ (function() {
63
- function Binding(path) {
64
- this.path = path;
65
- this.parts = path.split(".");
66
- var body = "return x";
67
-
68
- for (var i = 0; i < this.parts.length; i++) {
69
- body += '?.["' + this.parts[i] + '"]';
70
- }
71
-
72
- this.value = new Function("x", body);
73
- }
74
-
75
- var _proto = Binding.prototype;
76
-
77
- _proto.set = function set(state, value) {
78
- var cv = this.value(state);
79
- if (cv === value) return state;
80
- var ns = Object.assign({}, state);
81
- var o = ns;
82
-
83
- for (var i = 0; i < this.parts.length; i++) {
84
- var part = this.parts[i];
85
- var no = i == this.parts.length - 1 ? value : Object.assign({}, o[part]);
86
- o[part] = no;
87
- o = no;
88
- }
89
-
90
- return ns;
91
- };
92
-
93
- _proto["delete"] = function _delete(state) {
94
- var ns = Object.assign({}, state);
95
- var o = ns;
96
- var part;
97
-
98
- for (var i = 0; i < this.parts.length - 1; i++) {
99
- part = this.parts[i];
100
- var no = Object.assign({}, o[part]);
101
- o[part] = no;
102
- o = no;
103
- }
104
-
105
- part = this.parts[this.parts.length - 1];
106
- if (!o.hasOwnProperty(part)) return state;
107
- delete o[part];
108
- return ns;
109
- };
110
-
111
- Binding.get = function get(path) {
112
- if (isString(path)) {
113
- var b = bindingCache[path];
114
- if (b) return b;
115
- b = new Binding(path);
116
- bindingCache[path] = b;
117
- return b;
118
- }
119
-
120
- if (isObject(path) && isString(path.bind)) return this.get(path.bind);
121
- if (path instanceof Binding) return path;
122
- if (isAccessorChain(path)) return this.get(path.toString());
123
- throw new Error("Invalid binding definition provided.");
124
- };
125
-
126
- return Binding;
127
- })();
128
- function isBinding(value) {
129
- if (isObject(value) && isString(value.bind)) return true;
130
- if (value && value.isAccessorChain) return true;
131
- return value instanceof Binding;
132
- }
133
-
134
- function ownKeys(object, enumerableOnly) {
135
- var keys = Object.keys(object);
136
-
137
- if (Object.getOwnPropertySymbols) {
138
- var symbols = Object.getOwnPropertySymbols(object);
139
- enumerableOnly &&
140
- (symbols = symbols.filter(function(sym) {
141
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
142
- })),
143
- keys.push.apply(keys, symbols);
144
- }
145
-
146
- return keys;
147
- }
148
-
149
- function _objectSpread2(target) {
150
- for (var i = 1; i < arguments.length; i++) {
151
- var source = null != arguments[i] ? arguments[i] : {};
152
- i % 2
153
- ? ownKeys(Object(source), !0).forEach(function(key) {
154
- _defineProperty(target, key, source[key]);
155
- })
156
- : Object.getOwnPropertyDescriptors
157
- ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source))
158
- : ownKeys(Object(source)).forEach(function(key) {
159
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
160
- });
161
- }
162
-
163
- return target;
164
- }
165
-
166
- function _defineProperty(obj, key, value) {
167
- if (key in obj) {
168
- Object.defineProperty(obj, key, {
169
- value: value,
170
- enumerable: true,
171
- configurable: true,
172
- writable: true
173
- });
174
- } else {
175
- obj[key] = value;
176
- }
177
-
178
- return obj;
179
- }
180
-
181
- function _inheritsLoose(subClass, superClass) {
182
- subClass.prototype = Object.create(superClass.prototype);
183
- subClass.prototype.constructor = subClass;
184
-
185
- _setPrototypeOf(subClass, superClass);
186
- }
187
-
188
- function _setPrototypeOf(o, p) {
189
- _setPrototypeOf = Object.setPrototypeOf
190
- ? Object.setPrototypeOf.bind()
191
- : function _setPrototypeOf(o, p) {
192
- o.__proto__ = p;
193
- return o;
194
- };
195
- return _setPrototypeOf(o, p);
196
- }
197
-
198
- function _isNativeReflectConstruct() {
199
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
200
- if (Reflect.construct.sham) return false;
201
- if (typeof Proxy === "function") return true;
202
-
203
- try {
204
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
205
- return true;
206
- } catch (e) {
207
- return false;
208
- }
209
- }
210
-
211
- function _construct(Parent, args, Class) {
212
- if (_isNativeReflectConstruct()) {
213
- _construct = Reflect.construct.bind();
214
- } else {
215
- _construct = function _construct(Parent, args, Class) {
216
- var a = [null];
217
- a.push.apply(a, args);
218
- var Constructor = Function.bind.apply(Parent, a);
219
- var instance = new Constructor();
220
- if (Class) _setPrototypeOf(instance, Class.prototype);
221
- return instance;
222
- };
223
- }
224
-
225
- return _construct.apply(null, arguments);
226
- }
227
-
228
- function _assertThisInitialized(self) {
229
- if (self === void 0) {
230
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
231
- }
232
-
233
- return self;
234
- }
235
-
236
- function computable() {
237
- var _ref;
238
-
239
- if (arguments.length == 0)
240
- throw new Error("computable requires at least a compute function to be passed in arguments.");
241
- var compute = ((_ref = arguments.length - 1), _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref]);
242
- if (typeof compute != "function") throw new Error("Last argument to the computable function should be a function.");
243
- var inputs = [],
244
- a;
245
-
246
- for (var i = 0; i + 1 < arguments.length; i++) {
247
- a = i < 0 || arguments.length <= i ? undefined : arguments[i];
248
- if (isString(a) || isAccessorChain(a)) inputs.push(Binding.get(a.toString()).value);
249
- else if (a.memoize) inputs.push(a.memoize());
250
- else if (isFunction(a)) inputs.push(a);
251
- else throw new Error("Invalid selector type '" + typeof a + "' received.");
252
- }
253
-
254
- function memoize(warmupData) {
255
- var lastValue,
256
- lastArgs =
257
- warmupData &&
258
- inputs.map(function(s) {
259
- return s(warmupData);
260
- });
261
- return function(data) {
262
- var dirty = false;
263
-
264
- if (!lastArgs) {
265
- lastArgs = Array.from({
266
- length: inputs.length
267
- });
268
- dirty = true;
269
- }
270
-
271
- for (var _i = 0; _i < inputs.length; _i++) {
272
- var v = inputs[_i](data);
273
-
274
- if (v === lastArgs[_i]) continue;
275
- lastArgs[_i] = v;
276
- dirty = true;
277
- }
278
-
279
- if (dirty) lastValue = compute.apply(null, lastArgs);
280
- return lastValue;
281
- };
282
- }
283
-
284
- var selector = function selector(data) {
285
- return compute.apply(
286
- null,
287
- inputs.map(function(s) {
288
- return s(data);
289
- })
290
- );
291
- };
292
-
293
- selector.memoize = memoize;
294
- return selector;
295
- }
296
-
297
- /*
298
- Helper usage example
299
-
300
- Expression.registerHelper('_', _);
301
- let e = Expression.compile('_.min({data})');
302
- */
303
-
304
- var expCache = {},
305
- helpers = {},
306
- helperNames = [],
307
- helperValues = [],
308
- expFatArrows = null;
309
-
310
- function getExpr(expr) {
311
- if (expr.memoize) return expr;
312
-
313
- function memoize() {
314
- var lastValue,
315
- lastRunBindings = {},
316
- lastRunResults = {},
317
- getters = {},
318
- currentData,
319
- len = -1;
320
-
321
- var get = function get(bindingWithFormat) {
322
- var getter = getters[bindingWithFormat];
323
-
324
- if (!getter) {
325
- var binding = bindingWithFormat,
326
- format;
327
- var colonIndex = bindingWithFormat.indexOf(":");
328
-
329
- if (colonIndex != -1) {
330
- format = Format.parse(bindingWithFormat.substring(colonIndex + 1));
331
- binding = bindingWithFormat.substring(0, colonIndex);
332
- } else {
333
- var nullSeparatorIndex = bindingWithFormat.indexOf(":");
334
-
335
- if (nullSeparatorIndex != -1) {
336
- format = Format.parse(bindingWithFormat.substring(nullSeparatorIndex));
337
- binding = bindingWithFormat.substring(0, nullSeparatorIndex - 1);
338
- }
339
- }
340
-
341
- var b = Binding.get(binding);
342
-
343
- getter = function getter(data) {
344
- var value = b.value(data);
345
- lastRunBindings[len] = b.value;
346
- lastRunResults[len] = value;
347
- len++;
348
- return value;
349
- };
350
-
351
- if (format) {
352
- var valueGetter = getter;
353
-
354
- getter = function getter(data) {
355
- return format(valueGetter(data));
356
- };
357
- }
358
-
359
- getters[bindingWithFormat] = getter;
360
- }
361
-
362
- return getter(currentData);
363
- };
364
-
365
- return function(data) {
366
- var i = 0;
367
-
368
- for (; i < len; i++) {
369
- if (lastRunBindings[i](data) !== lastRunResults[i]) break;
370
- }
371
-
372
- if (i !== len) {
373
- len = 0;
374
- currentData = data;
375
- lastValue = expr(get);
376
- }
377
-
378
- return lastValue;
379
- };
380
- }
381
-
382
- var result = memoize();
383
- result.memoize = memoize;
384
- return result;
385
- }
386
-
387
- function expression(str) {
388
- if (isFunction(str)) return getExpr(str);
389
- var r = expCache[str];
390
- if (r) return r;
391
- var quote = false;
392
- var termStart = -1,
393
- curlyBrackets = 0,
394
- percentExpression;
395
- var fb = ["return ("];
396
- var args = {};
397
- var formats = [];
398
- var subExpr = 0;
399
-
400
- for (var i = 0; i < str.length; i++) {
401
- var c = str[i];
402
-
403
- switch (c) {
404
- case "{":
405
- if (curlyBrackets > 0) curlyBrackets++;
406
- else {
407
- if (!quote && termStart < 0 && (str[i + 1] != "{" || str[i - 1] == "%")) {
408
- termStart = i + 1;
409
- curlyBrackets = 1;
410
- percentExpression = str[i - 1] == "%";
411
- if (percentExpression) fb.pop(); //%
412
- } else if (str[i - 1] != "{") fb.push(c);
413
- }
414
- break;
415
-
416
- case "}":
417
- if (termStart >= 0) {
418
- if (--curlyBrackets == 0) {
419
- var term = str.substring(termStart, i);
420
- var formatStart = 0;
421
- if (term[0] == "[") formatStart = term.indexOf("]");
422
- var colon = term.indexOf(":", formatStart > 0 ? formatStart : 0);
423
- var binding = colon == -1 ? term : term.substring(0, colon);
424
- var format = colon == -1 ? null : term.substring(colon + 1);
425
-
426
- if (colon == -1) {
427
- var nullSepIndex = binding.indexOf("|", formatStart);
428
-
429
- if (nullSepIndex != -1) {
430
- format = binding.substring(nullSepIndex);
431
- binding = binding.substring(0, nullSepIndex);
432
- }
433
- }
434
-
435
- var argName = binding.replace(/\./g, "_");
436
- if (isDigit(argName[0])) argName = "$" + argName;
437
-
438
- if (percentExpression || (binding[0] == "[" && binding[binding.length - 1] == "]")) {
439
- argName = "expr" + ++subExpr;
440
- args[argName] = expression(percentExpression ? binding : binding.substring(1, binding.length - 1));
441
- } else args[argName] = binding;
442
-
443
- if (format) {
444
- var formatter = "fmt" + formats.length;
445
- fb.push(formatter, "(", argName, ", ", quoteStr(format), ")");
446
- formats.push(Format.parse(format));
447
- } else fb.push(argName);
448
-
449
- termStart = -1;
450
- }
451
- } else fb.push(c);
452
-
453
- break;
454
-
455
- case '"':
456
- case "'":
457
- if (curlyBrackets == 0) {
458
- if (!quote) quote = c;
459
- else if (str[i - 1] != "\\" && quote == c) quote = false;
460
- fb.push(c);
461
- }
462
-
463
- break;
464
-
465
- default:
466
- if (termStart < 0) fb.push(c);
467
- break;
468
- }
469
- }
470
-
471
- fb.push(")");
472
- var body = fb.join("");
473
- if (expFatArrows) body = expFatArrows(body); //console.log(body);
474
-
475
- var keys = Object.keys(args);
476
-
477
- try {
478
- var _Function;
479
-
480
- var compute = (_Function = _construct(
481
- Function,
482
- formats
483
- .map(function(f, i) {
484
- return "fmt" + i;
485
- })
486
- .concat(keys, helperNames, [body])
487
- )).bind.apply(_Function, [Format].concat(formats, helperValues));
488
-
489
- var selector = computable.apply(
490
- void 0,
491
- keys
492
- .map(function(k) {
493
- return args[k];
494
- })
495
- .concat([compute])
496
- );
497
- expCache[str] = selector;
498
- return selector;
499
- } catch (err) {
500
- throw new Error("Failed to parse expression: '" + str + "'. Error: " + err.message);
501
- }
502
- }
503
- var Expression = {
504
- get: function get(str) {
505
- return expression(str);
506
- },
507
- compile: function compile(str) {
508
- return this.get(str).memoize();
509
- },
510
- registerHelper: function registerHelper(name, helper) {
511
- helpers[name] = helper;
512
- helperNames = Object.keys(helpers);
513
- helperValues = helperNames.map(function(n) {
514
- return helpers[n];
515
- });
516
- }
517
- };
518
- function plugFatArrowExpansion(impl) {
519
- expFatArrows = impl;
520
- }
521
- function invalidateExpressionCache() {
522
- expCache = {};
523
- }
524
-
525
- function plus(str) {
526
- return str.length ? str + " + " : str;
527
- }
528
-
529
- var tplCache = {};
530
- function stringTemplate(str) {
531
- var expr = tplCache[str];
532
- if (expr) return expr;
533
- expr = "";
534
- var termStart = -1,
535
- quoteStart = 0,
536
- term,
537
- bracketsOpen = 0,
538
- percentSign;
539
-
540
- for (var i = 0; i < str.length; i++) {
541
- var c = str[i];
542
-
543
- switch (c) {
544
- case "{":
545
- if (termStart < 0) {
546
- if (str[i + 1] == "{" && str[i - 1] != "%") {
547
- expr = plus(expr) + quoteStr(str.substring(quoteStart, i) + "{");
548
- i++;
549
- quoteStart = i + 1;
550
- } else {
551
- termStart = i + 1;
552
- percentSign = str[i - 1] == "%";
553
- if (i > quoteStart) expr = plus(expr) + quoteStr(str.substring(quoteStart, percentSign ? i - 1 : i));
554
- bracketsOpen = 1;
555
- }
556
- } else bracketsOpen++;
557
-
558
- break;
559
-
560
- case "}":
561
- if (termStart >= 0) {
562
- if (--bracketsOpen == 0) {
563
- term = str.substring(termStart, i);
564
-
565
- if (term.indexOf(":") == -1) {
566
- var nullSepIndex = term.indexOf("|");
567
- if (nullSepIndex == -1) term += ":s";
568
- else term = term.substring(0, nullSepIndex) + ":s" + term.substring(nullSepIndex);
569
- }
570
-
571
- expr = plus(expr) + (percentSign ? "%{" : "{") + term + "}";
572
- termStart = -1;
573
- quoteStart = i + 1;
574
- bracketsOpen = 0;
575
- }
576
- } else if (str[i + 1] == "}") {
577
- expr = plus(expr) + quoteStr(str.substring(quoteStart, i) + "}");
578
- i++;
579
- quoteStart = i + 1;
580
- }
581
-
582
- break;
583
- }
584
- }
585
-
586
- if (quoteStart < str.length) expr = plus(expr) + quoteStr(str.substring(quoteStart));
587
- return (tplCache[str] = expression(expr));
588
- }
589
- var StringTemplate = {
590
- get: function get(str) {
591
- return stringTemplate(str);
592
- },
593
- compile: function compile(str) {
594
- return stringTemplate(str).memoize();
595
- },
596
- format: function format(_format) {
597
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
598
- args[_key - 1] = arguments[_key];
599
- }
600
-
601
- return stringTemplate(_format)(args);
602
- }
603
- };
604
- function invalidateStringTemplateCache() {
605
- tplCache = {};
606
- }
607
-
608
- var Ref = /*#__PURE__*/ (function(_Component) {
609
- _inheritsLoose(Ref, _Component);
610
-
611
- function Ref(config) {
612
- var _this;
613
-
614
- _this = _Component.call(this, config) || this;
615
- _this.get = _this.get.bind(_assertThisInitialized(_this));
616
- if (_this.set) _this.set = _this.set.bind(_assertThisInitialized(_this));
617
- return _this;
618
- }
619
-
620
- var _proto = Ref.prototype;
621
-
622
- _proto.get = function get() {
623
- throw new Error("Ref's get method is not implemented.");
624
- };
625
-
626
- _proto.init = function init(value) {
627
- if (this.get() === undefined) this.set(value);
628
- };
629
-
630
- _proto.toggle = function toggle() {
631
- this.set(!this.get());
632
- };
633
-
634
- _proto.update = function update(cb) {
635
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
636
- args[_key - 1] = arguments[_key];
637
- }
638
-
639
- this.set(cb.apply(void 0, [this.get()].concat(args)));
640
- };
641
-
642
- _proto.as = function as(config) {
643
- return Ref.create(config, {
644
- get: this.get,
645
- set: this.set
646
- });
647
- };
648
-
649
- _proto.ref = function ref(path) {
650
- var _this2 = this;
651
-
652
- var binding = Binding.get(path);
653
- return Ref.create({
654
- get: function get() {
655
- return binding.value(_this2.get());
656
- },
657
- set: function set(value) {
658
- var data = _this2.get();
659
-
660
- var newData = binding.set(data, value);
661
- if (data === newData) return false;
662
- return _this2.set(newData);
663
- }
664
- });
665
- }; //allows the function to be passed as a selector, e.g. to computable or addTrigger
666
-
667
- _proto.memoize = function memoize() {
668
- return this.get;
669
- };
670
-
671
- return Ref;
672
- })(Component);
673
- Ref.prototype.isRef = true;
674
-
675
- Ref.factory = function(alias, config, more) {
676
- if (isFunction(alias)) {
677
- var cfg = _objectSpread2(_objectSpread2({}, config), more);
678
-
679
- if (cfg.store) Object.assign(cfg, cfg.store.getMethods());
680
- var result = alias(cfg);
681
- if (result instanceof Ref) return result;
682
- return this.create(_objectSpread2(_objectSpread2(_objectSpread2({}, config), more), result));
683
- }
684
-
685
- return this.create(_objectSpread2(_objectSpread2({}, config), more));
686
- };
687
-
688
- var StoreRef = /*#__PURE__*/ (function(_Ref) {
689
- _inheritsLoose(StoreRef, _Ref);
690
-
691
- function StoreRef(config) {
692
- var _this;
693
-
694
- _this = _Ref.call(this, config) || this;
695
- if (isAccessorChain(_this.path)) _this.path = _this.path.toString();
696
- return _this;
697
- }
698
-
699
- var _proto = StoreRef.prototype;
700
-
701
- _proto.get = function get() {
702
- return this.store.get(this.path);
703
- };
704
-
705
- _proto.set = function set(value) {
706
- return this.store.set(this.path, value);
707
- };
708
-
709
- _proto.init = function init(value) {
710
- return this.store.init(this.path, value);
711
- };
712
-
713
- _proto.toggle = function toggle() {
714
- return this.store.toggle(this.path);
715
- };
716
-
717
- _proto["delete"] = function _delete() {
718
- return this.store["delete"](this.path);
719
- };
720
-
721
- _proto.update = function update() {
722
- var _this$store;
723
-
724
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
725
- args[_key] = arguments[_key];
726
- }
727
-
728
- return (_this$store = this.store).update.apply(_this$store, [this.path].concat(args));
729
- }; //allows the function to be passed as a selector, e.g. to computable or addTrigger
730
-
731
- _proto.memoize = function memoize() {
732
- return this.get;
733
- };
734
-
735
- _proto.ref = function ref(path) {
736
- return new StoreRef({
737
- path: this.path + "." + path,
738
- store: this.store
739
- });
740
- };
741
-
742
- _proto.as = function as(config) {
743
- return StoreRef.create(config, {
744
- path: this.path,
745
- store: this.store,
746
- get: this.get,
747
- set: this.set
748
- });
749
- };
750
-
751
- return StoreRef;
752
- })(Ref);
753
-
754
- var View = /*#__PURE__*/ (function() {
755
- function View(config) {
756
- Object.assign(this, config);
757
- this.cache = {
758
- version: -1
759
- };
760
- if (this.store) this.setStore(this.store);
761
- }
762
-
763
- var _proto = View.prototype;
764
-
765
- _proto.getData = function getData() {
766
- throw new Error("abstract method");
767
- };
768
-
769
- _proto.init = function init(path, value) {
770
- if (typeof path == "object" && path != null) {
771
- var changed = false;
772
-
773
- for (var key in path) {
774
- if (path.hasOwnProperty(key) && this.get(key) === undefined && this.setItem(key, path[key])) changed = true;
775
- }
776
-
777
- return changed;
778
- }
779
-
780
- var binding = Binding.get(path);
781
- if (this.get(binding.path) === undefined) return this.setItem(binding.path, value);
782
- return false;
783
- };
784
-
785
- _proto.set = function set(path, value) {
786
- if (isObject(path)) {
787
- var changed = false;
788
-
789
- for (var key in path) {
790
- if (path.hasOwnProperty(key) && this.setItem(key, path[key])) changed = true;
791
- }
792
-
793
- return changed;
794
- }
795
-
796
- var binding = Binding.get(path);
797
- return this.setItem(binding.path, value);
798
- };
799
-
800
- _proto.copy = function copy(from, to) {
801
- var value = this.get(from);
802
- this.set(to, value);
803
- };
804
-
805
- _proto.move = function move(from, to) {
806
- var _this = this;
807
-
808
- this.batch(function() {
809
- _this.copy(from, to);
810
-
811
- _this["delete"](from);
812
- });
813
- }; //protected
814
-
815
- _proto.setItem = function setItem(path, value) {
816
- if (this.store) return this.store.setItem(path, value);
817
- throw new Error("abstract method");
818
- };
819
-
820
- _proto["delete"] = function _delete(path) {
821
- var _this2 = this;
822
-
823
- if (arguments.length > 1) path = Array.from(arguments);
824
- if (isArray(path))
825
- return path
826
- .map(function(arg) {
827
- return _this2["delete"](arg);
828
- })
829
- .some(Boolean);
830
- var binding = Binding.get(path);
831
- return this.deleteItem(binding.path);
832
- }; //protected
833
-
834
- _proto.deleteItem = function deleteItem(path) {
835
- if (this.store) return this.store.deleteItem(path);
836
- throw new Error("abstract method");
837
- };
838
-
839
- _proto.clear = function clear() {
840
- if (this.store) return this.store.clear();
841
- throw new Error("abstract method");
842
- };
843
-
844
- _proto.get = function get(path) {
845
- var storeData = this.getData();
846
- if (arguments.length > 1) path = Array.from(arguments);
847
- if (isArray(path))
848
- return path.map(function(arg) {
849
- return Binding.get(arg).value(storeData);
850
- });
851
- return Binding.get(path).value(storeData);
852
- };
853
-
854
- _proto.toggle = function toggle(path) {
855
- return this.set(path, !this.get(path));
856
- };
857
-
858
- _proto.update = function update(path, updateFn) {
859
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
860
- args[_key - 2] = arguments[_key];
861
- }
862
-
863
- if (arguments.length == 1 && isFunction(path))
864
- return this.load(path.apply(null, [this.getData(), updateFn].concat(args)));
865
- return this.set(path, updateFn.apply(null, [this.get(path)].concat(args)));
866
- };
867
-
868
- _proto.batch = function batch(callback) {
869
- var dirty = this.silently(callback);
870
- if (dirty) this.notify();
871
- return dirty;
872
- };
873
-
874
- _proto.silently = function silently(callback) {
875
- if (this.store) return this.store.silently(callback);
876
- throw new Error("abstract method");
877
- };
878
-
879
- _proto.notify = function notify(path) {
880
- if (this.notificationsSuspended) this.dirty = true;
881
- else this.doNotify(path);
882
- };
883
-
884
- _proto.doNotify = function doNotify(path) {
885
- if (this.store) return this.store.notify(path);
886
- throw new Error("abstract method");
887
- };
888
-
889
- _proto.subscribe = function subscribe(callback) {
890
- if (this.store) return this.store.subscribe(callback);
891
- throw new Error("abstract method");
892
- };
893
-
894
- _proto.load = function load(data) {
895
- return this.batch(function(store) {
896
- for (var key in data) {
897
- store.set(key, data[key]);
898
- }
899
- });
900
- };
901
-
902
- _proto.dispatch = function dispatch(action) {
903
- if (this.store) return this.store.dispatch(action);
904
- throw new Error("The underlying store doesn't support dispatch.");
905
- };
906
-
907
- _proto.getMeta = function getMeta() {
908
- return this.meta;
909
- };
910
-
911
- _proto.setStore = function setStore(store) {
912
- this.store = store;
913
- this.meta = store.getMeta();
914
- };
915
-
916
- _proto.ref = function ref(path, defaultValue) {
917
- if (isDefined(defaultValue)) this.init(path, defaultValue);
918
- return StoreRef.create({
919
- store: this,
920
- path: path
921
- });
922
- };
923
-
924
- _proto.getMethods = function getMethods() {
925
- return {
926
- getData: this.getData.bind(this),
927
- set: this.set.bind(this),
928
- get: this.get.bind(this),
929
- update: this.update.bind(this),
930
- delete: this["delete"].bind(this),
931
- toggle: this.toggle.bind(this),
932
- init: this.init.bind(this),
933
- ref: this.ref.bind(this),
934
- mutate: this.ref.bind(this)
935
- };
936
- };
937
-
938
- return View;
939
- })();
940
- View.prototype.sealed = false; //indicate that data should be copied before virtual items are added
941
- //Immer integration point
942
-
943
- View.prototype.mutate = function() {
944
- throw new Error(
945
- "Mutate requires Immer. Please install 'immer' and 'cx-immer' packages and enable store mutation by calling enableImmerMutate()."
946
- );
947
- };
948
-
949
- var SubscribableView = /*#__PURE__*/ (function(_View) {
950
- _inheritsLoose(SubscribableView, _View);
951
-
952
- function SubscribableView(config) {
953
- var _this;
954
-
955
- _this = _View.call(this, config) || this;
956
- _this.subscribers = new SubscriberList();
957
- _this.changes = [];
958
- return _this;
959
- }
960
-
961
- var _proto = SubscribableView.prototype;
962
-
963
- _proto.subscribe = function subscribe(callback) {
964
- return this.subscribers.subscribe(callback);
965
- };
966
-
967
- _proto.unsubscribeAll = function unsubscribeAll() {
968
- this.subscribers.clear();
969
- };
970
-
971
- _proto.doNotify = function doNotify(path) {
972
- var _this2 = this;
973
-
974
- if (this.notificationsSuspended) return;
975
-
976
- if (!this.async) {
977
- this.subscribers.notify([path]);
978
- } else {
979
- this.changes.push(path || "");
980
-
981
- if (!this.scheduled) {
982
- this.scheduled = true;
983
- setTimeout(function() {
984
- _this2.scheduled = false;
985
- var changes = _this2.changes;
986
- _this2.changes = [];
987
-
988
- _this2.subscribers.notify(changes);
989
- }, 0);
990
- }
991
- }
992
- };
993
-
994
- _proto.silently = function silently(callback) {
995
- this.notificationsSuspended = (this.notificationsSuspended || 0) + 1;
996
- var wasDirty = this.dirty,
997
- dirty;
998
- this.dirty = false;
999
-
1000
- try {
1001
- callback(this);
1002
- } finally {
1003
- this.notificationsSuspended--;
1004
- dirty = this.dirty;
1005
- this.dirty = wasDirty;
1006
- }
1007
-
1008
- return dirty;
1009
- };
1010
-
1011
- return SubscribableView;
1012
- })(View);
1013
- SubscribableView.prototype.async = false;
1014
-
1015
- var Store = /*#__PURE__*/ (function(_SubscribableView) {
1016
- _inheritsLoose(Store, _SubscribableView);
1017
-
1018
- function Store(config) {
1019
- var _this;
1020
-
1021
- if (config === void 0) {
1022
- config = {};
1023
- }
1024
-
1025
- _this = _SubscribableView.call(this, config) || this;
1026
- _this.data = config.data || {};
1027
- _this.meta = {
1028
- version: 0
1029
- };
1030
- return _this;
1031
- }
1032
-
1033
- var _proto = Store.prototype;
1034
-
1035
- _proto.getData = function getData() {
1036
- return this.data;
1037
- };
1038
-
1039
- _proto.setItem = function setItem(path, value) {
1040
- var next = Binding.get(path).set(this.data, value);
1041
-
1042
- if (next != this.data) {
1043
- this.data = next;
1044
- this.meta.version++;
1045
- this.notify(path);
1046
- return true;
1047
- }
1048
-
1049
- return false;
1050
- };
1051
-
1052
- _proto.deleteItem = function deleteItem(path) {
1053
- var next = Binding.get(path)["delete"](this.data);
1054
-
1055
- if (next != this.data) {
1056
- this.data = next;
1057
- this.meta.version++;
1058
- this.notify(path);
1059
- return true;
1060
- }
1061
-
1062
- return false;
1063
- };
1064
-
1065
- _proto.clear = function clear() {
1066
- this.data = {};
1067
- this.meta.version++;
1068
- this.notify();
1069
- };
1070
-
1071
- return Store;
1072
- })(SubscribableView);
1073
- Store.prototype.async = false;
1074
-
1075
- var ExposedRecordView = /*#__PURE__*/ (function(_View) {
1076
- _inheritsLoose(ExposedRecordView, _View);
1077
-
1078
- function ExposedRecordView() {
1079
- return _View.apply(this, arguments) || this;
1080
- }
1081
-
1082
- var _proto = ExposedRecordView.prototype;
1083
-
1084
- _proto.getData = function getData() {
1085
- if (this.sealed && this.meta.version === this.cache.version && this.cache.itemIndex === this.itemIndex)
1086
- return this.cache.result;
1087
- this.cache.result = this.embed(this.store.getData());
1088
- this.cache.version = this.meta.version;
1089
- this.cache.itemIndex = this.itemIndex;
1090
- return this.cache.result;
1091
- };
1092
-
1093
- _proto.embed = function embed(data) {
1094
- var collection = this.collectionBinding.value(data);
1095
- var record = collection[this.itemIndex];
1096
- var copy = this.sealed || this.immutable || this.store.sealed ? _objectSpread2({}, data) : data;
1097
- copy[this.recordName] = record;
1098
- if (this.indexName) copy[this.indexName] = this.itemIndex;
1099
- return copy;
1100
- };
1101
-
1102
- _proto.setIndex = function setIndex(index) {
1103
- this.itemIndex = index;
1104
- };
1105
-
1106
- _proto.setItem = function setItem(path, value) {
1107
- if (path == this.recordName || path.indexOf(this.recordName + ".") == 0) {
1108
- var storeData = this.store.getData();
1109
- var collection = this.collectionBinding.value(storeData);
1110
- var data = this.embed(storeData);
1111
- var d = Binding.get(path).set(data, value);
1112
- if (d === data) return false;
1113
- var record = d[this.recordName];
1114
- var newCollection = [].concat(
1115
- collection.slice(0, this.itemIndex),
1116
- [record],
1117
- collection.slice(this.itemIndex + 1)
1118
- );
1119
- return this.store.setItem(this.collectionBinding.path, newCollection);
1120
- }
1121
-
1122
- return this.store.setItem(path, value);
1123
- };
1124
-
1125
- _proto.deleteItem = function deleteItem(path) {
1126
- var storeData, collection, newCollection;
1127
-
1128
- if (path == this.recordName) {
1129
- storeData = this.store.getData();
1130
- collection = this.collectionBinding.value(storeData);
1131
- newCollection = [].concat(collection.slice(0, this.itemIndex), collection.slice(this.itemIndex + 1));
1132
- return this.store.setItem(this.collectionBinding.path, newCollection);
1133
- } else if (path.indexOf(this.recordName + ".") == 0) {
1134
- storeData = this.store.getData();
1135
- collection = this.collectionBinding.value(storeData);
1136
- var data = this.embed(storeData);
1137
- var d = Binding.get(path)["delete"](data);
1138
- if (d === data) return false;
1139
- var record = d[this.recordName];
1140
- newCollection = [].concat(collection.slice(0, this.itemIndex), [record], collection.slice(this.itemIndex + 1));
1141
- return this.store.setItem(this.collectionBinding.path, newCollection);
1142
- }
1143
-
1144
- return this.store.deleteItem(path);
1145
- };
1146
-
1147
- return ExposedRecordView;
1148
- })(View);
1149
- ExposedRecordView.prototype.immutable = false;
1150
-
1151
- var ExposedValueView = /*#__PURE__*/ (function(_View) {
1152
- _inheritsLoose(ExposedValueView, _View);
1153
-
1154
- function ExposedValueView() {
1155
- return _View.apply(this, arguments) || this;
1156
- }
1157
-
1158
- var _proto = ExposedValueView.prototype;
1159
-
1160
- _proto.getData = function getData() {
1161
- if (this.sealed && this.meta.version === this.cache.version && this.cache.key === this.key)
1162
- return this.cache.result;
1163
- var data = this.store.getData();
1164
- var container = this.containerBinding.value(data) || {};
1165
- var record = container[this.key];
1166
- this.cache.version = this.meta.version;
1167
- this.cache.key = this.key;
1168
- this.cache.result = this.sealed || this.immutable || this.store.sealed ? _objectSpread2({}, data) : data;
1169
- this.cache.result[this.recordName] = record;
1170
- return this.cache.result;
1171
- };
1172
-
1173
- _proto.setKey = function setKey(key) {
1174
- this.key = key;
1175
- };
1176
-
1177
- _proto.getKey = function getKey() {
1178
- return this.key;
1179
- };
1180
-
1181
- _proto.setItem = function setItem(path, value) {
1182
- if (path == this.recordName || path.indexOf(this.recordName + ".") == 0) {
1183
- var data = this.getData();
1184
- var d = Binding.get(path).set(data, value);
1185
- if (d === data) return false;
1186
- var container = this.containerBinding.value(d);
1187
- var record = d[this.recordName];
1188
- var newContainer = Object.assign({}, container);
1189
- newContainer[this.key] = record;
1190
- return this.store.setItem(this.containerBinding.path, newContainer);
1191
- }
1192
-
1193
- return this.store.setItem(path, value);
1194
- };
1195
-
1196
- _proto.deleteItem = function deleteItem(path) {
1197
- var data, container, newContainer;
1198
-
1199
- if (path == this.recordName) {
1200
- data = this.getData();
1201
- container = this.containerBinding.value(data);
1202
- if (!container || !container.hasOwnProperty(path)) return false;
1203
- newContainer = Object.assign({}, container);
1204
- delete newContainer[this.key];
1205
- this.store.set(this.containerBinding.path, newContainer);
1206
- } else if (path.indexOf(this.recordName + ".") == 0) {
1207
- data = this.getData();
1208
- var d = Binding.get(path)["delete"](data);
1209
- if (d === data) return false;
1210
- container = this.containerBinding.value(d);
1211
- var record = d[this.recordName];
1212
- newContainer = Object.assign({}, container);
1213
- newContainer[this.key] = record;
1214
- return this.store.setItem(this.containerBinding.path, newContainer);
1215
- }
1216
-
1217
- return this.store.deleteItem(path);
1218
- };
1219
-
1220
- return ExposedValueView;
1221
- })(View);
1222
- ExposedValueView.prototype.immutable = false;
1223
-
1224
- var ReadOnlyDataView = /*#__PURE__*/ (function(_View) {
1225
- _inheritsLoose(ReadOnlyDataView, _View);
1226
-
1227
- function ReadOnlyDataView() {
1228
- return _View.apply(this, arguments) || this;
1229
- }
1230
-
1231
- var _proto = ReadOnlyDataView.prototype;
1232
-
1233
- _proto.getData = function getData() {
1234
- if (this.sealed && this.meta.version === this.cache.version && this.cache.data === this.data)
1235
- return this.cache.result;
1236
- var data = this.store.getData();
1237
- this.cache.result =
1238
- this.sealed || this.immutable || this.store.sealed
1239
- ? Object.assign({}, data, this.getAdditionalData(data))
1240
- : Object.assign(data, this.getAdditionalData(data));
1241
- this.cache.version = this.meta.version;
1242
- this.cache.data = this.data;
1243
- return this.cache.result;
1244
- };
1245
-
1246
- _proto.getAdditionalData = function getAdditionalData() {
1247
- return this.data;
1248
- };
1249
-
1250
- _proto.setData = function setData(data) {
1251
- this.data = data;
1252
- };
1253
-
1254
- return ReadOnlyDataView;
1255
- })(View);
1256
- ReadOnlyDataView.prototype.immutable = false;
1257
-
1258
- var AugmentedViewBase = /*#__PURE__*/ (function(_View) {
1259
- _inheritsLoose(AugmentedViewBase, _View);
1260
-
1261
- function AugmentedViewBase() {
1262
- return _View.apply(this, arguments) || this;
1263
- }
1264
-
1265
- var _proto = AugmentedViewBase.prototype;
1266
-
1267
- _proto.getData = function getData() {
1268
- if (this.meta.version === this.cache.version && this.sealed) return this.cache.result;
1269
- var parentStoreData = this.store.getData();
1270
- var result = this.getBaseData(parentStoreData);
1271
- this.embedAugmentData(result, parentStoreData);
1272
- this.cache.result = result;
1273
- this.cache.parentStoreData = parentStoreData;
1274
- this.cache.version = this.meta.version;
1275
- return this.cache.result;
1276
- };
1277
-
1278
- _proto.getBaseData = function getBaseData(parentStoreData) {
1279
- if (this.sealed || this.immutable || this.store.sealed) return _objectSpread2({}, parentStoreData);
1280
- return parentStoreData;
1281
- };
1282
-
1283
- _proto.embedAugmentData = function embedAugmentData(result, parentStoreData) {
1284
- throw new Error("abstract");
1285
- };
1286
-
1287
- _proto.isExtraKey = function isExtraKey(key) {
1288
- throw new Error("abstract");
1289
- };
1290
-
1291
- _proto.setExtraKeyValue = function setExtraKeyValue(key, value) {
1292
- throw new Error("abstract");
1293
- };
1294
-
1295
- _proto.deleteExtraKeyValue = function deleteExtraKeyValue(key) {
1296
- throw new Error("abstract");
1297
- };
1298
-
1299
- _proto.setItem = function setItem(path, value) {
1300
- var binding = Binding.get(path);
1301
-
1302
- if (this.isExtraKey(binding.parts[0])) {
1303
- var bindingRoot = binding.parts[0];
1304
- var newValue = value;
1305
-
1306
- if (binding.parts.length > 1) {
1307
- var data = {};
1308
- this.embedAugmentData(data, this.store.getData());
1309
- newValue = binding.set(data, value)[bindingRoot];
1310
- }
1311
-
1312
- return this.setExtraKeyValue(bindingRoot, newValue);
1313
- }
1314
-
1315
- return _View.prototype.setItem.call(this, path, value);
1316
- };
1317
-
1318
- _proto.deleteItem = function deleteItem(path) {
1319
- var binding = Binding.get(path);
1320
-
1321
- if (this.isExtraKey(binding.parts[0])) {
1322
- var bindingRoot = binding.parts[0];
1323
- if (binding.parts.length == 1) return this.deleteExtraKeyValue(bindingRoot);
1324
- var data = {};
1325
- this.embedAugmentData(data, this.store.getData());
1326
- var newValue = binding["delete"](data)[bindingRoot];
1327
- return this.setExtraKeyValue(bindingRoot, newValue);
1328
- }
1329
-
1330
- return _View.prototype.deleteItem.call(this, path);
1331
- };
1332
-
1333
- return AugmentedViewBase;
1334
- })(View);
1335
- AugmentedViewBase.prototype.immutable = false;
1336
-
1337
- var NestedDataView = /*#__PURE__*/ (function(_AugmentedViewBase) {
1338
- _inheritsLoose(NestedDataView, _AugmentedViewBase);
1339
-
1340
- function NestedDataView() {
1341
- return _AugmentedViewBase.apply(this, arguments) || this;
1342
- }
1343
-
1344
- var _proto = NestedDataView.prototype;
1345
-
1346
- _proto.embedAugmentData = function embedAugmentData(result, parentStoreData) {
1347
- if (this.nestedData) {
1348
- var nested = this.nestedData.getSelector()(parentStoreData);
1349
-
1350
- for (var key in nested) {
1351
- result[key] = nested[key];
1352
- }
1353
- }
1354
- };
1355
-
1356
- _proto.isExtraKey = function isExtraKey(key) {
1357
- return this.nestedData && this.nestedData.containsKey(key);
1358
- };
1359
-
1360
- _proto.setExtraKeyValue = function setExtraKeyValue(key, value) {
1361
- this.nestedData.setItem(key, value);
1362
- };
1363
-
1364
- _proto.deleteExtraKeyValue = function deleteExtraKeyValue(key) {
1365
- this.setExtraKeyValue(key, undefined);
1366
- };
1367
-
1368
- return NestedDataView;
1369
- })(AugmentedViewBase);
1370
-
1371
- var ZoomIntoPropertyView = /*#__PURE__*/ (function(_NestedDataView) {
1372
- _inheritsLoose(ZoomIntoPropertyView, _NestedDataView);
1373
-
1374
- function ZoomIntoPropertyView() {
1375
- return _NestedDataView.apply(this, arguments) || this;
1376
- }
1377
-
1378
- var _proto = ZoomIntoPropertyView.prototype;
1379
-
1380
- _proto.getBaseData = function getBaseData(parentStoreData) {
1381
- var x = this.binding.value(parentStoreData);
1382
- if (x != null && typeof x != "object") throw new Error("Zoomed value must be an object.");
1383
- return _objectSpread2({}, x);
1384
- };
1385
-
1386
- _proto.embedAugmentData = function embedAugmentData(result, parentStoreData) {
1387
- result[this.rootName] = parentStoreData;
1388
-
1389
- _NestedDataView.prototype.embedAugmentData.call(this, result, parentStoreData);
1390
- };
1391
-
1392
- _proto.setItem = function setItem(path, value) {
1393
- if (path.indexOf(this.rootName + ".") == 0) this.store.setItem(path.substring(this.rootName.length + 1), value);
1394
- else if (this.isExtraKey(Binding.get(path).parts[0])) _NestedDataView.prototype.setItem.call(this, path, value);
1395
- else _NestedDataView.prototype.setItem.call(this, this.binding.path + "." + path, value);
1396
- };
1397
-
1398
- _proto.deleteItem = function deleteItem(path) {
1399
- if (path.indexOf(this.rootName + ".") == 0) this.store.deleteItem(path.substring(this.rootName.length + 1));
1400
- else if (this.isExtraKey(Binding.get(path).parts[0])) _NestedDataView.prototype.deleteItem.call(this, path);
1401
- else _NestedDataView.prototype.deleteItem.call(this, this.binding.path + "." + path);
1402
- };
1403
-
1404
- return ZoomIntoPropertyView;
1405
- })(NestedDataView);
1406
- ZoomIntoPropertyView.prototype.rootName = "$root";
1407
-
1408
- function createStructuredSelector(selector, constants) {
1409
- var keys = Object.keys(selector);
1410
- if (keys.length == 0)
1411
- return function() {
1412
- return constants;
1413
- };
1414
-
1415
- function memoize() {
1416
- var lastResult = Object.assign({}, constants);
1417
- var memoizedSelectors = {};
1418
- keys.forEach(function(key) {
1419
- memoizedSelectors[key] = selector[key].memoize ? selector[key].memoize() : selector[key];
1420
- lastResult[key] = undefined;
1421
- });
1422
- return function(data) {
1423
- var result = lastResult,
1424
- k,
1425
- v,
1426
- i;
1427
-
1428
- for (i = 0; i < keys.length; i++) {
1429
- k = keys[i];
1430
- v = memoizedSelectors[k](data);
1431
-
1432
- if (result === lastResult) {
1433
- if (v === lastResult[k]) continue;
1434
- result = Object.assign({}, lastResult);
1435
- }
1436
-
1437
- result[k] = v;
1438
- }
1439
-
1440
- return (lastResult = result);
1441
- };
1442
- }
1443
-
1444
- function evaluate(data) {
1445
- var result = Object.assign({}, constants);
1446
-
1447
- for (var i = 0; i < keys.length; i++) {
1448
- result[keys[i]] = selector[keys[i]](data);
1449
- }
1450
-
1451
- return result;
1452
- }
1453
-
1454
- evaluate.memoize = memoize;
1455
- return evaluate;
1456
- }
1457
-
1458
- function isSelector(config) {
1459
- if (config == null) return true;
1460
-
1461
- switch (typeof config) {
1462
- case "object":
1463
- if (config.type || config.$type) return false;
1464
- return !!(config.bind || config.tpl || config.expr || config.get);
1465
-
1466
- case "function":
1467
- return true;
1468
-
1469
- case "string":
1470
- return true;
1471
-
1472
- case "number":
1473
- return true;
1474
-
1475
- case "boolean":
1476
- return true;
1477
- }
1478
-
1479
- return false;
1480
- }
1481
-
1482
- var undefinedF = function undefinedF() {
1483
- return undefined;
1484
- };
1485
-
1486
- var nullF = function nullF() {
1487
- return null;
1488
- };
1489
-
1490
- function getSelector(config) {
1491
- if (config === undefined) return undefinedF;
1492
- if (config === null) return nullF;
1493
-
1494
- switch (typeof config) {
1495
- case "object":
1496
- if (isArray(config)) {
1497
- var _selectors = config.map(function(x) {
1498
- return getSelector(x);
1499
- });
1500
-
1501
- return function(data) {
1502
- return _selectors.map(function(elementSelector) {
1503
- return elementSelector(data);
1504
- });
1505
- };
1506
- } //toString converts accessor chains to binding paths
1507
-
1508
- if (config.bind) return Binding.get(config.bind.toString()).value;
1509
- if (config.tpl) return StringTemplate.get(config.tpl);
1510
- if (config.expr) return Expression.get(config.expr);
1511
- if (config.get) return config.get;
1512
- var selectors = {};
1513
- var constants = {};
1514
-
1515
- for (var key in config) {
1516
- if (isSelector(config[key])) selectors[key] = getSelector(config[key]);
1517
- else constants[key] = config[key];
1518
- }
1519
-
1520
- return createStructuredSelector(selectors, constants);
1521
-
1522
- case "function":
1523
- if (isAccessorChain(config)) return Binding.get(config.toString()).value;
1524
- return config;
1525
-
1526
- default:
1527
- return function() {
1528
- return config;
1529
- };
1530
- }
1531
- }
1532
-
1533
- function defaultValue(pv) {
1534
- if (typeof pv == "object" && pv && pv.structured) return pv.defaultValue;
1535
- return pv;
1536
- }
1537
-
1538
- function getSelectorConfig(props, values, nameMap) {
1539
- var functions = {},
1540
- structures = {},
1541
- defaultValues = {},
1542
- constants,
1543
- p,
1544
- v,
1545
- pv,
1546
- constant = true;
1547
-
1548
- for (p in props) {
1549
- v = values[p];
1550
- pv = props[p];
1551
- if (isUndefined(v) && pv && (pv.bind || pv.tpl || pv.expr)) v = pv;
1552
-
1553
- if (v === null) {
1554
- if (!constants) constants = {};
1555
- constants[p] = null;
1556
- } else if (typeof v == "object") {
1557
- if (v.bind) {
1558
- if (isUndefined(v.defaultValue) && v != pv) v.defaultValue = defaultValue(pv);
1559
- if (isDefined(v.defaultValue)) defaultValues[v.bind] = v.defaultValue;
1560
- nameMap[p] = v.bind;
1561
- functions[p] = Binding.get(v.bind).value;
1562
- constant = false;
1563
- } else if (v.expr) {
1564
- functions[p] = Expression.get(v.expr);
1565
- constant = false;
1566
- } else if (v.get) {
1567
- functions[p] = v.get;
1568
- constant = false;
1569
- } else if (v.tpl) {
1570
- functions[p] = StringTemplate.get(v.tpl);
1571
- constant = false;
1572
- } else if (pv && typeof pv == "object" && pv.structured) {
1573
- if (isArray(v)) functions[p] = getSelector(v);
1574
- else {
1575
- var s = getSelectorConfig(v, v, {});
1576
- structures[p] = s;
1577
- Object.assign(defaultValues, s.defaultValues);
1578
- }
1579
- constant = false;
1580
- } else {
1581
- if (!constants) constants = {};
1582
- constants[p] = v;
1583
- }
1584
- } else if (isFunction(v)) {
1585
- if (isAccessorChain(v)) {
1586
- var path = v.toString();
1587
- nameMap[p] = path;
1588
- functions[p] = Binding.get(path).value;
1589
- } else functions[p] = v;
1590
-
1591
- constant = false;
1592
- } else {
1593
- if (isUndefined(v)) {
1594
- if (isUndefined(pv)) continue;
1595
- v = defaultValue(pv);
1596
- }
1597
-
1598
- if (isUndefined(v)) continue;
1599
- if (!constants) constants = {};
1600
- constants[p] = v;
1601
- }
1602
- }
1603
-
1604
- return {
1605
- functions: functions,
1606
- structures: structures,
1607
- defaultValues: defaultValues,
1608
- constants: constants,
1609
- constant: constant
1610
- };
1611
- }
1612
-
1613
- function createSelector(_ref) {
1614
- var functions = _ref.functions,
1615
- structures = _ref.structures,
1616
- constants = _ref.constants,
1617
- defaultValues = _ref.defaultValues;
1618
- var selector = {};
1619
-
1620
- for (var n in functions) {
1621
- selector[n] = functions[n];
1622
- }
1623
-
1624
- for (var _n in structures) {
1625
- selector[_n] = createSelector(structures[_n]);
1626
- }
1627
-
1628
- return createStructuredSelector(selector, constants);
1629
- }
1630
-
1631
- var StructuredSelector = /*#__PURE__*/ (function() {
1632
- function StructuredSelector(_ref2) {
1633
- var props = _ref2.props,
1634
- values = _ref2.values;
1635
- this.nameMap = {};
1636
- this.config = getSelectorConfig(props, values, this.nameMap);
1637
- }
1638
-
1639
- var _proto = StructuredSelector.prototype;
1640
-
1641
- _proto.init = function init(store) {
1642
- store.init(this.config.defaultValues);
1643
- };
1644
-
1645
- _proto.create = function create(memoize) {
1646
- if (memoize === void 0) {
1647
- memoize = true;
1648
- }
1649
-
1650
- var selector = createSelector(this.config);
1651
- if (memoize && selector.memoize) return selector.memoize();
1652
- return selector;
1653
- };
1654
-
1655
- _proto.createStoreSelector = function createStoreSelector() {
1656
- if (this.config.constant) {
1657
- var result = _objectSpread2({}, this.config.constants);
1658
-
1659
- return function() {
1660
- return result;
1661
- };
1662
- }
1663
-
1664
- var selector = this.create();
1665
- return function(store) {
1666
- return selector(store.getData());
1667
- };
1668
- };
1669
-
1670
- return StructuredSelector;
1671
- })();
1672
-
1673
- var AggregateFunction = /*#__PURE__*/ (function() {
1674
- function AggregateFunction() {}
1675
-
1676
- AggregateFunction.sum = function sum() {
1677
- return new Sum();
1678
- };
1679
-
1680
- AggregateFunction.avg = function avg() {
1681
- return new Avg();
1682
- };
1683
-
1684
- AggregateFunction.count = function count() {
1685
- return new Count();
1686
- };
1687
-
1688
- AggregateFunction.distinct = function distinct() {
1689
- return new Distinct();
1690
- };
1691
-
1692
- AggregateFunction.min = function min() {
1693
- return new Min();
1694
- };
1695
-
1696
- AggregateFunction.max = function max() {
1697
- return new Max();
1698
- };
1699
-
1700
- return AggregateFunction;
1701
- })();
1702
-
1703
- var Sum = /*#__PURE__*/ (function() {
1704
- function Sum() {}
1705
-
1706
- var _proto = Sum.prototype;
1707
-
1708
- _proto.process = function process(value) {
1709
- this.empty = false;
1710
- if (!isNaN(value)) this.result += value;
1711
- else this.invalid = true;
1712
- };
1713
-
1714
- _proto.getResult = function getResult() {
1715
- if (this.invalid) return null;
1716
- return this.result;
1717
- };
1718
-
1719
- return Sum;
1720
- })();
1721
-
1722
- Sum.prototype.result = 0;
1723
- Sum.prototype.empty = true;
1724
-
1725
- var Avg = /*#__PURE__*/ (function() {
1726
- function Avg() {}
1727
-
1728
- var _proto2 = Avg.prototype;
1729
-
1730
- _proto2.process = function process(value, count) {
1731
- if (count === void 0) {
1732
- count = 1;
1733
- }
1734
-
1735
- this.empty = false;
1736
-
1737
- if (!isNaN(value) && !isNaN(count)) {
1738
- this.result += value * count;
1739
- this.count += count;
1740
- } else this.invalid = true;
1741
- };
1742
-
1743
- _proto2.getResult = function getResult() {
1744
- if (this.empty || this.invalid || this.count == 0) return null;
1745
- return this.result / this.count;
1746
- };
1747
-
1748
- return Avg;
1749
- })();
1750
-
1751
- Avg.prototype.result = 0;
1752
- Avg.prototype.count = 0;
1753
- Avg.prototype.empty = true;
1754
-
1755
- var Count = /*#__PURE__*/ (function() {
1756
- function Count() {}
1757
-
1758
- var _proto3 = Count.prototype;
1759
-
1760
- _proto3.process = function process(value) {
1761
- if (value != null) this.result++;
1762
- };
1763
-
1764
- _proto3.getResult = function getResult() {
1765
- return this.result;
1766
- };
1767
-
1768
- return Count;
1769
- })();
1770
-
1771
- Count.prototype.result = 0;
1772
-
1773
- var Distinct = /*#__PURE__*/ (function() {
1774
- function Distinct() {
1775
- this.values = {};
1776
- }
1777
-
1778
- var _proto4 = Distinct.prototype;
1779
-
1780
- _proto4.process = function process(value) {
1781
- if (value == null || this.values[value]) return;
1782
- this.values[value] = true;
1783
- this.empty = false;
1784
- this.result++;
1785
- };
1786
-
1787
- _proto4.getResult = function getResult() {
1788
- if (this.empty || this.invalid) return null;
1789
- return this.result;
1790
- };
1791
-
1792
- return Distinct;
1793
- })();
1794
-
1795
- Distinct.prototype.result = 0;
1796
- Distinct.prototype.empty = true;
1797
-
1798
- var Max = /*#__PURE__*/ (function() {
1799
- function Max() {}
1800
-
1801
- var _proto5 = Max.prototype;
1802
-
1803
- _proto5.process = function process(value) {
1804
- if (!isNaN(value)) {
1805
- if (this.empty) this.result = value;
1806
- else if (value > this.result) this.result = value;
1807
- this.empty = false;
1808
- } else if (value != null) this.invalid = true;
1809
- };
1810
-
1811
- _proto5.getResult = function getResult() {
1812
- if (this.empty || this.invalid) return null;
1813
- return this.result;
1814
- };
1815
-
1816
- return Max;
1817
- })();
1818
-
1819
- Max.prototype.result = 0;
1820
- Max.prototype.empty = true;
1821
-
1822
- var Min = /*#__PURE__*/ (function() {
1823
- function Min() {}
1824
-
1825
- var _proto6 = Min.prototype;
1826
-
1827
- _proto6.process = function process(value) {
1828
- if (!isNaN(value)) {
1829
- if (this.empty) this.result = value;
1830
- else if (value < this.result) this.result = value;
1831
- this.empty = false;
1832
- } else if (value != null) this.invalid = true;
1833
- };
1834
-
1835
- _proto6.getResult = function getResult() {
1836
- if (this.empty || this.invalid) return null;
1837
- return this.result;
1838
- };
1839
-
1840
- return Min;
1841
- })();
1842
-
1843
- Min.prototype.result = 0;
1844
- Min.prototype.empty = true;
1845
-
1846
- /*
1847
- 'column': {
1848
- index: 0,
1849
- sort: 'asc',
1850
- group: true
1851
- aggregate: 'count'
1852
- }
1853
- */
1854
-
1855
- function transform(o, f) {
1856
- var res = {};
1857
-
1858
- for (var k in o) {
1859
- res[k] = f(o[k], k);
1860
- }
1861
-
1862
- return res;
1863
- }
1864
-
1865
- var Grouper = /*#__PURE__*/ (function() {
1866
- function Grouper(key, aggregates, dataGetter, nameGetter) {
1867
- this.keys = Object.keys(key).map(function(k) {
1868
- return {
1869
- name: k,
1870
- value: getSelector(key[k])
1871
- };
1872
- });
1873
- if (nameGetter) this.nameGetter = getSelector(nameGetter);
1874
-
1875
- this.dataGetter =
1876
- dataGetter ||
1877
- function(x) {
1878
- return x;
1879
- };
1880
-
1881
- this.aggregates =
1882
- aggregates &&
1883
- transform(aggregates, function(prop) {
1884
- if (!AggregateFunction[prop.type]) throw new Error("Unknown aggregate function '" + prop.type + "'.");
1885
- return {
1886
- value: getSelector(prop.value),
1887
- weight: getSelector(prop.weight || 1),
1888
- type: prop.type
1889
- };
1890
- });
1891
- this.reset();
1892
- }
1893
-
1894
- var _proto = Grouper.prototype;
1895
-
1896
- _proto.reset = function reset() {
1897
- this.groups = this.initGroup(this.keys.length == 0);
1898
- };
1899
-
1900
- _proto.initGroup = function initGroup(leaf) {
1901
- if (!leaf) return {};
1902
- return {
1903
- records: [],
1904
- indexes: [],
1905
- aggregates:
1906
- this.aggregates &&
1907
- transform(this.aggregates, function(prop) {
1908
- var f = AggregateFunction[prop.type];
1909
- return {
1910
- processor: f(),
1911
- value: prop.value,
1912
- weight: prop.weight
1913
- };
1914
- })
1915
- };
1916
- };
1917
-
1918
- _proto.process = function process(record, index) {
1919
- var data = this.dataGetter(record);
1920
- var key = this.keys.map(function(k) {
1921
- return k.value(data);
1922
- });
1923
- var g = this.groups;
1924
-
1925
- for (var i = 0; i < key.length; i++) {
1926
- var sg = g[key[i]];
1927
-
1928
- if (!sg) {
1929
- sg = g[key[i]] = this.initGroup(i + 1 == key.length);
1930
- if (this.nameGetter) sg.name = this.nameGetter(data);
1931
- }
1932
-
1933
- g = sg;
1934
- }
1935
-
1936
- g.records.push(record);
1937
- g.indexes.push(index);
1938
-
1939
- if (g.aggregates) {
1940
- for (var k in g.aggregates) {
1941
- g.aggregates[k].processor.process(g.aggregates[k].value(data), g.aggregates[k].weight(data));
1942
- }
1943
- }
1944
- };
1945
-
1946
- _proto.processAll = function processAll(records, indexes) {
1947
- var _this = this;
1948
-
1949
- if (indexes) {
1950
- for (var i = 0; i < records.length; i++) {
1951
- this.process(records[i], indexes[i]);
1952
- }
1953
- } else
1954
- records.forEach(function(r, i) {
1955
- return _this.process(r, i);
1956
- });
1957
- };
1958
-
1959
- _proto.report = function report(g, path, level, results) {
1960
- var _this2 = this;
1961
-
1962
- if (level == this.keys.length) {
1963
- var key = {};
1964
- this.keys.forEach(function(k, i) {
1965
- return (key[k.name] = path[i]);
1966
- });
1967
- results.push({
1968
- key: key,
1969
- name: g.name,
1970
- records: g.records,
1971
- indexes: g.indexes,
1972
- aggregates: transform(g.aggregates, function(p) {
1973
- return p.processor.getResult();
1974
- })
1975
- });
1976
- } else {
1977
- Object.keys(g).forEach(function(k) {
1978
- return _this2.report(g[k], [].concat(path, [k]), level + 1, results);
1979
- });
1980
- }
1981
- };
1982
-
1983
- _proto.getResults = function getResults() {
1984
- var g = this.groups;
1985
- var results = [];
1986
- this.report(g, [], 0, results);
1987
- return results;
1988
- };
1989
-
1990
- return Grouper;
1991
- })();
1992
-
1993
- function defaultCompare(av, bv) {
1994
- if (av == null) {
1995
- if (bv == null) return 0;
1996
- return -1;
1997
- }
1998
-
1999
- if (bv == null || av > bv) return 1;
2000
- if (av < bv) return -1;
2001
- return 0;
2002
- }
2003
-
2004
- function getComparer(sorters, dataAccessor, comparer) {
2005
- var resolvedSorters = (sorters || []).map(function(s) {
2006
- var selector = isDefined(s.value)
2007
- ? getSelector(s.value)
2008
- : s.field
2009
- ? function(x) {
2010
- return x[s.field];
2011
- }
2012
- : function() {
2013
- return null;
2014
- };
2015
- return {
2016
- getter: dataAccessor
2017
- ? function(x) {
2018
- return selector(dataAccessor(x));
2019
- }
2020
- : selector,
2021
- factor: s.direction && s.direction[0].toLowerCase() == "d" ? -1 : 1,
2022
- compare: s.comparer || s.compare || comparer || defaultCompare
2023
- };
2024
- });
2025
- return function(a, b) {
2026
- var d, av, bv;
2027
-
2028
- for (var i = 0; i < resolvedSorters.length; i++) {
2029
- d = resolvedSorters[i];
2030
- av = d.getter(a);
2031
- bv = d.getter(b); // show nulls always on the bottom
2032
-
2033
- if (av == null) {
2034
- if (bv == null) continue;
2035
- else return 1;
2036
- }
2037
-
2038
- if (bv == null) return -1;
2039
- var r = d.compare(av, bv);
2040
- if (r == 0) continue;
2041
- return d.factor * r;
2042
- }
2043
-
2044
- return 0;
2045
- };
2046
- }
2047
- function indexSorter(sorters, dataAccessor, compare) {
2048
- var cmp = getComparer(sorters, dataAccessor, compare);
2049
- return function(data) {
2050
- var result = Array.from(
2051
- {
2052
- length: data.length
2053
- },
2054
- function(v, k) {
2055
- return k;
2056
- }
2057
- );
2058
- result.sort(function(ia, ib) {
2059
- return cmp(data[ia], data[ib]);
2060
- });
2061
- return result;
2062
- };
2063
- }
2064
- function sorter(sorters, dataAccessor, compare) {
2065
- var cmp = getComparer(sorters, dataAccessor, compare);
2066
- return function(data) {
2067
- var result = [].concat(data);
2068
- result.sort(cmp);
2069
- return result;
2070
- };
2071
- }
2072
-
2073
- function enableFatArrowExpansion() {
2074
- plugFatArrowExpansion(expandFatArrows);
2075
- }
2076
-
2077
- function append(array) {
2078
- for (var _len = arguments.length, items = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2079
- items[_key - 1] = arguments[_key];
2080
- }
2081
-
2082
- if (items.length == 0) return array;
2083
- if (!array) return items;
2084
- return [].concat(array, items);
2085
- }
2086
-
2087
- function merge(item, data) {
2088
- var result = item;
2089
- if (data)
2090
- for (var key in data) {
2091
- result = Binding.get(key).set(result, data[key]);
2092
- }
2093
- return result;
2094
- }
2095
-
2096
- function filter(array, callback) {
2097
- if (array == null) return array;
2098
- var result = array.filter(callback);
2099
- if (result.length == array.length) return array;
2100
- return result;
2101
- }
2102
-
2103
- function updateArray(array, updateCallback, itemFilter, removeFilter) {
2104
- if (!array) return array;
2105
- var newArray = [];
2106
- var dirty = false;
2107
-
2108
- for (var index = 0; index < array.length; index++) {
2109
- var item = array[index];
2110
-
2111
- if (removeFilter && removeFilter(item, index)) {
2112
- dirty = true;
2113
- continue;
2114
- }
2115
-
2116
- if (!itemFilter || itemFilter(item, index)) {
2117
- var newItem = updateCallback(item, index);
2118
- newArray.push(newItem);
2119
- if (newItem !== item) dirty = true;
2120
- } else newArray.push(item);
2121
- }
2122
-
2123
- return dirty ? newArray : array;
2124
- }
2125
-
2126
- function updateTree(array, updateCallback, itemFilter, childrenField, removeFilter) {
2127
- return updateArray(
2128
- array,
2129
- function(item) {
2130
- var _objectSpread2$1;
2131
-
2132
- if (!itemFilter || itemFilter(item)) item = updateCallback(item);
2133
- var children = item[childrenField];
2134
- if (!Array.isArray(children)) return item;
2135
- var updatedChildren = updateTree(children, updateCallback, itemFilter, childrenField, removeFilter);
2136
- if (updatedChildren != children)
2137
- return _objectSpread2(
2138
- _objectSpread2({}, item),
2139
- {},
2140
- ((_objectSpread2$1 = {}), (_objectSpread2$1[childrenField] = updatedChildren), _objectSpread2$1)
2141
- );
2142
- return item;
2143
- },
2144
- null,
2145
- removeFilter
2146
- );
2147
- }
2148
-
2149
- function removeTreeNodes(array, criteria, childrenField) {
2150
- if (childrenField === void 0) {
2151
- childrenField = "$children";
2152
- }
2153
-
2154
- return updateTree(
2155
- array,
2156
- null,
2157
- function() {
2158
- return false;
2159
- },
2160
- childrenField,
2161
- criteria
2162
- );
2163
- }
2164
-
2165
- function findTreeNode(array, criteria, childrenField) {
2166
- if (childrenField === void 0) {
2167
- childrenField = "$children";
2168
- }
2169
-
2170
- if (!Array.isArray(array)) return false;
2171
-
2172
- for (var i = 0; i < array.length; i++) {
2173
- if (criteria(array[i])) return array[i];
2174
- var child = findTreeNode(array[i][childrenField], criteria, childrenField);
2175
- if (child) return child;
2176
- }
2177
-
2178
- return false;
2179
- }
2180
-
2181
- function moveElement(array, sourceIndex, targetIndex) {
2182
- if (targetIndex == sourceIndex) return array;
2183
- var el = array[sourceIndex];
2184
- var res = [].concat(array);
2185
-
2186
- if (sourceIndex < targetIndex) {
2187
- for (var i = sourceIndex; i + 1 < targetIndex; i++) {
2188
- res[i] = res[i + 1];
2189
- }
2190
-
2191
- targetIndex--;
2192
- } else {
2193
- for (var _i = sourceIndex; _i > targetIndex; _i--) {
2194
- res[_i] = res[_i - 1];
2195
- }
2196
- }
2197
-
2198
- res[targetIndex] = el;
2199
- return res;
2200
- }
2201
-
2202
- function insertElement(array, index) {
2203
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
2204
- args[_key - 2] = arguments[_key];
2205
- }
2206
-
2207
- return [].concat(array.slice(0, index), args, array.slice(index));
2208
- }
2209
-
2210
- function findTreePath(array, criteria, childrenField, currentPath) {
2211
- if (childrenField === void 0) {
2212
- childrenField = "$children";
2213
- }
2214
-
2215
- if (currentPath === void 0) {
2216
- currentPath = [];
2217
- }
2218
-
2219
- if (!Array.isArray(array)) return false;
2220
-
2221
- for (var i = 0; i < array.length; i++) {
2222
- currentPath.push(array[i]);
2223
- if (criteria(array[i])) return currentPath;
2224
- var childPath = findTreePath(array[i][childrenField], criteria, childrenField, currentPath);
2225
- if (childPath) return childPath;
2226
- currentPath.pop();
2227
- }
2228
-
2229
- return false;
2230
- }
2231
-
2232
- function diffArrays(oldArray, newArray, keyFn) {
2233
- if (!keyFn)
2234
- keyFn = function keyFn(e) {
2235
- return e;
2236
- };
2237
- var map = new Map();
2238
-
2239
- for (var i = 0; i < oldArray.length; i++) {
2240
- map.set(keyFn(oldArray[i]), oldArray[i]);
2241
- }
2242
-
2243
- var added = [],
2244
- changed = [],
2245
- unchanged = [];
2246
-
2247
- for (var _i = 0; _i < newArray.length; _i++) {
2248
- var el = newArray[_i];
2249
- var k = keyFn(el);
2250
- var old = map.get(k);
2251
- if (isUndefined(old)) added.push(el);
2252
- else {
2253
- map["delete"](k);
2254
- if (el == old) unchanged.push(el);
2255
- else
2256
- changed.push({
2257
- before: old,
2258
- after: el
2259
- });
2260
- }
2261
- }
2262
-
2263
- var removed = Array.from(map.values());
2264
- return {
2265
- added: added,
2266
- changed: changed,
2267
- unchanged: unchanged,
2268
- removed: removed
2269
- };
2270
- }
2271
-
2272
- var ArrayRef = /*#__PURE__*/ (function(_Ref) {
2273
- _inheritsLoose(ArrayRef, _Ref);
2274
-
2275
- function ArrayRef() {
2276
- return _Ref.apply(this, arguments) || this;
2277
- }
2278
-
2279
- var _proto = ArrayRef.prototype;
2280
-
2281
- _proto.append = function append$1() {
2282
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2283
- args[_key] = arguments[_key];
2284
- }
2285
-
2286
- this.update.apply(this, [append].concat(args));
2287
- };
2288
-
2289
- _proto.insert = function insert(index) {
2290
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
2291
- args[_key2 - 1] = arguments[_key2];
2292
- }
2293
-
2294
- this.update.apply(this, [insertElement].concat(args));
2295
- };
2296
-
2297
- _proto.filter = function filter(predicate) {
2298
- this.update(function(array) {
2299
- return array.filter(function(a) {
2300
- return predicate(a);
2301
- });
2302
- });
2303
- };
2304
-
2305
- _proto.move = function move(fromIndex, toIndex) {
2306
- this.update(moveElement, fromIndex, toIndex);
2307
- };
2308
-
2309
- _proto.clear = function clear() {
2310
- this.set([]);
2311
- };
2312
-
2313
- _proto.sort = function sort(compare) {
2314
- var data = this.get();
2315
- if (!data) return;
2316
- var x = [].concat(data);
2317
- x.sort(compare);
2318
- this.set(x);
2319
- };
2320
-
2321
- return ArrayRef;
2322
- })(Ref);
2323
-
2324
- var StoreProxy = /*#__PURE__*/ (function(_View) {
2325
- _inheritsLoose(StoreProxy, _View);
2326
-
2327
- function StoreProxy(getStore) {
2328
- var _this;
2329
-
2330
- _this =
2331
- _View.call(this, {
2332
- store: getStore()
2333
- }) || this;
2334
- Object.defineProperty(_assertThisInitialized(_this), "store", {
2335
- get: getStore
2336
- });
2337
- return _this;
2338
- }
2339
-
2340
- var _proto = StoreProxy.prototype;
2341
-
2342
- _proto.getData = function getData() {
2343
- return this.store.getData();
2344
- };
2345
-
2346
- return StoreProxy;
2347
- })(View);
2348
-
2349
- var ArrayElementView = /*#__PURE__*/ (function(_AugmentedViewBase) {
2350
- _inheritsLoose(ArrayElementView, _AugmentedViewBase);
2351
-
2352
- function ArrayElementView() {
2353
- return _AugmentedViewBase.apply(this, arguments) || this;
2354
- }
2355
-
2356
- var _proto = ArrayElementView.prototype;
2357
-
2358
- _proto.isExtraKey = function isExtraKey(key) {
2359
- return key == this.recordAlias || key == this.indexAlias || key == this.lengthAlias;
2360
- };
2361
-
2362
- _proto.deleteExtraKeyValue = function deleteExtraKeyValue(key) {
2363
- if (key != this.recordAlias) throw new Error("Field " + key + " cannot be deleted.");
2364
- var array = this.arrayAccessor.get(this.store.getData());
2365
- if (!array) return false;
2366
- var newArray = [].concat(array.slice(0, this.itemIndex), array.slice(this.itemIndex + 1));
2367
- return this.arrayAccessor.set(newArray, this.store);
2368
- };
2369
-
2370
- _proto.setExtraKeyValue = function setExtraKeyValue(key, value) {
2371
- if (key != this.recordAlias) throw new Error("Field " + key + " is read-only.");
2372
- var array = this.arrayAccessor.get(this.store.getData());
2373
- if (!array || value === array[this.itemIndex]) return false;
2374
- var newArray = [].concat(array.slice(0, this.itemIndex), [value], array.slice(this.itemIndex + 1));
2375
- return this.arrayAccessor.set(newArray, this.store);
2376
- };
2377
-
2378
- _proto.embedAugmentData = function embedAugmentData(result, parentStoreData) {
2379
- var array = this.arrayAccessor.get(parentStoreData);
2380
- if (!isArray(array)) return;
2381
- result[this.recordAlias] = array[this.itemIndex];
2382
- result[this.indexAlias] = this.itemIndex;
2383
- result[this.lengthAlias] = array.length;
2384
- };
2385
-
2386
- _proto.setIndex = function setIndex(itemIndex) {
2387
- this.itemIndex = itemIndex;
2388
- };
2389
-
2390
- return ArrayElementView;
2391
- })(AugmentedViewBase);
2392
- ArrayElementView.prototype.recordAlias = "$record";
2393
- ArrayElementView.prototype.indexAlias = "$index";
2394
- ArrayElementView.prototype.lengthAlias = "$length";
2395
-
2396
- /*
2397
- Accessor provides a common ground between refs and bindings.
2398
- Refs offer simplicity, bindings have better performance with more arguments.
2399
- Accessor works as a common interface which works with both patterns.
2400
- */
2401
-
2402
- function getAccessor(accessor, options) {
2403
- if (accessor == null) return null;
2404
-
2405
- if (isObject(accessor)) {
2406
- if (accessor.isAccessor || accessor.isRef) return accessor;
2407
-
2408
- if (isBinding(accessor)) {
2409
- var binding = Binding.get(accessor);
2410
- return {
2411
- get: binding.value,
2412
- set: function set(v, store) {
2413
- return store.set(binding.path, v);
2414
- },
2415
- isAccessor: true
2416
- };
2417
- }
2418
- }
2419
-
2420
- if (isAccessorChain(accessor)) {
2421
- var _binding = Binding.get(accessor);
2422
-
2423
- return {
2424
- get: _binding.value,
2425
- set: function set(v, store) {
2426
- return store.set(_binding.path, v);
2427
- },
2428
- isAccessor: true
2429
- };
2430
- }
2431
-
2432
- if (isSelector(accessor)) {
2433
- var selector = getSelector(accessor);
2434
- if (accessor && accessor.set)
2435
- return {
2436
- get: selector,
2437
- isAccessor: true,
2438
- bindInstance: function bindInstance(instance) {
2439
- return {
2440
- get: selector,
2441
- set: function set(value) {
2442
- return accessor.set(value, instance);
2443
- },
2444
- isAccessor: true
2445
- };
2446
- }
2447
- };
2448
- return {
2449
- get: selector,
2450
- isAccessor: true
2451
- };
2452
- }
2453
-
2454
- return {
2455
- get: function get() {
2456
- return accessor;
2457
- }
2458
- };
2459
- }
2460
-
2461
- export {
2462
- ArrayElementView,
2463
- ArrayRef,
2464
- AugmentedViewBase,
2465
- Binding,
2466
- ExposedRecordView,
2467
- ExposedValueView,
2468
- Expression,
2469
- Grouper,
2470
- NestedDataView,
2471
- ReadOnlyDataView,
2472
- Ref,
2473
- Store,
2474
- StoreProxy,
2475
- StringTemplate,
2476
- StructuredSelector,
2477
- SubscribableView,
2478
- View,
2479
- ZoomIntoPropertyView,
2480
- append,
2481
- computable,
2482
- createAccessorModelProxy,
2483
- defaultCompare,
2484
- diffArrays,
2485
- enableFatArrowExpansion,
2486
- expression,
2487
- filter,
2488
- findTreeNode,
2489
- findTreePath,
2490
- getAccessor,
2491
- getComparer,
2492
- getSelector,
2493
- indexSorter,
2494
- insertElement,
2495
- invalidateExpressionCache,
2496
- invalidateStringTemplateCache,
2497
- isAccessorChain,
2498
- isBinding,
2499
- isSelector,
2500
- merge,
2501
- moveElement,
2502
- plugFatArrowExpansion,
2503
- removeTreeNodes,
2504
- sorter,
2505
- stringTemplate,
2506
- updateArray,
2507
- updateTree
2508
- };