diff --git a/src/lib/components/HelloEarth/HelloEarth.svelte b/src/lib/components/HelloEarth/HelloEarth.svelte
index 86c66a5..68e6a97 100644
--- a/src/lib/components/HelloEarth/HelloEarth.svelte
+++ b/src/lib/components/HelloEarth/HelloEarth.svelte
@@ -7,6 +7,10 @@
$: if (services && services.helloEarthAlert) {
// services.helloEarthAlert.alertMe();
}
+ $: if (services.core) {
+ console.log('services: ' + JSON.stringify(services));
+ // services.core.testAlert();
+ }
$: if ($store) isStoreLoaded = true;
@@ -14,9 +18,15 @@
{#if isStoreLoaded}
Hello Earth
+ Wallet Address:
{#if $store.pkpWallet}
-
Wallet Address: {$store.pkpWallet.address}
+
{$store.pkpWallet.address}
{/if}
+
+ hello store: {#if $store.hello}{$store.hello}{/if}
+
+ hello store2: {#if $store.hello2}{$store.hello2}{/if}
+
Reference TodoList
{#if $store.todos}
diff --git a/src/lib/core/Composite.svelte b/src/lib/core/Composite.svelte
index 13bc11d..3bb948b 100644
--- a/src/lib/core/Composite.svelte
+++ b/src/lib/core/Composite.svelte
@@ -5,6 +5,7 @@
import services from '$lib/core/servicesLoader';
import { dataStore } from '$lib/core/dataLoader';
import { createCompositeStore, getCompositeStore } from '$lib/core/compositeStores';
+ import { coreServices } from './coreServices';
interface ICompositeLayout {
areas: string;
@@ -27,7 +28,9 @@
}
export let composite: IComposite;
- let loadedServices: Record = {};
+ let loadedServices: Record = {
+ core: coreServices
+ };
let layoutStyle = '';
$: {
diff --git a/src/lib/core/coreServices.ts b/src/lib/core/coreServices.ts
new file mode 100644
index 0000000..8a1f454
--- /dev/null
+++ b/src/lib/core/coreServices.ts
@@ -0,0 +1,18 @@
+// coreServices.ts
+import { getCompositeStore } from './compositeStores';
+
+export const coreServices = {
+ updateStore: (mappings: Record) => {
+ for (const [mappingString, value] of Object.entries(mappings)) {
+ const [storeID, key] = mappingString.replace('@', '').split(':');
+ const store = getCompositeStore(storeID);
+ store.update(storeData => {
+ storeData[key] = value;
+ return storeData;
+ });
+ }
+ },
+ testAlert: () => {
+ alert("core service alert")
+ }
+};
diff --git a/src/lib/core/dataLoader.ts b/src/lib/core/dataLoader.ts
index 1509172..726bd53 100644
--- a/src/lib/core/dataLoader.ts
+++ b/src/lib/core/dataLoader.ts
@@ -1,6 +1,6 @@
// dataLoader.ts
import { writable } from 'svelte/store';
-import dataSources from 'virtual:data-sources-list'; // Import the generated list
+import dataSources from 'virtual:data-sources-list';
// The store that holds the data sets
export const dataStore = writable({});
@@ -14,17 +14,3 @@ dataSources.forEach(src => {
dataStore.update(store => ({ ...store, [src]: moduleData }));
});
});
-
-
-
-// // dataLoader.ts
-
-// import { writable } from 'svelte/store';
-// import { queryMessages } from '$lib/data/queryMessages';
-// import { queryTodos } from '$lib/data/queryTodos';
-
-// // The store that holds the data sets
-// export const dataStore = writable({
-// queryMessages: queryMessages,
-// queryTodos: queryTodos
-// });
\ No newline at end of file
diff --git a/src/routes/helloearth/+page.svelte b/src/routes/helloearth/+page.svelte
index 6a3eba6..41fdbea 100644
--- a/src/routes/helloearth/+page.svelte
+++ b/src/routes/helloearth/+page.svelte
@@ -3,6 +3,9 @@
let composite = {
id: 'hello',
+ store: {
+ helloMapMe: 'this is going to be mapped'
+ },
layout: {
areas: `
"main"
@@ -12,10 +15,15 @@
},
children: [
{
- id: 'hello',
+ id: 'earth',
component: 'HelloEarth',
slot: 'main',
+ store: {
+ hello: 'define me directly',
+ hello2: 'overwrite me with the mapping value'
+ },
map: {
+ hello2: '@hello.helloMapMe',
pkpWallet: '@wallet.pkpWallet',
todos: '@data:queryTodos'
},