diff --git a/src/lib/components/Login/Login.svelte b/src/lib/components/Login.svelte
similarity index 100%
rename from src/lib/components/Login/Login.svelte
rename to src/lib/components/Login.svelte
diff --git a/src/lib/components/Recipies/LearnColor.svelte b/src/lib/components/Recipies/LearnColor.svelte
deleted file mode 100644
index ca447b8..0000000
--- a/src/lib/components/Recipies/LearnColor.svelte
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
- I am the parent, this is my state: {$store.machine.state}
-
-
diff --git a/src/lib/components/Recipies/LearnReady.svelte b/src/lib/components/Recipies/LearnReady.svelte
deleted file mode 100644
index 3d6d860..0000000
--- a/src/lib/components/Recipies/LearnReady.svelte
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
- i am the child and this is my state: {$store.machine.state}
-
-
diff --git a/src/lib/components/Recipies/machines/formMachine.ts b/src/lib/components/Recipies/machines/formMachine.ts
deleted file mode 100644
index 9a47887..0000000
--- a/src/lib/components/Recipies/machines/formMachine.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import { createMachine } from 'xstate';
-
-export const formMachine = createMachine(
- {
- id: 'validation',
- initial: 'notValidated',
- context: {
- isValidated: false
- },
- states: {
- notValidated: {
- on: {
- VALIDATE: {
- target: 'isValidated',
- actions: 'setValidated'
- }
- }
- },
- isValidated: {
- on: {
- INVALIDATE: {
- target: 'notValidated',
- actions: 'setNotValidated'
- }
- }
- }
- }
- },
- {
- actions: {
- setValidated: (context) => (context.isValidated = true),
- setNotValidated: (context) => (context.isValidated = false)
- }
- }
-);
\ No newline at end of file
diff --git a/src/lib/components/Recipies/oForm.svelte b/src/lib/components/Recipies/oForm.svelte
deleted file mode 100644
index b2056c7..0000000
--- a/src/lib/components/Recipies/oForm.svelte
+++ /dev/null
@@ -1,185 +0,0 @@
-
-
-{#if isStoreLoaded}
-
- {#if $successMessage}
-
- {:else}
-
- {/if}
-
-{/if}
diff --git a/src/lib/components/Recipies/oRecipe.svelte b/src/lib/components/Recipies/oRecipe.svelte
deleted file mode 100644
index b50f958..0000000
--- a/src/lib/components/Recipies/oRecipe.svelte
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/lib/components/examples/Recipies.svelte b/src/lib/components/examples/Recipies.svelte
index e10276c..38db8b8 100644
--- a/src/lib/components/examples/Recipies.svelte
+++ b/src/lib/components/examples/Recipies.svelte
@@ -39,7 +39,7 @@
context: {
name: '',
email: '',
- constraints: {} // <- New addition
+ constraints: {}
},
states: {
start: {
diff --git a/src/lib/components/refactor/ComposerCharly.svelte b/src/lib/components/refactor/ComposerCharly.svelte
index e1db913..4a2ddb0 100644
--- a/src/lib/components/refactor/ComposerCharly.svelte
+++ b/src/lib/components/refactor/ComposerCharly.svelte
@@ -25,6 +25,12 @@
{/each}
{/if}
+
{#if $data.store.messages}
{#each $data.store.messages as message}
@@ -32,10 +38,4 @@
{/each}
{/if}
-
diff --git a/src/lib/components/refactor/ComposerForm.svelte b/src/lib/components/refactor/ComposerForm.svelte
new file mode 100644
index 0000000..02b9b66
--- /dev/null
+++ b/src/lib/components/refactor/ComposerForm.svelte
@@ -0,0 +1,163 @@
+
+
+
+ My state is: {$data.state}
+ {#if $successMessage}
+
+ {:else}
+
+ {/if}
+
diff --git a/src/lib/components/refactor/ComposerWrap.svelte b/src/lib/components/refactor/ComposerWrap.svelte
index 4ff195e..62f3fa2 100644
--- a/src/lib/components/refactor/ComposerWrap.svelte
+++ b/src/lib/components/refactor/ComposerWrap.svelte
@@ -18,17 +18,17 @@
},
layout: {
columns: '1fr 1fr',
- rows: '1fr 1fr',
+ rows: 'auto 1fr',
areas: `
- "top aside"
- "bottom aside"
+ "topleft topright"
+ "mainleft mainright"
`
},
children: [
{
id: 'ComposerCharly',
component: 'ComposerCharly',
- slot: 'aside',
+ slot: 'mainright',
data: {
map: {
todos: queryTodos,
@@ -58,7 +58,7 @@
{
id: 'ComposerBob',
component: 'ComposerBob',
- slot: 'top',
+ slot: 'topleft',
machine: {
initial: 'READY',
states: {
@@ -74,7 +74,7 @@
{
id: 'ComposerAlice',
component: 'ComposerAlice',
- slot: 'bottom',
+ slot: 'topright',
machine: {
initial: 'RED',
states: {
@@ -93,6 +93,40 @@
NOTREADY: 'RED'
}
}
+ },
+ {
+ id: 'ComposerForm',
+ component: 'ComposerForm',
+ slot: 'mainleft',
+ machine: {
+ id: 'validation',
+ initial: 'notValidated',
+ context: {
+ isValidated: false
+ },
+ states: {
+ notValidated: {
+ on: {
+ VALIDATE: {
+ target: 'isValidated',
+ actions: 'setValidated'
+ }
+ }
+ },
+ isValidated: {
+ on: {
+ INVALIDATE: {
+ target: 'notValidated',
+ actions: 'setNotValidated'
+ }
+ }
+ }
+ },
+ services: {
+ setValidated: (context) => (context.isValidated = true),
+ setNotValidated: (context) => (context.isValidated = false)
+ }
+ }
}
]
};
diff --git a/src/lib/core/refactor/Composer.svelte b/src/lib/core/refactor/Composer.svelte
index 93afdcc..c1b5674 100644
--- a/src/lib/core/refactor/Composer.svelte
+++ b/src/lib/core/refactor/Composer.svelte
@@ -64,8 +64,6 @@
}
);
const machineService = interpret(machine).onTransition((state) => {
- console.log(`${composer.id} State transitioned to: ${state.value}`);
- console.log('Context:', state.context); // Log the context
getComposerStore(composer.id).update((storeValue) => ({
...storeValue,
state: state.value,
diff --git a/src/lib/core/refactor/coreServices.ts b/src/lib/core/refactor/coreServices.ts
index 9d94b5e..7c0bee7 100644
--- a/src/lib/core/refactor/coreServices.ts
+++ b/src/lib/core/refactor/coreServices.ts
@@ -4,7 +4,6 @@ import { getComposerStore } from './composerStores';
export const coreServices = {
mutateStore: (storeID: string, value: any) => {
const store = getComposerStore(storeID);
- console.log(`mutateData called with storeID: ${storeID} and value: ${JSON.stringify(value)}`);
store.update(storeData => {
storeData.store = { ...storeData.store, ...value };
return storeData;
diff --git a/src/lib/core/refactor/queryLoader.ts b/src/lib/core/refactor/queryLoader.ts
index 48336c5..683dcd8 100644
--- a/src/lib/core/refactor/queryLoader.ts
+++ b/src/lib/core/refactor/queryLoader.ts
@@ -1,6 +1,6 @@
// dataLoader.ts
-import { writable } from 'svelte/store';
import dataSources from 'virtual:data-sources-list';
+import { writable } from 'svelte/store';
import { coreServices } from './coreServices';
// The store that holds the data sets
@@ -9,9 +9,7 @@ export const queryStore = writable({});
// Dynamically import the data modules and assign them to the store
dataSources.forEach(src => {
import(`/src/lib/data/${src}.ts`).then(module => {
- // Here, explicitly extract the required data or function from the module
const moduleData = module[src] || module.default;
-
queryStore.update(store => ({ ...store, [src]: moduleData }));
});
});
diff --git a/src/routes/dashboard/+page.svelte b/src/routes/dashboard/+page.svelte
deleted file mode 100644
index 954d200..0000000
--- a/src/routes/dashboard/+page.svelte
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
diff --git a/src/routes/form/+page.svelte b/src/routes/form/+page.svelte
deleted file mode 100644
index c244e07..0000000
--- a/src/routes/form/+page.svelte
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
diff --git a/src/routes/helloearth/+page.svelte b/src/routes/helloearth/+page.svelte
deleted file mode 100644
index 9f43e40..0000000
--- a/src/routes/helloearth/+page.svelte
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-