For now? I'm experimenting on an old concept.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: update dom_ffi extension from `.ts` to `.mjs` and add JSdoc comments for exported functions

+33 -21
+2 -2
client/src/lumina_client/dom.gleam
··· 1 1 import gleam/dynamic/decode 2 2 3 3 /// Get the color scheme of the user's system (media query) 4 - @external(javascript, "./dom_ffi.ts", "get_color_scheme") 4 + @external(javascript, "./dom_ffi.mjs", "get_color_scheme") 5 5 pub fn get_color_scheme() -> String 6 6 7 - @external(javascript, "./dom_ffi.ts", "classfoundintree") 7 + @external(javascript, "./dom_ffi.mjs", "classfoundintree") 8 8 pub fn classfoundintree(element: decode.Dynamic, class_name: String) -> Bool
+31
client/src/lumina_client/dom_ffi.mjs
··· 1 + /** 2 + * @description Returns the color scheme of the user 3 + * @see https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme 4 + * @returns {string} 5 + */ 6 + export function get_color_scheme() { 7 + // Media queries the preferred color colorscheme 8 + 9 + if (window.matchMedia("(prefers-color-scheme: dark)").matches) { 10 + return "dark"; 11 + } 12 + return "light"; 13 + } 14 + 15 + /** 16 + * @description Goes up the DOM tree to see if a class is found 17 + * @returns {boolean} 18 + * @param {HTMLElement} starting_element 19 + * @param {string} className 20 + */ 21 + export function classfoundintree(starting_element, className) { 22 + let element = starting_element; 23 + do { 24 + if (element.classList && element.classList.contains(className)) { 25 + return true; 26 + } 27 + // Might be null if we reach the top of the tree 28 + element = element.parentElement; 29 + } while (element); 30 + return false; 31 + }
-19
client/src/lumina_client/dom_ffi.ts
··· 1 - export function get_color_scheme() { 2 - // Media queries the preferred color colorscheme 3 - 4 - if (window.matchMedia("(prefers-color-scheme: dark)").matches) { 5 - return "dark"; 6 - } 7 - return "light"; 8 - } 9 - 10 - export function classfoundintree(starting_element: HTMLElement, className: string): boolean { 11 - let element: HTMLElement | null = starting_element; 12 - do { 13 - if (element.classList && element.classList.contains(className)) { 14 - return true; 15 - } 16 - element = element.parentElement as HTMLElement | null; 17 - } while (element); 18 - return false; 19 - }