@darajs/core 0.4.8

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 (464) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +101 -0
  3. package/dist/actions/download-variable.d.ts +8 -0
  4. package/dist/actions/download-variable.d.ts.map +1 -0
  5. package/dist/actions/download-variable.js +140 -0
  6. package/dist/actions/download-variable.js.map +1 -0
  7. package/dist/actions/index.d.ts +7 -0
  8. package/dist/actions/index.d.ts.map +1 -0
  9. package/dist/actions/index.js +7 -0
  10. package/dist/actions/index.js.map +1 -0
  11. package/dist/actions/navigate-to.d.ts +8 -0
  12. package/dist/actions/navigate-to.d.ts.map +1 -0
  13. package/dist/actions/navigate-to.js +37 -0
  14. package/dist/actions/navigate-to.js.map +1 -0
  15. package/dist/actions/notify.d.ts +4 -0
  16. package/dist/actions/notify.d.ts.map +1 -0
  17. package/dist/actions/notify.js +11 -0
  18. package/dist/actions/notify.js.map +1 -0
  19. package/dist/actions/reset-variables.d.ts +8 -0
  20. package/dist/actions/reset-variables.d.ts.map +1 -0
  21. package/dist/actions/reset-variables.js +37 -0
  22. package/dist/actions/reset-variables.js.map +1 -0
  23. package/dist/actions/trigger-variable.d.ts +8 -0
  24. package/dist/actions/trigger-variable.d.ts.map +1 -0
  25. package/dist/actions/trigger-variable.js +14 -0
  26. package/dist/actions/trigger-variable.js.map +1 -0
  27. package/dist/actions/update-variable.d.ts +15 -0
  28. package/dist/actions/update-variable.d.ts.map +1 -0
  29. package/dist/actions/update-variable.js +56 -0
  30. package/dist/actions/update-variable.js.map +1 -0
  31. package/dist/api/core.d.ts +35 -0
  32. package/dist/api/core.d.ts.map +1 -0
  33. package/dist/api/core.js +112 -0
  34. package/dist/api/core.js.map +1 -0
  35. package/dist/api/http.d.ts +29 -0
  36. package/dist/api/http.d.ts.map +1 -0
  37. package/dist/api/http.js +126 -0
  38. package/dist/api/http.js.map +1 -0
  39. package/dist/api/index.d.ts +5 -0
  40. package/dist/api/index.d.ts.map +1 -0
  41. package/dist/api/index.js +5 -0
  42. package/dist/api/index.js.map +1 -0
  43. package/dist/api/websocket.d.ts +222 -0
  44. package/dist/api/websocket.d.ts.map +1 -0
  45. package/dist/api/websocket.js +353 -0
  46. package/dist/api/websocket.js.map +1 -0
  47. package/dist/assets/causalens-dark.svg +29 -0
  48. package/dist/assets/causalens-light.svg +29 -0
  49. package/dist/assets/dara-dark.svg +20 -0
  50. package/dist/assets/dara-light.svg +15 -0
  51. package/dist/assets/fonts/Manrope-VariableFont_wght.ttf +0 -0
  52. package/dist/auth/auth-wrapper.d.ts +15 -0
  53. package/dist/auth/auth-wrapper.d.ts.map +1 -0
  54. package/dist/auth/auth-wrapper.js +72 -0
  55. package/dist/auth/auth-wrapper.js.map +1 -0
  56. package/dist/auth/auth.d.ts +61 -0
  57. package/dist/auth/auth.d.ts.map +1 -0
  58. package/dist/auth/auth.js +163 -0
  59. package/dist/auth/auth.js.map +1 -0
  60. package/dist/auth/basic/basic-auth-login.d.ts +6 -0
  61. package/dist/auth/basic/basic-auth-login.d.ts.map +1 -0
  62. package/dist/auth/basic/basic-auth-login.js +171 -0
  63. package/dist/auth/basic/basic-auth-login.js.map +1 -0
  64. package/dist/auth/basic/basic-auth-logout.d.ts +6 -0
  65. package/dist/auth/basic/basic-auth-logout.d.ts.map +1 -0
  66. package/dist/auth/basic/basic-auth-logout.js +18 -0
  67. package/dist/auth/basic/basic-auth-logout.js.map +1 -0
  68. package/dist/auth/default/default-auth-login.d.ts +6 -0
  69. package/dist/auth/default/default-auth-login.d.ts.map +1 -0
  70. package/dist/auth/default/default-auth-login.js +59 -0
  71. package/dist/auth/default/default-auth-login.js.map +1 -0
  72. package/dist/auth/index.d.ts +7 -0
  73. package/dist/auth/index.d.ts.map +1 -0
  74. package/dist/auth/index.js +7 -0
  75. package/dist/auth/index.js.map +1 -0
  76. package/dist/auth/use-session-token.d.ts +19 -0
  77. package/dist/auth/use-session-token.d.ts.map +1 -0
  78. package/dist/auth/use-session-token.js +30 -0
  79. package/dist/auth/use-session-token.js.map +1 -0
  80. package/dist/components/fallback/default.d.ts +5 -0
  81. package/dist/components/fallback/default.d.ts.map +1 -0
  82. package/dist/components/fallback/default.js +10 -0
  83. package/dist/components/fallback/default.js.map +1 -0
  84. package/dist/components/fallback/dots.d.ts +7 -0
  85. package/dist/components/fallback/dots.d.ts.map +1 -0
  86. package/dist/components/fallback/dots.js +78 -0
  87. package/dist/components/fallback/dots.js.map +1 -0
  88. package/dist/components/fallback/row.d.ts +5 -0
  89. package/dist/components/fallback/row.d.ts.map +1 -0
  90. package/dist/components/fallback/row.js +14 -0
  91. package/dist/components/fallback/row.js.map +1 -0
  92. package/dist/components/for/for.d.ts +35 -0
  93. package/dist/components/for/for.d.ts.map +1 -0
  94. package/dist/components/for/for.js +44 -0
  95. package/dist/components/for/for.js.map +1 -0
  96. package/dist/components/index.d.ts +9 -0
  97. package/dist/components/index.d.ts.map +1 -0
  98. package/dist/components/index.js +9 -0
  99. package/dist/components/index.js.map +1 -0
  100. package/dist/components/menu/menu.d.ts +14 -0
  101. package/dist/components/menu/menu.d.ts.map +1 -0
  102. package/dist/components/menu/menu.js +58 -0
  103. package/dist/components/menu/menu.js.map +1 -0
  104. package/dist/components/progress-tracker/progress-tracker.d.ts +18 -0
  105. package/dist/components/progress-tracker/progress-tracker.d.ts.map +1 -0
  106. package/dist/components/progress-tracker/progress-tracker.js +204 -0
  107. package/dist/components/progress-tracker/progress-tracker.js.map +1 -0
  108. package/dist/components/router-content/router-content.d.ts +14 -0
  109. package/dist/components/router-content/router-content.d.ts.map +1 -0
  110. package/dist/components/router-content/router-content.js +17 -0
  111. package/dist/components/router-content/router-content.js.map +1 -0
  112. package/dist/components/side-bar-frame/side-bar-frame.d.ts +21 -0
  113. package/dist/components/side-bar-frame/side-bar-frame.d.ts.map +1 -0
  114. package/dist/components/side-bar-frame/side-bar-frame.js +87 -0
  115. package/dist/components/side-bar-frame/side-bar-frame.js.map +1 -0
  116. package/dist/components/top-bar-frame/top-bar-frame.d.ts +16 -0
  117. package/dist/components/top-bar-frame/top-bar-frame.d.ts.map +1 -0
  118. package/dist/components/top-bar-frame/top-bar-frame.js +89 -0
  119. package/dist/components/top-bar-frame/top-bar-frame.js.map +1 -0
  120. package/dist/dara_core-0.4.8-py3-none-any.whl +0 -0
  121. package/dist/devtools/backend-errors/backend-errors-ctx.d.ts +17 -0
  122. package/dist/devtools/backend-errors/backend-errors-ctx.d.ts.map +1 -0
  123. package/dist/devtools/backend-errors/backend-errors-ctx.js +37 -0
  124. package/dist/devtools/backend-errors/backend-errors-ctx.js.map +1 -0
  125. package/dist/devtools/backend-errors/backend-errors.d.ts +6 -0
  126. package/dist/devtools/backend-errors/backend-errors.d.ts.map +1 -0
  127. package/dist/devtools/backend-errors/backend-errors.js +57 -0
  128. package/dist/devtools/backend-errors/backend-errors.js.map +1 -0
  129. package/dist/devtools/backend-errors/error-display.d.ts +22 -0
  130. package/dist/devtools/backend-errors/error-display.d.ts.map +1 -0
  131. package/dist/devtools/backend-errors/error-display.js +101 -0
  132. package/dist/devtools/backend-errors/error-display.js.map +1 -0
  133. package/dist/devtools/backend-errors/index.d.ts +3 -0
  134. package/dist/devtools/backend-errors/index.d.ts.map +1 -0
  135. package/dist/devtools/backend-errors/index.js +3 -0
  136. package/dist/devtools/backend-errors/index.js.map +1 -0
  137. package/dist/devtools/devtools-content.d.ts +12 -0
  138. package/dist/devtools/devtools-content.d.ts.map +1 -0
  139. package/dist/devtools/devtools-content.js +73 -0
  140. package/dist/devtools/devtools-content.js.map +1 -0
  141. package/dist/devtools/devtools-context.d.ts +7 -0
  142. package/dist/devtools/devtools-context.d.ts.map +1 -0
  143. package/dist/devtools/devtools-context.js +9 -0
  144. package/dist/devtools/devtools-context.js.map +1 -0
  145. package/dist/devtools/devtools-wrapper.d.ts +8 -0
  146. package/dist/devtools/devtools-wrapper.d.ts.map +1 -0
  147. package/dist/devtools/devtools-wrapper.js +64 -0
  148. package/dist/devtools/devtools-wrapper.js.map +1 -0
  149. package/dist/devtools/devtools.d.ts +5 -0
  150. package/dist/devtools/devtools.d.ts.map +1 -0
  151. package/dist/devtools/devtools.js +10 -0
  152. package/dist/devtools/devtools.js.map +1 -0
  153. package/dist/devtools/floating-button.d.ts +23 -0
  154. package/dist/devtools/floating-button.d.ts.map +1 -0
  155. package/dist/devtools/floating-button.js +94 -0
  156. package/dist/devtools/floating-button.js.map +1 -0
  157. package/dist/devtools/index.d.ts +2 -0
  158. package/dist/devtools/index.d.ts.map +1 -0
  159. package/dist/devtools/index.js +2 -0
  160. package/dist/devtools/index.js.map +1 -0
  161. package/dist/devtools/resizer.d.ts +18 -0
  162. package/dist/devtools/resizer.d.ts.map +1 -0
  163. package/dist/devtools/resizer.js +49 -0
  164. package/dist/devtools/resizer.js.map +1 -0
  165. package/dist/devtools/use-move.d.ts +21 -0
  166. package/dist/devtools/use-move.d.ts.map +1 -0
  167. package/dist/devtools/use-move.js +56 -0
  168. package/dist/devtools/use-move.js.map +1 -0
  169. package/dist/index.css +95 -0
  170. package/dist/index.d.ts +17 -0
  171. package/dist/index.d.ts.map +1 -0
  172. package/dist/index.js +14 -0
  173. package/dist/index.js.map +1 -0
  174. package/dist/jest-setup.d.ts +2 -0
  175. package/dist/jest-setup.d.ts.map +1 -0
  176. package/dist/jest-setup.js +18 -0
  177. package/dist/jest-setup.js.map +1 -0
  178. package/dist/pages/error-page.d.ts +3 -0
  179. package/dist/pages/error-page.d.ts.map +1 -0
  180. package/dist/pages/error-page.js +32 -0
  181. package/dist/pages/error-page.js.map +1 -0
  182. package/dist/pages/sso-callback-page.d.ts +6 -0
  183. package/dist/pages/sso-callback-page.d.ts.map +1 -0
  184. package/dist/pages/sso-callback-page.js +8 -0
  185. package/dist/pages/sso-callback-page.js.map +1 -0
  186. package/dist/run.d.ts +22 -0
  187. package/dist/run.d.ts.map +1 -0
  188. package/dist/run.js +40 -0
  189. package/dist/run.js.map +1 -0
  190. package/dist/shared/center/center.d.ts +5 -0
  191. package/dist/shared/center/center.d.ts.map +1 -0
  192. package/dist/shared/center/center.js +15 -0
  193. package/dist/shared/center/center.js.map +1 -0
  194. package/dist/shared/context/direction-context.d.ts +6 -0
  195. package/dist/shared/context/direction-context.d.ts.map +1 -0
  196. package/dist/shared/context/direction-context.js +4 -0
  197. package/dist/shared/context/direction-context.js.map +1 -0
  198. package/dist/shared/context/display-context.d.ts +13 -0
  199. package/dist/shared/context/display-context.d.ts.map +1 -0
  200. package/dist/shared/context/display-context.js +4 -0
  201. package/dist/shared/context/display-context.js.map +1 -0
  202. package/dist/shared/context/fallback-context.d.ts +11 -0
  203. package/dist/shared/context/fallback-context.d.ts.map +1 -0
  204. package/dist/shared/context/fallback-context.js +4 -0
  205. package/dist/shared/context/fallback-context.js.map +1 -0
  206. package/dist/shared/context/global-task-context.d.ts +40 -0
  207. package/dist/shared/context/global-task-context.d.ts.map +1 -0
  208. package/dist/shared/context/global-task-context.js +81 -0
  209. package/dist/shared/context/global-task-context.js.map +1 -0
  210. package/dist/shared/context/importers-context.d.ts +6 -0
  211. package/dist/shared/context/importers-context.d.ts.map +1 -0
  212. package/dist/shared/context/importers-context.js +4 -0
  213. package/dist/shared/context/importers-context.js.map +1 -0
  214. package/dist/shared/context/index.d.ts +10 -0
  215. package/dist/shared/context/index.d.ts.map +1 -0
  216. package/dist/shared/context/index.js +10 -0
  217. package/dist/shared/context/index.js.map +1 -0
  218. package/dist/shared/context/registries-context.d.ts +20 -0
  219. package/dist/shared/context/registries-context.d.ts.map +1 -0
  220. package/dist/shared/context/registries-context.js +8 -0
  221. package/dist/shared/context/registries-context.js.map +1 -0
  222. package/dist/shared/context/request-extras-context.d.ts +33 -0
  223. package/dist/shared/context/request-extras-context.d.ts.map +1 -0
  224. package/dist/shared/context/request-extras-context.js +55 -0
  225. package/dist/shared/context/request-extras-context.js.map +1 -0
  226. package/dist/shared/context/variable-context.d.ts +10 -0
  227. package/dist/shared/context/variable-context.d.ts.map +1 -0
  228. package/dist/shared/context/variable-context.js +4 -0
  229. package/dist/shared/context/variable-context.js.map +1 -0
  230. package/dist/shared/context/websocket-context.d.ts +7 -0
  231. package/dist/shared/context/websocket-context.d.ts.map +1 -0
  232. package/dist/shared/context/websocket-context.js +4 -0
  233. package/dist/shared/context/websocket-context.js.map +1 -0
  234. package/dist/shared/dynamic-component/clean-props.d.ts +6 -0
  235. package/dist/shared/dynamic-component/clean-props.d.ts.map +1 -0
  236. package/dist/shared/dynamic-component/clean-props.js +13 -0
  237. package/dist/shared/dynamic-component/clean-props.js.map +1 -0
  238. package/dist/shared/dynamic-component/dynamic-component.d.ts +16 -0
  239. package/dist/shared/dynamic-component/dynamic-component.d.ts.map +1 -0
  240. package/dist/shared/dynamic-component/dynamic-component.js +252 -0
  241. package/dist/shared/dynamic-component/dynamic-component.js.map +1 -0
  242. package/dist/shared/error-handling/error-display.d.ts +8 -0
  243. package/dist/shared/error-handling/error-display.d.ts.map +1 -0
  244. package/dist/shared/error-handling/error-display.js +94 -0
  245. package/dist/shared/error-handling/error-display.js.map +1 -0
  246. package/dist/shared/error-handling/index.d.ts +3 -0
  247. package/dist/shared/error-handling/index.d.ts.map +1 -0
  248. package/dist/shared/error-handling/index.js +3 -0
  249. package/dist/shared/error-handling/index.js.map +1 -0
  250. package/dist/shared/error-handling/types.d.ts +11 -0
  251. package/dist/shared/error-handling/types.d.ts.map +1 -0
  252. package/dist/shared/error-handling/types.js +9 -0
  253. package/dist/shared/error-handling/types.js.map +1 -0
  254. package/dist/shared/event-bus/event-bus.d.ts +27 -0
  255. package/dist/shared/event-bus/event-bus.d.ts.map +1 -0
  256. package/dist/shared/event-bus/event-bus.js +58 -0
  257. package/dist/shared/event-bus/event-bus.js.map +1 -0
  258. package/dist/shared/global-state-store.d.ts +54 -0
  259. package/dist/shared/global-state-store.d.ts.map +1 -0
  260. package/dist/shared/global-state-store.js +168 -0
  261. package/dist/shared/global-state-store.js.map +1 -0
  262. package/dist/shared/index.d.ts +12 -0
  263. package/dist/shared/index.d.ts.map +1 -0
  264. package/dist/shared/index.js +10 -0
  265. package/dist/shared/index.js.map +1 -0
  266. package/dist/shared/interactivity/data-variable.d.ts +78 -0
  267. package/dist/shared/interactivity/data-variable.d.ts.map +1 -0
  268. package/dist/shared/interactivity/data-variable.js +218 -0
  269. package/dist/shared/interactivity/data-variable.js.map +1 -0
  270. package/dist/shared/interactivity/derived-variable.d.ts +160 -0
  271. package/dist/shared/interactivity/derived-variable.d.ts.map +1 -0
  272. package/dist/shared/interactivity/derived-variable.js +446 -0
  273. package/dist/shared/interactivity/derived-variable.js.map +1 -0
  274. package/dist/shared/interactivity/filtering.d.ts +9 -0
  275. package/dist/shared/interactivity/filtering.d.ts.map +1 -0
  276. package/dist/shared/interactivity/filtering.js +20 -0
  277. package/dist/shared/interactivity/filtering.js.map +1 -0
  278. package/dist/shared/interactivity/index.d.ts +10 -0
  279. package/dist/shared/interactivity/index.d.ts.map +1 -0
  280. package/dist/shared/interactivity/index.js +9 -0
  281. package/dist/shared/interactivity/index.js.map +1 -0
  282. package/dist/shared/interactivity/internal.d.ts +9 -0
  283. package/dist/shared/interactivity/internal.d.ts.map +1 -0
  284. package/dist/shared/interactivity/internal.js +11 -0
  285. package/dist/shared/interactivity/internal.js.map +1 -0
  286. package/dist/shared/interactivity/nested.d.ts +16 -0
  287. package/dist/shared/interactivity/nested.d.ts.map +1 -0
  288. package/dist/shared/interactivity/nested.js +54 -0
  289. package/dist/shared/interactivity/nested.js.map +1 -0
  290. package/dist/shared/interactivity/persistence.d.ts +43 -0
  291. package/dist/shared/interactivity/persistence.d.ts.map +1 -0
  292. package/dist/shared/interactivity/persistence.js +215 -0
  293. package/dist/shared/interactivity/persistence.js.map +1 -0
  294. package/dist/shared/interactivity/plain-variable.d.ts +17 -0
  295. package/dist/shared/interactivity/plain-variable.d.ts.map +1 -0
  296. package/dist/shared/interactivity/plain-variable.js +222 -0
  297. package/dist/shared/interactivity/plain-variable.js.map +1 -0
  298. package/dist/shared/interactivity/resolve-value.d.ts +13 -0
  299. package/dist/shared/interactivity/resolve-value.d.ts.map +1 -0
  300. package/dist/shared/interactivity/resolve-value.js +36 -0
  301. package/dist/shared/interactivity/resolve-value.js.map +1 -0
  302. package/dist/shared/interactivity/resolve-variable.d.ts +18 -0
  303. package/dist/shared/interactivity/resolve-variable.d.ts.map +1 -0
  304. package/dist/shared/interactivity/resolve-variable.js +46 -0
  305. package/dist/shared/interactivity/resolve-variable.js.map +1 -0
  306. package/dist/shared/interactivity/store.d.ts +76 -0
  307. package/dist/shared/interactivity/store.d.ts.map +1 -0
  308. package/dist/shared/interactivity/store.js +99 -0
  309. package/dist/shared/interactivity/store.js.map +1 -0
  310. package/dist/shared/interactivity/triggers.d.ts +31 -0
  311. package/dist/shared/interactivity/triggers.d.ts.map +1 -0
  312. package/dist/shared/interactivity/triggers.js +105 -0
  313. package/dist/shared/interactivity/triggers.js.map +1 -0
  314. package/dist/shared/interactivity/url-variable.d.ts +12 -0
  315. package/dist/shared/interactivity/url-variable.d.ts.map +1 -0
  316. package/dist/shared/interactivity/url-variable.js +27 -0
  317. package/dist/shared/interactivity/url-variable.js.map +1 -0
  318. package/dist/shared/interactivity/use-any-variable.d.ts +8 -0
  319. package/dist/shared/interactivity/use-any-variable.d.ts.map +1 -0
  320. package/dist/shared/interactivity/use-any-variable.js +39 -0
  321. package/dist/shared/interactivity/use-any-variable.js.map +1 -0
  322. package/dist/shared/interactivity/use-data-variable.d.ts +18 -0
  323. package/dist/shared/interactivity/use-data-variable.d.ts.map +1 -0
  324. package/dist/shared/interactivity/use-data-variable.js +58 -0
  325. package/dist/shared/interactivity/use-data-variable.js.map +1 -0
  326. package/dist/shared/interactivity/use-refresh-selector.d.ts +5 -0
  327. package/dist/shared/interactivity/use-refresh-selector.d.ts.map +1 -0
  328. package/dist/shared/interactivity/use-refresh-selector.js +20 -0
  329. package/dist/shared/interactivity/use-refresh-selector.js.map +1 -0
  330. package/dist/shared/interactivity/use-server-component.d.ts +24 -0
  331. package/dist/shared/interactivity/use-server-component.d.ts.map +1 -0
  332. package/dist/shared/interactivity/use-server-component.js +256 -0
  333. package/dist/shared/interactivity/use-server-component.js.map +1 -0
  334. package/dist/shared/interactivity/use-variable-state.d.ts +9 -0
  335. package/dist/shared/interactivity/use-variable-state.d.ts.map +1 -0
  336. package/dist/shared/interactivity/use-variable-state.js +26 -0
  337. package/dist/shared/interactivity/use-variable-state.js.map +1 -0
  338. package/dist/shared/interactivity/use-variable-value.d.ts +33 -0
  339. package/dist/shared/interactivity/use-variable-value.d.ts.map +1 -0
  340. package/dist/shared/interactivity/use-variable-value.js +94 -0
  341. package/dist/shared/interactivity/use-variable-value.js.map +1 -0
  342. package/dist/shared/interactivity/use-variable.d.ts +12 -0
  343. package/dist/shared/interactivity/use-variable.d.ts.map +1 -0
  344. package/dist/shared/interactivity/use-variable.js +84 -0
  345. package/dist/shared/interactivity/use-variable.js.map +1 -0
  346. package/dist/shared/private-route/private-route.d.ts +19 -0
  347. package/dist/shared/private-route/private-route.d.ts.map +1 -0
  348. package/dist/shared/private-route/private-route.js +35 -0
  349. package/dist/shared/private-route/private-route.js.map +1 -0
  350. package/dist/shared/template-root/dynamic-context.d.ts +9 -0
  351. package/dist/shared/template-root/dynamic-context.d.ts.map +1 -0
  352. package/dist/shared/template-root/dynamic-context.js +29 -0
  353. package/dist/shared/template-root/dynamic-context.js.map +1 -0
  354. package/dist/shared/template-root/template-root.d.ts +12 -0
  355. package/dist/shared/template-root/template-root.d.ts.map +1 -0
  356. package/dist/shared/template-root/template-root.js +94 -0
  357. package/dist/shared/template-root/template-root.js.map +1 -0
  358. package/dist/shared/utils/clean-session-cache.d.ts +9 -0
  359. package/dist/shared/utils/clean-session-cache.d.ts.map +1 -0
  360. package/dist/shared/utils/clean-session-cache.js +19 -0
  361. package/dist/shared/utils/clean-session-cache.js.map +1 -0
  362. package/dist/shared/utils/embed.d.ts +22 -0
  363. package/dist/shared/utils/embed.d.ts.map +1 -0
  364. package/dist/shared/utils/embed.js +43 -0
  365. package/dist/shared/utils/embed.js.map +1 -0
  366. package/dist/shared/utils/get-icon.d.ts +9 -0
  367. package/dist/shared/utils/get-icon.d.ts.map +1 -0
  368. package/dist/shared/utils/get-icon.js +30 -0
  369. package/dist/shared/utils/get-icon.js.map +1 -0
  370. package/dist/shared/utils/hashing.d.ts +14 -0
  371. package/dist/shared/utils/hashing.d.ts.map +1 -0
  372. package/dist/shared/utils/hashing.js +26 -0
  373. package/dist/shared/utils/hashing.js.map +1 -0
  374. package/dist/shared/utils/index.d.ts +19 -0
  375. package/dist/shared/utils/index.d.ts.map +1 -0
  376. package/dist/shared/utils/index.js +17 -0
  377. package/dist/shared/utils/index.js.map +1 -0
  378. package/dist/shared/utils/inject-css.d.ts +12 -0
  379. package/dist/shared/utils/inject-css.d.ts.map +1 -0
  380. package/dist/shared/utils/inject-css.js +25 -0
  381. package/dist/shared/utils/inject-css.js.map +1 -0
  382. package/dist/shared/utils/is-js-component.d.ts +9 -0
  383. package/dist/shared/utils/is-js-component.d.ts.map +1 -0
  384. package/dist/shared/utils/is-js-component.js +11 -0
  385. package/dist/shared/utils/is-js-component.js.map +1 -0
  386. package/dist/shared/utils/normalization.d.ts +19 -0
  387. package/dist/shared/utils/normalization.d.ts.map +1 -0
  388. package/dist/shared/utils/normalization.js +121 -0
  389. package/dist/shared/utils/normalization.js.map +1 -0
  390. package/dist/shared/utils/resolve-theme.d.ts +9 -0
  391. package/dist/shared/utils/resolve-theme.d.ts.map +1 -0
  392. package/dist/shared/utils/resolve-theme.js +28 -0
  393. package/dist/shared/utils/resolve-theme.js.map +1 -0
  394. package/dist/shared/utils/templating.d.ts +24 -0
  395. package/dist/shared/utils/templating.d.ts.map +1 -0
  396. package/dist/shared/utils/templating.js +67 -0
  397. package/dist/shared/utils/templating.js.map +1 -0
  398. package/dist/shared/utils/use-action-registry.d.ts +11 -0
  399. package/dist/shared/utils/use-action-registry.d.ts.map +1 -0
  400. package/dist/shared/utils/use-action-registry.js +18 -0
  401. package/dist/shared/utils/use-action-registry.js.map +1 -0
  402. package/dist/shared/utils/use-action.d.ts +34 -0
  403. package/dist/shared/utils/use-action.d.ts.map +1 -0
  404. package/dist/shared/utils/use-action.js +314 -0
  405. package/dist/shared/utils/use-action.js.map +1 -0
  406. package/dist/shared/utils/use-component-registry.d.ts +11 -0
  407. package/dist/shared/utils/use-component-registry.d.ts.map +1 -0
  408. package/dist/shared/utils/use-component-registry.js +57 -0
  409. package/dist/shared/utils/use-component-registry.js.map +1 -0
  410. package/dist/shared/utils/use-component-styles.d.ts +24 -0
  411. package/dist/shared/utils/use-component-styles.d.ts.map +1 -0
  412. package/dist/shared/utils/use-component-styles.js +69 -0
  413. package/dist/shared/utils/use-component-styles.js.map +1 -0
  414. package/dist/shared/utils/use-defer-loadable.d.ts +8 -0
  415. package/dist/shared/utils/use-defer-loadable.d.ts.map +1 -0
  416. package/dist/shared/utils/use-defer-loadable.js +44 -0
  417. package/dist/shared/utils/use-defer-loadable.js.map +1 -0
  418. package/dist/shared/utils/use-interval.d.ts +9 -0
  419. package/dist/shared/utils/use-interval.d.ts.map +1 -0
  420. package/dist/shared/utils/use-interval.js +19 -0
  421. package/dist/shared/utils/use-interval.js.map +1 -0
  422. package/dist/shared/utils/use-previous.d.ts +10 -0
  423. package/dist/shared/utils/use-previous.d.ts.map +1 -0
  424. package/dist/shared/utils/use-previous.js +17 -0
  425. package/dist/shared/utils/use-previous.js.map +1 -0
  426. package/dist/shared/utils/use-url-sync.d.ts +20 -0
  427. package/dist/shared/utils/use-url-sync.d.ts.map +1 -0
  428. package/dist/shared/utils/use-url-sync.js +68 -0
  429. package/dist/shared/utils/use-url-sync.js.map +1 -0
  430. package/dist/shared/utils/use-window-title.d.ts +3 -0
  431. package/dist/shared/utils/use-window-title.d.ts.map +1 -0
  432. package/dist/shared/utils/use-window-title.js +14 -0
  433. package/dist/shared/utils/use-window-title.js.map +1 -0
  434. package/dist/shared/variable-state-provider/variable-state-provider.d.ts +10 -0
  435. package/dist/shared/variable-state-provider/variable-state-provider.d.ts.map +1 -0
  436. package/dist/shared/variable-state-provider/variable-state-provider.js +29 -0
  437. package/dist/shared/variable-state-provider/variable-state-provider.js.map +1 -0
  438. package/dist/shared/wrapper/wrapper.d.ts +7 -0
  439. package/dist/shared/wrapper/wrapper.d.ts.map +1 -0
  440. package/dist/shared/wrapper/wrapper.js +14 -0
  441. package/dist/shared/wrapper/wrapper.js.map +1 -0
  442. package/dist/types/auth.d.ts +15 -0
  443. package/dist/types/auth.d.ts.map +1 -0
  444. package/dist/types/auth.js +6 -0
  445. package/dist/types/auth.js.map +1 -0
  446. package/dist/types/core.d.ts +440 -0
  447. package/dist/types/core.d.ts.map +1 -0
  448. package/dist/types/core.js +22 -0
  449. package/dist/types/core.js.map +1 -0
  450. package/dist/types/index.d.ts +7 -0
  451. package/dist/types/index.d.ts.map +1 -0
  452. package/dist/types/index.js +4 -0
  453. package/dist/types/index.js.map +1 -0
  454. package/dist/types/utils.d.ts +56 -0
  455. package/dist/types/utils.d.ts.map +1 -0
  456. package/dist/types/utils.js +93 -0
  457. package/dist/types/utils.js.map +1 -0
  458. package/dist/umd/dara.core.umd.js +86508 -0
  459. package/dist/umd/style.css +848 -0
  460. package/dist/utils.d.ts +11 -0
  461. package/dist/utils.d.ts.map +1 -0
  462. package/dist/utils.js +20 -0
  463. package/dist/utils.js.map +1 -0
  464. package/package.json +121 -0
@@ -0,0 +1,43 @@
1
+ import * as React from 'react';
2
+ import { AtomEffect } from 'recoil';
3
+ import { WebSocketClientInterface } from '../../api';
4
+ import { RequestExtrasSerializable } from '../../api/http';
5
+ import { GlobalTaskContext } from '../../shared/context/global-task-context';
6
+ import { SingleVariable } from '../../types';
7
+ import { PersistenceStore } from '../../types/core';
8
+ /**
9
+ * Get the session key used to persist a variable value
10
+ *
11
+ * @param uid uid of the variable to persist
12
+ */
13
+ export declare function getSessionKey(uid: string): string;
14
+ interface StoreSync {
15
+ (props: {
16
+ children: React.ReactNode;
17
+ }): JSX.Element;
18
+ }
19
+ interface Effect<T = any> {
20
+ (variable: SingleVariable<T>, requestExtras: RequestExtrasSerializable, wsClient: WebSocketClientInterface, taskContext: GlobalTaskContext): AtomEffect<T>;
21
+ }
22
+ export declare const STORES: Record<string, {
23
+ effect: Effect;
24
+ sync: StoreSync;
25
+ }>;
26
+ /**
27
+ * Get the effect creator function for a given variable
28
+ *
29
+ * Looks up correct definition based on variable.store type
30
+ *
31
+ * @param variable variable to get effect for
32
+ */
33
+ export declare function getEffect(variable: SingleVariable<any, PersistenceStore>): Effect | null;
34
+ /**
35
+ * Wrapper for the store providers.
36
+ *
37
+ * Applies all STORES around the children.
38
+ */
39
+ export declare function StoreProviders({ children }: {
40
+ children: React.ReactNode;
41
+ }): JSX.Element;
42
+ export {};
43
+ //# sourceMappingURL=persistence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/persistence.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAKpC,OAAO,EAAE,wBAAwB,EAAoB,MAAM,OAAO,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAW,MAAM,YAAY,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAqB,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAiC,gBAAgB,EAAE,MAAM,cAAc,CAAC;AA6G/E;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOjD;AAuGD,UAAU,SAAS;IACf,CAAC,KAAK,EAAE;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,GAAG,GAAG,CAAC,OAAO,CAAC;CACvD;AAED,UAAU,MAAM,CAAC,CAAC,GAAG,GAAG;IACpB,CACI,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAC3B,aAAa,EAAE,yBAAyB,EACxC,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,iBAAiB,GAC/B,UAAU,CAAC,CAAC,CAAC,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,EAAE,MAAM,CACvB,MAAM,EACN;IACI,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;CACnB,CAUJ,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,cAAc,CAAC,GAAG,EAAE,gBAAgB,CAAC,GAAG,MAAM,GAAG,IAAI,CAQxF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CAOvF"}
@@ -0,0 +1,215 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { mixed } from '@recoiljs/refine';
12
+ import * as React from 'react';
13
+ import { RecoilSync, syncEffect } from 'recoil-sync';
14
+ import { validateResponse } from '@darajs/ui-utils';
15
+ import { handleAuthErrors } from '../../api';
16
+ import { request } from '../../api/http';
17
+ import { getSessionToken } from '../../auth/use-session-token';
18
+ import { isEmbedded } from '../../shared/utils/embed';
19
+ import { isDerivedVariable } from '../../types';
20
+ import { WebSocketCtx } from '../context';
21
+ // eslint-disable-next-line import/no-cycle
22
+ import { getOrRegisterDerivedVariableValue } from './internal';
23
+ /**
24
+ * Global map to store the extras for each store uid
25
+ */
26
+ const STORE_EXTRAS_MAP = new Map();
27
+ /**
28
+ * RecoilSync implementation for BackendStore
29
+ *
30
+ * - read: GET from /api/core/store/:store_uid
31
+ * - write: POST to /api/core/store
32
+ * - listen: subscribed to `backendStoreMessages$` on WsClient
33
+ */
34
+ function BackendStoreSync({ children }) {
35
+ const { client } = React.useContext(WebSocketCtx);
36
+ const getStoreValue = React.useCallback((itemKey) => __awaiter(this, void 0, void 0, function* () {
37
+ const serializableExtras = STORE_EXTRAS_MAP.get(itemKey);
38
+ const response = yield request(`/api/core/store/${itemKey}`, {}, serializableExtras.extras);
39
+ yield handleAuthErrors(response, true);
40
+ yield validateResponse(response, `Failed to fetch the store value for key: ${itemKey}`);
41
+ const val = yield response.json();
42
+ return val;
43
+ }), []);
44
+ const syncStoreValues = React.useCallback((_a) => __awaiter(this, [_a], void 0, function* ({ diff }) {
45
+ // keep track of extras -> diff to send each set of extras as a separate request
46
+ const extrasMap = new Map();
47
+ for (const [itemKey, value] of diff.entries()) {
48
+ const extras = STORE_EXTRAS_MAP.get(itemKey);
49
+ if (!extrasMap.has(extras)) {
50
+ extrasMap.set(extras, {});
51
+ }
52
+ // store the value in the extras map
53
+ extrasMap.get(extras)[itemKey] = value;
54
+ }
55
+ function sendRequest(serializableExtras, storeDiff) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const response = yield request(`/api/core/store`, { body: JSON.stringify(storeDiff), method: 'POST' }, serializableExtras.extras);
58
+ yield handleAuthErrors(response, true);
59
+ yield validateResponse(response, `Failed to sync the store values`);
60
+ });
61
+ }
62
+ // Send a request with each different set of extras
63
+ yield Promise.allSettled(Array.from(extrasMap.entries()).map(([serializableExtras, storeDiff]) => sendRequest(serializableExtras, storeDiff)));
64
+ }), []);
65
+ const listenToStoreChanges = React.useCallback(({ updateItem }) => {
66
+ if (!client) {
67
+ return;
68
+ }
69
+ const sub = client.backendStoreMessages$().subscribe((message) => {
70
+ updateItem(message.store_uid, message.value);
71
+ });
72
+ return () => sub.unsubscribe();
73
+ }, [client]);
74
+ return (_jsx(RecoilSync, { listen: listenToStoreChanges, read: getStoreValue, storeKey: "BackendStore", write: syncStoreValues, children: children }));
75
+ }
76
+ /**
77
+ * Create a syncEffect for BackendStore
78
+ *
79
+ * @param variable variable to create the atom effect for
80
+ * @param requestExtras extras object to create the effect for; used to pass through correct extras to write requests
81
+ */
82
+ function backendStoreEffect(variable, requestExtras) {
83
+ // Assumption: the set of extras is unique to the store, i.e. the variable will not be used under different sets of extras
84
+ STORE_EXTRAS_MAP.set(variable.store.uid, requestExtras);
85
+ return syncEffect({
86
+ /** Use store uid as the unique identifier */
87
+ itemKey: variable.store.uid,
88
+ refine: mixed(),
89
+ storeKey: 'BackendStore',
90
+ });
91
+ }
92
+ /**
93
+ * Get the session key used to persist a variable value
94
+ *
95
+ * @param uid uid of the variable to persist
96
+ */
97
+ export function getSessionKey(uid) {
98
+ // If we're within an IFrame (Jupyter)
99
+ if (isEmbedded()) {
100
+ return `dara-session-${window.frameElement.dataset.daraPageId}-var-${uid}`;
101
+ }
102
+ return `dara-session-${getSessionToken()}-var-${uid}`;
103
+ }
104
+ /**
105
+ * RecoilSync implementation for BrowserStore
106
+ *
107
+ * localStorage keys are generated via @see getSessionKey
108
+ *
109
+ * - read: read from localStorage
110
+ * - write: write to localStorage
111
+ * - listen: subscribe to 'storage' event for cross-tab or cross-window syncing
112
+ */
113
+ function BrowserStoreSync({ children }) {
114
+ const getStoreValue = React.useCallback((itemKey) => {
115
+ var _a;
116
+ const key = getSessionKey(itemKey);
117
+ return JSON.parse((_a = localStorage.getItem(key)) !== null && _a !== void 0 ? _a : 'null');
118
+ }, []);
119
+ const syncStoreValues = React.useCallback(({ diff }) => {
120
+ for (const [itemKey, value] of diff.entries()) {
121
+ const key = getSessionKey(itemKey);
122
+ localStorage.setItem(key, JSON.stringify(value));
123
+ }
124
+ }, []);
125
+ /**
126
+ * Listen to storage events and update the store when a change is detected.
127
+ *
128
+ * This is useful to keep the store in sync across tabs.
129
+ */
130
+ const listenToStoreChanges = React.useCallback(({ updateItem }) => {
131
+ const listener = (e) => {
132
+ var _a;
133
+ if (e.storageArea === localStorage) {
134
+ if (e.key) {
135
+ // check if the key matches our dara-session key
136
+ const match = e.key.match(/^dara-session-(.*)-var-(.*)$/);
137
+ if (match) {
138
+ const [, sessionToken, uid] = match;
139
+ if (sessionToken === getSessionToken()) {
140
+ updateItem(uid, JSON.parse((_a = e.newValue) !== null && _a !== void 0 ? _a : 'null'));
141
+ }
142
+ }
143
+ }
144
+ }
145
+ };
146
+ window.addEventListener('storage', listener);
147
+ return () => {
148
+ window.removeEventListener('storage', listener);
149
+ };
150
+ }, []);
151
+ return (_jsx(RecoilSync, { listen: listenToStoreChanges, read: getStoreValue, storeKey: "BrowserStore", write: syncStoreValues, children: children }));
152
+ }
153
+ /**
154
+ * Create a syncEffect for BrowserStore
155
+ *
156
+ * @param variable variable to create effect for
157
+ */
158
+ function localStorageEffect(variable, extrasSerializable, wsClient, taskContext) {
159
+ let firstRun = false;
160
+ return syncEffect({
161
+ itemKey: variable.uid,
162
+ read: ({ read }) => {
163
+ const readValue = read(variable.uid);
164
+ if (!firstRun) {
165
+ firstRun = true;
166
+ // during first run fall back to the default value if the read value is null
167
+ // as local storage might not have been initialized yet
168
+ if (!readValue) {
169
+ const isDefaultDerived = isDerivedVariable(variable.default);
170
+ return isDefaultDerived ?
171
+ getOrRegisterDerivedVariableValue(variable.default, wsClient, taskContext, extrasSerializable.extras)
172
+ : variable.default;
173
+ }
174
+ }
175
+ return readValue;
176
+ },
177
+ refine: mixed(),
178
+ storeKey: 'BrowserStore',
179
+ });
180
+ }
181
+ export const STORES = {
182
+ BackendStore: {
183
+ effect: backendStoreEffect,
184
+ sync: BackendStoreSync,
185
+ },
186
+ BrowserStore: {
187
+ effect: localStorageEffect,
188
+ sync: BrowserStoreSync,
189
+ },
190
+ };
191
+ /**
192
+ * Get the effect creator function for a given variable
193
+ *
194
+ * Looks up correct definition based on variable.store type
195
+ *
196
+ * @param variable variable to get effect for
197
+ */
198
+ export function getEffect(variable) {
199
+ var _a, _b;
200
+ const storeName = (_a = variable.store) === null || _a === void 0 ? void 0 : _a.__typename;
201
+ if (!storeName) {
202
+ return null;
203
+ }
204
+ return (_b = STORES[storeName].effect) !== null && _b !== void 0 ? _b : null;
205
+ }
206
+ /**
207
+ * Wrapper for the store providers.
208
+ *
209
+ * Applies all STORES around the children.
210
+ */
211
+ export function StoreProviders({ children }) {
212
+ // this could be a loop if STORES is dynamically extensible but static for now
213
+ return (_jsx(BackendStoreSync, { children: _jsx(BrowserStoreSync, { children: children }) }));
214
+ }
215
+ //# sourceMappingURL=persistence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"persistence.js","sourceRoot":"","sources":["../../../js/shared/interactivity/persistence.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAA2B,UAAU,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAA4B,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,EAA6B,OAAO,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAkB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,2CAA2C;AAC3C,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAE/D;;GAEG;AACH,MAAM,gBAA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AAI,IAAI,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAiC;IACtE,8EAA8E;IAC9E,OAAO,CACH,KAAC,gBAAgB,cACb,KAAC,gBAAgB,cAAE,QAAQ,GAAoB,GAChC,CACtB,CAAC;AACN,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { RecoilState } from 'recoil';
2
+ import { WebSocketClientInterface } from '../../api';
3
+ import { RequestExtras } from '../../api/http';
4
+ import { GlobalTaskContext } from '../../shared/context/global-task-context';
5
+ import { SingleVariable } from '../../types';
6
+ /**
7
+ * Get a plain variable from the atom or selector registry (based on nested property),
8
+ * registering it if not already registered
9
+ *
10
+ * @param variable variable to register
11
+ * @param wsClient websocket client
12
+ * @param taskContext task context
13
+ * @param search search query
14
+ * @param extras request extras to be merged into the options
15
+ */
16
+ export declare function getOrRegisterPlainVariable<T>(variable: SingleVariable<T>, wsClient: WebSocketClientInterface, taskContext: GlobalTaskContext, extras: RequestExtras): RecoilState<T>;
17
+ //# sourceMappingURL=plain-variable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain-variable.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/plain-variable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,WAAW,EAA8B,MAAM,QAAQ,CAAC;AAG7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,aAAa,EAA6B,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAEzE,OAAO,EAAmB,cAAc,EAAqB,MAAM,SAAS,CAAC;AAqG7E;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,CAAC,EACxC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAC3B,QAAQ,EAAE,wBAAwB,EAClC,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,aAAa,GACtB,WAAW,CAAC,CAAC,CAAC,CAuJhB"}
@@ -0,0 +1,222 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
+ };
6
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
+ if (kind === "m") throw new TypeError("Private method is not writable");
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
+ };
12
+ var _a, _StateSynchronizer_instance, _StateSynchronizer_observers;
13
+ import { atomFamily, selectorFamily } from 'recoil';
14
+ import { BehaviorSubject } from 'rxjs';
15
+ import { RequestExtrasSerializable } from '../../api/http';
16
+ import { isEmbedded } from '../../shared/utils/embed';
17
+ import { isDerivedVariable } from '../../types';
18
+ // eslint-disable-next-line import/no-cycle
19
+ import { STORES, getEffect, getOrRegisterDerivedVariableValue, resolveNested, setNested } from './internal';
20
+ import { atomFamilyMembersRegistry, atomFamilyRegistry, getRegistryKey, selectorFamilyRegistry } from './store';
21
+ /**
22
+ * State synchronizer singleton
23
+ *
24
+ * Used to synchronize changes across atoms of the same family
25
+ */
26
+ class StateSynchronizer {
27
+ // eslint-disable-next-line no-useless-constructor, no-empty-function
28
+ constructor() {
29
+ _StateSynchronizer_observers.set(this, new Map());
30
+ }
31
+ static getInstance() {
32
+ if (!__classPrivateFieldGet(_a, _a, "f", _StateSynchronizer_instance)) {
33
+ __classPrivateFieldSet(_a, _a, new _a(), "f", _StateSynchronizer_instance);
34
+ }
35
+ return __classPrivateFieldGet(_a, _a, "f", _StateSynchronizer_instance);
36
+ }
37
+ /**
38
+ * Register a key in the state synchronizer
39
+ *
40
+ * @param key key to register
41
+ * @param defaultValue value to register
42
+ */
43
+ register(key, defaultValue) {
44
+ if (!__classPrivateFieldGet(this, _StateSynchronizer_observers, "f").has(key)) {
45
+ __classPrivateFieldGet(this, _StateSynchronizer_observers, "f").set(key, new BehaviorSubject({ type: 'initial', value: defaultValue }));
46
+ }
47
+ }
48
+ /**
49
+ * Check if a given key is registered in the state synchronizer
50
+ *
51
+ * @param key key to check if registered
52
+ */
53
+ isRegistered(key) {
54
+ return __classPrivateFieldGet(this, _StateSynchronizer_observers, "f").has(key);
55
+ }
56
+ /**
57
+ * Get the current state for a given key
58
+ *
59
+ * @param key key to get the current value for
60
+ */
61
+ getCurrentState(key) {
62
+ if (!this.isRegistered(key)) {
63
+ return null;
64
+ }
65
+ return __classPrivateFieldGet(this, _StateSynchronizer_observers, "f").get(key).getValue();
66
+ }
67
+ /**
68
+ * Subscribe to changes on a given key
69
+ *
70
+ * @param key key to subscribe to
71
+ */
72
+ subscribe(key, subscription) {
73
+ // If somehow the ended up with no listener here, register it with null value
74
+ if (!this.isRegistered(key)) {
75
+ this.register(key, null);
76
+ }
77
+ const sub = __classPrivateFieldGet(this, _StateSynchronizer_observers, "f").get(key).subscribe(subscription);
78
+ return () => {
79
+ sub.unsubscribe();
80
+ // if no more observers, remove the listener
81
+ if (__classPrivateFieldGet(this, _StateSynchronizer_observers, "f").get(key).observers.length === 0) {
82
+ __classPrivateFieldGet(this, _StateSynchronizer_observers, "f").delete(key);
83
+ }
84
+ };
85
+ }
86
+ /**
87
+ * Notify listeners for a given key
88
+ *
89
+ * @param key key to notify listeners for
90
+ * @param update update to notify about
91
+ */
92
+ notify(key, update) {
93
+ // If somehow the ended up with no listener here, register it with null value
94
+ if (!this.isRegistered(key)) {
95
+ this.register(key, null);
96
+ }
97
+ __classPrivateFieldGet(this, _StateSynchronizer_observers, "f").get(key).next(update);
98
+ }
99
+ }
100
+ _a = StateSynchronizer, _StateSynchronizer_observers = new WeakMap();
101
+ _StateSynchronizer_instance = { value: void 0 };
102
+ /**
103
+ * Get a plain variable from the atom or selector registry (based on nested property),
104
+ * registering it if not already registered
105
+ *
106
+ * @param variable variable to register
107
+ * @param wsClient websocket client
108
+ * @param taskContext task context
109
+ * @param search search query
110
+ * @param extras request extras to be merged into the options
111
+ */
112
+ export function getOrRegisterPlainVariable(variable, wsClient, taskContext, extras) {
113
+ const isNested = variable.nested && variable.nested.length > 0;
114
+ const isDefaultDerived = isDerivedVariable(variable.default);
115
+ if (!atomFamilyRegistry.has(variable.uid)) {
116
+ atomFamilyRegistry.set(variable.uid, atomFamily({
117
+ /*
118
+ If created from a DerivedVariable, link the default state to that DV's selector
119
+ From Recoil docs:
120
+ "If a selector is used as the default the atom will dynamically update as the default selector updates.
121
+ Once the atom is set, then it will retain that value unless the atom is reset."
122
+
123
+ Otherwise just use variable.default directly.
124
+ */
125
+ default: isDefaultDerived ?
126
+ (extrasSerializable) => getOrRegisterDerivedVariableValue(variable.default, wsClient, taskContext, extrasSerializable.extras)
127
+ : variable.default,
128
+ effects: (extrasSerializable) => {
129
+ const familySync = ({ onSet, setSelf, resetSelf, node }) => {
130
+ // Register the atom in the state synchronizer if not already registered
131
+ if (!StateSynchronizer.getInstance().isRegistered(variable.uid)) {
132
+ StateSynchronizer.getInstance().register(variable.uid, variable.default);
133
+ }
134
+ else {
135
+ const currentState = StateSynchronizer.getInstance().getCurrentState(variable.uid);
136
+ if (!isDefaultDerived || (currentState === null || currentState === void 0 ? void 0 : currentState.type) !== 'initial') {
137
+ // Otherwise synchronize the initial value,
138
+ // unless the default is a DerivedVariable and the current state is initial
139
+ // because in that case the default will be linked to the selector which needs to be resolved
140
+ setSelf(currentState === null || currentState === void 0 ? void 0 : currentState.value);
141
+ }
142
+ }
143
+ // Synchronize changes across atoms of the same family
144
+ const unsub = StateSynchronizer.getInstance().subscribe(variable.uid, (update) => {
145
+ if (update.type === 'initial') {
146
+ return;
147
+ }
148
+ // skip updates from the same atom
149
+ if (update.nodeKey === node.key) {
150
+ return;
151
+ }
152
+ if (update.isReset) {
153
+ resetSelf();
154
+ }
155
+ else {
156
+ setSelf(update.value);
157
+ }
158
+ });
159
+ onSet((newValue, oldValue, isReset) => {
160
+ StateSynchronizer.getInstance().notify(variable.uid, {
161
+ isReset,
162
+ nodeKey: node.key,
163
+ oldValue,
164
+ type: 'update',
165
+ value: newValue,
166
+ });
167
+ });
168
+ return unsub;
169
+ };
170
+ const effects = [familySync];
171
+ // add an effect to handle backend store updates
172
+ const storeEffect = getEffect(variable);
173
+ if (storeEffect) {
174
+ effects.push(storeEffect(variable, extrasSerializable, wsClient, taskContext));
175
+ }
176
+ else {
177
+ // TODO: This is in an else block to ensure store effect are mutually exclusive, can be unified once backend API is unified
178
+ // If persist_value flag is set, register an effect which updates the selected value in local storage
179
+ // TODO: once BrowserStore is implemented instead of persist_value, this block can only check for isEmbedded
180
+ // eslint-disable-next-line no-lonely-if
181
+ if (variable.persist_value || isEmbedded()) {
182
+ effects.push(STORES.BrowserStore.effect(variable, extrasSerializable, wsClient, taskContext));
183
+ }
184
+ }
185
+ return effects;
186
+ },
187
+ key: variable.uid,
188
+ }));
189
+ }
190
+ const family = atomFamilyRegistry.get(variable.uid);
191
+ const extrasSerializable = new RequestExtrasSerializable(extras);
192
+ const atomInstance = family(extrasSerializable);
193
+ // Register the atom instance in the atomFamilyMembersRegistry so we can retrieve it later
194
+ if (!atomFamilyMembersRegistry.has(family)) {
195
+ atomFamilyMembersRegistry.set(family, new Map());
196
+ }
197
+ atomFamilyMembersRegistry.get(family).set(extrasSerializable.toJSON(), atomInstance);
198
+ // In case of a nested variable, register and return a selector to resolve the nested values
199
+ if (isNested) {
200
+ const key = getRegistryKey(variable, 'selector');
201
+ if (!selectorFamilyRegistry.has(key)) {
202
+ // Below we make sure nested is a list of strings
203
+ // this is validated on the Python side but when using @template we can't validate it and is replaced at runtime
204
+ // so we coerce it to a list of strings here
205
+ selectorFamilyRegistry.set(key, selectorFamily({
206
+ get: (currentExtras) => ({ get }) => {
207
+ const variableValue = get(family(currentExtras));
208
+ return resolveNested(variableValue, variable.nested.map((n) => String(n)));
209
+ },
210
+ key,
211
+ set: (currentExtras) => ({ set }, newValue) => {
212
+ set(family(currentExtras), (v) => setNested(v, variable.nested.map((n) => String(n)), newValue));
213
+ },
214
+ }));
215
+ }
216
+ const selectorFamilyInstance = selectorFamilyRegistry.get(key);
217
+ // We cast it since it's a writeable selector
218
+ return selectorFamilyInstance(extrasSerializable);
219
+ }
220
+ return atomInstance;
221
+ }
222
+ //# sourceMappingURL=plain-variable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plain-variable.js","sourceRoot":"","sources":["../../../js/shared/interactivity/plain-variable.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAA2B,UAAU,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAGvC,OAAO,EAAiB,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAmC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE7E,2CAA2C;AAC3C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,iCAAiC,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5G,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAMhH;;;;GAIG;AACH,MAAM,iBAAiB;IAKnB,qEAAqE;IACrE;QAHA,uCAAa,IAAI,GAAG,EAA2C,EAAC;IAGzC,CAAC;IAExB,MAAM,CAAC,WAAW;QACd,IAAI,CAAC,uBAAA,EAAiB,uCAAU,EAAE,CAAC;YAC/B,uBAAA,EAAiB,MA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,sBAAsB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAE/D,6CAA6C;QAC7C,OAAO,sBAAsB,CAAC,kBAAkB,CAAmB,CAAC;IACxE,CAAC;IAED,OAAO,YAAY,CAAC;AACxB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Resolve a value to a format understood by the backend, calling any callback found.
3
+ *
4
+ * Resolves:
5
+ * - simple values to themselves,
6
+ * - callbacks to their return values,
7
+ * - for a ResolvedDerivedVariable, recursively resolve its dependencies, remove deps values (to maintain a consistent request payload shape)
8
+ *
9
+ * @param value a value to resolve
10
+ * @param force whether to force a derived variable recalculation
11
+ */
12
+ export declare function resolveValue(value: unknown, force: boolean): any;
13
+ //# sourceMappingURL=resolve-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-value.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/resolve-value.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,GAAG,CAkBhE"}
@@ -0,0 +1,36 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { isResolvedDerivedDataVariable, isResolvedDerivedVariable } from '../../types';
13
+ /**
14
+ * Resolve a value to a format understood by the backend, calling any callback found.
15
+ *
16
+ * Resolves:
17
+ * - simple values to themselves,
18
+ * - callbacks to their return values,
19
+ * - for a ResolvedDerivedVariable, recursively resolve its dependencies, remove deps values (to maintain a consistent request payload shape)
20
+ *
21
+ * @param value a value to resolve
22
+ * @param force whether to force a derived variable recalculation
23
+ */
24
+ export function resolveValue(value, force) {
25
+ if (isResolvedDerivedVariable(value) || isResolvedDerivedDataVariable(value)) {
26
+ const { deps } = value, rest = __rest(value, ["deps"]);
27
+ const resolvedValues = value.values.map((v) => resolveValue(v, force));
28
+ return Object.assign(Object.assign({}, rest), { force, values: resolvedValues });
29
+ }
30
+ if (typeof value === 'function') {
31
+ // Make sure the value returned by the callback is also resolved
32
+ return resolveValue(value(), force);
33
+ }
34
+ return value;
35
+ }
36
+ //# sourceMappingURL=resolve-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-value.js","sourceRoot":"","sources":["../../../js/shared/interactivity/resolve-value.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,6BAA6B,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEnF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc,EAAE,KAAc;IACvD,IAAI,yBAAyB,CAAC,KAAK,CAAC,IAAI,6BAA6B,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3E,MAAM,EAAE,IAAI,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAAzB,QAAiB,CAAQ,CAAC;QAChC,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;QAEvE,uCACO,IAAI,KACP,KAAK,EACL,MAAM,EAAE,cAAc,IACxB;IACN,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAC9B,gEAAgE;QAChE,OAAO,YAAY,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { RecoilState } from 'recoil';
2
+ import { WebSocketClientInterface } from '../../api';
3
+ import { RequestExtras } from '../../api/http';
4
+ import { GlobalTaskContext } from '../../shared/context/global-task-context';
5
+ import { AnyVariable, ResolvedDataVariable, ResolvedDerivedDataVariable, ResolvedDerivedVariable } from '../../types';
6
+ /**
7
+ * Resolve a variable to a value (for non-derived variables using provided resolver)
8
+ * or a ResolvedDerivedVariable (if it's a derived variable).
9
+ * Registers all encountered variables which aren't yet in registry.
10
+ *
11
+ * @param variable variable to resolve
12
+ * @param client websocket client from context
13
+ * @param taskContext global task context
14
+ * @param extras request extras to be merged into the options
15
+ * @param resolver function to run the value through (for non-derived variables)
16
+ */
17
+ export declare function resolveVariable<VariableType>(variable: AnyVariable<VariableType>, client: WebSocketClientInterface, taskContext: GlobalTaskContext, extras: RequestExtras, resolver?: (val: RecoilState<VariableType>) => RecoilState<VariableType> | ResolvedDerivedVariable | VariableType): RecoilState<VariableType> | ResolvedDerivedVariable | ResolvedDerivedDataVariable | ResolvedDataVariable | VariableType;
18
+ //# sourceMappingURL=resolve-variable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-variable.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/resolve-variable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EACH,WAAW,EACX,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EAK1B,MAAM,SAAS,CAAC;AAUjB;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,YAAY,EACxC,QAAQ,EAAE,WAAW,CAAC,YAAY,CAAC,EACnC,MAAM,EAAE,wBAAwB,EAChC,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,aAAa,EACrB,QAAQ,GAAE,CAAC,GAAG,EAAE,WAAW,CAAC,YAAY,CAAC,KAAK,WAAW,CAAC,YAAY,CAAC,GAAG,uBAAuB,GAAG,YAE5F,GAEN,WAAW,CAAC,YAAY,CAAC,GACzB,uBAAuB,GACvB,2BAA2B,GAC3B,oBAAoB,GACpB,YAAY,CAqCjB"}