import { localStorageStore } from '@skeletonlabs/skeleton'; import { writable } from 'svelte/store'; import type { Writable } from 'svelte/store'; import type { key_val } from '$lib/ae_stores'; /* *** BEGIN *** Initialize notes_local_data_struct */ // This is for longer term or sticky app data. This should be stored to *local* storage. // Updated 2024-08-20 let notes_local_data_struct: key_val = { ver: '2024-08-20_19', // Shared name: 'Aether - Notes (SvelteKit 2.x Svelte 4.x)', title: `OSIT's Æ Notes`, // Æ mode__edit: false, mode__debug: false, }; // console.log(`AE Stores - App Notes Local Storage Data:`, notes_local_data_struct); // This works and uses *local* storage: export let notes_loc: Writable = localStorageStore('ae_notes_loc', notes_local_data_struct); // console.log(`AE Stores - App Local Storage Data:`, get(ae_loc)); /* *** BEGIN *** Initialize notes_session_data_struct */ // Temporary app data. This is lost if the page is refreshed or using different tabs/windows. This should be stored to *session* storage. // Updated 2024-08-20 let notes_session_data_struct: key_val = { ver: '2024-08-20_19', log_lvl: 1, // Shared Triggers trigger: null, trigger__note_id: null, // trigger__note_li: null, }; // console.log(`AE Stores - App Notes Session Storage Data:`, notes_session_data_struct); export let notes_sess = writable(notes_session_data_struct); /* *** BEGIN *** Initialize notes_slct and notes_trigger */ /* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different notes, badges, exhibits, etc. */ // Intended for temporary session storage. // Updated 2024-08-20 let notes_slct_obj_template: key_val = { // Top level 'note_id': null, 'note_obj': {}, 'note_obj_li': [], 'lq__note_obj': {}, // Testing passing a LiveQuery object around... }; // console.log(`AE Stores - Selected Notes Objects:`, notes_slct_obj_template); // This works, and uses *session* (not local) storage: export let notes_slct = writable(notes_slct_obj_template); /* *** BEGIN *** Initialize notes_trigger */ // Intended for temporary session storage. // Updated 2024-08-20 export let notes_trigger: any = writable(null); // console.log(`AE Notes Stores - Notes Trigger:`, notes_trigger);