web_lib

Common web application libraries
git clone https://radroots.dev/git/web_lib.git
Log | Files | Refs | LICENSE

commit 429088bc03f67e8b203c6e165b795f3a62639f04
parent 8fb36e9be5ddd9e6fe07722e3ce690957df11c78
Author: triesap <137732411+triesap@users.noreply.github.com>
Date:   Fri,  7 Mar 2025 11:00:37 +0000

utils: edit app utils

Diffstat:
Mutils/src/app/lib.ts | 29++++++-----------------------
Mutils/src/app/styles.ts | 7++-----
Mutils/src/app/types/app.ts | 11++---------
Mutils/src/app/util.ts | 29+++++------------------------
4 files changed, 15 insertions(+), 61 deletions(-)

diff --git a/utils/src/app/lib.ts b/utils/src/app/lib.ts @@ -3,7 +3,6 @@ import type { AppLayoutKey } from "$root"; type ConfigWindow = { layout: Record<AppLayoutKey, { h: number; - w?: number; }>; debounce: { search: number; @@ -13,32 +12,16 @@ type ConfigWindow = { export const cfg_app: ConfigWindow = { layout: { ios0: { - h: 600, - w: 300, + h: 600 }, ios1: { - h: 750, - w: 350, + h: 750 }, - web0: { - h: 600, - w: 300, + webm0: { + h: 600 }, - web_ios0: { - h: 600, - w: 300, - }, - web_ios1: { - h: 750, - w: 800, - }, - web_mobile: { - h: 600, - w: 300, - }, - web_desktop: { - h: 600, - w: 300, + webm1: { + h: 750 } }, debounce: { diff --git a/utils/src/app/styles.ts b/utils/src/app/styles.ts @@ -29,11 +29,8 @@ export const loading_style_map: Map<LoadingDimension, { dim_1: number; gl_2: num export const toast_layout_map: Map<AppLayoutKey, string> = new Map([ [`ios0`, `pt-8`], [`ios1`, `pt-16`], - [`web_mobile`, `pt-8`], - [`web_desktop`, `pt-16`], - [`web_ios0`, `pt-8`], - [`web_ios1`, `pt-16`], - [`web0`, `pt-8`], + [`webm0`, `pt-8`], + [`webm1`, `pt-16`], ]); export const toast_style_map: Map<IToastKind, { inner: string; outer: string }> = new Map([ diff --git a/utils/src/app/types/app.ts b/utils/src/app/types/app.ts @@ -5,17 +5,13 @@ export type ThemeLayer = 0 | 1 | 2; export type AppConfigType = `farmer` | `personal` export type AppLayoutKeyIOS = `ios0` | `ios1`; -export type AppLayoutKeyWeb = `web_mobile` | `web_desktop`; -export type AppLayoutKeyWebPwa = `web_ios0` | `web_ios1` | `web0`; - -export type AppLayoutKey = AppLayoutKeyIOS | AppLayoutKeyWeb | AppLayoutKeyWebPwa; +export type AppLayoutKeyWeb = `webm0` | `webm1`; +export type AppLayoutKey = AppLayoutKeyIOS | AppLayoutKeyWeb; export type AppLayoutIOS<T extends string> = `${T}_${AppLayoutKeyIOS}`; export type AppLayoutWeb<T extends string> = `${T}_${AppLayoutKeyWeb}`; -export type AppLayoutWebPwa<T extends string> = `${T}_${AppLayoutKeyWebPwa}`; export type AppLayoutKeyHeight = - | `lo_view_main` | `lo_bottom_button` | `nav_tabs` | `nav_page_header` @@ -27,11 +23,9 @@ export type AppLayoutKeyWidth = export type AppHeightsResponsiveIOS = AppLayoutIOS<AppLayoutKeyHeight>; export type AppHeightsResponsiveWeb = AppLayoutWeb<AppLayoutKeyHeight>; -export type AppHeightsResponsiveWebPwa = AppLayoutWebPwa<AppLayoutKeyHeight>; export type AppWidthsResponsiveIOS = AppLayoutIOS<AppLayoutKeyWidth>; export type AppWidthsResponsiveWeb = AppLayoutWeb<AppLayoutKeyWidth>; -export type AppWidthsResponsiveWebPwa = AppLayoutWebPwa<AppLayoutKeyWidth>; export type CallbackPromiseFigureResult<Ti, Tr> = (value: Ti) => Promise<Tr | undefined>; export type CallbackPromiseFull<Ti, Tr> = (value: Ti) => Promise<Tr>; @@ -52,7 +46,6 @@ export type LoadingDimension = GeometryDimension | `glyph-send-button`; //@todo export type LayerGlyphBasisKind = `_a` | `_d` | `_pl`; - export type NavigationRouteParamId = `id`; export type NavigationRouteParamField = `field`; export type NavigationRouteParamRef = `ref`; diff --git a/utils/src/app/util.ts b/utils/src/app/util.ts @@ -1,4 +1,4 @@ -import type { AppLayoutKey, AppLayoutKeyIOS, AppLayoutKeyWeb, AppLayoutKeyWebPwa, LabelFieldKind, NavigationParamTuple, ThemeLayer } from "$root"; +import type { AppLayoutKey, AppLayoutKeyIOS, AppLayoutKeyWeb, LabelFieldKind, NavigationParamTuple, ThemeLayer } from "$root"; export const fmt_cl = (classes?: string): string => { return classes ? classes : ``; @@ -9,14 +9,12 @@ export const get_layout = (val?: string): AppLayoutKey | undefined => { if (lo_ios) return lo_ios; const lo_web = get_web_layout(val); if (lo_web) return lo_web; - const lo_web_pwa = get_web_pwa_layout(val); - if (lo_web_pwa) return lo_web_pwa; return undefined; }; export const get_layout_default = (val?: string): AppLayoutKey => { const res = get_layout(val); - return res || `web0`; + return res || `webm0`; }; export const get_ios_layout = (val?: string): AppLayoutKeyIOS | undefined => { @@ -36,8 +34,8 @@ export const get_ios_layout_default = (val?: string): AppLayoutKeyIOS => { export const get_web_layout = (val?: string): AppLayoutKeyWeb | undefined => { switch (val) { - case `web_mobile`: - case `web_desktop`: + case `webm0`: + case `webm1`: return val; default: return undefined; @@ -46,24 +44,7 @@ export const get_web_layout = (val?: string): AppLayoutKeyWeb | undefined => { export const get_web_layout_default = (val?: string): AppLayoutKeyWeb => { const res = get_web_layout(val); - return res || `web_desktop`; -}; - - -export const get_web_pwa_layout = (val?: string): AppLayoutKeyWebPwa | undefined => { - switch (val) { - case `web_ios0`: - case `web_ios1`: - case `web0`: - return val; - default: - return undefined; - }; -}; - -export const get_web_pwa_layout_default = (val?: string): AppLayoutKeyWebPwa => { - const res = get_web_pwa_layout(val); - return res || `web0`; + return res || `webm0`; }; export const parse_layer = (layer?: number, layer_default?: ThemeLayer): ThemeLayer => {