--- import ThemeSettings from '@ui/ThemeSettings.astro' import { site } from '@shared/lib/site' import PageModals from '@shared/components/PageModals.astro' import PageScripts from '@shared/components/PageScripts.astro' import libs from '@tabler/core/libs.json' interface Props { title?: string /** Third-party libs from libs.json, e.g. ['apexcharts', 'jsvectormap'] */ pageLibs?: string[] /** Extra body classes, e.g. "layout-boxed" / "layout-fluid" */ bodyClass?: string /** dir="rtl" + RTL variants of the tabler/plugin stylesheets */ rtl?: boolean /** Relative asset base: '.' for root pages, '..' one level deep */ base?: string } const { title, pageLibs = [], bodyClass, rtl = false, base = '.' } = Astro.props // Development build: unminified assets, dev favicon. const environment = 'development' const min = environment === 'development' ? '' : '.min' // RTL swaps tabler/plugin stylesheets for their .rtl.css variants (demo stays LTR) const rtlSuffix = rtl ? '.rtl' : '' type Lib = { npm?: string; js?: string[]; css?: string[]; head?: boolean } const pageLibEntries = Object.entries(libs as Record).filter(([name]) => pageLibs.includes(name)) const googleMapsKey = site.googleMapsDevKey // External URLs (http/https) are emitted verbatim (with the maps-key placeholder // replaced); local files as ./dist/libs/{npm}/{file}. const libHref = (lib: Lib, file: string) => (/^https?:\/\//.test(file) ? file.replace('GOOGLE_MAPS_KEY', googleMapsKey) : `${base}/dist/libs/${lib.npm}/${file}`) const libCssFiles = pageLibEntries.flatMap(([, lib]) => (lib.css ?? []).map((file) => libHref(lib, file))) const libJsFiles = (head: boolean) => pageLibEntries.filter(([, lib]) => Boolean(lib.head) === head).flatMap(([, lib]) => (lib.js ?? []).map((file) => libHref(lib, file))) --- {title ? `${title} - ` : ''}{site.title} - {site.descriptionShort} { libCssFiles.length > 0 && ( '} /> {libCssFiles.map((href) => ( ))} '} /> ) } {site.cssPlugins.map((plugin) => )} { libJsFiles(true).length > 0 && ( '} /> {libJsFiles(true).map((src) => ( { libJsFiles(false).length > 0 && ( '} /> {libJsFiles(false).map((src) => (