core-maugli 1.2.34 → 1.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
Binary file
|
package/public/blackbox-400.webp
CHANGED
Binary file
|
package/public/blackbox-800.webp
CHANGED
Binary file
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// MAUGLI_CONFIG_VERSION — config version for CLI/automation compatibility
|
2
|
-
export const MAUGLI_CONFIG_VERSION = '0.
|
2
|
+
export const MAUGLI_CONFIG_VERSION = '0.4';
|
3
3
|
// Main configuration interface for the Maugli project
|
4
4
|
export interface MaugliConfig {
|
5
5
|
// Show example/demo content (for CLI/empty blog setup)
|
@@ -63,6 +63,7 @@ export interface MaugliConfig {
|
|
63
63
|
// Control display of tags/rubrics
|
64
64
|
// Theme switcher
|
65
65
|
enableThemeSwitcher?: boolean; // Enable theme switcher (true by default)
|
66
|
+
defaultTheme?: 'light' | 'dark' | 'auto'; // Default theme (light, dark, or auto based on system preference)
|
66
67
|
// Social and contact links (displayed in the footer)
|
67
68
|
links?: Record<string, string>; // Social/contact links for footer
|
68
69
|
navLinks?: Array<{ key: string; label: string; href: string }>; // Navigation links
|
@@ -93,7 +94,7 @@ export interface MaugliConfig {
|
|
93
94
|
}
|
94
95
|
// Main exported configuration object for the Maugli project
|
95
96
|
export const maugliConfig: MaugliConfig = {
|
96
|
-
configVersion: MAUGLI_CONFIG_VERSION, // Config version for CLI/automation compatibility
|
97
|
+
configVersion: MAUGLI_CONFIG_VERSION, // Config version for CLI/automation compatibility (0.4)
|
97
98
|
showExamples: true, // Show example/demo content (set false to hide all demo content)
|
98
99
|
brand: {
|
99
100
|
name: 'Maugli', // Brand name
|
@@ -122,6 +123,7 @@ export const maugliConfig: MaugliConfig = {
|
|
122
123
|
netlifyEnabled: true, // Enable Netlify deployment button (default: true)
|
123
124
|
},
|
124
125
|
enableThemeSwitcher: true, // Enable theme switcher (true by default)
|
126
|
+
defaultTheme: 'dark', // Default theme (dark by default)
|
125
127
|
seo: {
|
126
128
|
titleSuffix: ' — Maugli', // Suffix for page titles
|
127
129
|
defaultImage: '/default-image.webp', // Default image for SEO
|
@@ -5,6 +5,7 @@ import Footer from '../components/Footer.astro';
|
|
5
5
|
import MaugliFloatingLabel from '../components/MaugliFloatingLabel.astro';
|
6
6
|
import Header from '../components/Header.astro';
|
7
7
|
import Nav from '../components/Nav.astro';
|
8
|
+
import { maugliConfig } from '../config/maugli.config';
|
8
9
|
|
9
10
|
export type Props = HeadProps & { showHeader?: boolean; fullWidth?: boolean };
|
10
11
|
|
@@ -15,11 +16,27 @@ const { showHeader = true, fullWidth = false, ...head } = Astro.props;
|
|
15
16
|
<html lang="ru" class="antialiased break-words bg-main">
|
16
17
|
<head>
|
17
18
|
<BaseHead {...head} />
|
18
|
-
<script>
|
19
|
+
<script define:vars={{ defaultTheme: maugliConfig.defaultTheme || 'auto' }}>
|
19
20
|
// Инициализация темы до загрузки DOM
|
20
21
|
function initTheme() {
|
21
|
-
const
|
22
|
-
|
22
|
+
const savedTheme = localStorage.getItem('theme');
|
23
|
+
let appliedTheme;
|
24
|
+
|
25
|
+
if (savedTheme) {
|
26
|
+
// Если есть сохранённая тема, используем её
|
27
|
+
appliedTheme = savedTheme;
|
28
|
+
} else {
|
29
|
+
// Если нет сохранённой темы, используем значение из конфигурации
|
30
|
+
if (defaultTheme === 'auto') {
|
31
|
+
// Автоматический выбор на основе системных настроек
|
32
|
+
appliedTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
33
|
+
} else {
|
34
|
+
// Используем тему из конфигурации
|
35
|
+
appliedTheme = defaultTheme;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
if (appliedTheme === 'dark') {
|
23
40
|
document.documentElement.classList.add('dark');
|
24
41
|
localStorage.setItem('theme', 'dark');
|
25
42
|
} else {
|
@@ -43,12 +60,25 @@ const { showHeader = true, fullWidth = false, ...head } = Astro.props;
|
|
43
60
|
<MaugliFloatingLabel />
|
44
61
|
</div>
|
45
62
|
|
46
|
-
<script>
|
63
|
+
<script define:vars={{ defaultTheme: maugliConfig.defaultTheme || 'auto' }}>
|
47
64
|
// Сохранение темы при переходах между страницами
|
48
65
|
document.addEventListener('astro:page-load', () => {
|
49
66
|
// Переинициализируем тему на каждой новой странице
|
50
|
-
const
|
51
|
-
|
67
|
+
const savedTheme = localStorage.getItem('theme');
|
68
|
+
let appliedTheme;
|
69
|
+
|
70
|
+
if (savedTheme) {
|
71
|
+
appliedTheme = savedTheme;
|
72
|
+
} else {
|
73
|
+
// Если нет сохранённой темы, используем значение из конфигурации
|
74
|
+
if (defaultTheme === 'auto') {
|
75
|
+
appliedTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
76
|
+
} else {
|
77
|
+
appliedTheme = defaultTheme;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
if (appliedTheme === 'dark') {
|
52
82
|
document.documentElement.classList.add('dark');
|
53
83
|
} else {
|
54
84
|
document.documentElement.classList.remove('dark');
|