srcdev-nuxt-forms 6.1.9 → 6.1.10
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.
|
@@ -7,38 +7,17 @@
|
|
|
7
7
|
<div class="select-scheme-group-wrapper">
|
|
8
8
|
<div class="select-scheme-group">
|
|
9
9
|
<LazyIcon name="material-symbols:night-sight-auto-sharp" class="scheme-icon" />
|
|
10
|
-
<input
|
|
11
|
-
type="radio"
|
|
12
|
-
id="auto"
|
|
13
|
-
name="colour-scheme"
|
|
14
|
-
class="scheme-input"
|
|
15
|
-
v-model="currentColourScheme"
|
|
16
|
-
value="auto"
|
|
17
|
-
/>
|
|
10
|
+
<input type="radio" id="auto" name="colour-scheme" class="scheme-input" v-model="colourMode" value="auto" />
|
|
18
11
|
<label for="auto" class="sr-only">{{ labels.auto }}</label>
|
|
19
12
|
</div>
|
|
20
13
|
<div class="select-scheme-group">
|
|
21
14
|
<LazyIcon name="radix-icons:sun" class="scheme-icon" />
|
|
22
|
-
<input
|
|
23
|
-
type="radio"
|
|
24
|
-
id="light"
|
|
25
|
-
name="colour-scheme"
|
|
26
|
-
class="scheme-input"
|
|
27
|
-
v-model="currentColourScheme"
|
|
28
|
-
value="light"
|
|
29
|
-
/>
|
|
15
|
+
<input type="radio" id="light" name="colour-scheme" class="scheme-input" v-model="colourMode" value="light" />
|
|
30
16
|
<label for="light" class="sr-only">{{ labels.light }}</label>
|
|
31
17
|
</div>
|
|
32
18
|
<div class="select-scheme-group">
|
|
33
19
|
<LazyIcon name="radix-icons:moon" class="scheme-icon" />
|
|
34
|
-
<input
|
|
35
|
-
type="radio"
|
|
36
|
-
id="dark"
|
|
37
|
-
name="colour-scheme"
|
|
38
|
-
class="scheme-input"
|
|
39
|
-
v-model="currentColourScheme"
|
|
40
|
-
value="dark"
|
|
41
|
-
/>
|
|
20
|
+
<input type="radio" id="dark" name="colour-scheme" class="scheme-input" v-model="colourMode" value="dark" />
|
|
42
21
|
<label for="dark" class="sr-only">{{ labels.dark }}</label>
|
|
43
22
|
</div>
|
|
44
23
|
</div>
|
|
@@ -88,7 +67,8 @@ const props = defineProps({
|
|
|
88
67
|
|
|
89
68
|
const duration = ref(props.stepAnimationDuration)
|
|
90
69
|
|
|
91
|
-
const
|
|
70
|
+
const colourMode = ref<"light" | "dark" | "auto">("dark")
|
|
71
|
+
const { setColourScheme } = useSettingsStore()
|
|
92
72
|
|
|
93
73
|
const colourSchemeWrapper = ref<HTMLFormElement | null>(null)
|
|
94
74
|
const colourSchemeGroupElements = ref<HTMLDivElement[]>([])
|
|
@@ -96,9 +76,9 @@ const colourSchemeInputElements = ref<HTMLInputElement[]>([])
|
|
|
96
76
|
const showMarker = ref(false)
|
|
97
77
|
|
|
98
78
|
const findIndexOfInputValueFromCurrentColourScheme = () => {
|
|
99
|
-
if (
|
|
100
|
-
if (
|
|
101
|
-
if (
|
|
79
|
+
if (colourMode.value === "auto") return 1
|
|
80
|
+
if (colourMode.value === "light") return 2
|
|
81
|
+
if (colourMode.value === "dark") return 3
|
|
102
82
|
return undefined
|
|
103
83
|
}
|
|
104
84
|
|
|
@@ -165,8 +145,9 @@ onMounted(() => {
|
|
|
165
145
|
}
|
|
166
146
|
})
|
|
167
147
|
|
|
168
|
-
watch(
|
|
169
|
-
|
|
148
|
+
watch(colourMode, (newVal) => {
|
|
149
|
+
console.log("Colour mode changed:", newVal)
|
|
150
|
+
setColourScheme(newVal)
|
|
170
151
|
})
|
|
171
152
|
|
|
172
153
|
watch(currentActiveIndex, () => {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<ToggleSwitchWithLabelInline
|
|
2
|
+
<ToggleSwitchWithLabelInline
|
|
3
|
+
v-model="colourMode"
|
|
4
|
+
:name
|
|
5
|
+
:label
|
|
6
|
+
labelWeight="normal"
|
|
7
|
+
:size
|
|
8
|
+
trueValue="dark"
|
|
9
|
+
falseValue="light"
|
|
10
|
+
:style-class-passthrough
|
|
11
|
+
>
|
|
3
12
|
<template #iconOn>
|
|
4
13
|
<LazyIcon name="radix-icons:moon" class="icon" />
|
|
5
14
|
</template>
|
|
@@ -10,7 +19,7 @@
|
|
|
10
19
|
</template>
|
|
11
20
|
|
|
12
21
|
<script setup lang="ts">
|
|
13
|
-
import propValidators from
|
|
22
|
+
import propValidators from "../../forms/c12/prop-validators"
|
|
14
23
|
|
|
15
24
|
defineProps({
|
|
16
25
|
name: {
|
|
@@ -23,25 +32,32 @@ defineProps({
|
|
|
23
32
|
},
|
|
24
33
|
labelWeight: {
|
|
25
34
|
type: String as PropType<string>,
|
|
26
|
-
default:
|
|
35
|
+
default: "semi-bold",
|
|
27
36
|
validator(value: string) {
|
|
28
|
-
return propValidators.labelWeight.includes(value)
|
|
37
|
+
return propValidators.labelWeight.includes(value)
|
|
29
38
|
},
|
|
30
39
|
},
|
|
31
40
|
size: {
|
|
32
41
|
type: String as PropType<string>,
|
|
33
|
-
default:
|
|
42
|
+
default: "small",
|
|
34
43
|
validator(value: string) {
|
|
35
|
-
return propValidators.size.includes(value)
|
|
44
|
+
return propValidators.size.includes(value)
|
|
36
45
|
},
|
|
37
46
|
},
|
|
38
47
|
styleClassPassthrough: {
|
|
39
48
|
type: Array as PropType<string[]>,
|
|
40
49
|
default: () => [],
|
|
41
50
|
},
|
|
42
|
-
})
|
|
51
|
+
})
|
|
43
52
|
|
|
44
53
|
// const displayMode = ref<'auto' | 'dark' | 'light'>('auto');
|
|
45
54
|
|
|
46
|
-
const
|
|
55
|
+
const colourMode = ref<"light" | "dark" | "auto">("dark")
|
|
56
|
+
|
|
57
|
+
const { currentColourScheme, setColourScheme } = useSettingsStore()
|
|
58
|
+
|
|
59
|
+
watch(colourMode, (newVal) => {
|
|
60
|
+
console.log("Colour mode changed:", newVal)
|
|
61
|
+
setColourScheme(newVal)
|
|
62
|
+
})
|
|
47
63
|
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// const delay = (t: number) => new Promise((r) => setTimeout(r, t))
|
|
2
|
+
|
|
3
|
+
export const useSettingsStore = defineStore(
|
|
4
|
+
"settingsStore",
|
|
5
|
+
() => {
|
|
6
|
+
// State
|
|
7
|
+
const colourScheme = ref<"auto" | "dark" | "light" | null>(null)
|
|
8
|
+
|
|
9
|
+
// Getters
|
|
10
|
+
const currentColourScheme = computed(() => colourScheme.value)
|
|
11
|
+
|
|
12
|
+
// Actions
|
|
13
|
+
const setColourScheme = (state: "auto" | "dark" | "light" | null) => {
|
|
14
|
+
console.log("Setting colour scheme:", state)
|
|
15
|
+
colourScheme.value = state
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
currentColourScheme,
|
|
20
|
+
setColourScheme,
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
persist: {
|
|
25
|
+
storage: piniaPluginPersistedstate.cookies(),
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
)
|
package/nuxt.config.ts
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
export default defineNuxtConfig({
|
|
4
4
|
devtools: { enabled: true },
|
|
5
5
|
modules: ["@nuxt/eslint", "@nuxt/icon", "@pinia/nuxt", "pinia-plugin-persistedstate/nuxt", "@nuxt/test-utils/module"],
|
|
6
|
+
imports: {
|
|
7
|
+
dirs: ["./stores"],
|
|
8
|
+
},
|
|
6
9
|
alias: {
|
|
7
10
|
"#shared": "./shared",
|
|
8
11
|
},
|
package/package.json
CHANGED