Fix: System-wide type hardening and V3 API alignment

This commit is contained in:
Scott Idem
2026-01-22 19:22:16 -05:00
parent 9de1d4b23e
commit 4976f2d897
11 changed files with 87 additions and 56 deletions

View File

@@ -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
};

View File

@@ -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);

View File

@@ -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() ***');