diff options
Diffstat (limited to 'ui/routes/(swatch)')
| -rw-r--r-- | ui/routes/(swatch)/.swatch/ConversationList/+page.svelte | 32 | ||||
| -rw-r--r-- | ui/routes/(swatch)/.swatch/Invites/+page.svelte | 8 | ||||
| -rw-r--r-- | ui/routes/(swatch)/.swatch/swatch/EventLog/+page.svelte | 13 |
3 files changed, 23 insertions, 30 deletions
diff --git a/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte b/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte index ef0c8a9..b0bc97a 100644 --- a/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte +++ b/ui/routes/(swatch)/.swatch/ConversationList/+page.svelte @@ -1,27 +1,23 @@ <script> - import { json } from '$lib/swatch/derive.js'; + import * as json from '$lib/swatch/json.js'; import ConversationList from '$lib/components/ConversationList.svelte'; let conversationsInput = $state( - JSON.stringify( - [ - { - id: 'Czero', - name: 'A long conversation', - hasUnreads: false, - }, - { - id: 'Cone', - name: 'A shorter conversation', - hasUnreads: true, - }, - ], - /* replacer */ null, - /* space */ 2, - ), + json.encode([ + { + id: 'Czero', + name: 'A long conversation', + hasUnreads: false, + }, + { + id: 'Cone', + name: 'A shorter conversation', + hasUnreads: true, + }, + ]), ); - let conversations = $derived(json(conversationsInput)); + let conversations = $derived(json.decode(conversationsInput)); let active = $state(null); </script> diff --git a/ui/routes/(swatch)/.swatch/Invites/+page.svelte b/ui/routes/(swatch)/.swatch/Invites/+page.svelte index 8c24627..bc4bdb1 100644 --- a/ui/routes/(swatch)/.swatch/Invites/+page.svelte +++ b/ui/routes/(swatch)/.swatch/Invites/+page.svelte @@ -1,14 +1,12 @@ <script> - import { json } from '$lib/swatch/derive.js'; + import * as json from '$lib/swatch/json.js'; import EventCapture from '$lib/swatch/event-capture.svelte.js'; import EventLog from '$lib/components/swatch/EventLog.svelte'; import Invites from '$lib/components/Invites.svelte'; - let invitesInput = $state( - JSON.stringify([{ id: 'Iaaaa' }, { id: 'Ibbbb' }], /* replacer */ null, /* space */ 2), - ); - let invites = $derived(json(invitesInput)); + let invitesInput = $state(json.encode([{ id: 'Iaaaa' }, { id: 'Ibbbb' }])); + let invites = $derived(json.decode(invitesInput)); let capture = $state(new EventCapture()); const createInvite = capture.on('createInvite'); diff --git a/ui/routes/(swatch)/.swatch/swatch/EventLog/+page.svelte b/ui/routes/(swatch)/.swatch/swatch/EventLog/+page.svelte index a751ca3..eae0838 100644 --- a/ui/routes/(swatch)/.swatch/swatch/EventLog/+page.svelte +++ b/ui/routes/(swatch)/.swatch/swatch/EventLog/+page.svelte @@ -1,17 +1,16 @@ <script> import EventCapture from '$lib/swatch/event-capture.svelte.js'; - import { json } from '$lib/swatch/derive.js'; + import * as json from '$lib/swatch/json.js'; import EventLog from '$lib/components/swatch/EventLog.svelte'; let eventsInput = $state( - JSON.stringify( - [{ event: 'example', args: ['argument a', 'argument b'] }], - /* replacer */ null, - /* space */ 2, - ), + json.encode([ + { event: 'firstExample', args: ['argument a', 'argument b'] }, + { event: 'secondExample', args: ['argument 1'] }, + ]), ); - let events = $derived(json(eventsInput)); + let events = $derived(json.decode(eventsInput)); let capture = $state(new EventCapture()); const clear = capture.on('clear'); |
