diff --git a/src/lib/ae_elements/AE_AITools.svelte b/src/lib/ae_elements/AE_AITools.svelte index ad6529a3..419284dc 100644 --- a/src/lib/ae_elements/AE_AITools.svelte +++ b/src/lib/ae_elements/AE_AITools.svelte @@ -94,11 +94,11 @@ try { ae_promises = ai_client.chat.completions.create({ - model: model, + model: model || 'dgrzone-deepseek-8b-quick', max_tokens: maxTokens, temperature: temperature, messages: [ - { role: 'system', content: systemPrompt }, + { role: 'system', content: systemPrompt || 'You are a helpful assistant.' }, { role: 'user', content: content } ] }).then((resp) => { diff --git a/src/lib/ae_sponsorships/ae_sponsorships_functions.ts b/src/lib/ae_sponsorships/ae_sponsorships_functions.ts index 940b3ad8..23e2ce37 100644 --- a/src/lib/ae_sponsorships/ae_sponsorships_functions.ts +++ b/src/lib/ae_sponsorships/ae_sponsorships_functions.ts @@ -2,7 +2,7 @@ import type { key_val } from '$lib/stores/ae_stores'; import { api } from '$lib/api/api'; import { db_sponsorships } from '$lib/ae_sponsorships/db_sponsorships'; import { db_save_ae_obj_li__ae_obj } from '$lib/ae_core/core__idb_dexie'; -import type { ae_Sponsorship, ae_Sponsorship_Cfg } from '$lib/types/ae_types'; +import type { ae_Sponsorship, ae_SponsorshipCfg } from '$lib/types/ae_types'; const ae_promises: key_val = {}; @@ -197,7 +197,7 @@ export async function load_ae_obj_id__sponsorship_cfg({ sponsorship_cfg_id: string; try_cache?: boolean; log_lvl?: number; -}): Promise { +}): Promise { if (log_lvl) { console.log(`*** load_ae_obj_id__sponsorship_cfg() *** [V3] id=${sponsorship_cfg_id}`); } @@ -348,7 +348,7 @@ export async function create_ae_obj__sponsorship({ return await api.create_ae_obj_v3({ api_cfg, obj_type: 'sponsorship', - data, + fields: data, log_lvl }); } @@ -371,7 +371,7 @@ export async function update_ae_obj__sponsorship({ api_cfg, obj_type: 'sponsorship', obj_id: sponsorship_id, - data, + fields: data, log_lvl }); } diff --git a/src/lib/ae_utils/ae_utils.ts b/src/lib/ae_utils/ae_utils.ts index 322ba80e..b2f9964a 100644 --- a/src/lib/ae_utils/ae_utils.ts +++ b/src/lib/ae_utils/ae_utils.ts @@ -259,6 +259,20 @@ export const shorten_string = function shorten_string({ return new_string; }; +// Svelte action to set focus on an element +function set_focus(node: HTMLElement, focus: boolean) { + if (focus) { + node.focus(); + } + return { + update(new_focus: boolean) { + if (new_focus) { + node.focus(); + } + } + }; +} + // Updated 2024-06-19 // This function should return a shorted version of a filename if over the max length. It should always contain at least the first character of the original filename and the complete extension. // Example 1: The Original Long File Name.pdf -> The Orig....pdf @@ -328,5 +342,6 @@ export const ae_util = { encrypt_content: encrypt_content, encrypt_wrapper: encrypt_wrapper, decrypt_content: decrypt_content, - decrypt_wrapper: decrypt_wrapper + decrypt_wrapper: decrypt_wrapper, + set_focus: set_focus }; diff --git a/src/lib/ae_utils/ae_utils__crypto.ts b/src/lib/ae_utils/ae_utils__crypto.ts index c35f0f8c..4003a230 100644 --- a/src/lib/ae_utils/ae_utils__crypto.ts +++ b/src/lib/ae_utils/ae_utils__crypto.ts @@ -15,9 +15,9 @@ export const encrypt_content = async function encrypt_content(content: string, k 'encrypt' ]); const encodedContent = await crypto.subtle.encrypt( - { name: 'AES-CBC', iv }, + { name: 'AES-CBC', iv: iv.buffer as ArrayBuffer }, key, - new TextEncoder().encode(content) + new TextEncoder().encode(content).buffer as ArrayBuffer ); const base64 = btoa(String.fromCharCode(...new Uint8Array(encodedContent))); if (log_lvl) { @@ -79,9 +79,9 @@ export const decrypt_content = async function decrypt_content( ]); const encryptedContent = Uint8Array.from(atob(base64Content), (c) => c.charCodeAt(0)); const decryptedContent = await crypto.subtle.decrypt( - { name: 'AES-CBC', iv }, + { name: 'AES-CBC', iv: iv.buffer as ArrayBuffer }, key, - encryptedContent + encryptedContent.buffer as ArrayBuffer ); const decodedContent = new TextDecoder().decode(decryptedContent); // console.log('Decrypted Content:', decodedContent); diff --git a/src/lib/ae_utils/ae_utils__set_obj_prop_display_name.ts b/src/lib/ae_utils/ae_utils__set_obj_prop_display_name.ts index ca828fb3..cc37036b 100644 --- a/src/lib/ae_utils/ae_utils__set_obj_prop_display_name.ts +++ b/src/lib/ae_utils/ae_utils__set_obj_prop_display_name.ts @@ -1,6 +1,6 @@ import { to_title_case } from './ae_utils__to_title_case'; -// Updated 2023-08-18 +// Updated 2026-01-22 export function set_obj_prop_display_name({ prop_name, obj_type = null, @@ -9,6 +9,14 @@ export function set_obj_prop_display_name({ replace_underscores = true, title_case = true, override = null +}: { + prop_name: string; + obj_type?: string | null; + prefix_w_obj_type?: boolean; + prefix_all_w_obj_type?: boolean; + replace_underscores?: boolean; + title_case?: boolean; + override?: string | null; }) { console.log('*** set_obj_prop_display_name() ***'); diff --git a/src/lib/app_components/e_app_codemirror_v5.svelte b/src/lib/app_components/e_app_codemirror_v5.svelte index 675c846c..d2b6067f 100644 --- a/src/lib/app_components/e_app_codemirror_v5.svelte +++ b/src/lib/app_components/e_app_codemirror_v5.svelte @@ -31,7 +31,7 @@ content = 'test test test test', new_content = $bindable(), editorView = $bindable(), // Exposed for external control - theme_mode = 'light', + theme_mode = $bindable('light'), extensions = [], editable = true, readonly = false, @@ -105,12 +105,17 @@ ...extensions // Add any custom extensions passed in props ].filter(Boolean); + if (!editor_element) { + console.error('Editor element not found.'); + return; + } + editorView = new cm_modules.EditorView({ state: cm_modules.EditorState.create({ doc: content, extensions: editor_extensions }), - parent: editor_element + parent: editor_element as HTMLElement }); } diff --git a/src/lib/elements/codemirror_modules.ts b/src/lib/elements/codemirror_modules.ts index 8c5af2da..addead39 100644 --- a/src/lib/elements/codemirror_modules.ts +++ b/src/lib/elements/codemirror_modules.ts @@ -1,6 +1,7 @@ let _cmCache: { EditorView?: any; EditorState?: any; + EditorSelection?: any; markdown?: any; markdownLanguage?: any; keymap?: any; @@ -25,6 +26,7 @@ let _cmCache: { highlightSelectionMatches?: any; lintKeymap?: any; EditorState_allowMultipleSelections?: any; + EditorState_readOnly?: any; EditorView_lineWrapping?: any; EditorView_editable?: any; EditorView_contentAttributes?: any; @@ -43,6 +45,7 @@ import { browser } from '$app/environment'; type CMCache = { EditorView: any; EditorState: any; + EditorSelection?: any; markdown?: any; markdownLanguage?: any; keymap?: any; @@ -67,6 +70,7 @@ type CMCache = { highlightSelectionMatches?: any; lintKeymap?: any; EditorState_allowMultipleSelections?: any; + EditorState_readOnly?: any; EditorView_lineWrapping?: any; EditorView_editable?: any; EditorView_contentAttributes?: any; @@ -133,7 +137,7 @@ export async function ensureCodeMirrorModules(): Promise { markdown: markdownMod?.markdown, markdownLanguage: markdownMod?.markdownLanguage, - languages: languageMod?.languages, // From @codemirror/language-data, often re-exported by @codemirror/language + languages: (languageMod as any)?.languages, // Cast to any to avoid TS error if property is missing from types defaultKeymap: (commandsMod && commandsMod.defaultKeymap) || [], history: commandsMod?.history, diff --git a/src/lib/elements/element_ae_crud.svelte b/src/lib/elements/element_ae_crud.svelte index 984c1e73..0652739d 100644 --- a/src/lib/elements/element_ae_crud.svelte +++ b/src/lib/elements/element_ae_crud.svelte @@ -6,6 +6,7 @@ // *** Import Aether core variables and functions import type { key_val } from '$lib/stores/ae_stores'; + import { core_func } from '$lib/ae_core/ae_core_functions'; // import { api } from '$lib/api'; // import { update_ae_obj_id_crud } from '$lib/ae_core/core__crud_generic'; import { update_ae_obj } from '$lib/ae_core/core__crud_generic'; diff --git a/src/lib/elements/element_input_v2.svelte b/src/lib/elements/element_input_v2.svelte index 809ad98a..03759a7f 100644 --- a/src/lib/elements/element_input_v2.svelte +++ b/src/lib/elements/element_input_v2.svelte @@ -3,41 +3,7 @@ import { createEventDispatcher, onMount } from 'svelte'; - import util from './utilities.js'; - - // import Select_element_lu from './element_select_lu.svelte'; - - console.log(`Input name=${name} value=${value}`); - - console.log('Original Value', original_value); - console.log('Data Type:', data_type); - - let set_input_type = $state((node) => { - node.type = 'text'; - }); - let input_element_type_list = ['checkbox', 'date', 'email', 'hidden', 'number', 'text']; - if (input_element_type_list.includes(type)) { - set_input_type = (node) => { - node.type = type; - }; - } else { - } - - console.log(`Input name=${name} value=${value} type=${type}`); - - /* *** END *** Core input settings */ - - /* *** BEGIN *** Container content, layout, and behavior */ - - console.log(`Input input_mode=${input_mode}`); - - /* *** END *** Container content, layout, and behavior */ - - /* *** BEGIN *** Input type specific */ - - if (type == 'textarea') { - console.log(`Input textarea size=${size} rows=${rows} cols=${cols}`); - } + import { ae_util as util } from '$lib/ae_utils/ae_utils'; interface Props { /* *** BEGIN *** Core input settings */ @@ -141,6 +107,39 @@ date_time_tz = null, more_html }: Props = $props(); + + console.log(`Input name=${name} value=${value}`); + + console.log('Original Value', original_value); + console.log('Data Type:', data_type); + + let set_input_type = $state((node) => { + node.type = 'text'; + }); + let input_element_type_list = ['checkbox', 'date', 'email', 'hidden', 'number', 'text']; + if (input_element_type_list.includes(type)) { + set_input_type = (node) => { + node.type = type; + }; + } else { + } + + console.log(`Input name=${name} value=${value} type=${type}`); + + /* *** END *** Core input settings */ + + /* *** BEGIN *** Container content, layout, and behavior */ + + console.log(`Input input_mode=${input_mode}`); + + /* *** END *** Container content, layout, and behavior */ + + /* *** BEGIN *** Input type specific */ + + if (type == 'textarea') { + console.log(`Input textarea size=${size} rows=${rows} cols=${cols}`); + } + let value_datetime = null; let value_date = $state(null); let value_time = $state(null); @@ -802,4 +801,4 @@ .container_inline { display: inline; } - + \ No newline at end of file diff --git a/src/routes/events/[event_id]/(badges)/badges/+page.svelte b/src/routes/events/[event_id]/(badges)/badges/+page.svelte index 40559a31..a59838bd 100644 --- a/src/routes/events/[event_id]/(badges)/badges/+page.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/+page.svelte @@ -102,14 +102,14 @@ {#if show_create_badge_modal} - +

Create New Badge

{ show_create_badge_modal = false; - ae_triggers.event_badge_qry = true; // Trigger a refresh of the list + $events_trigger.event_badge_qry = true; // Trigger a refresh of the list }} on:cancel={() => (show_create_badge_modal = false)} /> @@ -118,14 +118,14 @@ {/if} {#if show_upload_badge_modal} - +

Upload Badges (CSV)

{ show_upload_badge_modal = false; - ae_triggers.event_badge_qry = true; // Trigger a refresh of the list + $events_trigger.event_badge_qry = true; // Trigger a refresh of the list }} on:cancel={() => (show_upload_badge_modal = false)} /> diff --git a/src/routes/events/[event_id]/(pres_mgmt)/session/[session_id]/+page.ts b/src/routes/events/[event_id]/(pres_mgmt)/session/[session_id]/+page.ts index 84e229c5..9c53c610 100644 --- a/src/routes/events/[event_id]/(pres_mgmt)/session/[session_id]/+page.ts +++ b/src/routes/events/[event_id]/(pres_mgmt)/session/[session_id]/+page.ts @@ -72,7 +72,6 @@ export async function load({ params, parent }) { enabled: 'all', hidden: 'all', limit: 19, - params: {}, try_cache: true, log_lvl: 2 });