@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,11 @@
|
|
|
1
|
+
import { ComponentType } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Check a component is a JS component and apply a type guard for the returned type
|
|
4
|
+
*
|
|
5
|
+
* @param component - the component to check
|
|
6
|
+
*/
|
|
7
|
+
function isJsComponent(component) {
|
|
8
|
+
return component.type === ComponentType.JS;
|
|
9
|
+
}
|
|
10
|
+
export default isJsComponent;
|
|
11
|
+
//# sourceMappingURL=is-js-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-js-component.js","sourceRoot":"","sources":["../../../js/shared/utils/is-js-component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAe,MAAM,SAAS,CAAC;AAEhE;;;;GAIG;AACH,SAAS,aAAa,CAAC,SAAoB;IACvC,OAAO,SAAS,CAAC,IAAI,KAAK,aAAa,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AnyVariable, NormalizedPayload, ResolvedDerivedVariable } from '../../types';
|
|
2
|
+
type Mapping = Record<string, any>;
|
|
3
|
+
type JsonArray = Array<JsonLike | string | number>;
|
|
4
|
+
type JsonLike = Mapping | JsonArray;
|
|
5
|
+
export declare function getIdentifier(variable: AnyVariable<any>): string;
|
|
6
|
+
export declare function denormalize(obj: Mapping, lookup: Mapping): Mapping;
|
|
7
|
+
export declare function denormalize(obj: JsonArray, lookup: Mapping): JsonArray;
|
|
8
|
+
type DerivedVariableRequest = Array<ResolvedDerivedVariable | any>;
|
|
9
|
+
type PyComponentRequest = Record<string, ResolvedDerivedVariable | any>;
|
|
10
|
+
/**
|
|
11
|
+
* Normalize py_component request data into a NormalizedPayload.
|
|
12
|
+
* Puts all variable values into a lookup object to prevent data duplication.
|
|
13
|
+
*
|
|
14
|
+
* @param values resolved values
|
|
15
|
+
* @param kwargsDefinition raw kwarg definition object
|
|
16
|
+
*/
|
|
17
|
+
export declare function normalizeRequest(values: PyComponentRequest | DerivedVariableRequest, kwargsDefinition: Record<string, AnyVariable<any>> | Array<AnyVariable<any>>): NormalizedPayload<Record<string | number, any>>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=normalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalization.d.ts","sourceRoot":"","sources":["../../../js/shared/utils/normalization.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EAGX,iBAAiB,EAEjB,uBAAuB,EAK1B,MAAM,SAAS,CAAC;AAKjB,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACnC,KAAK,SAAS,GAAG,KAAK,CAAC,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;AACnD,KAAK,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAUpC,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,MAAM,CAYhE;AAiBD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;AACpE,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;AAwExE,KAAK,sBAAsB,GAAG,KAAK,CAAC,uBAAuB,GAAG,GAAG,CAAC,CAAC;AAEnE,KAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,uBAAuB,GAAG,GAAG,CAAC,CAAC;AAExE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,kBAAkB,GAAG,sBAAsB,EACnD,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAC7E,iBAAiB,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,CAkCjD"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { isDerivedDataVariable, isDerivedVariable, isResolvedDerivedDataVariable, isResolvedDerivedVariable, } from '../../types';
|
|
2
|
+
import { hashObject } from './hashing';
|
|
3
|
+
function isPlaceholder(value) {
|
|
4
|
+
return typeof value === 'object' && '__ref' in value;
|
|
5
|
+
}
|
|
6
|
+
export function getIdentifier(variable) {
|
|
7
|
+
let id = `${variable.__typename}:${variable.uid}`;
|
|
8
|
+
if ('nested' in variable && variable.nested.length > 0) {
|
|
9
|
+
id += `:${variable.nested.join(',')}`;
|
|
10
|
+
}
|
|
11
|
+
if ('filters' in variable) {
|
|
12
|
+
id += `:${hashObject(variable.filters)}`;
|
|
13
|
+
}
|
|
14
|
+
return id;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get an iterable of entries of array or object
|
|
18
|
+
*
|
|
19
|
+
* @param obj json-like array or object
|
|
20
|
+
*/
|
|
21
|
+
function getEntries(obj) {
|
|
22
|
+
if (Array.isArray(obj)) {
|
|
23
|
+
return obj.entries();
|
|
24
|
+
}
|
|
25
|
+
return Object.entries(obj);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Denormalize data by replacing Placeholders with objects from lookup
|
|
29
|
+
*
|
|
30
|
+
* @param obj JSON-like structure containing placeholders
|
|
31
|
+
* @param lookup map of identifier -> referrable
|
|
32
|
+
*/
|
|
33
|
+
export function denormalize(obj, lookup) {
|
|
34
|
+
if (isPlaceholder(obj)) {
|
|
35
|
+
const referrable = lookup[obj.__ref];
|
|
36
|
+
return denormalize(referrable, lookup);
|
|
37
|
+
}
|
|
38
|
+
const output = Array.isArray(obj) ? [] : {};
|
|
39
|
+
for (const [key, val] of getEntries(obj)) {
|
|
40
|
+
if (val !== null && typeof val === 'object') {
|
|
41
|
+
output[key] = denormalize(val, lookup);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
output[key] = val;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return output;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Normalize a ResolvedDerivedVariable object
|
|
51
|
+
*
|
|
52
|
+
* @param resolved resolved derived variable object
|
|
53
|
+
* @param def variable definition
|
|
54
|
+
*/
|
|
55
|
+
function normalizeResolvedDerivedVariable(resolved, def) {
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
|
|
57
|
+
const normalizedValues = [];
|
|
58
|
+
let lookup = {};
|
|
59
|
+
for (const [key, val] of resolved.values.entries()) {
|
|
60
|
+
// Recursively call normalize on resolve derived variables
|
|
61
|
+
if (isResolvedDerivedVariable(val) || isResolvedDerivedDataVariable(val)) {
|
|
62
|
+
const { data: nestedNormalized, lookup: nestedLookup } = normalizeResolvedDerivedVariable(val, def.variables[key]);
|
|
63
|
+
normalizedValues.push(nestedNormalized);
|
|
64
|
+
lookup = Object.assign(Object.assign({}, lookup), nestedLookup);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
// Put values into lookup
|
|
68
|
+
const varDef = def.variables[key];
|
|
69
|
+
const identifier = getIdentifier(varDef);
|
|
70
|
+
lookup[identifier] = val;
|
|
71
|
+
normalizedValues.push({ __ref: identifier });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
data: Object.assign(Object.assign({}, resolved), { values: normalizedValues }),
|
|
76
|
+
lookup,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Normalize py_component request data into a NormalizedPayload.
|
|
81
|
+
* Puts all variable values into a lookup object to prevent data duplication.
|
|
82
|
+
*
|
|
83
|
+
* @param values resolved values
|
|
84
|
+
* @param kwargsDefinition raw kwarg definition object
|
|
85
|
+
*/
|
|
86
|
+
export function normalizeRequest(values, kwargsDefinition) {
|
|
87
|
+
const data = Array.isArray(values) ? [] : {};
|
|
88
|
+
let lookup = {};
|
|
89
|
+
// Iterate through both kwargs def and values
|
|
90
|
+
// Where a plain Variable is found, put value to lookup
|
|
91
|
+
for (const [key, val] of getEntries(values)) {
|
|
92
|
+
const kwargDef = kwargsDefinition[key];
|
|
93
|
+
// If no def is found, i.e. a static kwarg in PyComponent
|
|
94
|
+
if (!kwargDef) {
|
|
95
|
+
data[key] = val;
|
|
96
|
+
}
|
|
97
|
+
else if (isDerivedVariable(kwargDef) || isDerivedDataVariable(kwargDef)) {
|
|
98
|
+
// Handle resolved derived variable
|
|
99
|
+
const { data: nestedData, lookup: nestedLookup } = normalizeResolvedDerivedVariable(val, kwargDef);
|
|
100
|
+
data[key] = nestedData;
|
|
101
|
+
lookup = Object.assign(Object.assign({}, lookup), nestedLookup);
|
|
102
|
+
}
|
|
103
|
+
else if (kwargDef.constructor === Object) {
|
|
104
|
+
const identifier = getIdentifier(kwargDef);
|
|
105
|
+
lookup[identifier] = val === undefined ? null : val;
|
|
106
|
+
data[key] = { __ref: identifier };
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
// If constructor is not an Object then it is the case of normalizing a static value
|
|
110
|
+
data[key] = val;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
data,
|
|
115
|
+
lookup,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=normalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalization.js","sourceRoot":"","sources":["../../../js/shared/utils/normalization.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOH,qBAAqB,EACrB,iBAAiB,EACjB,6BAA6B,EAC7B,yBAAyB,GAC5B,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAWvC,SAAS,aAAa,CAAC,KAAU;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,QAA0B;IACpD,IAAI,EAAE,GAAG,GAAG,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC;IAElD,IAAI,QAAQ,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACpD,EAAE,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;KACzC;IAED,IAAI,SAAS,IAAI,QAAQ,EAAE;QACvB,EAAE,IAAI,IAAI,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;KAC5C;IAED,OAAO,EAAE,CAAC;AACd,CAAC;AAID;;;;GAIG;AACH,SAAS,UAAU,CAAC,GAAa;IAC7B,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACpB,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC;KACxB;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC;AAKD;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,GAAa,EAAE,MAAe;IACtD,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE;QACpB,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;KAC1C;IAED,MAAM,MAAM,GAAiC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1E,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,EAAE;QACtC,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;YACzC,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;SAC1C;aAAM;YACH,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;SACrB;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;GAKG;AACH,SAAS,gCAAgC,CACrC,QAA+D,EAC/D,GAA0C;IAE1C,6EAA6E;IAC7E,MAAM,gBAAgB,GAAuE,EAAE,CAAC;IAChG,IAAI,MAAM,GAAwB,EAAE,CAAC;IAErC,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;QAChD,0DAA0D;QAC1D,IAAI,yBAAyB,CAAC,GAAG,CAAC,IAAI,6BAA6B,CAAC,GAAG,CAAC,EAAE;YACtE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,gCAAgC,CACrF,GAAG,EACH,GAAG,CAAC,SAAS,CAAC,GAAG,CAAoB,CACxC,CAAC;YACF,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACxC,MAAM,mCACC,MAAM,GACN,YAAY,CAClB,CAAC;SACL;aAAM;YACH,yBAAyB;YACzB,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;YAClC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;YACzC,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,CAAC;YACzB,gBAAgB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;SAChD;KACJ;IAED,OAAO;QACH,IAAI,kCACG,QAAQ,KACX,MAAM,EAAE,gBAAgB,GAC3B;QACD,MAAM;KACT,CAAC;AACN,CAAC;AAOD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC5B,MAAmD,EACnD,gBAA4E;IAE5E,MAAM,IAAI,GAAiC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,IAAI,MAAM,GAAwB,EAAE,CAAC;IAErC,6CAA6C;IAC7C,uDAAuD;IACvD,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE;QACzC,MAAM,QAAQ,GAAsB,gBAAwB,CAAC,GAAG,CAAC,CAAC;QAElE,yDAAyD;QACzD,IAAI,CAAC,QAAQ,EAAE;YACX,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;SACnB;aAAM,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,qBAAqB,CAAC,QAAQ,CAAC,EAAE;YACvE,mCAAmC;YACnC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,gCAAgC,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;YACnG,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YACvB,MAAM,mCACC,MAAM,GACN,YAAY,CAClB,CAAC;SACL;aAAM,IAAI,QAAQ,CAAC,WAAW,KAAK,MAAM,EAAE;YACxC,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC3C,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;YACpD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;SACrC;aAAM;YACH,oFAAoF;YACpF,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;SACnB;KACJ;IAED,OAAO;QACH,IAAI;QACJ,MAAM;KACT,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DefaultTheme } from '@darajs/styled-components';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the theme passed from the backend. If the default values of 'default' or 'dark' are passed then return the
|
|
4
|
+
* default themes from styled-components, otherwise pass back the custom theme scheme.
|
|
5
|
+
*
|
|
6
|
+
* @param configTheme - the config theme structure of the app
|
|
7
|
+
*/
|
|
8
|
+
export default function resolveTheme(configTheme: 'light' | 'dark' | DefaultTheme, baseTheme?: 'light' | 'dark'): DefaultTheme;
|
|
9
|
+
//# sourceMappingURL=resolve-theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-theme.d.ts","sourceRoot":"","sources":["../../../js/shared/utils/resolve-theme.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAoB,MAAM,2BAA2B,CAAC;AAM3E;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAChC,WAAW,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,EAC5C,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,GAC7B,YAAY,CAkCd"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import isNull from 'lodash/isNull';
|
|
2
|
+
import omitBy from 'lodash/omitBy';
|
|
3
|
+
import { darkTheme, theme } from '@darajs/styled-components';
|
|
4
|
+
function isTheme(configTheme) {
|
|
5
|
+
return typeof configTheme !== 'string';
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the theme passed from the backend. If the default values of 'default' or 'dark' are passed then return the
|
|
9
|
+
* default themes from styled-components, otherwise pass back the custom theme scheme.
|
|
10
|
+
*
|
|
11
|
+
* @param configTheme - the config theme structure of the app
|
|
12
|
+
*/
|
|
13
|
+
export default function resolveTheme(configTheme, baseTheme) {
|
|
14
|
+
if (!configTheme || configTheme === 'light') {
|
|
15
|
+
return theme;
|
|
16
|
+
}
|
|
17
|
+
if (configTheme === 'dark') {
|
|
18
|
+
return darkTheme;
|
|
19
|
+
}
|
|
20
|
+
if (isTheme(configTheme)) {
|
|
21
|
+
const original = baseTheme === 'dark' ? darkTheme : theme;
|
|
22
|
+
return Object.assign(Object.assign(Object.assign({}, original), omitBy(configTheme, isNull)), { colors: Object.assign(Object.assign({}, original.colors), omitBy(configTheme.colors, isNull)), font: Object.assign(Object.assign({}, original.font), omitBy(configTheme.font, isNull)), shadow: Object.assign(Object.assign({}, original.shadow), omitBy(configTheme.shadow, isNull)) });
|
|
23
|
+
}
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
25
|
+
console.warn('No valid theme was found. Defaulting to light theme.');
|
|
26
|
+
return theme;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=resolve-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-theme.js","sourceRoot":"","sources":["../../../js/shared/utils/resolve-theme.tsx"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,MAAM,MAAM,eAAe,CAAC;AAEnC,OAAO,EAAgB,SAAS,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAE3E,SAAS,OAAO,CAAC,WAAkC;IAC/C,OAAO,OAAO,WAAW,KAAK,QAAQ,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAChC,WAA4C,EAC5C,SAA4B;IAE5B,IAAI,CAAC,WAAW,IAAI,WAAW,KAAK,OAAO,EAAE;QACzC,OAAO,KAAK,CAAC;KAChB;IAED,IAAI,WAAW,KAAK,MAAM,EAAE;QACxB,OAAO,SAAS,CAAC;KACpB;IAED,IAAI,OAAO,CAAC,WAAW,CAAC,EAAE;QACtB,MAAM,QAAQ,GAAiB,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;QAExE,qDAGO,QAAQ,GACR,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,KAC9B,MAAM,kCACC,QAAQ,CAAC,MAAM,GACf,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAEzC,IAAI,kCACG,QAAQ,CAAC,IAAI,GACb,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,GAEvC,MAAM,kCACC,QAAQ,CAAC,MAAM,GACf,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,KAE3C;KACL;IACD,sCAAsC;IACtC,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;IACrE,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ComponentInstance, TemplatedComponentInstance } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Recursively searches through the component instance looking for TemplateMarker instances.
|
|
4
|
+
*
|
|
5
|
+
* @param component component to search through
|
|
6
|
+
*/
|
|
7
|
+
export declare function hasTemplateMarkers(component: ComponentInstance): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Recursively searches through the templated component instance looking for TemplateMarker instances.
|
|
10
|
+
* Returns a map of the path to the marker to the field name of the marker.
|
|
11
|
+
*
|
|
12
|
+
* @param template template to search through
|
|
13
|
+
*/
|
|
14
|
+
export declare function getMarkerPaths(template: ComponentInstance & TemplatedComponentInstance): Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Replaces markers in a template with data.
|
|
17
|
+
* Utilises lodash.set to set the value of the marker.
|
|
18
|
+
*
|
|
19
|
+
* @param template template to replace markers in
|
|
20
|
+
* @param data data to replace markers with
|
|
21
|
+
* @param paths paths to markers in the template
|
|
22
|
+
*/
|
|
23
|
+
export declare function replaceMarkers(template: ComponentInstance & TemplatedComponentInstance, data: Record<string, any>, paths: Record<string, string>): ComponentInstance & TemplatedComponentInstance;
|
|
24
|
+
//# sourceMappingURL=templating.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templating.d.ts","sourceRoot":"","sources":["../../../js/shared/utils/templating.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAkB,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAWxF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAexE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgB/G;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,iBAAiB,GAAG,0BAA0B,EACxD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,iBAAiB,GAAG,0BAA0B,CAShD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import copy from 'lodash/cloneDeep';
|
|
2
|
+
import set from 'lodash/set';
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a value is a TemplateMarker.
|
|
5
|
+
*
|
|
6
|
+
* @param value value to check
|
|
7
|
+
*/
|
|
8
|
+
function isTemplateMarker(value) {
|
|
9
|
+
return value && typeof value === 'object' && value.__typename === 'TemplateMarker';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Recursively searches through the component instance looking for TemplateMarker instances.
|
|
13
|
+
*
|
|
14
|
+
* @param component component to search through
|
|
15
|
+
*/
|
|
16
|
+
export function hasTemplateMarkers(component) {
|
|
17
|
+
if (!component || typeof component !== 'object') {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
for (const value of Object.values(component)) {
|
|
21
|
+
if (isTemplateMarker(value)) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
if (value && typeof value === 'object') {
|
|
25
|
+
return hasTemplateMarkers(value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Recursively searches through the templated component instance looking for TemplateMarker instances.
|
|
32
|
+
* Returns a map of the path to the marker to the field name of the marker.
|
|
33
|
+
*
|
|
34
|
+
* @param template template to search through
|
|
35
|
+
*/
|
|
36
|
+
export function getMarkerPaths(template) {
|
|
37
|
+
const paths = {};
|
|
38
|
+
function recurse(component, path) {
|
|
39
|
+
for (const [key, value] of Object.entries(component)) {
|
|
40
|
+
if (isTemplateMarker(value)) {
|
|
41
|
+
paths[path + key] = value.field_name;
|
|
42
|
+
}
|
|
43
|
+
else if (value instanceof Object) {
|
|
44
|
+
recurse(value, `${path + key}.`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
recurse(template, '');
|
|
49
|
+
return paths;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Replaces markers in a template with data.
|
|
53
|
+
* Utilises lodash.set to set the value of the marker.
|
|
54
|
+
*
|
|
55
|
+
* @param template template to replace markers in
|
|
56
|
+
* @param data data to replace markers with
|
|
57
|
+
* @param paths paths to markers in the template
|
|
58
|
+
*/
|
|
59
|
+
export function replaceMarkers(template, data, paths) {
|
|
60
|
+
const templateCopy = copy(template);
|
|
61
|
+
for (const [path, fieldName] of Object.entries(paths)) {
|
|
62
|
+
const value = data[fieldName];
|
|
63
|
+
set(templateCopy, path, value);
|
|
64
|
+
}
|
|
65
|
+
return templateCopy;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=templating.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templating.js","sourceRoot":"","sources":["../../../js/shared/utils/templating.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,GAAG,MAAM,YAAY,CAAC;AAI7B;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,KAAU;IAChC,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,KAAK,gBAAgB,CAAC;AACvF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAA4B;IAC3D,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;QAC7C,OAAO,KAAK,CAAC;KAChB;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC1C,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YACzB,OAAO,IAAI,CAAC;SACf;QACD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACpC,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;SACpC;KACJ;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,QAAwD;IACnF,MAAM,KAAK,GAA2B,EAAE,CAAC;IAEzC,SAAS,OAAO,CAAC,SAA4B,EAAE,IAAY;QACvD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAClD,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;gBACzB,KAAK,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC;aACxC;iBAAM,IAAI,KAAK,YAAY,MAAM,EAAE;gBAChC,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC;aACpC;SACJ;IACL,CAAC;IAED,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEtB,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC1B,QAAwD,EACxD,IAAyB,EACzB,KAA6B;IAE7B,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEpC,KAAK,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACnD,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9B,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;KAClC;IAED,OAAO,YAAY,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionDef, ActionInstance } from '../../types/core';
|
|
2
|
+
interface ActionRegistryInterface {
|
|
3
|
+
get: (instance: ActionInstance) => ActionDef;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The action registry pulls the full list of actions from the backend and then returns a function that allows a
|
|
7
|
+
* specific action to be requested using it's instance.
|
|
8
|
+
*/
|
|
9
|
+
declare function useActionRegistry(): ActionRegistryInterface;
|
|
10
|
+
export default useActionRegistry;
|
|
11
|
+
//# sourceMappingURL=use-action-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-action-registry.d.ts","sourceRoot":"","sources":["../../../js/shared/utils/use-action-registry.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEzD,UAAU,uBAAuB;IAC7B,GAAG,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,SAAS,CAAC;CAChD;AAED;;;GAGG;AACH,iBAAS,iBAAiB,IAAI,uBAAuB,CAcpD;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useCallback, useContext } from 'react';
|
|
2
|
+
import RegistriesCtx from '../../shared/context/registries-context';
|
|
3
|
+
/**
|
|
4
|
+
* The action registry pulls the full list of actions from the backend and then returns a function that allows a
|
|
5
|
+
* specific action to be requested using it's instance.
|
|
6
|
+
*/
|
|
7
|
+
function useActionRegistry() {
|
|
8
|
+
const { actionRegistry: actions } = useContext(RegistriesCtx);
|
|
9
|
+
const get = useCallback((instance) => {
|
|
10
|
+
if (actions && actions[instance.name]) {
|
|
11
|
+
return actions[instance.name];
|
|
12
|
+
}
|
|
13
|
+
throw new Error(`Attempted to load an action (${instance.name}) that is not in the registry`);
|
|
14
|
+
}, [actions]);
|
|
15
|
+
return { get };
|
|
16
|
+
}
|
|
17
|
+
export default useActionRegistry;
|
|
18
|
+
//# sourceMappingURL=use-action-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-action-registry.js","sourceRoot":"","sources":["../../../js/shared/utils/use-action-registry.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,aAAa,MAAM,qCAAqC,CAAC;AAOhE;;;GAGG;AACH,SAAS,iBAAiB;IACtB,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAE9D,MAAM,GAAG,GAAG,WAAW,CACnB,CAAC,QAAwB,EAAa,EAAE;QACpC,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACnC,OAAO,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SACjC;QACD,MAAM,IAAI,KAAK,CAAC,gCAAgC,QAAQ,CAAC,IAAI,+BAA+B,CAAC,CAAC;IAClG,CAAC,EACD,CAAC,OAAO,CAAC,CACZ,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,CAAC;AACnB,CAAC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Action } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Consume an action def from the framework and return a callback function that can be used to trigger it
|
|
4
|
+
* and a loading state boolean indicating whether an action is currently in progress
|
|
5
|
+
*
|
|
6
|
+
* @param actionDefinition the action def passed in
|
|
7
|
+
*/
|
|
8
|
+
export default function useAction(action: Action): [(value: any) => Promise<void>, boolean];
|
|
9
|
+
//# sourceMappingURL=use-action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-action.d.ts","sourceRoot":"","sources":["../../../js/shared/utils/use-action.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAyC,MAAM,SAAS,CAAC;AAsCxE;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CA6C1F"}
|
|
@@ -0,0 +1,84 @@
|
|
|
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 { useCallback, useContext, useState } from 'react';
|
|
11
|
+
import { useAsyncResource } from 'use-async-resource';
|
|
12
|
+
import { useActionContext } from '../../actions/utils';
|
|
13
|
+
import { ImportersCtx } from '../../shared/context';
|
|
14
|
+
import useActionRegistry from './use-action-registry';
|
|
15
|
+
// Disabling rules of hook since the followiing function are willingly breaking the rules, making the assumption that the components call
|
|
16
|
+
// the exported functions with values which don't change the hook order etc
|
|
17
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
18
|
+
/**
|
|
19
|
+
* Helper method which converts an action into a list of hooks.
|
|
20
|
+
*
|
|
21
|
+
* @param action action(s) to import
|
|
22
|
+
* @param getAction method to convert an action instance into its definition
|
|
23
|
+
* @param importers importers available in the app
|
|
24
|
+
*/
|
|
25
|
+
function getActionHooks(action, getAction, importers) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const hooks = [];
|
|
28
|
+
const actions = Array.isArray(action) ? action : [action];
|
|
29
|
+
for (const act of actions) {
|
|
30
|
+
const actDef = getAction(act);
|
|
31
|
+
// Doing this sequentially to preserve order and not break rules of hooks
|
|
32
|
+
// eslint-disable-next-line no-await-in-loop
|
|
33
|
+
const moduleContent = yield importers[actDef.py_module]();
|
|
34
|
+
const Hook = moduleContent[actDef.name];
|
|
35
|
+
hooks.push(Hook);
|
|
36
|
+
}
|
|
37
|
+
return hooks;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Consume an action def from the framework and return a callback function that can be used to trigger it
|
|
42
|
+
* and a loading state boolean indicating whether an action is currently in progress
|
|
43
|
+
*
|
|
44
|
+
* @param actionDefinition the action def passed in
|
|
45
|
+
*/
|
|
46
|
+
export default function useAction(action) {
|
|
47
|
+
// Sanity check - it's technically possible to pass an ActionInstance or empty array and pydantic accepts them and converts to an ActionInstance
|
|
48
|
+
if ((action === null || action === void 0 ? void 0 : action.name) === 'ActionInstance') {
|
|
49
|
+
throw new Error('Expected a registered sub-class of "ActionInstance", base class detected');
|
|
50
|
+
}
|
|
51
|
+
// No action passed - noop
|
|
52
|
+
if (!action || (Array.isArray(action) && action.length === 0)) {
|
|
53
|
+
return [() => Promise.resolve(), false];
|
|
54
|
+
}
|
|
55
|
+
const [loading, setLoading] = useState(false);
|
|
56
|
+
const importers = useContext(ImportersCtx);
|
|
57
|
+
const actionContext = useActionContext();
|
|
58
|
+
const { get: getAction } = useActionRegistry();
|
|
59
|
+
const [actionHooksReader] = useAsyncResource(getActionHooks, action, getAction, importers);
|
|
60
|
+
// Call all action hooks and collect the callbacks
|
|
61
|
+
const actionHooks = actionHooksReader();
|
|
62
|
+
const actionCallbacks = [];
|
|
63
|
+
const actions = Array.isArray(action) ? action : [action];
|
|
64
|
+
for (const [index, actionHook] of actionHooks.entries()) {
|
|
65
|
+
actionCallbacks.push(actionHook(actions[index], actionContext));
|
|
66
|
+
}
|
|
67
|
+
const actionCallback = useCallback((value) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
// Track loading state for all actions
|
|
69
|
+
setLoading(true);
|
|
70
|
+
try {
|
|
71
|
+
for (const actionCb of actionCallbacks) {
|
|
72
|
+
// Sequentially execute actions to ensure deterministic order of execution
|
|
73
|
+
// eslint-disable-next-line no-await-in-loop
|
|
74
|
+
yield actionCb(value);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
// make sure to clean up loading state regardless of errors
|
|
79
|
+
setLoading(false);
|
|
80
|
+
}
|
|
81
|
+
}), [action, ...actionCallbacks]);
|
|
82
|
+
return [actionCallback, loading];
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=use-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-action.js","sourceRoot":"","sources":["../../../js/shared/utils/use-action.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Component, ComponentInstance } from '../../types/core';
|
|
2
|
+
interface ComponentRegistryInterface {
|
|
3
|
+
get: (instance: ComponentInstance) => Promise<Component>;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The component registry pulls the full list of components from the backend and then returns a function that allows a
|
|
7
|
+
* specific component to be requested using it's instance.
|
|
8
|
+
*/
|
|
9
|
+
declare function useComponentRegistry(maxRetries?: number): ComponentRegistryInterface;
|
|
10
|
+
export default useComponentRegistry;
|
|
11
|
+
//# sourceMappingURL=use-component-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-component-registry.d.ts","sourceRoot":"","sources":["../../../js/shared/utils/use-component-registry.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE5D,UAAU,0BAA0B;IAChC,GAAG,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;CAC5D;AAED;;;GAGG;AACH,iBAAS,oBAAoB,CAAC,UAAU,SAAI,GAAG,0BAA0B,CAmCxE;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 no-await-in-loop */
|
|
11
|
+
import { useCallback, useContext } from 'react';
|
|
12
|
+
import { RegistriesCtx } from '../../shared/context';
|
|
13
|
+
/**
|
|
14
|
+
* The component registry pulls the full list of components from the backend and then returns a function that allows a
|
|
15
|
+
* specific component to be requested using it's instance.
|
|
16
|
+
*/
|
|
17
|
+
function useComponentRegistry(maxRetries = 5) {
|
|
18
|
+
const { componentRegistry: components, refetchComponents } = useContext(RegistriesCtx);
|
|
19
|
+
const get = useCallback((instance) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
let component = null;
|
|
21
|
+
let registry = Object.assign({}, components);
|
|
22
|
+
let i = 0;
|
|
23
|
+
while (i < maxRetries) {
|
|
24
|
+
if (registry && registry[instance.name]) {
|
|
25
|
+
component = registry[instance.name];
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
// If component has not been found, it could be a nested py_component, so we refetch the registry
|
|
30
|
+
// to see if the component might have been added to the registry in the meantime
|
|
31
|
+
// But first wait for 0,5s before retrying, to give time for backend to update the registry
|
|
32
|
+
yield new Promise((resolve) => setTimeout(resolve, 500));
|
|
33
|
+
const { data } = yield refetchComponents();
|
|
34
|
+
registry = data;
|
|
35
|
+
}
|
|
36
|
+
i++;
|
|
37
|
+
}
|
|
38
|
+
if (!component) {
|
|
39
|
+
throw new Error(`Attempted to load a component (${instance.name}) that is not in the registry`);
|
|
40
|
+
}
|
|
41
|
+
return component;
|
|
42
|
+
}), [components]);
|
|
43
|
+
return { get };
|
|
44
|
+
}
|
|
45
|
+
export default useComponentRegistry;
|
|
46
|
+
//# sourceMappingURL=use-component-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-component-registry.js","sourceRoot":"","sources":["../../../js/shared/utils/use-component-registry.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,qCAAqC;AACrC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOjD;;;GAGG;AACH,SAAS,oBAAoB,CAAC,UAAU,GAAG,CAAC;IACxC,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAEvF,MAAM,GAAG,GAAG,WAAW,CACnB,CAAO,QAA2B,EAAsB,EAAE;QACtD,IAAI,SAAS,GAAc,IAAI,CAAC;QAChC,IAAI,QAAQ,qBAAQ,UAAU,CAAE,CAAC;QAEjC,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,OAAO,CAAC,GAAG,UAAU,EAAE;YACnB,IAAI,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACrC,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACpC,MAAM;aACT;iBAAM;gBACH,iGAAiG;gBACjG,gFAAgF;gBAChF,2FAA2F;gBAC3F,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;gBACzD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,iBAAiB,EAAE,CAAC;gBAC3C,QAAQ,GAAG,IAAI,CAAC;aACnB;YAED,CAAC,EAAE,CAAC;SACP;QAED,IAAI,CAAC,SAAS,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,kCAAkC,QAAQ,CAAC,IAAI,+BAA+B,CAAC,CAAC;SACnG;QAED,OAAO,SAAS,CAAC;IACrB,CAAC,CAAA,EACD,CAAC,UAAU,CAAC,CACf,CAAC;IAEF,OAAO,EAAE,GAAG,EAAE,CAAC;AACnB,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StyledComponentProps } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Type containing CSSProperties which extends to those that are missing React's defined list
|
|
5
|
+
*/
|
|
6
|
+
interface CustomCSSProperties extends React.CSSProperties {
|
|
7
|
+
gap?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Parse a raw_css property into styles and css
|
|
11
|
+
*
|
|
12
|
+
* @param rawCss raw css property to parse
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseRawCss(rawCss: string | CustomCSSProperties): [rawStyles: CustomCSSProperties, rawCss: string];
|
|
15
|
+
/**
|
|
16
|
+
* Styling utility hook which takes in base styling props and raw_css
|
|
17
|
+
* Outputs `style` and `css` properties to inject into the top-level component
|
|
18
|
+
*
|
|
19
|
+
* @param props props to get styles from
|
|
20
|
+
* @param useDisplayContext whether or not to use the display context, for some components such as Modal, these do not care for the context of their parent
|
|
21
|
+
*/
|
|
22
|
+
export default function useComponentStyles(props: StyledComponentProps, useDisplayContext?: boolean): [CustomCSSProperties, string];
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=use-component-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-component-styles.d.ts","sourceRoot":"","sources":["../../../js/shared/utils/use-component-styles.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAQ/C;;GAEG;AACH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,aAAa;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAsCD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,GAAG,CAAC,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,CAAC,CAOlH;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACtC,KAAK,EAAE,oBAAoB,EAC3B,iBAAiB,UAAO,GACzB,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAoC/B"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useContext, useMemo } from 'react';
|
|
2
|
+
import { useDeepCompare } from '@darajs/ui-utils';
|
|
3
|
+
import { default as DisplayCtx } from '../../shared/context/display-context';
|
|
4
|
+
/**
|
|
5
|
+
* Sets the flex property of a component based on props passed to it
|
|
6
|
+
*
|
|
7
|
+
* @param props the props passed to the component
|
|
8
|
+
* @param displayCtx the display context of the component, contains the parent layout context
|
|
9
|
+
* @param useDisplayContext whether or not to consider width/height in conjunction with displayCtx for some components such as Modal, these do not care for the context of their parent
|
|
10
|
+
*/
|
|
11
|
+
function flexStyles(props, displayCtx, useDisplayContext) {
|
|
12
|
+
let flexBasis = props.basis;
|
|
13
|
+
let flexShrink = props.shrink;
|
|
14
|
+
let flexGrow = props.grow;
|
|
15
|
+
if (useDisplayContext) {
|
|
16
|
+
// In a horizontal Stack setting the width should also set the flex-basis
|
|
17
|
+
if (props.width && displayCtx.direction === 'horizontal') {
|
|
18
|
+
flexBasis !== null && flexBasis !== void 0 ? flexBasis : (flexBasis = props.width);
|
|
19
|
+
flexShrink !== null && flexShrink !== void 0 ? flexShrink : (flexShrink = '0');
|
|
20
|
+
flexGrow !== null && flexGrow !== void 0 ? flexGrow : (flexGrow = '0');
|
|
21
|
+
}
|
|
22
|
+
// In a vertical Stack setting the height should also set the flex-basis
|
|
23
|
+
if (props.height && displayCtx.direction === 'vertical') {
|
|
24
|
+
flexBasis !== null && flexBasis !== void 0 ? flexBasis : (flexBasis = props.height);
|
|
25
|
+
flexShrink !== null && flexShrink !== void 0 ? flexShrink : (flexShrink = '0');
|
|
26
|
+
flexGrow !== null && flexGrow !== void 0 ? flexGrow : (flexGrow = '0');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// If hug is set, then the flex-basis should be set to content
|
|
30
|
+
// Otherwise we check if the parent is a component that has hug set to true, and its children should inherit
|
|
31
|
+
if (props.hug || (props.hug !== false && displayCtx.hug)) {
|
|
32
|
+
flexBasis !== null && flexBasis !== void 0 ? flexBasis : (flexBasis = 'content');
|
|
33
|
+
flexShrink !== null && flexShrink !== void 0 ? flexShrink : (flexShrink = '1');
|
|
34
|
+
flexGrow !== null && flexGrow !== void 0 ? flexGrow : (flexGrow = '0');
|
|
35
|
+
}
|
|
36
|
+
return { flexBasis, flexGrow, flexShrink };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse a raw_css property into styles and css
|
|
40
|
+
*
|
|
41
|
+
* @param rawCss raw css property to parse
|
|
42
|
+
*/
|
|
43
|
+
export function parseRawCss(rawCss) {
|
|
44
|
+
const isRawObject = typeof rawCss === 'object' && rawCss !== null && rawCss !== undefined;
|
|
45
|
+
const componentCss = !isRawObject && typeof rawCss === 'string' ? rawCss : '';
|
|
46
|
+
const styles = isRawObject ? rawCss : {};
|
|
47
|
+
return [styles, componentCss];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Styling utility hook which takes in base styling props and raw_css
|
|
51
|
+
* Outputs `style` and `css` properties to inject into the top-level component
|
|
52
|
+
*
|
|
53
|
+
* @param props props to get styles from
|
|
54
|
+
* @param useDisplayContext whether or not to use the display context, for some components such as Modal, these do not care for the context of their parent
|
|
55
|
+
*/
|
|
56
|
+
export default function useComponentStyles(props, useDisplayContext = true) {
|
|
57
|
+
const [rawStyles, rawCss] = parseRawCss(props.raw_css);
|
|
58
|
+
const displayCtx = useContext(DisplayCtx);
|
|
59
|
+
const flexProps = flexStyles(props, displayCtx, useDisplayContext);
|
|
60
|
+
const styles = useMemo(() => {
|
|
61
|
+
var _a;
|
|
62
|
+
const stylesObj = Object.assign(Object.assign(Object.assign({ backgroundColor: props.background, border: props.border, borderRadius: props.border_radius, color: props.color, fontFamily: props.font, fontSize: props.font_size, fontStyle: props.italic ? 'italic' : 'normal', fontWeight: props.bold ? 'bold' : 'normal', gap: props.gap, height: props.height, margin: props.margin, maxHeight: props.max_height, maxWidth: props.max_width, minHeight: props.min_height, minWidth: props.min_width, overflow: props.overflow, padding: props.padding, position: props.position, textDecoration: props.underline ? 'underline' : 'none', width: props.width }, flexProps), rawStyles), ((_a = props.style) !== null && _a !== void 0 ? _a : {}));
|
|
63
|
+
// Filter out null/undefined values so they don't end up accidentally overriding other style properties
|
|
64
|
+
return Object.fromEntries(Object.entries(stylesObj).filter(([, v]) => v !== null && v !== undefined));
|
|
65
|
+
}, [useDeepCompare(props)]);
|
|
66
|
+
return [styles, rawCss];
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=use-component-styles.js.map
|