create-rue 0.0.15 → 0.0.16
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/bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/*! create-rue v0.0.
|
|
2
|
+
/*! create-rue v0.0.16 | MIT */
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import * as fs from "node:fs";
|
|
5
5
|
import "node:fs";
|
|
@@ -2037,7 +2037,7 @@ function inferPackageManager() {
|
|
|
2037
2037
|
//#endregion
|
|
2038
2038
|
//#region package.json
|
|
2039
2039
|
var name = "create-rue";
|
|
2040
|
-
var version = "0.0.
|
|
2040
|
+
var version = "0.0.16";
|
|
2041
2041
|
//#endregion
|
|
2042
2042
|
//#region index.ts
|
|
2043
2043
|
const language = await getLanguage(fileURLToPath(new URL("./locales", import.meta.url)));
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { computed, type FC, ref, useEffect, watch } from '@rue-js/rue'
|
|
|
2
2
|
import { RouterLink, useRoute } from '@rue-js/router'
|
|
3
3
|
|
|
4
4
|
const themeStorageKey = 'rue.base.theme'
|
|
5
|
-
const
|
|
5
|
+
const headerToggleRoutes = ['/', '/report', '/todo']
|
|
6
6
|
|
|
7
7
|
const navItems = [
|
|
8
8
|
{ to: '/', label: '首页' },
|
|
@@ -85,7 +85,15 @@ const getStoredTheme = () => {
|
|
|
85
85
|
return storedTheme && themes.includes(storedTheme) ? storedTheme : 'light'
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
const
|
|
88
|
+
const getHeaderStorageKey = (path: string) => {
|
|
89
|
+
if (path === '/') {
|
|
90
|
+
return 'rue.base.header.hide.home'
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return `rue.base.header.hide.${path.replace(/^\//, '')}`
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const getStoredHeaderHidden = (path: string) => localStorage.getItem(getHeaderStorageKey(path)) === '1'
|
|
89
97
|
|
|
90
98
|
const applyTheme = (theme: string) => {
|
|
91
99
|
document.documentElement.setAttribute('data-theme', theme)
|
|
@@ -229,26 +237,69 @@ const Footer: FC = () => (
|
|
|
229
237
|
const HeaderToggleButton: FC<{ hidden: boolean; onToggle: () => void }> = (props) => (
|
|
230
238
|
<button
|
|
231
239
|
type="button"
|
|
232
|
-
className="btn btn-circle btn-sm fixed left-3 top-3 z-50 border-base-300 bg-base-100/
|
|
240
|
+
className="btn btn-circle btn-sm fixed left-3 top-3 z-50 border-base-300 bg-base-100/95 text-base-content shadow-lg backdrop-blur"
|
|
233
241
|
aria-label={props.hidden ? '显示头部和底部' : '隐藏头部和底部'}
|
|
234
242
|
title={props.hidden ? '显示头部和底部' : '隐藏头部和底部'}
|
|
235
243
|
onClick={props.onToggle}
|
|
236
244
|
>
|
|
237
|
-
{props.hidden ?
|
|
245
|
+
{props.hidden ? (
|
|
246
|
+
<svg
|
|
247
|
+
viewBox="0 0 24 24"
|
|
248
|
+
width="16"
|
|
249
|
+
height="16"
|
|
250
|
+
aria-hidden="true"
|
|
251
|
+
fill="none"
|
|
252
|
+
stroke="currentColor"
|
|
253
|
+
stroke-width="2"
|
|
254
|
+
stroke-linecap="round"
|
|
255
|
+
stroke-linejoin="round"
|
|
256
|
+
>
|
|
257
|
+
<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z" />
|
|
258
|
+
<circle cx="12" cy="12" r="3" />
|
|
259
|
+
</svg>
|
|
260
|
+
) : (
|
|
261
|
+
<svg
|
|
262
|
+
viewBox="0 0 24 24"
|
|
263
|
+
width="16"
|
|
264
|
+
height="16"
|
|
265
|
+
aria-hidden="true"
|
|
266
|
+
fill="none"
|
|
267
|
+
stroke="currentColor"
|
|
268
|
+
stroke-width="2"
|
|
269
|
+
stroke-linecap="round"
|
|
270
|
+
stroke-linejoin="round"
|
|
271
|
+
>
|
|
272
|
+
<path d="M3 3l18 18" />
|
|
273
|
+
<path d="M10.6 10.7a3 3 0 0 0 4.2 4.2" />
|
|
274
|
+
<path d="M9.9 5.1A10.9 10.9 0 0 1 12 5c6.5 0 10 7 10 7a21.7 21.7 0 0 1-4 5.2" />
|
|
275
|
+
<path d="M6.6 6.7C4.2 8.3 2.7 10.9 2 12c0 0 3.5 7 10 7 1.8 0 3.4-.5 4.8-1.3" />
|
|
276
|
+
</svg>
|
|
277
|
+
)}
|
|
238
278
|
</button>
|
|
239
279
|
)
|
|
240
280
|
|
|
241
281
|
const SiteLayout: FC = (props) => {
|
|
242
282
|
const route = useRoute()
|
|
243
283
|
const currentPath = computed(() => route.get()?.path || '/')
|
|
244
|
-
const allowHeaderToggle = computed(() => currentPath.get()
|
|
245
|
-
const reportHeaderHidden = ref(getStoredHeaderHidden())
|
|
284
|
+
const allowHeaderToggle = computed(() => headerToggleRoutes.includes(currentPath.get()))
|
|
285
|
+
const reportHeaderHidden = ref(getStoredHeaderHidden(currentPath.get()))
|
|
246
286
|
const hideHeader = computed(() => allowHeaderToggle.get() && reportHeaderHidden.value)
|
|
247
287
|
|
|
288
|
+
watch(
|
|
289
|
+
() => currentPath.get(),
|
|
290
|
+
(path) => {
|
|
291
|
+
reportHeaderHidden.value = allowHeaderToggle.get() ? getStoredHeaderHidden(path) : false
|
|
292
|
+
},
|
|
293
|
+
)
|
|
294
|
+
|
|
248
295
|
watch(
|
|
249
296
|
() => reportHeaderHidden.value,
|
|
250
297
|
() => {
|
|
251
|
-
|
|
298
|
+
if (!allowHeaderToggle.get()) {
|
|
299
|
+
return
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
localStorage.setItem(getHeaderStorageKey(currentPath.get()), reportHeaderHidden.value ? '1' : '0')
|
|
252
303
|
},
|
|
253
304
|
)
|
|
254
305
|
|