agentation-vue 0.2.2 → 0.2.4
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/dist/AgentationVue.vue +411 -528
- package/dist/components/AgentationToolbar.vue +49 -76
- package/dist/components/AnnotationInput.vue +30 -40
- package/dist/components/AnnotationMarker.vue +20 -25
- package/dist/components/ComponentChain.vue +19 -29
- package/dist/components/ElementHighlight.vue +13 -16
- package/dist/components/SettingsPanel.vue +29 -41
- package/dist/components/SettingsPopover.vue +128 -159
- package/dist/components/VaButton.vue +6 -12
- package/dist/components/VaIcon.vue +5 -5
- package/dist/components/VaIconButton.vue +15 -23
- package/dist/components/VaToggle.vue +7 -8
- package/package.json +7 -12
- package/dist/composables/useAnimationPause.js +0 -52
- package/dist/composables/useAnnotations.js +0 -106
- package/dist/composables/useAreaSelect.js +0 -62
- package/dist/composables/useElementDetection.js +0 -85
- package/dist/composables/useInteractionMode.js +0 -29
- package/dist/composables/useKeyboardShortcuts.js +0 -202
- package/dist/composables/useMarkerPositions.js +0 -45
- package/dist/composables/useMultiSelect.js +0 -108
- package/dist/composables/useOutputFormatter.js +0 -100
- package/dist/composables/useSettings.js +0 -48
- package/dist/composables/useTextSelection.js +0 -33
- package/dist/composables/useToolbarAutoHide.js +0 -270
- package/dist/composables/useToolbarDragSnap.js +0 -296
- package/dist/constants.js +0 -8
- package/dist/directives/vaTooltip.js +0 -241
- package/dist/icons.js +0 -21
- package/dist/index.js +0 -168
- package/dist/types.js +0 -1
- package/dist/utils/clipboard.js +0 -22
- package/dist/utils/dom-inspector.js +0 -168
- package/dist/utils/math.js +0 -9
- package/dist/utils/portal.js +0 -18
- package/dist/utils/selectors.js +0 -103
- package/dist/utils/style.js +0 -14
|
@@ -1,34 +1,19 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const emit = defineEmits<{
|
|
19
|
-
'activate': []
|
|
20
|
-
'deactivate': []
|
|
21
|
-
'copy': []
|
|
22
|
-
'clear': []
|
|
23
|
-
'toggle-pause': []
|
|
24
|
-
'toggle-area': [value: boolean]
|
|
25
|
-
'update:placement': [value: ToolbarAnchor]
|
|
26
|
-
'open-settings': [anchorEl: HTMLElement | null]
|
|
27
|
-
'drag-start': []
|
|
28
|
-
'drag-end': []
|
|
29
|
-
}>()
|
|
30
|
-
|
|
31
|
-
const expanded = ref(false)
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onBeforeUnmount, ref, toRef, watch } from "vue-demi";
|
|
3
|
+
import { useToolbarAutoHide } from "../composables/useToolbarAutoHide";
|
|
4
|
+
import { useToolbarDragSnap } from "../composables/useToolbarDragSnap";
|
|
5
|
+
import VaIcon from "./VaIcon.vue";
|
|
6
|
+
import VaIconButton from "./VaIconButton.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
mode: { type: String, required: true },
|
|
9
|
+
annotationCount: { type: Number, required: true },
|
|
10
|
+
isPaused: { type: Boolean, required: true },
|
|
11
|
+
isAreaMode: { type: Boolean, required: true },
|
|
12
|
+
autoHideEnabled: { type: Boolean, required: true },
|
|
13
|
+
placement: { type: String, required: true }
|
|
14
|
+
});
|
|
15
|
+
const emit = defineEmits(["activate", "deactivate", "copy", "clear", "toggle-pause", "toggle-area", "update:placement", "open-settings", "drag-start", "drag-end"]);
|
|
16
|
+
const expanded = ref(false);
|
|
32
17
|
const {
|
|
33
18
|
placement,
|
|
34
19
|
isDragging,
|
|
@@ -44,15 +29,14 @@ const {
|
|
|
44
29
|
onPointerUp,
|
|
45
30
|
onPointerCancel,
|
|
46
31
|
consumeToggleClickSuppression,
|
|
47
|
-
cleanup
|
|
32
|
+
cleanup
|
|
48
33
|
} = useToolbarDragSnap({
|
|
49
34
|
expanded,
|
|
50
35
|
initialPlacement: props.placement,
|
|
51
|
-
onDragStart: () => emit(
|
|
52
|
-
onDragEnd: () => emit(
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
const autoHideEnabled = toRef(props, 'autoHideEnabled')
|
|
36
|
+
onDragStart: () => emit("drag-start"),
|
|
37
|
+
onDragEnd: () => emit("drag-end")
|
|
38
|
+
});
|
|
39
|
+
const autoHideEnabled = toRef(props, "autoHideEnabled");
|
|
56
40
|
const {
|
|
57
41
|
isAutoHideActive,
|
|
58
42
|
isAutoHideRevealed,
|
|
@@ -60,69 +44,58 @@ const {
|
|
|
60
44
|
onToolbarPointerLeave,
|
|
61
45
|
onToolbarPointerDown,
|
|
62
46
|
onToolbarFocusIn,
|
|
63
|
-
onToolbarFocusOut
|
|
47
|
+
onToolbarFocusOut
|
|
64
48
|
} = useToolbarAutoHide({
|
|
65
49
|
enabled: autoHideEnabled,
|
|
66
50
|
expanded,
|
|
67
51
|
isDragging,
|
|
68
52
|
placement,
|
|
69
|
-
toolbarEl
|
|
70
|
-
})
|
|
71
|
-
|
|
53
|
+
toolbarEl
|
|
54
|
+
});
|
|
72
55
|
const toolbarClass = computed(() => [
|
|
73
56
|
`__va-toolbar--place-${placement.value}`,
|
|
74
57
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
])
|
|
82
|
-
|
|
58
|
+
"__va-toolbar--collapsed": !expanded.value,
|
|
59
|
+
"__va-toolbar--expanded": expanded.value,
|
|
60
|
+
"__va-toolbar--dragging": isDragging.value,
|
|
61
|
+
"__va-toolbar--auto-hide": isAutoHideActive.value,
|
|
62
|
+
"__va-toolbar--auto-hide-revealed": isAutoHideRevealed.value
|
|
63
|
+
}
|
|
64
|
+
]);
|
|
83
65
|
function onToggleClick() {
|
|
84
66
|
if (consumeToggleClickSuppression()) {
|
|
85
|
-
return
|
|
67
|
+
return;
|
|
86
68
|
}
|
|
87
|
-
onActivate()
|
|
69
|
+
onActivate();
|
|
88
70
|
}
|
|
89
|
-
|
|
90
71
|
function onActivate() {
|
|
91
|
-
expanded.value = true
|
|
92
|
-
emit(
|
|
72
|
+
expanded.value = true;
|
|
73
|
+
emit("activate");
|
|
93
74
|
}
|
|
94
|
-
|
|
95
75
|
function onDeactivate() {
|
|
96
|
-
expanded.value = false
|
|
97
|
-
emit(
|
|
76
|
+
expanded.value = false;
|
|
77
|
+
emit("deactivate");
|
|
98
78
|
}
|
|
99
|
-
|
|
100
79
|
function onClear() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
emit('clear')
|
|
80
|
+
if (confirm("Clear all annotations?"))
|
|
81
|
+
emit("clear");
|
|
104
82
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
emit('open-settings', anchorEl)
|
|
83
|
+
function onOpenSettings(e) {
|
|
84
|
+
const anchorEl = e.currentTarget instanceof HTMLElement ? e.currentTarget : null;
|
|
85
|
+
emit("open-settings", anchorEl);
|
|
109
86
|
}
|
|
110
|
-
|
|
111
87
|
onBeforeUnmount(() => {
|
|
112
|
-
cleanup()
|
|
113
|
-
})
|
|
114
|
-
|
|
88
|
+
cleanup();
|
|
89
|
+
});
|
|
115
90
|
watch(
|
|
116
91
|
() => props.placement,
|
|
117
92
|
(value) => {
|
|
118
93
|
if (placement.value !== value)
|
|
119
|
-
placement.value = value
|
|
120
|
-
}
|
|
121
|
-
)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
defineExpose({ expanded, placement })
|
|
94
|
+
placement.value = value;
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
watch(placement, (value) => emit("update:placement", value));
|
|
98
|
+
defineExpose({ expanded, placement });
|
|
126
99
|
</script>
|
|
127
100
|
|
|
128
101
|
<template>
|
|
@@ -1,47 +1,37 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { computed, onMounted, ref } from
|
|
3
|
-
import ComponentChain from
|
|
4
|
-
import VaButton from
|
|
5
|
-
import VaIcon from
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
cancel: []
|
|
19
|
-
delete: []
|
|
20
|
-
}>()
|
|
21
|
-
|
|
22
|
-
const comment = ref(props.initialComment || '')
|
|
23
|
-
const inputEl = ref<HTMLInputElement | null>(null)
|
|
24
|
-
const computedStyleEntries = computed(() => Object.entries(props.computedStyles || {}))
|
|
25
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, onMounted, ref } from "vue-demi";
|
|
3
|
+
import ComponentChain from "./ComponentChain.vue";
|
|
4
|
+
import VaButton from "./VaButton.vue";
|
|
5
|
+
import VaIcon from "./VaIcon.vue";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
position: { type: Object, required: true },
|
|
8
|
+
elementName: { type: String, required: false },
|
|
9
|
+
componentChain: { type: String, required: false },
|
|
10
|
+
computedStyles: { type: Object, required: false },
|
|
11
|
+
initialComment: { type: String, required: false },
|
|
12
|
+
isEditing: { type: Boolean, required: false }
|
|
13
|
+
});
|
|
14
|
+
const emit = defineEmits(["add", "cancel", "delete"]);
|
|
15
|
+
const comment = ref(props.initialComment || "");
|
|
16
|
+
const inputEl = ref(null);
|
|
17
|
+
const computedStyleEntries = computed(() => Object.entries(props.computedStyles || {}));
|
|
26
18
|
const inputStyle = computed(() => {
|
|
27
|
-
const x = Math.min(props.position.x, window.innerWidth - 380)
|
|
28
|
-
const y = Math.min(props.position.y + 20, window.innerHeight - 150)
|
|
19
|
+
const x = Math.min(props.position.x, window.innerWidth - 380);
|
|
20
|
+
const y = Math.min(props.position.y + 20, window.innerHeight - 150);
|
|
29
21
|
return {
|
|
30
22
|
left: `${Math.max(10, x)}px`,
|
|
31
|
-
top: `${Math.max(10, y)}px
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
23
|
+
top: `${Math.max(10, y)}px`
|
|
24
|
+
};
|
|
25
|
+
});
|
|
35
26
|
function onAdd() {
|
|
36
|
-
const text = comment.value.trim()
|
|
27
|
+
const text = comment.value.trim();
|
|
37
28
|
if (!text)
|
|
38
|
-
return
|
|
39
|
-
emit(
|
|
29
|
+
return;
|
|
30
|
+
emit("add", text);
|
|
40
31
|
}
|
|
41
|
-
|
|
42
32
|
onMounted(() => {
|
|
43
|
-
inputEl.value?.focus()
|
|
44
|
-
})
|
|
33
|
+
inputEl.value?.focus();
|
|
34
|
+
});
|
|
45
35
|
</script>
|
|
46
36
|
|
|
47
37
|
<template>
|
|
@@ -60,7 +50,7 @@ onMounted(() => {
|
|
|
60
50
|
>
|
|
61
51
|
<summary class="__va-input-styles-summary">
|
|
62
52
|
<ComponentChain v-if="componentChain" :chain="componentChain" variant="light" truncate="leaf" />
|
|
63
|
-
<span v-else class="__va-input-styles-element">{{ elementName ||
|
|
53
|
+
<span v-else class="__va-input-styles-element">{{ elementName || "Annotation" }}</span>
|
|
64
54
|
</summary>
|
|
65
55
|
<div class="__va-input-styles-block">
|
|
66
56
|
<div
|
|
@@ -75,7 +65,7 @@ onMounted(() => {
|
|
|
75
65
|
<div v-else-if="componentChain" class="__va-input-chain">
|
|
76
66
|
<ComponentChain :chain="componentChain" variant="light" truncate="leaf" />
|
|
77
67
|
</div>
|
|
78
|
-
<span v-else class="__va-input-label">{{ elementName ||
|
|
68
|
+
<span v-else class="__va-input-label">{{ elementName || "Annotation" }}</span>
|
|
79
69
|
<input
|
|
80
70
|
ref="inputEl"
|
|
81
71
|
v-model="comment"
|
|
@@ -97,7 +87,7 @@ onMounted(() => {
|
|
|
97
87
|
Cancel
|
|
98
88
|
</VaButton>
|
|
99
89
|
<VaButton :disabled="!comment.trim()" @click="onAdd">
|
|
100
|
-
{{ isEditing ?
|
|
90
|
+
{{ isEditing ? "Save" : "Add" }}
|
|
101
91
|
</VaButton>
|
|
102
92
|
</div>
|
|
103
93
|
</div>
|
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { computed } from
|
|
3
|
-
import VaIcon from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
defineEmits<{
|
|
16
|
-
click: []
|
|
17
|
-
}>()
|
|
18
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue-demi";
|
|
3
|
+
import VaIcon from "./VaIcon.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
number: { type: Number, required: true },
|
|
6
|
+
x: { type: Number, required: true },
|
|
7
|
+
y: { type: Number, required: true },
|
|
8
|
+
isFixed: { type: Boolean, required: false },
|
|
9
|
+
isStale: { type: Boolean, required: false },
|
|
10
|
+
isPending: { type: Boolean, required: false },
|
|
11
|
+
isSelection: { type: Boolean, required: false }
|
|
12
|
+
});
|
|
13
|
+
defineEmits(["click"]);
|
|
19
14
|
const markerStyle = computed(() => ({
|
|
20
15
|
left: `${props.x}%`,
|
|
21
|
-
top: `${props.y}px
|
|
22
|
-
}))
|
|
16
|
+
top: `${props.y}px`
|
|
17
|
+
}));
|
|
23
18
|
</script>
|
|
24
19
|
|
|
25
20
|
<template>
|
|
26
21
|
<div
|
|
27
22
|
class="__va-marker"
|
|
28
23
|
:class="{
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
'__va-marker--fixed': isFixed,
|
|
25
|
+
'__va-marker--stale': isStale,
|
|
26
|
+
'__va-marker--pending': isPending,
|
|
27
|
+
'__va-marker--selection': isSelection
|
|
28
|
+
}"
|
|
34
29
|
:style="markerStyle"
|
|
35
30
|
data-agentation-vue
|
|
36
31
|
@click.stop="$emit('click')"
|
|
@@ -1,30 +1,20 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import { computed, ref } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const TRUNCATE_THRESHOLD = 4
|
|
14
|
-
|
|
15
|
-
const components = computed(() => props.chain.split(' > '))
|
|
16
|
-
const shouldTruncate = computed(() => components.value.length >= TRUNCATE_THRESHOLD)
|
|
17
|
-
|
|
18
|
-
// For 'auto' mode: first + ellipsis + last 2
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref } from "vue-demi";
|
|
3
|
+
const props = defineProps({
|
|
4
|
+
chain: { type: String, required: true },
|
|
5
|
+
variant: { type: String, required: false, default: "light" },
|
|
6
|
+
truncate: { type: String, required: false, default: "none" }
|
|
7
|
+
});
|
|
8
|
+
const TRUNCATE_THRESHOLD = 4;
|
|
9
|
+
const components = computed(() => props.chain.split(" > "));
|
|
10
|
+
const shouldTruncate = computed(() => components.value.length >= TRUNCATE_THRESHOLD);
|
|
19
11
|
const autoTruncated = computed(() => {
|
|
20
12
|
if (!shouldTruncate.value)
|
|
21
|
-
return components.value
|
|
22
|
-
const all = components.value
|
|
23
|
-
return [all[0], null, all[all.length - 2], all[all.length - 1]]
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
// For 'leaf' mode
|
|
27
|
-
const leafExpanded = ref(false)
|
|
13
|
+
return components.value;
|
|
14
|
+
const all = components.value;
|
|
15
|
+
return [all[0], null, all[all.length - 2], all[all.length - 1]];
|
|
16
|
+
});
|
|
17
|
+
const leafExpanded = ref(false);
|
|
28
18
|
</script>
|
|
29
19
|
|
|
30
20
|
<template>
|
|
@@ -56,10 +46,10 @@ const leafExpanded = ref(false)
|
|
|
56
46
|
v-else-if="truncate === 'leaf'"
|
|
57
47
|
class="__va-comp-chain"
|
|
58
48
|
:class="[
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
@click.stop="shouldTruncate ?
|
|
49
|
+
`__va-comp-chain--${variant}`,
|
|
50
|
+
shouldTruncate ? '__va-comp-chain--collapsible' : ''
|
|
51
|
+
]"
|
|
52
|
+
@click.stop="shouldTruncate ? leafExpanded = !leafExpanded : void 0"
|
|
63
53
|
>
|
|
64
54
|
<template v-if="!shouldTruncate || leafExpanded">
|
|
65
55
|
<span v-for="comp in components" :key="comp" class="__va-comp">
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
componentChain?: string
|
|
12
|
-
}>()
|
|
13
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue-demi";
|
|
3
|
+
import { boundingBoxToStyle } from "../utils/style";
|
|
4
|
+
import ComponentChain from "./ComponentChain.vue";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
rect: { type: [Object, null], required: true },
|
|
7
|
+
elementName: { type: String, required: true },
|
|
8
|
+
visible: { type: Boolean, required: true },
|
|
9
|
+
componentChain: { type: String, required: false }
|
|
10
|
+
});
|
|
14
11
|
const highlightStyle = computed(() => {
|
|
15
12
|
if (!props.rect)
|
|
16
|
-
return {}
|
|
17
|
-
return boundingBoxToStyle(props.rect)
|
|
18
|
-
})
|
|
13
|
+
return {};
|
|
14
|
+
return boundingBoxToStyle(props.rect);
|
|
15
|
+
});
|
|
19
16
|
</script>
|
|
20
17
|
|
|
21
18
|
<template>
|
|
@@ -1,47 +1,35 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const presetColors = ['#8B5CF6', '#3B82F6', '#06B6D4', '#10B981', '#EAB308', '#FF5C00', '#EF4444']
|
|
17
|
-
const isMac = typeof navigator !== 'undefined' && /Mac|iPhone|iPad|iPod/.test(navigator.userAgent)
|
|
18
|
-
|
|
19
|
-
function update(key: keyof Settings, value: any) {
|
|
20
|
-
emit('update', { [key]: value })
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, toRef } from "vue-demi";
|
|
3
|
+
import { vaTooltipDirective } from "../directives/vaTooltip";
|
|
4
|
+
import VaIcon from "./VaIcon.vue";
|
|
5
|
+
import VaToggle from "./VaToggle.vue";
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
settings: { type: Object, required: true }
|
|
8
|
+
});
|
|
9
|
+
const emit = defineEmits(["update"]);
|
|
10
|
+
const settings = toRef(props, "settings");
|
|
11
|
+
const presetColors = ["#8B5CF6", "#3B82F6", "#06B6D4", "#10B981", "#EAB308", "#FF5C00", "#EF4444"];
|
|
12
|
+
const isMac = typeof navigator !== "undefined" && /Mac|iPhone|iPad|iPod/.test(navigator.userAgent);
|
|
13
|
+
function update(key, value) {
|
|
14
|
+
emit("update", { [key]: value });
|
|
21
15
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const target = event.currentTarget as HTMLSelectElement | null
|
|
16
|
+
function onSelectChange(key, event) {
|
|
17
|
+
const target = event.currentTarget;
|
|
25
18
|
if (!target)
|
|
26
|
-
return
|
|
27
|
-
update(key, target.value)
|
|
19
|
+
return;
|
|
20
|
+
update(key, target.value);
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
const isDarkTheme = computed(() => {
|
|
31
|
-
if (settings.value.theme ===
|
|
32
|
-
return true
|
|
33
|
-
if (settings.value.theme ===
|
|
34
|
-
return false
|
|
35
|
-
return typeof window !==
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const themeIcon = computed(() => (isDarkTheme.value ? 'sun' : 'moon'))
|
|
41
|
-
const vVaTooltip = vaTooltipDirective
|
|
42
|
-
|
|
23
|
+
if (settings.value.theme === "dark")
|
|
24
|
+
return true;
|
|
25
|
+
if (settings.value.theme === "light")
|
|
26
|
+
return false;
|
|
27
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
28
|
+
});
|
|
29
|
+
const themeIcon = computed(() => isDarkTheme.value ? "sun" : "moon");
|
|
30
|
+
const vVaTooltip = vaTooltipDirective;
|
|
43
31
|
function toggleTheme() {
|
|
44
|
-
update(
|
|
32
|
+
update("theme", isDarkTheme.value ? "light" : "dark");
|
|
45
33
|
}
|
|
46
34
|
</script>
|
|
47
35
|
|
|
@@ -129,10 +117,10 @@ function toggleTheme() {
|
|
|
129
117
|
Off
|
|
130
118
|
</option>
|
|
131
119
|
<option value="Meta">
|
|
132
|
-
{{ isMac ?
|
|
120
|
+
{{ isMac ? "\u2318 Cmd" : "Ctrl" }}
|
|
133
121
|
</option>
|
|
134
122
|
<option value="Alt">
|
|
135
|
-
{{ isMac ?
|
|
123
|
+
{{ isMac ? "\u2325 Option" : "Alt" }}
|
|
136
124
|
</option>
|
|
137
125
|
<option value="Shift">
|
|
138
126
|
Shift
|