@darajs/core 1.0.0-a.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +7 -0
- package/dist/actions/download-content.d.ts +8 -0
- package/dist/actions/download-content.d.ts.map +1 -0
- package/dist/actions/download-content.js +46 -0
- package/dist/actions/download-content.js.map +1 -0
- package/dist/actions/download-variable.d.ts +8 -0
- package/dist/actions/download-variable.d.ts.map +1 -0
- package/dist/actions/download-variable.js +153 -0
- package/dist/actions/download-variable.js.map +1 -0
- package/dist/actions/index.d.ts +11 -0
- package/dist/actions/index.d.ts.map +1 -0
- package/dist/actions/index.js +11 -0
- package/dist/actions/index.js.map +1 -0
- package/dist/actions/logout.d.ts +8 -0
- package/dist/actions/logout.d.ts.map +1 -0
- package/dist/actions/logout.js +24 -0
- package/dist/actions/logout.js.map +1 -0
- package/dist/actions/navigate-to.d.ts +8 -0
- package/dist/actions/navigate-to.d.ts.map +1 -0
- package/dist/actions/navigate-to.js +77 -0
- package/dist/actions/navigate-to.js.map +1 -0
- package/dist/actions/notify.d.ts +8 -0
- package/dist/actions/notify.d.ts.map +1 -0
- package/dist/actions/notify.js +16 -0
- package/dist/actions/notify.js.map +1 -0
- package/dist/actions/reset-variables.d.ts +8 -0
- package/dist/actions/reset-variables.d.ts.map +1 -0
- package/dist/actions/reset-variables.js +24 -0
- package/dist/actions/reset-variables.js.map +1 -0
- package/dist/actions/side-effect.d.ts +8 -0
- package/dist/actions/side-effect.d.ts.map +1 -0
- package/dist/actions/side-effect.js +44 -0
- package/dist/actions/side-effect.js.map +1 -0
- package/dist/actions/trigger-variable.d.ts +8 -0
- package/dist/actions/trigger-variable.d.ts.map +1 -0
- package/dist/actions/trigger-variable.js +25 -0
- package/dist/actions/trigger-variable.js.map +1 -0
- package/dist/actions/update-variable.d.ts +9 -0
- package/dist/actions/update-variable.d.ts.map +1 -0
- package/dist/actions/update-variable.js +89 -0
- package/dist/actions/update-variable.js.map +1 -0
- package/dist/actions/utils.d.ts +9 -0
- package/dist/actions/utils.d.ts.map +1 -0
- package/dist/actions/utils.js +37 -0
- package/dist/actions/utils.js.map +1 -0
- package/dist/api/core.d.ts +34 -0
- package/dist/api/core.d.ts.map +1 -0
- package/dist/api/core.js +110 -0
- package/dist/api/core.js.map +1 -0
- package/dist/api/http.d.ts +9 -0
- package/dist/api/http.d.ts.map +1 -0
- package/dist/api/http.js +38 -0
- package/dist/api/http.js.map +1 -0
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +5 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/websocket.d.ts +140 -0
- package/dist/api/websocket.d.ts.map +1 -0
- package/dist/api/websocket.js +241 -0
- package/dist/api/websocket.js.map +1 -0
- package/dist/assets/fonts/Manrope-VariableFont_wght.ttf +0 -0
- package/dist/assets/login-background.svg +11 -0
- package/dist/assets/logo.svg +12 -0
- package/dist/auth/auth-context.d.ts +22 -0
- package/dist/auth/auth-context.d.ts.map +1 -0
- package/dist/auth/auth-context.js +18 -0
- package/dist/auth/auth-context.js.map +1 -0
- package/dist/auth/auth-wrapper.d.ts +14 -0
- package/dist/auth/auth-wrapper.d.ts.map +1 -0
- package/dist/auth/auth-wrapper.js +90 -0
- package/dist/auth/auth-wrapper.js.map +1 -0
- package/dist/auth/auth.d.ts +61 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/auth.js +161 -0
- package/dist/auth/auth.js.map +1 -0
- package/dist/auth/basic/basic-auth-login.d.ts +6 -0
- package/dist/auth/basic/basic-auth-login.d.ts.map +1 -0
- package/dist/auth/basic/basic-auth-login.js +174 -0
- package/dist/auth/basic/basic-auth-login.js.map +1 -0
- package/dist/auth/basic/basic-auth-logout.d.ts +6 -0
- package/dist/auth/basic/basic-auth-logout.d.ts.map +1 -0
- package/dist/auth/basic/basic-auth-logout.js +18 -0
- package/dist/auth/basic/basic-auth-logout.js.map +1 -0
- package/dist/auth/default/default-auth-login.d.ts +6 -0
- package/dist/auth/default/default-auth-login.d.ts.map +1 -0
- package/dist/auth/default/default-auth-login.js +66 -0
- package/dist/auth/default/default-auth-login.js.map +1 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +7 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/components/fallback/default.d.ts +5 -0
- package/dist/components/fallback/default.d.ts.map +1 -0
- package/dist/components/fallback/default.js +10 -0
- package/dist/components/fallback/default.js.map +1 -0
- package/dist/components/fallback/dots.d.ts +8 -0
- package/dist/components/fallback/dots.d.ts.map +1 -0
- package/dist/components/fallback/dots.js +77 -0
- package/dist/components/fallback/dots.js.map +1 -0
- package/dist/components/fallback/row.d.ts +5 -0
- package/dist/components/fallback/row.d.ts.map +1 -0
- package/dist/components/fallback/row.js +14 -0
- package/dist/components/fallback/row.js.map +1 -0
- package/dist/components/for/for.d.ts +35 -0
- package/dist/components/for/for.d.ts.map +1 -0
- package/dist/components/for/for.js +43 -0
- package/dist/components/for/for.js.map +1 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +9 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/menu/menu.d.ts +14 -0
- package/dist/components/menu/menu.d.ts.map +1 -0
- package/dist/components/menu/menu.js +58 -0
- package/dist/components/menu/menu.js.map +1 -0
- package/dist/components/progress-tracker/progress-tracker.d.ts +18 -0
- package/dist/components/progress-tracker/progress-tracker.d.ts.map +1 -0
- package/dist/components/progress-tracker/progress-tracker.js +202 -0
- package/dist/components/progress-tracker/progress-tracker.js.map +1 -0
- package/dist/components/router-content/router-content.d.ts +14 -0
- package/dist/components/router-content/router-content.d.ts.map +1 -0
- package/dist/components/router-content/router-content.js +17 -0
- package/dist/components/router-content/router-content.js.map +1 -0
- package/dist/components/side-bar-frame/side-bar-frame.d.ts +21 -0
- package/dist/components/side-bar-frame/side-bar-frame.d.ts.map +1 -0
- package/dist/components/side-bar-frame/side-bar-frame.js +63 -0
- package/dist/components/side-bar-frame/side-bar-frame.js.map +1 -0
- package/dist/components/top-bar-frame/top-bar-frame.d.ts +16 -0
- package/dist/components/top-bar-frame/top-bar-frame.d.ts.map +1 -0
- package/dist/components/top-bar-frame/top-bar-frame.js +70 -0
- package/dist/components/top-bar-frame/top-bar-frame.js.map +1 -0
- package/dist/dara_core-1.0.0a1-py3-none-any.whl +0 -0
- package/dist/devtools/backend-errors/backend-errors-ctx.d.ts +17 -0
- package/dist/devtools/backend-errors/backend-errors-ctx.d.ts.map +1 -0
- package/dist/devtools/backend-errors/backend-errors-ctx.js +37 -0
- package/dist/devtools/backend-errors/backend-errors-ctx.js.map +1 -0
- package/dist/devtools/backend-errors/backend-errors.d.ts +6 -0
- package/dist/devtools/backend-errors/backend-errors.d.ts.map +1 -0
- package/dist/devtools/backend-errors/backend-errors.js +57 -0
- package/dist/devtools/backend-errors/backend-errors.js.map +1 -0
- package/dist/devtools/backend-errors/error-display.d.ts +22 -0
- package/dist/devtools/backend-errors/error-display.d.ts.map +1 -0
- package/dist/devtools/backend-errors/error-display.js +99 -0
- package/dist/devtools/backend-errors/error-display.js.map +1 -0
- package/dist/devtools/backend-errors/index.d.ts +3 -0
- package/dist/devtools/backend-errors/index.d.ts.map +1 -0
- package/dist/devtools/backend-errors/index.js +3 -0
- package/dist/devtools/backend-errors/index.js.map +1 -0
- package/dist/devtools/devtools-content.d.ts +12 -0
- package/dist/devtools/devtools-content.d.ts.map +1 -0
- package/dist/devtools/devtools-content.js +73 -0
- package/dist/devtools/devtools-content.js.map +1 -0
- package/dist/devtools/devtools-context.d.ts +7 -0
- package/dist/devtools/devtools-context.d.ts.map +1 -0
- package/dist/devtools/devtools-context.js +9 -0
- package/dist/devtools/devtools-context.js.map +1 -0
- package/dist/devtools/devtools-wrapper.d.ts +8 -0
- package/dist/devtools/devtools-wrapper.d.ts.map +1 -0
- package/dist/devtools/devtools-wrapper.js +64 -0
- package/dist/devtools/devtools-wrapper.js.map +1 -0
- package/dist/devtools/devtools.d.ts +5 -0
- package/dist/devtools/devtools.d.ts.map +1 -0
- package/dist/devtools/devtools.js +10 -0
- package/dist/devtools/devtools.js.map +1 -0
- package/dist/devtools/floating-button.d.ts +24 -0
- package/dist/devtools/floating-button.d.ts.map +1 -0
- package/dist/devtools/floating-button.js +96 -0
- package/dist/devtools/floating-button.js.map +1 -0
- package/dist/devtools/index.d.ts +2 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +2 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/devtools/resizer.d.ts +18 -0
- package/dist/devtools/resizer.d.ts.map +1 -0
- package/dist/devtools/resizer.js +48 -0
- package/dist/devtools/resizer.js.map +1 -0
- package/dist/devtools/use-move.d.ts +21 -0
- package/dist/devtools/use-move.d.ts.map +1 -0
- package/dist/devtools/use-move.js +55 -0
- package/dist/devtools/use-move.js.map +1 -0
- package/dist/index.css +95 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/jest-setup.d.ts +2 -0
- package/dist/jest-setup.d.ts.map +1 -0
- package/dist/jest-setup.js +7 -0
- package/dist/jest-setup.js.map +1 -0
- package/dist/pages/error-page.d.ts +3 -0
- package/dist/pages/error-page.d.ts.map +1 -0
- package/dist/pages/error-page.js +32 -0
- package/dist/pages/error-page.js.map +1 -0
- package/dist/pages/sso-callback-page.d.ts +6 -0
- package/dist/pages/sso-callback-page.d.ts.map +1 -0
- package/dist/pages/sso-callback-page.js +8 -0
- package/dist/pages/sso-callback-page.js.map +1 -0
- package/dist/run.d.ts +22 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +40 -0
- package/dist/run.js.map +1 -0
- package/dist/shared/center/center.d.ts +5 -0
- package/dist/shared/center/center.d.ts.map +1 -0
- package/dist/shared/center/center.js +15 -0
- package/dist/shared/center/center.js.map +1 -0
- package/dist/shared/context/direction-context.d.ts +7 -0
- package/dist/shared/context/direction-context.d.ts.map +1 -0
- package/dist/shared/context/direction-context.js +4 -0
- package/dist/shared/context/direction-context.js.map +1 -0
- package/dist/shared/context/display-context.d.ts +14 -0
- package/dist/shared/context/display-context.d.ts.map +1 -0
- package/dist/shared/context/display-context.js +4 -0
- package/dist/shared/context/display-context.js.map +1 -0
- package/dist/shared/context/fallback-context.d.ts +11 -0
- package/dist/shared/context/fallback-context.d.ts.map +1 -0
- package/dist/shared/context/fallback-context.js +4 -0
- package/dist/shared/context/fallback-context.js.map +1 -0
- package/dist/shared/context/global-task-context.d.ts +40 -0
- package/dist/shared/context/global-task-context.d.ts.map +1 -0
- package/dist/shared/context/global-task-context.js +78 -0
- package/dist/shared/context/global-task-context.js.map +1 -0
- package/dist/shared/context/importers-context.d.ts +7 -0
- package/dist/shared/context/importers-context.d.ts.map +1 -0
- package/dist/shared/context/importers-context.js +4 -0
- package/dist/shared/context/importers-context.js.map +1 -0
- package/dist/shared/context/index.d.ts +10 -0
- package/dist/shared/context/index.d.ts.map +1 -0
- package/dist/shared/context/index.js +10 -0
- package/dist/shared/context/index.js.map +1 -0
- package/dist/shared/context/registries-context.d.ts +21 -0
- package/dist/shared/context/registries-context.d.ts.map +1 -0
- package/dist/shared/context/registries-context.js +8 -0
- package/dist/shared/context/registries-context.js.map +1 -0
- package/dist/shared/context/variable-context.d.ts +10 -0
- package/dist/shared/context/variable-context.d.ts.map +1 -0
- package/dist/shared/context/variable-context.js +4 -0
- package/dist/shared/context/variable-context.js.map +1 -0
- package/dist/shared/context/websocket-context.d.ts +8 -0
- package/dist/shared/context/websocket-context.d.ts.map +1 -0
- package/dist/shared/context/websocket-context.js +4 -0
- package/dist/shared/context/websocket-context.js.map +1 -0
- package/dist/shared/dynamic-component/dynamic-component.d.ts +16 -0
- package/dist/shared/dynamic-component/dynamic-component.d.ts.map +1 -0
- package/dist/shared/dynamic-component/dynamic-component.js +243 -0
- package/dist/shared/dynamic-component/dynamic-component.js.map +1 -0
- package/dist/shared/error-handling/error-display.d.ts +8 -0
- package/dist/shared/error-handling/error-display.d.ts.map +1 -0
- package/dist/shared/error-handling/error-display.js +92 -0
- package/dist/shared/error-handling/error-display.js.map +1 -0
- package/dist/shared/error-handling/index.d.ts +3 -0
- package/dist/shared/error-handling/index.d.ts.map +1 -0
- package/dist/shared/error-handling/index.js +3 -0
- package/dist/shared/error-handling/index.js.map +1 -0
- package/dist/shared/error-handling/types.d.ts +10 -0
- package/dist/shared/error-handling/types.d.ts.map +1 -0
- package/dist/shared/error-handling/types.js +9 -0
- package/dist/shared/error-handling/types.js.map +1 -0
- package/dist/shared/index.d.ts +11 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +9 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/interactivity/data-variable.d.ts +66 -0
- package/dist/shared/interactivity/data-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/data-variable.js +186 -0
- package/dist/shared/interactivity/data-variable.js.map +1 -0
- package/dist/shared/interactivity/derived-variable.d.ts +153 -0
- package/dist/shared/interactivity/derived-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/derived-variable.js +403 -0
- package/dist/shared/interactivity/derived-variable.js.map +1 -0
- package/dist/shared/interactivity/filtering.d.ts +9 -0
- package/dist/shared/interactivity/filtering.d.ts.map +1 -0
- package/dist/shared/interactivity/filtering.js +20 -0
- package/dist/shared/interactivity/filtering.js.map +1 -0
- package/dist/shared/interactivity/index.d.ts +12 -0
- package/dist/shared/interactivity/index.d.ts.map +1 -0
- package/dist/shared/interactivity/index.js +11 -0
- package/dist/shared/interactivity/index.js.map +1 -0
- package/dist/shared/interactivity/internal.d.ts +8 -0
- package/dist/shared/interactivity/internal.d.ts.map +1 -0
- package/dist/shared/interactivity/internal.js +10 -0
- package/dist/shared/interactivity/internal.js.map +1 -0
- package/dist/shared/interactivity/nested.d.ts +16 -0
- package/dist/shared/interactivity/nested.d.ts.map +1 -0
- package/dist/shared/interactivity/nested.js +50 -0
- package/dist/shared/interactivity/nested.js.map +1 -0
- package/dist/shared/interactivity/plain-variable.d.ts +23 -0
- package/dist/shared/interactivity/plain-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/plain-variable.js +89 -0
- package/dist/shared/interactivity/plain-variable.js.map +1 -0
- package/dist/shared/interactivity/resolve-value.d.ts +13 -0
- package/dist/shared/interactivity/resolve-value.d.ts.map +1 -0
- package/dist/shared/interactivity/resolve-value.js +36 -0
- package/dist/shared/interactivity/resolve-value.js.map +1 -0
- package/dist/shared/interactivity/resolve-variable.d.ts +18 -0
- package/dist/shared/interactivity/resolve-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/resolve-variable.js +47 -0
- package/dist/shared/interactivity/resolve-variable.js.map +1 -0
- package/dist/shared/interactivity/store.d.ts +35 -0
- package/dist/shared/interactivity/store.d.ts.map +1 -0
- package/dist/shared/interactivity/store.js +47 -0
- package/dist/shared/interactivity/store.js.map +1 -0
- package/dist/shared/interactivity/triggers.d.ts +31 -0
- package/dist/shared/interactivity/triggers.d.ts.map +1 -0
- package/dist/shared/interactivity/triggers.js +105 -0
- package/dist/shared/interactivity/triggers.js.map +1 -0
- package/dist/shared/interactivity/url-variable.d.ts +12 -0
- package/dist/shared/interactivity/url-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/url-variable.js +28 -0
- package/dist/shared/interactivity/url-variable.js.map +1 -0
- package/dist/shared/interactivity/use-any-variable.d.ts +8 -0
- package/dist/shared/interactivity/use-any-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/use-any-variable.js +38 -0
- package/dist/shared/interactivity/use-any-variable.js.map +1 -0
- package/dist/shared/interactivity/use-data-variable.d.ts +12 -0
- package/dist/shared/interactivity/use-data-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/use-data-variable.js +56 -0
- package/dist/shared/interactivity/use-data-variable.js.map +1 -0
- package/dist/shared/interactivity/use-refresh-selector.d.ts +5 -0
- package/dist/shared/interactivity/use-refresh-selector.d.ts.map +1 -0
- package/dist/shared/interactivity/use-refresh-selector.js +16 -0
- package/dist/shared/interactivity/use-refresh-selector.js.map +1 -0
- package/dist/shared/interactivity/use-reset-variables.d.ts +8 -0
- package/dist/shared/interactivity/use-reset-variables.d.ts.map +1 -0
- package/dist/shared/interactivity/use-reset-variables.js +46 -0
- package/dist/shared/interactivity/use-reset-variables.js.map +1 -0
- package/dist/shared/interactivity/use-server-component.d.ts +24 -0
- package/dist/shared/interactivity/use-server-component.d.ts.map +1 -0
- package/dist/shared/interactivity/use-server-component.js +227 -0
- package/dist/shared/interactivity/use-server-component.js.map +1 -0
- package/dist/shared/interactivity/use-trigger-variable.d.ts +9 -0
- package/dist/shared/interactivity/use-trigger-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/use-trigger-variable.js +18 -0
- package/dist/shared/interactivity/use-trigger-variable.js.map +1 -0
- package/dist/shared/interactivity/use-variable-state.d.ts +9 -0
- package/dist/shared/interactivity/use-variable-state.d.ts.map +1 -0
- package/dist/shared/interactivity/use-variable-state.js +35 -0
- package/dist/shared/interactivity/use-variable-state.js.map +1 -0
- package/dist/shared/interactivity/use-variable-value.d.ts +20 -0
- package/dist/shared/interactivity/use-variable-value.d.ts.map +1 -0
- package/dist/shared/interactivity/use-variable-value.js +77 -0
- package/dist/shared/interactivity/use-variable-value.js.map +1 -0
- package/dist/shared/interactivity/use-variable.d.ts +11 -0
- package/dist/shared/interactivity/use-variable.d.ts.map +1 -0
- package/dist/shared/interactivity/use-variable.js +62 -0
- package/dist/shared/interactivity/use-variable.js.map +1 -0
- package/dist/shared/private-route/private-route.d.ts +23 -0
- package/dist/shared/private-route/private-route.d.ts.map +1 -0
- package/dist/shared/private-route/private-route.js +39 -0
- package/dist/shared/private-route/private-route.js.map +1 -0
- package/dist/shared/template-root/dynamic-context.d.ts +9 -0
- package/dist/shared/template-root/dynamic-context.d.ts.map +1 -0
- package/dist/shared/template-root/dynamic-context.js +28 -0
- package/dist/shared/template-root/dynamic-context.js.map +1 -0
- package/dist/shared/template-root/template-root.d.ts +8 -0
- package/dist/shared/template-root/template-root.d.ts.map +1 -0
- package/dist/shared/template-root/template-root.js +76 -0
- package/dist/shared/template-root/template-root.js.map +1 -0
- package/dist/shared/utils/clean-session-cache.d.ts +9 -0
- package/dist/shared/utils/clean-session-cache.d.ts.map +1 -0
- package/dist/shared/utils/clean-session-cache.js +17 -0
- package/dist/shared/utils/clean-session-cache.js.map +1 -0
- package/dist/shared/utils/embed.d.ts +13 -0
- package/dist/shared/utils/embed.d.ts.map +1 -0
- package/dist/shared/utils/embed.js +23 -0
- package/dist/shared/utils/embed.js.map +1 -0
- package/dist/shared/utils/get-icon.d.ts +9 -0
- package/dist/shared/utils/get-icon.d.ts.map +1 -0
- package/dist/shared/utils/get-icon.js +30 -0
- package/dist/shared/utils/get-icon.js.map +1 -0
- package/dist/shared/utils/hashing.d.ts +14 -0
- package/dist/shared/utils/hashing.d.ts.map +1 -0
- package/dist/shared/utils/hashing.js +26 -0
- package/dist/shared/utils/hashing.js.map +1 -0
- package/dist/shared/utils/index.d.ts +18 -0
- package/dist/shared/utils/index.d.ts.map +1 -0
- package/dist/shared/utils/index.js +16 -0
- package/dist/shared/utils/index.js.map +1 -0
- package/dist/shared/utils/inject-css.d.ts +13 -0
- package/dist/shared/utils/inject-css.d.ts.map +1 -0
- package/dist/shared/utils/inject-css.js +25 -0
- package/dist/shared/utils/inject-css.js.map +1 -0
- package/dist/shared/utils/is-js-component.d.ts +9 -0
- package/dist/shared/utils/is-js-component.d.ts.map +1 -0
- package/dist/shared/utils/is-js-component.js +11 -0
- package/dist/shared/utils/is-js-component.js.map +1 -0
- package/dist/shared/utils/normalization.d.ts +19 -0
- package/dist/shared/utils/normalization.d.ts.map +1 -0
- package/dist/shared/utils/normalization.js +118 -0
- package/dist/shared/utils/normalization.js.map +1 -0
- package/dist/shared/utils/resolve-theme.d.ts +9 -0
- package/dist/shared/utils/resolve-theme.d.ts.map +1 -0
- package/dist/shared/utils/resolve-theme.js +28 -0
- package/dist/shared/utils/resolve-theme.js.map +1 -0
- package/dist/shared/utils/templating.d.ts +24 -0
- package/dist/shared/utils/templating.d.ts.map +1 -0
- package/dist/shared/utils/templating.js +67 -0
- package/dist/shared/utils/templating.js.map +1 -0
- package/dist/shared/utils/use-action-registry.d.ts +11 -0
- package/dist/shared/utils/use-action-registry.d.ts.map +1 -0
- package/dist/shared/utils/use-action-registry.js +18 -0
- package/dist/shared/utils/use-action-registry.js.map +1 -0
- package/dist/shared/utils/use-action.d.ts +9 -0
- package/dist/shared/utils/use-action.d.ts.map +1 -0
- package/dist/shared/utils/use-action.js +84 -0
- package/dist/shared/utils/use-action.js.map +1 -0
- package/dist/shared/utils/use-component-registry.d.ts +11 -0
- package/dist/shared/utils/use-component-registry.d.ts.map +1 -0
- package/dist/shared/utils/use-component-registry.js +46 -0
- package/dist/shared/utils/use-component-registry.js.map +1 -0
- package/dist/shared/utils/use-component-styles.d.ts +24 -0
- package/dist/shared/utils/use-component-styles.d.ts.map +1 -0
- package/dist/shared/utils/use-component-styles.js +68 -0
- package/dist/shared/utils/use-component-styles.js.map +1 -0
- package/dist/shared/utils/use-defer-loadable.d.ts +8 -0
- package/dist/shared/utils/use-defer-loadable.d.ts.map +1 -0
- package/dist/shared/utils/use-defer-loadable.js +44 -0
- package/dist/shared/utils/use-defer-loadable.js.map +1 -0
- package/dist/shared/utils/use-interval.d.ts +9 -0
- package/dist/shared/utils/use-interval.d.ts.map +1 -0
- package/dist/shared/utils/use-interval.js +18 -0
- package/dist/shared/utils/use-interval.js.map +1 -0
- package/dist/shared/utils/use-previous.d.ts +10 -0
- package/dist/shared/utils/use-previous.d.ts.map +1 -0
- package/dist/shared/utils/use-previous.js +17 -0
- package/dist/shared/utils/use-previous.js.map +1 -0
- package/dist/shared/utils/use-url-sync.d.ts +20 -0
- package/dist/shared/utils/use-url-sync.d.ts.map +1 -0
- package/dist/shared/utils/use-url-sync.js +68 -0
- package/dist/shared/utils/use-url-sync.js.map +1 -0
- package/dist/shared/utils/use-window-title.d.ts +3 -0
- package/dist/shared/utils/use-window-title.d.ts.map +1 -0
- package/dist/shared/utils/use-window-title.js +14 -0
- package/dist/shared/utils/use-window-title.js.map +1 -0
- package/dist/shared/variable-state-provider/variable-state-provider.d.ts +10 -0
- package/dist/shared/variable-state-provider/variable-state-provider.d.ts.map +1 -0
- package/dist/shared/variable-state-provider/variable-state-provider.js +21 -0
- package/dist/shared/variable-state-provider/variable-state-provider.js.map +1 -0
- package/dist/shared/wrapper/wrapper.d.ts +7 -0
- package/dist/shared/wrapper/wrapper.d.ts.map +1 -0
- package/dist/shared/wrapper/wrapper.js +14 -0
- package/dist/shared/wrapper/wrapper.js.map +1 -0
- package/dist/types/auth.d.ts +15 -0
- package/dist/types/auth.d.ts.map +1 -0
- package/dist/types/auth.js +6 -0
- package/dist/types/auth.js.map +1 -0
- package/dist/types/core.d.ts +325 -0
- package/dist/types/core.d.ts.map +1 -0
- package/dist/types/core.js +22 -0
- package/dist/types/core.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/utils.d.ts +50 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/utils.js +84 -0
- package/dist/types/utils.js.map +1 -0
- package/dist/umd/dara.core.umd.js +93592 -0
- package/dist/umd/style.css +848 -0
- package/package.json +117 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { atom, selector } from 'recoil';
|
|
2
|
+
import { isEmbedded } from '../../shared/utils/embed';
|
|
3
|
+
import { isDerivedVariable } from '../../types';
|
|
4
|
+
// eslint-disable-next-line import/no-cycle
|
|
5
|
+
import { getOrRegisterDerivedVariableValue, resolveNested, setNested } from './internal';
|
|
6
|
+
import { atomRegistry, getRegistryKey, selectorRegistry } from './store';
|
|
7
|
+
/**
|
|
8
|
+
* Get the session key used to persist a variable value
|
|
9
|
+
*
|
|
10
|
+
* @param sessionToken current session token
|
|
11
|
+
* @param uid uid of the variable to persist
|
|
12
|
+
*/
|
|
13
|
+
export function getSessionKey(sessionToken, uid) {
|
|
14
|
+
// If we're within an IFrame (Jupyter)
|
|
15
|
+
if (isEmbedded()) {
|
|
16
|
+
return `dara-session-${window.frameElement.dataset.daraPageId}-var-${uid}`;
|
|
17
|
+
}
|
|
18
|
+
return `dara-session-${sessionToken}-var-${uid}`;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a plain variable from the atom or selector registry (based on nested property),
|
|
22
|
+
* registering it if not already registered
|
|
23
|
+
*
|
|
24
|
+
* @param variable variable to register
|
|
25
|
+
* @param wsClient websocket client
|
|
26
|
+
* @param taskContext task context
|
|
27
|
+
* @param search search query
|
|
28
|
+
* @param token current session token
|
|
29
|
+
*/
|
|
30
|
+
export function getOrRegisterPlainVariable(variable, wsClient, taskContext, search, token) {
|
|
31
|
+
const isNested = variable.nested && variable.nested.length > 0;
|
|
32
|
+
if (!atomRegistry.has(variable.uid)) {
|
|
33
|
+
let defaultValue = variable.default;
|
|
34
|
+
// Variables created from DVs cannot be persisted
|
|
35
|
+
const persistValue = (variable.persist_value || isEmbedded()) && !isDerivedVariable(variable.default);
|
|
36
|
+
// If persist_value flag is set, try to retrieve persisted value and use it if we found one instead of default
|
|
37
|
+
if (persistValue) {
|
|
38
|
+
const persistedValue = localStorage.getItem(getSessionKey(token, variable.uid));
|
|
39
|
+
if (persistedValue) {
|
|
40
|
+
defaultValue = JSON.parse(persistedValue);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
atomRegistry.set(variable.uid, atom({
|
|
44
|
+
/*
|
|
45
|
+
If created from a DerivedVariable, link the default state to that DV's selector
|
|
46
|
+
From Recoil docs:
|
|
47
|
+
"If a selector is used as the default the atom will dynamically update as the default selector updates.
|
|
48
|
+
Once the atom is set, then it will retain that value unless the atom is reset."
|
|
49
|
+
*/
|
|
50
|
+
default: isDerivedVariable(variable.default)
|
|
51
|
+
? getOrRegisterDerivedVariableValue(variable.default, wsClient, taskContext, search, token)
|
|
52
|
+
: defaultValue,
|
|
53
|
+
effects: [
|
|
54
|
+
({ onSet }) => {
|
|
55
|
+
// If persist_value flag is set, register an effect which updates the selected value in sessionStorage on each variable update
|
|
56
|
+
if (persistValue) {
|
|
57
|
+
onSet((newValue) => {
|
|
58
|
+
localStorage.setItem(getSessionKey(token, variable.uid), JSON.stringify(newValue));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
key: variable.uid,
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
// In case of a nested variable, register a selector
|
|
67
|
+
if (isNested) {
|
|
68
|
+
const key = getRegistryKey(variable, 'selector');
|
|
69
|
+
if (!selectorRegistry.has(key)) {
|
|
70
|
+
// Below we make sure nested is a list of strings
|
|
71
|
+
// this is validated on the Python side but when using @template we can't validate it and is replaced at runtime
|
|
72
|
+
// so we coerce it to a list of strings here
|
|
73
|
+
selectorRegistry.set(key, selector({
|
|
74
|
+
get: ({ get }) => {
|
|
75
|
+
const variableValue = get(atomRegistry.get(variable.uid));
|
|
76
|
+
return resolveNested(variableValue, variable.nested.map((n) => String(n)));
|
|
77
|
+
},
|
|
78
|
+
key,
|
|
79
|
+
set: ({ set }, newValue) => {
|
|
80
|
+
set(atomRegistry.get(variable.uid), (v) => setNested(v, variable.nested.map((n) => String(n)), newValue));
|
|
81
|
+
},
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
// We cast it since it's a writeable selector
|
|
85
|
+
return selectorRegistry.get(key);
|
|
86
|
+
}
|
|
87
|
+
return atomRegistry.get(variable.uid);
|
|
88
|
+
}
|
|
89
|
+
//# 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,EAAe,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAIrD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAkB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5D,2CAA2C;AAC3C,OAAO,EAAE,iCAAiC,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,YAAoB,EAAE,GAAW;IAC3D,sCAAsC;IACtC,IAAI,UAAU,EAAE,EAAE;QACd,OAAO,gBAAiB,MAAM,CAAC,YAAkC,CAAC,OAAO,CAAC,UAAU,QAAQ,GAAG,EAAE,CAAC;KACrG;IAED,OAAO,gBAAgB,YAAY,QAAQ,GAAG,EAAE,CAAC;AACrD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CACtC,QAA2B,EAC3B,QAAkC,EAClC,WAA8B,EAC9B,MAAc,EACd,KAAa;IAEb,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAE/D,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACjC,IAAI,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC;QACpC,iDAAiD;QACjD,MAAM,YAAY,GAAG,CAAC,QAAQ,CAAC,aAAa,IAAI,UAAU,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEtG,8GAA8G;QAC9G,IAAI,YAAY,EAAE;YACd,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;YAEhF,IAAI,cAAc,EAAE;gBAChB,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;aAC7C;SACJ;QAED,YAAY,CAAC,GAAG,CACZ,QAAQ,CAAC,GAAG,EACZ,IAAI,CAAC;YACD;;;;;UAKF;YACE,OAAO,EAAE,iBAAiB,CAAC,QAAQ,CAAC,OAAO,CAAC;gBACxC,CAAC,CAAC,iCAAiC,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC;gBAC3F,CAAC,CAAC,YAAY;YAClB,OAAO,EAAE;gBACL,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;oBACV,8HAA8H;oBAC9H,IAAI,YAAY,EAAE;wBACd,KAAK,CAAC,CAAC,QAAQ,EAAE,EAAE;4BACf,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;wBACvF,CAAC,CAAC,CAAC;qBACN;gBACL,CAAC;aACJ;YACD,GAAG,EAAE,QAAQ,CAAC,GAAG;SACpB,CAAC,CACL,CAAC;KACL;IAED,oDAAoD;IACpD,IAAI,QAAQ,EAAE;QACV,MAAM,GAAG,GAAG,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAEjD,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAC5B,iDAAiD;YACjD,gHAAgH;YAChH,4CAA4C;YAC5C,gBAAgB,CAAC,GAAG,CAChB,GAAG,EACH,QAAQ,CAAM;gBACV,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;oBACb,MAAM,aAAa,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;oBAE1D,OAAO,aAAa,CAChB,aAAa,EACb,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CACxC,CAAC;gBACN,CAAC;gBACD,GAAG;gBACH,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE;oBACvB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CACtC,SAAS,CACL,CAAC,EACD,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EACrC,QAAQ,CACX,CACJ,CAAC;gBACN,CAAC;aACJ,CAAC,CACL,CAAC;SACL;QAED,6CAA6C;QAC7C,OAAO,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAmB,CAAC;KACtD;IAED,OAAO,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC1C,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;QAC1E,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;KACL;IAED,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE;QAC7B,gEAAgE;QAChE,OAAO,YAAY,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;KACvC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RecoilState } from 'recoil';
|
|
2
|
+
import { WebSocketClientInterface } from '../../api';
|
|
3
|
+
import { GlobalTaskContext } from '../../shared/context/global-task-context';
|
|
4
|
+
import { AnyVariable, ResolvedDataVariable, ResolvedDerivedDataVariable, ResolvedDerivedVariable } from '../../types';
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a variable to a value (for non-derived variables using provided resolver)
|
|
7
|
+
* or a ResolvedDerivedVariable (if it's a derived variable).
|
|
8
|
+
* Registers all encountered variables which aren't yet in registry.
|
|
9
|
+
*
|
|
10
|
+
* @param variable variable to resolve
|
|
11
|
+
* @param client websocket client from context
|
|
12
|
+
* @param taskContext global task context
|
|
13
|
+
* @param search search query from location
|
|
14
|
+
* @param token session token from context
|
|
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, search: string, token: string, 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,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EACH,WAAW,EACX,oBAAoB,EACpB,2BAA2B,EAC3B,uBAAuB,EAK1B,MAAM,SAAS,CAAC;AAUjB;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,YAAY,EACxC,QAAQ,EAAE,WAAW,CAAC,YAAY,CAAC,EACnC,MAAM,EAAE,wBAAwB,EAChC,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isDataVariable, isDerivedDataVariable, isDerivedVariable, isUrlVariable, } from '../../types';
|
|
2
|
+
// eslint-disable-next-line import/no-cycle
|
|
3
|
+
import { getOrRegisterDerivedVariable, getOrRegisterPlainVariable, getOrRegisterUrlVariable, resolveDataVariable, } from './internal';
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a variable to a value (for non-derived variables using provided resolver)
|
|
6
|
+
* or a ResolvedDerivedVariable (if it's a derived variable).
|
|
7
|
+
* Registers all encountered variables which aren't yet in registry.
|
|
8
|
+
*
|
|
9
|
+
* @param variable variable to resolve
|
|
10
|
+
* @param client websocket client from context
|
|
11
|
+
* @param taskContext global task context
|
|
12
|
+
* @param search search query from location
|
|
13
|
+
* @param token session token from context
|
|
14
|
+
* @param resolver function to run the value through (for non-derived variables)
|
|
15
|
+
*/
|
|
16
|
+
export function resolveVariable(variable, client, taskContext, search, token, resolver = (val) => val) {
|
|
17
|
+
if (isDerivedVariable(variable) || isDerivedDataVariable(variable)) {
|
|
18
|
+
getOrRegisterDerivedVariable(variable, client, taskContext, search, token);
|
|
19
|
+
// For derived variable, recursively resolve the dependencies
|
|
20
|
+
const values = variable.variables.map((v) => resolveVariable(v, client, taskContext, search, token, resolver));
|
|
21
|
+
// Store indexes of values which are in deps
|
|
22
|
+
const deps = variable.deps.map((dep) => variable.variables.findIndex((v) => v.uid === dep.uid));
|
|
23
|
+
if (isDerivedDataVariable(variable)) {
|
|
24
|
+
return {
|
|
25
|
+
deps,
|
|
26
|
+
filters: variable.filters,
|
|
27
|
+
type: 'derived-data',
|
|
28
|
+
uid: variable.uid,
|
|
29
|
+
values,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
deps,
|
|
34
|
+
type: 'derived',
|
|
35
|
+
uid: variable.uid,
|
|
36
|
+
values,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (isDataVariable(variable)) {
|
|
40
|
+
return resolveDataVariable(variable);
|
|
41
|
+
}
|
|
42
|
+
if (isUrlVariable(variable)) {
|
|
43
|
+
return resolver(getOrRegisterUrlVariable(variable));
|
|
44
|
+
}
|
|
45
|
+
return resolver(getOrRegisterPlainVariable(variable, client, taskContext, search, token));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=resolve-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-variable.js","sourceRoot":"","sources":["../../../js/shared/interactivity/resolve-variable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAKH,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,GAChB,MAAM,SAAS,CAAC;AAEjB,2CAA2C;AAC3C,OAAO,EACH,4BAA4B,EAC5B,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,GACtB,MAAM,YAAY,CAAC;AAEpB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAC3B,QAAmC,EACnC,MAAgC,EAChC,WAA8B,EAC9B,MAAc,EACd,KAAa,EACb,WAAmH,CAC/G,GAA8B,EAChC,EAAE,CAAC,GAAG;IAOR,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE;QAChE,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;QAE3E,6DAA6D;QAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QAE/G,4CAA4C;QAC5C,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAEhG,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE;YACjC,OAAO;gBACH,IAAI;gBACJ,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,IAAI,EAAE,cAAc;gBACpB,GAAG,EAAE,QAAQ,CAAC,GAAG;gBACjB,MAAM;aACsB,CAAC;SACpC;QAED,OAAO;YACH,IAAI;YACJ,IAAI,EAAE,SAAS;YACf,GAAG,EAAE,QAAQ,CAAC,GAAG;YACjB,MAAM;SACkB,CAAC;KAChC;IAED,IAAI,cAAc,CAAC,QAAQ,CAAC,EAAE;QAC1B,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC;KACxC;IAED,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE;QACzB,OAAO,QAAQ,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;KACvD;IAED,OAAO,QAAQ,CAAC,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RecoilState, RecoilValue } from 'recoil';
|
|
2
|
+
import { AnyVariable } from '../../types';
|
|
3
|
+
export declare const dataRegistry: Map<string, RecoilState<TriggerIndexValue>>;
|
|
4
|
+
export declare const atomRegistry: Map<string, RecoilState<any>>;
|
|
5
|
+
export declare const selectorRegistry: Map<string, RecoilValue<any>>;
|
|
6
|
+
export declare const depsRegistry: Map<string, {
|
|
7
|
+
args: any[];
|
|
8
|
+
cacheKey: string;
|
|
9
|
+
result: any;
|
|
10
|
+
}>;
|
|
11
|
+
export type TriggerIndexValue = {
|
|
12
|
+
force: boolean;
|
|
13
|
+
inc: number;
|
|
14
|
+
};
|
|
15
|
+
type RegistryKeyType = 'selector' | 'derived-selector' | 'trigger' | 'filters';
|
|
16
|
+
/**
|
|
17
|
+
* Get a unique registry key of a given type for a given variable.
|
|
18
|
+
*
|
|
19
|
+
* @param variable variable to get the key for
|
|
20
|
+
* @param type type of the registry entry
|
|
21
|
+
*/
|
|
22
|
+
export declare function getRegistryKey<T>(variable: AnyVariable<T>, type: RegistryKeyType): string;
|
|
23
|
+
/**
|
|
24
|
+
* Clear registries - to be used in tests only.
|
|
25
|
+
*/
|
|
26
|
+
export declare function clearRegistries_TEST(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Check whether a given variable is registered within the application
|
|
29
|
+
* (More strictly, under the current RecoilRoot)
|
|
30
|
+
*
|
|
31
|
+
* @param variable variable to check
|
|
32
|
+
*/
|
|
33
|
+
export declare function isRegistered<T>(variable: AnyVariable<T>): boolean;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/store.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAc,MAAM,SAAS,CAAC;AAElD,eAAO,MAAM,YAAY,6CAAoD,CAAC;AAC9E,eAAO,MAAM,YAAY,+BAAsC,CAAC;AAChE,eAAO,MAAM,gBAAgB,+BAAsC,CAAC;AACpE,eAAO,MAAM,YAAY;UAGX,GAAG,EAAE;cACD,MAAM;YACR,GAAG;EAEhB,CAAC;AAEJ,MAAM,MAAM,iBAAiB,GAAG;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,eAAe,GAAG,UAAU,GAAG,kBAAkB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE/E;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,CAEzF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAI3C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAkBjE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { getUniqueIdentifier } from '../../shared/utils/hashing';
|
|
2
|
+
import { isVariable } from '../../types';
|
|
3
|
+
export const dataRegistry = new Map(); // datavariableId -> trigger atom
|
|
4
|
+
export const atomRegistry = new Map();
|
|
5
|
+
export const selectorRegistry = new Map();
|
|
6
|
+
export const depsRegistry = new Map();
|
|
7
|
+
/**
|
|
8
|
+
* Get a unique registry key of a given type for a given variable.
|
|
9
|
+
*
|
|
10
|
+
* @param variable variable to get the key for
|
|
11
|
+
* @param type type of the registry entry
|
|
12
|
+
*/
|
|
13
|
+
export function getRegistryKey(variable, type) {
|
|
14
|
+
return `${getUniqueIdentifier(variable)}-${type}`;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Clear registries - to be used in tests only.
|
|
18
|
+
*/
|
|
19
|
+
export function clearRegistries_TEST() {
|
|
20
|
+
for (const registry of [dataRegistry, atomRegistry, selectorRegistry, depsRegistry]) {
|
|
21
|
+
registry.clear();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Check whether a given variable is registered within the application
|
|
26
|
+
* (More strictly, under the current RecoilRoot)
|
|
27
|
+
*
|
|
28
|
+
* @param variable variable to check
|
|
29
|
+
*/
|
|
30
|
+
export function isRegistered(variable) {
|
|
31
|
+
if (!isVariable(variable))
|
|
32
|
+
return false;
|
|
33
|
+
switch (variable.__typename) {
|
|
34
|
+
case 'Variable':
|
|
35
|
+
case 'UrlVariable':
|
|
36
|
+
case 'DataVariable':
|
|
37
|
+
return atomRegistry.has(variable.uid);
|
|
38
|
+
case 'DerivedVariable':
|
|
39
|
+
case 'DerivedDataVariable': {
|
|
40
|
+
const key = getRegistryKey(variable, 'selector');
|
|
41
|
+
return selectorRegistry.has(key);
|
|
42
|
+
}
|
|
43
|
+
default:
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../js/shared/interactivity/store.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAe,UAAU,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA0C,CAAC,CAAC,iCAAiC;AAChH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA4B,CAAC;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA4B,CAAC;AACpE,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,EAOhC,CAAC;AASJ;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAI,QAAwB,EAAE,IAAqB;IAC7E,OAAO,GAAG,mBAAmB,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAChC,KAAK,MAAM,QAAQ,IAAI,CAAC,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,CAAC,EAAE;QACjF,QAAQ,CAAC,KAAK,EAAE,CAAC;KACpB;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAI,QAAwB;IACpD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAExC,QAAQ,QAAQ,CAAC,UAAU,EAAE;QACzB,KAAK,UAAU,CAAC;QAChB,KAAK,aAAa,CAAC;QACnB,KAAK,cAAc;YACf,OAAO,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAE1C,KAAK,iBAAiB,CAAC;QACvB,KAAK,qBAAqB,CAAC,CAAC;YACxB,MAAM,GAAG,GAAG,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACjD,OAAO,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;SACpC;QAED;YACI,OAAO,KAAK,CAAC;KACpB;AACL,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { RecoilState } from 'recoil';
|
|
2
|
+
import { WebSocketClientInterface } from '../../api';
|
|
3
|
+
import { AnyVariable, DataVariable, DerivedDataVariable, DerivedVariable } from '../../types';
|
|
4
|
+
import { TriggerIndexValue } from './store';
|
|
5
|
+
/**
|
|
6
|
+
* Get a trigger index for a variable from the atom registry, registering it if not already registered
|
|
7
|
+
*
|
|
8
|
+
* @param variable variable to register trigger for
|
|
9
|
+
*/
|
|
10
|
+
export declare function getOrRegisterTrigger(variable: DerivedVariable | DerivedDataVariable): RecoilState<TriggerIndexValue>;
|
|
11
|
+
/**
|
|
12
|
+
* Get the data variable server trigger atom if it exists, otherwise create it
|
|
13
|
+
*/
|
|
14
|
+
export declare function getOrRegisterDataVariableTrigger(variable: DataVariable, wsClient: WebSocketClientInterface): RecoilState<TriggerIndexValue>;
|
|
15
|
+
/**
|
|
16
|
+
* Recursively register triggers as dependencies by calling the registerFunc on all nested derived variables
|
|
17
|
+
*
|
|
18
|
+
* @param variable variable to register triggers for
|
|
19
|
+
* @param wsClient websocket client
|
|
20
|
+
* @param registerFunc register function to run
|
|
21
|
+
*/
|
|
22
|
+
export declare function registerTriggers(variable: DerivedVariable | DerivedDataVariable, wsClient: WebSocketClientInterface, registerFunc?: (state: RecoilState<any>) => TriggerIndexValue): Array<TriggerIndexValue>;
|
|
23
|
+
/**
|
|
24
|
+
* Recursively register triggers in the list of dependant variables
|
|
25
|
+
*
|
|
26
|
+
* @param variable variable to register triggers for
|
|
27
|
+
* @param wsClient websocket client
|
|
28
|
+
* @param registerFunc register function to run
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerChildTriggers(variables: AnyVariable<any>[], wsClient: WebSocketClientInterface, registerFunc?: (state: RecoilState<any>) => TriggerIndexValue): Array<TriggerIndexValue>;
|
|
31
|
+
//# sourceMappingURL=triggers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggers.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/triggers.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAwB,MAAM,QAAQ,CAAC;AAE3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EACH,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,eAAe,EAIlB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,iBAAiB,EAA8C,MAAM,SAAS,CAAC;AAExF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,eAAe,GAAG,mBAAmB,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAiBpH;AAED;;GAEG;AACH,wBAAgB,gCAAgC,CAC5C,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,wBAAwB,GACnC,WAAW,CAAC,iBAAiB,CAAC,CAwChC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC5B,QAAQ,EAAE,eAAe,GAAG,mBAAmB,EAC/C,QAAQ,EAAE,wBAAwB,EAClC,YAAY,GAAE,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,KAAK,iBAAkC,GAC9E,KAAK,CAAC,iBAAiB,CAAC,CAmB1B;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,EAC7B,QAAQ,EAAE,wBAAwB,EAClC,YAAY,GAAE,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG,CAAC,KAAK,iBAAkC,GAC9E,KAAK,CAAC,iBAAiB,CAAC,CAc1B"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { atom, useRecoilValue } from 'recoil';
|
|
2
|
+
import { isDataVariable, isDerivedDataVariable, isDerivedVariable, } from '../../types';
|
|
3
|
+
import { atomRegistry, dataRegistry, getRegistryKey } from './store';
|
|
4
|
+
/**
|
|
5
|
+
* Get a trigger index for a variable from the atom registry, registering it if not already registered
|
|
6
|
+
*
|
|
7
|
+
* @param variable variable to register trigger for
|
|
8
|
+
*/
|
|
9
|
+
export function getOrRegisterTrigger(variable) {
|
|
10
|
+
const triggerKey = getRegistryKey(variable, 'trigger');
|
|
11
|
+
if (!atomRegistry.has(triggerKey)) {
|
|
12
|
+
atomRegistry.set(triggerKey, atom({
|
|
13
|
+
default: {
|
|
14
|
+
force: false,
|
|
15
|
+
inc: 0,
|
|
16
|
+
},
|
|
17
|
+
key: triggerKey,
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
return atomRegistry.get(triggerKey);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Get the data variable server trigger atom if it exists, otherwise create it
|
|
24
|
+
*/
|
|
25
|
+
export function getOrRegisterDataVariableTrigger(variable, wsClient) {
|
|
26
|
+
// get or create an observable for the data variable
|
|
27
|
+
const key = `${variable.uid}-data`;
|
|
28
|
+
if (!dataRegistry.has(key)) {
|
|
29
|
+
dataRegistry.set(key, atom({
|
|
30
|
+
default: {
|
|
31
|
+
force: true,
|
|
32
|
+
inc: 0,
|
|
33
|
+
},
|
|
34
|
+
effects: [
|
|
35
|
+
// synchronize with server triggers - increment when the variable is triggered on the server side
|
|
36
|
+
({ setSelf }) => {
|
|
37
|
+
const subscription = wsClient.serverTriggers$(variable.uid).subscribe(() => {
|
|
38
|
+
setSelf((v) => {
|
|
39
|
+
if (typeof v === 'object' && 'inc' in v) {
|
|
40
|
+
return {
|
|
41
|
+
force: true,
|
|
42
|
+
inc: v.inc + 1,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
force: true,
|
|
47
|
+
inc: 1,
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
return () => {
|
|
52
|
+
subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
key,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
return dataRegistry.get(key);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Recursively register triggers as dependencies by calling the registerFunc on all nested derived variables
|
|
63
|
+
*
|
|
64
|
+
* @param variable variable to register triggers for
|
|
65
|
+
* @param wsClient websocket client
|
|
66
|
+
* @param registerFunc register function to run
|
|
67
|
+
*/
|
|
68
|
+
export function registerTriggers(variable, wsClient, registerFunc = useRecoilValue) {
|
|
69
|
+
const triggers = [];
|
|
70
|
+
// Register the variable itself
|
|
71
|
+
const triggerIndex = getOrRegisterTrigger(variable);
|
|
72
|
+
triggers.push(registerFunc(triggerIndex));
|
|
73
|
+
// Register nested derived and data variables triggers recursively
|
|
74
|
+
variable.variables.forEach((v) => {
|
|
75
|
+
if (isDerivedVariable(v) || isDerivedDataVariable(v)) {
|
|
76
|
+
triggers.push(...registerTriggers(v, wsClient, registerFunc));
|
|
77
|
+
}
|
|
78
|
+
if (isDataVariable(v)) {
|
|
79
|
+
const serverTrigger = getOrRegisterDataVariableTrigger(v, wsClient);
|
|
80
|
+
triggers.push(registerFunc(serverTrigger));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return triggers;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Recursively register triggers in the list of dependant variables
|
|
87
|
+
*
|
|
88
|
+
* @param variable variable to register triggers for
|
|
89
|
+
* @param wsClient websocket client
|
|
90
|
+
* @param registerFunc register function to run
|
|
91
|
+
*/
|
|
92
|
+
export function registerChildTriggers(variables, wsClient, registerFunc = useRecoilValue) {
|
|
93
|
+
const triggers = [];
|
|
94
|
+
variables.forEach((v) => {
|
|
95
|
+
if (isDerivedVariable(v) || isDerivedDataVariable(v)) {
|
|
96
|
+
triggers.push(...registerTriggers(v, wsClient, registerFunc));
|
|
97
|
+
}
|
|
98
|
+
if (isDataVariable(v)) {
|
|
99
|
+
const serverTrigger = getOrRegisterDataVariableTrigger(v, wsClient);
|
|
100
|
+
triggers.push(registerFunc(serverTrigger));
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return triggers;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=triggers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggers.js","sourceRoot":"","sources":["../../../js/shared/interactivity/triggers.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RecoilState } from 'recoil';
|
|
2
|
+
import { UrlVariable } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Get a URL variable from the atom registry, registering it if not already registered
|
|
5
|
+
* TODO: once persist_value is unified with url sync, this can be moved into the same function as getOrRegisterPlainVariable
|
|
6
|
+
*
|
|
7
|
+
* @param variable variable to register
|
|
8
|
+
* @param searchString URL search string
|
|
9
|
+
*/
|
|
10
|
+
export declare function getOrRegisterUrlVariable<T>(variable: UrlVariable<T>): RecoilState<T>;
|
|
11
|
+
export declare function useUrlVariable<T>(variable: UrlVariable<T>): [T, (value: T) => void];
|
|
12
|
+
//# sourceMappingURL=url-variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-variable.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/url-variable.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAwB,MAAM,QAAQ,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAItC;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAcpF;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAInF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { mixed } from '@recoiljs/refine';
|
|
2
|
+
import { atom, useRecoilState } from 'recoil';
|
|
3
|
+
import { urlSyncEffect } from 'recoil-sync';
|
|
4
|
+
import { atomRegistry } from './store';
|
|
5
|
+
/**
|
|
6
|
+
* Get a URL variable from the atom registry, registering it if not already registered
|
|
7
|
+
* TODO: once persist_value is unified with url sync, this can be moved into the same function as getOrRegisterPlainVariable
|
|
8
|
+
*
|
|
9
|
+
* @param variable variable to register
|
|
10
|
+
* @param searchString URL search string
|
|
11
|
+
*/
|
|
12
|
+
export function getOrRegisterUrlVariable(variable) {
|
|
13
|
+
if (!atomRegistry.has(variable.uid)) {
|
|
14
|
+
atomRegistry.set(variable.uid, atom({
|
|
15
|
+
default: variable.default,
|
|
16
|
+
effects: [
|
|
17
|
+
urlSyncEffect({ history: 'push', itemKey: variable.query, refine: mixed(), syncDefault: true }),
|
|
18
|
+
],
|
|
19
|
+
key: variable.uid,
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
return atomRegistry.get(variable.uid);
|
|
23
|
+
}
|
|
24
|
+
export function useUrlVariable(variable) {
|
|
25
|
+
const [val, setVal] = useRecoilState(getOrRegisterUrlVariable(variable));
|
|
26
|
+
return [val, setVal];
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=url-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-variable.js","sourceRoot":"","sources":["../../../js/shared/interactivity/url-variable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAe,IAAI,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAI,QAAwB;IAChE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACjC,YAAY,CAAC,GAAG,CACZ,QAAQ,CAAC,GAAG,EACZ,IAAI,CAAC;YACD,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,OAAO,EAAE;gBACL,aAAa,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;aAClG;YACD,GAAG,EAAE,QAAQ,CAAC,GAAG;SACpB,CAAC,CACL,CAAC;KACL;IACD,OAAO,YAAY,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,cAAc,CAAI,QAAwB;IACtD,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,cAAc,CAAI,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE5E,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AnyDataVariable, AnyVariable, DataFrame } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* A helper hook to retrieve value of any variable.
|
|
4
|
+
* For the rare occassions where a component can accept both a DataVariable and a non-DataVariable.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useAnyVariable(variable: AnyDataVariable): DataFrame;
|
|
7
|
+
export declare function useAnyVariable<T = any>(variable: AnyVariable<T>): T;
|
|
8
|
+
//# sourceMappingURL=use-any-variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-any-variable.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/use-any-variable.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAyC,MAAM,SAAS,CAAC;AAKzG;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAC;AACrE,wBAAgB,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
11
|
+
import { useQuery } from '@tanstack/react-query';
|
|
12
|
+
import { useEffect } from 'react';
|
|
13
|
+
import { isDataVariable, isDerivedDataVariable } from '../../types';
|
|
14
|
+
import { useDataVariable } from './use-data-variable';
|
|
15
|
+
import { useVariable } from './use-variable';
|
|
16
|
+
export function useAnyVariable(variable) {
|
|
17
|
+
if (isDataVariable(variable) || isDerivedDataVariable(variable)) {
|
|
18
|
+
const getData = useDataVariable(variable);
|
|
19
|
+
const { data, refetch } = useQuery({
|
|
20
|
+
// ideally would be 0 but that causes infinite loops, see https://github.com/TanStack/query/issues/2367
|
|
21
|
+
cacheTime: 1,
|
|
22
|
+
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const dataResponse = yield getData();
|
|
24
|
+
return dataResponse.data;
|
|
25
|
+
}),
|
|
26
|
+
queryKey: ['any-variable-data', variable.uid],
|
|
27
|
+
refetchOnWindowFocus: false,
|
|
28
|
+
suspense: true,
|
|
29
|
+
});
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
// Refetch when getData changes
|
|
32
|
+
refetch();
|
|
33
|
+
}, [getData]);
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
return useVariable(variable)[0];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=use-any-variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-any-variable.js","sourceRoot":"","sources":["../../../js/shared/interactivity/use-any-variable.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA+C;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAA2C,cAAc,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEzG,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ7C,MAAM,UAAU,cAAc,CAAU,QAAwB;IAC5D,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE;QAC7D,MAAM,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;QAE1C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC;YAC/B,uGAAuG;YACvG,SAAS,EAAE,CAAC;YACZ,OAAO,EAAE,GAAS,EAAE;gBAChB,MAAM,YAAY,GAAG,MAAM,OAAO,EAAE,CAAC;gBACrC,OAAO,YAAY,CAAC,IAAI,CAAC;YAC7B,CAAC,CAAA;YACD,QAAQ,EAAE,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GAAG,CAAC;YAC7C,oBAAoB,EAAE,KAAK;YAC3B,QAAQ,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,SAAS,CAAC,GAAG,EAAE;YACX,+BAA+B;YAC/B,OAAO,EAAE,CAAC;QACd,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;QAEd,OAAO,IAAI,CAAC;KACf;IAED,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AnyDataVariable, FilterQuery, Pagination } from '../../types';
|
|
2
|
+
import { DataResponse } from './internal';
|
|
3
|
+
/**
|
|
4
|
+
* Helper hook which turns a (Derived)DataVariable into a callback to return DataFrame.
|
|
5
|
+
* Can be used in components that only work with data variables.
|
|
6
|
+
*
|
|
7
|
+
* The callback identity changes whenever a refetch should be triggered.
|
|
8
|
+
*
|
|
9
|
+
* @param variable data variable
|
|
10
|
+
*/
|
|
11
|
+
export declare function useDataVariable(variable: AnyDataVariable): (filters?: FilterQuery, pagination?: Pagination) => Promise<DataResponse>;
|
|
12
|
+
//# sourceMappingURL=use-data-variable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-data-variable.d.ts","sourceRoot":"","sources":["../../../js/shared/interactivity/use-data-variable.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAC;AAEnF,OAAO,EACH,YAAY,EAMf,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC3B,QAAQ,EAAE,eAAe,GAC1B,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,UAAU,CAAC,EAAE,UAAU,KAAK,OAAO,CAAC,YAAY,CAAC,CA+C3E"}
|