|
|
@ -2,20 +2,35 @@ |
|
|
import { screenStore, routeStore } from "stores" |
|
|
import { screenStore, routeStore } from "stores" |
|
|
import Component from "./Component.svelte" |
|
|
import Component from "./Component.svelte" |
|
|
import Provider from "./context/Provider.svelte" |
|
|
import Provider from "./context/Provider.svelte" |
|
|
import { onMount } from "svelte" |
|
|
import { onMount, getContext } from "svelte" |
|
|
|
|
|
import { enrichButtonActions } from "utils/buttonActions.js" |
|
|
|
|
|
|
|
|
// Keep route params up to date |
|
|
|
|
|
export let params = {} |
|
|
export let params = {} |
|
|
|
|
|
|
|
|
|
|
|
const context = getContext("context") |
|
|
|
|
|
|
|
|
|
|
|
// Keep route params up to date |
|
|
$: routeStore.actions.setRouteParams(params || {}) |
|
|
$: routeStore.actions.setRouteParams(params || {}) |
|
|
|
|
|
|
|
|
// Get the screen definition for the current route |
|
|
// Get the screen definition for the current route |
|
|
$: screenDefinition = $screenStore.activeScreen?.props |
|
|
$: screenDefinition = $screenStore.activeScreen?.props |
|
|
|
|
|
|
|
|
// Mark the router as loaded whenever the screen mounts |
|
|
|
|
|
onMount(() => { |
|
|
onMount(() => { |
|
|
|
|
|
// Mark the router as loaded whenever the screen mounts |
|
|
if (!$routeStore.routerLoaded) { |
|
|
if (!$routeStore.routerLoaded) { |
|
|
routeStore.actions.setRouterLoaded() |
|
|
routeStore.actions.setRouterLoaded() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Enrich and execute and on load actions. |
|
|
|
|
|
// We manually construct the full context here as this component is the |
|
|
|
|
|
// one that provides the url context, so it is not available in $context yet |
|
|
|
|
|
if ($screenStore.activeScreen?.onLoad) { |
|
|
|
|
|
const actions = enrichButtonActions($screenStore.activeScreen.onLoad, { |
|
|
|
|
|
...$context, |
|
|
|
|
|
url: params, |
|
|
|
|
|
}) |
|
|
|
|
|
actions() |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
|