@d-mok/quasar-app-extension-quasar-axe 4.0.12 → 4.1.2
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
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { boot } from 'quasar/wrappers'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
LocationQuery,
|
|
4
|
+
LocationQueryValue,
|
|
5
|
+
RouteLocationNormalizedGeneric,
|
|
6
|
+
RouteRecordRaw,
|
|
7
|
+
} from 'vue-router'
|
|
3
8
|
|
|
4
9
|
if (!process.env.HOME_ROUTE) throw 'Missing HOME_ROUTE in process.env!'
|
|
5
10
|
|
|
@@ -7,33 +12,57 @@ const HOME_ROUTE = process.env.HOME_ROUTE ?? '/'
|
|
|
7
12
|
|
|
8
13
|
console.log('[QuasarAxe] Run Boot AutoRoute')
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
function parse(glob: Record<string, { default: any }>) {
|
|
16
|
+
return Object.entries(glob).map(([filepath, val]) => {
|
|
17
|
+
const filename = filepath
|
|
18
|
+
.split('/')
|
|
19
|
+
.at(-1)!
|
|
20
|
+
.replace(/\.\w+$/, '')
|
|
21
|
+
const name = filename.toLowerCase().replace('_', '') // for underscore pages
|
|
22
|
+
return {
|
|
23
|
+
filepath,
|
|
24
|
+
filename,
|
|
25
|
+
// for raw route record
|
|
26
|
+
component: val.default,
|
|
27
|
+
path: '/' + name, // absolute path
|
|
28
|
+
name: name,
|
|
29
|
+
props: (route: RouteLocationNormalizedGeneric) =>
|
|
30
|
+
castQuery(route.query),
|
|
31
|
+
children: [] as RouteRecordRaw[],
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
11
35
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}))
|
|
36
|
+
const [layoutMaster] = parse(
|
|
37
|
+
import.meta.glob('src/boot/axe/LayoutMaster.vue', { eager: true })
|
|
38
|
+
)
|
|
39
|
+
const layouts = parse(import.meta.glob('src/layouts/*.vue', { eager: true }))
|
|
40
|
+
const pages = parse(import.meta.glob('src/pages/**/*.vue', { eager: true }))
|
|
18
41
|
|
|
19
|
-
const
|
|
42
|
+
for (const layout of layouts) {
|
|
43
|
+
layout.children = pages.filter($ =>
|
|
44
|
+
$.filepath.includes('pages/' + layout.filename)
|
|
45
|
+
)
|
|
46
|
+
}
|
|
20
47
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
name: pascal(path).toLowerCase().replace('_', ''),
|
|
24
|
-
component: _pages[path].default,
|
|
25
|
-
props: route => castQuery(route.query),
|
|
26
|
-
}))
|
|
48
|
+
console.dev('[QuasarAxe] Routes:')
|
|
49
|
+
console.dev(layouts)
|
|
27
50
|
|
|
28
51
|
export default boot(({ app, router }) => {
|
|
29
52
|
router.addRoute({
|
|
53
|
+
component: layoutMaster?.component,
|
|
30
54
|
path: '/',
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
children: [
|
|
56
|
+
...layouts,
|
|
57
|
+
{
|
|
58
|
+
path: '/:catchAll(.*)*',
|
|
59
|
+
redirect: HOME_ROUTE,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
path: '/',
|
|
63
|
+
redirect: HOME_ROUTE,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
37
66
|
})
|
|
38
67
|
})
|
|
39
68
|
|
|
@@ -41,13 +70,6 @@ export default boot(({ app, router }) => {
|
|
|
41
70
|
* HELPER FUNCTIONS
|
|
42
71
|
*/
|
|
43
72
|
|
|
44
|
-
function pascal(s: string): string {
|
|
45
|
-
return s
|
|
46
|
-
.split('/')
|
|
47
|
-
.pop()!
|
|
48
|
-
.replace(/\.\w+$/, '')
|
|
49
|
-
}
|
|
50
|
-
|
|
51
73
|
type QueryValueBasicType = string | number | boolean | undefined
|
|
52
74
|
type QueryValueType = QueryValueBasicType | QueryValueBasicType[]
|
|
53
75
|
|
|
@@ -104,6 +104,7 @@
|
|
|
104
104
|
<script lang="ts" setup>
|
|
105
105
|
import { computed, ref } from 'vue'
|
|
106
106
|
import { useRoute } from 'vue-router'
|
|
107
|
+
import { setCssVar } from 'quasar'
|
|
107
108
|
|
|
108
109
|
type item = {
|
|
109
110
|
title?: string
|
|
@@ -128,6 +129,8 @@ let {
|
|
|
128
129
|
noMenu = false,
|
|
129
130
|
onSignOut,
|
|
130
131
|
account,
|
|
132
|
+
primaryColor,
|
|
133
|
+
positiveColor,
|
|
131
134
|
} = defineProps<{
|
|
132
135
|
title: string
|
|
133
136
|
appendix?: string
|
|
@@ -141,6 +144,8 @@ let {
|
|
|
141
144
|
noMenu?: boolean
|
|
142
145
|
onSignOut?: () => void
|
|
143
146
|
account?: string
|
|
147
|
+
primaryColor?: string
|
|
148
|
+
positiveColor?: string
|
|
144
149
|
}>()
|
|
145
150
|
|
|
146
151
|
let open = ref(false)
|
|
@@ -152,6 +157,15 @@ const currentRouteItem = computed(() => {
|
|
|
152
157
|
$ => $.link.replace('/', '') === route.path.replace('/', '')
|
|
153
158
|
)
|
|
154
159
|
})
|
|
160
|
+
|
|
161
|
+
if (primaryColor) {
|
|
162
|
+
setCssVar('primary', primaryColor)
|
|
163
|
+
setCssVar('positive', primaryColor)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (positiveColor) {
|
|
167
|
+
setCssVar('positive', positiveColor)
|
|
168
|
+
}
|
|
155
169
|
</script>
|
|
156
170
|
|
|
157
171
|
<style scoped>
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<q-btn
|
|
3
|
-
v-bind="$attrs"
|
|
4
|
-
label="Sign Out"
|
|
5
|
-
@click="signOut"
|
|
6
|
-
/>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script lang="ts" setup>
|
|
10
|
-
import { supabase } from '../../../utils'
|
|
11
|
-
|
|
12
|
-
function signOut() {
|
|
13
|
-
supabase.auth.signOut()
|
|
14
|
-
supabase.signIn()
|
|
15
|
-
}
|
|
16
|
-
</script>
|