create-rue 0.0.15 → 0.1.1
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.
|
|
2
|
+
/*! create-rue v0.1.1 | 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.
|
|
2040
|
+
var version = "0.1.1";
|
|
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rue",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "🛠️ The
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "🛠️ The will to start a Vite-powered Rue project",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/hunzhiwange/create-rue#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -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,16 @@ 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) =>
|
|
97
|
+
localStorage.getItem(getHeaderStorageKey(path)) === '1'
|
|
89
98
|
|
|
90
99
|
const applyTheme = (theme: string) => {
|
|
91
100
|
document.documentElement.setAttribute('data-theme', theme)
|
|
@@ -229,26 +238,72 @@ const Footer: FC = () => (
|
|
|
229
238
|
const HeaderToggleButton: FC<{ hidden: boolean; onToggle: () => void }> = (props) => (
|
|
230
239
|
<button
|
|
231
240
|
type="button"
|
|
232
|
-
className="btn btn-circle btn-sm fixed left-3 top-3 z-50 border-base-300 bg-base-100/
|
|
241
|
+
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
242
|
aria-label={props.hidden ? '显示头部和底部' : '隐藏头部和底部'}
|
|
234
243
|
title={props.hidden ? '显示头部和底部' : '隐藏头部和底部'}
|
|
235
244
|
onClick={props.onToggle}
|
|
236
245
|
>
|
|
237
|
-
{props.hidden ?
|
|
246
|
+
{props.hidden ? (
|
|
247
|
+
<svg
|
|
248
|
+
viewBox="0 0 24 24"
|
|
249
|
+
width="16"
|
|
250
|
+
height="16"
|
|
251
|
+
aria-hidden="true"
|
|
252
|
+
fill="none"
|
|
253
|
+
stroke="currentColor"
|
|
254
|
+
stroke-width="2"
|
|
255
|
+
stroke-linecap="round"
|
|
256
|
+
stroke-linejoin="round"
|
|
257
|
+
>
|
|
258
|
+
<path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z" />
|
|
259
|
+
<circle cx="12" cy="12" r="3" />
|
|
260
|
+
</svg>
|
|
261
|
+
) : (
|
|
262
|
+
<svg
|
|
263
|
+
viewBox="0 0 24 24"
|
|
264
|
+
width="16"
|
|
265
|
+
height="16"
|
|
266
|
+
aria-hidden="true"
|
|
267
|
+
fill="none"
|
|
268
|
+
stroke="currentColor"
|
|
269
|
+
stroke-width="2"
|
|
270
|
+
stroke-linecap="round"
|
|
271
|
+
stroke-linejoin="round"
|
|
272
|
+
>
|
|
273
|
+
<path d="M3 3l18 18" />
|
|
274
|
+
<path d="M10.6 10.7a3 3 0 0 0 4.2 4.2" />
|
|
275
|
+
<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" />
|
|
276
|
+
<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" />
|
|
277
|
+
</svg>
|
|
278
|
+
)}
|
|
238
279
|
</button>
|
|
239
280
|
)
|
|
240
281
|
|
|
241
282
|
const SiteLayout: FC = (props) => {
|
|
242
283
|
const route = useRoute()
|
|
243
284
|
const currentPath = computed(() => route.get()?.path || '/')
|
|
244
|
-
const allowHeaderToggle = computed(() => currentPath.get()
|
|
245
|
-
const reportHeaderHidden = ref(getStoredHeaderHidden())
|
|
285
|
+
const allowHeaderToggle = computed(() => headerToggleRoutes.includes(currentPath.get()))
|
|
286
|
+
const reportHeaderHidden = ref(getStoredHeaderHidden(currentPath.get()))
|
|
246
287
|
const hideHeader = computed(() => allowHeaderToggle.get() && reportHeaderHidden.value)
|
|
247
288
|
|
|
289
|
+
watch(
|
|
290
|
+
() => currentPath.get(),
|
|
291
|
+
(path) => {
|
|
292
|
+
reportHeaderHidden.value = allowHeaderToggle.get() ? getStoredHeaderHidden(path) : false
|
|
293
|
+
},
|
|
294
|
+
)
|
|
295
|
+
|
|
248
296
|
watch(
|
|
249
297
|
() => reportHeaderHidden.value,
|
|
250
298
|
() => {
|
|
251
|
-
|
|
299
|
+
if (!allowHeaderToggle.get()) {
|
|
300
|
+
return
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
localStorage.setItem(
|
|
304
|
+
getHeaderStorageKey(currentPath.get()),
|
|
305
|
+
reportHeaderHidden.value ? '1' : '0',
|
|
306
|
+
)
|
|
252
307
|
},
|
|
253
308
|
)
|
|
254
309
|
|
|
@@ -264,9 +319,7 @@ const SiteLayout: FC = (props) => {
|
|
|
264
319
|
}}
|
|
265
320
|
/>
|
|
266
321
|
)}
|
|
267
|
-
<main className="content-width pb-10 pt-6 sm:pt-8">
|
|
268
|
-
{props.children}
|
|
269
|
-
</main>
|
|
322
|
+
<main className="content-width pb-10 pt-6 sm:pt-8">{props.children}</main>
|
|
270
323
|
{!hideHeader.get() && <Footer />}
|
|
271
324
|
</div>
|
|
272
325
|
</div>
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
8
8
|
"build": "vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
9
10
|
"typecheck": "tsgo --noEmit",
|
|
10
11
|
"oxlint": "oxlint -c ./.oxlintrc.json .",
|
|
11
12
|
"oxlint-fix": "oxlint -c ./.oxlintrc.json . --fix",
|
|
@@ -13,18 +14,18 @@
|
|
|
13
14
|
"format-check": "oxfmt --check ."
|
|
14
15
|
},
|
|
15
16
|
"dependencies": {
|
|
16
|
-
"@rue-js/jsx-runtime": "^0.
|
|
17
|
-
"@rue-js/router": "^0.
|
|
18
|
-
"@rue-js/rue": "^0.
|
|
19
|
-
"@rue-js/runtime": "^0.
|
|
20
|
-
"@rue-js/runtime-vapor": "^0.
|
|
17
|
+
"@rue-js/jsx-runtime": "^0.1.1",
|
|
18
|
+
"@rue-js/router": "^0.1.1",
|
|
19
|
+
"@rue-js/rue": "^0.1.1",
|
|
20
|
+
"@rue-js/runtime": "^0.1.1",
|
|
21
|
+
"@rue-js/runtime-vapor": "^0.1.1",
|
|
21
22
|
"daisyui": "^5.5.19",
|
|
22
23
|
"oxfmt": "^0.48.0",
|
|
23
24
|
"oxlint": "^1.63.0"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
|
-
"@rue-js/jsx-dev-runtime": "^0.
|
|
27
|
-
"@rue-js/vite-plugin-rue": "^0.
|
|
27
|
+
"@rue-js/jsx-dev-runtime": "^0.1.1",
|
|
28
|
+
"@rue-js/vite-plugin-rue": "^0.1.1",
|
|
28
29
|
"@swc/core": "^1.15.33",
|
|
29
30
|
"@tailwindcss/typography": "^0.5.19",
|
|
30
31
|
"@tailwindcss/vite": "^4.3.0",
|
|
@@ -3,7 +3,7 @@ import VitePluginRue from '@rue-js/vite-plugin-rue'
|
|
|
3
3
|
import wasm from 'vite-plugin-wasm'
|
|
4
4
|
import tailwindcss from '@tailwindcss/vite'
|
|
5
5
|
|
|
6
|
-
export default defineConfig({
|
|
6
|
+
export default defineConfig(({ command }) => ({
|
|
7
7
|
resolve: {
|
|
8
8
|
conditions: ['import', 'module', 'browser', 'default'],
|
|
9
9
|
},
|
|
@@ -11,8 +11,11 @@ export default defineConfig({
|
|
|
11
11
|
wasm(),
|
|
12
12
|
tailwindcss() as any,
|
|
13
13
|
VitePluginRue({
|
|
14
|
-
|
|
15
|
-
debug: true,
|
|
14
|
+
debug: command === 'serve',
|
|
16
15
|
}),
|
|
17
16
|
],
|
|
18
|
-
|
|
17
|
+
server: {
|
|
18
|
+
port: 5173,
|
|
19
|
+
strictPort: false,
|
|
20
|
+
},
|
|
21
|
+
}))
|