aboutsummaryrefslogtreecommitdiff
path: root/src/tools/json-diff/json-diff.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/json-diff/json-diff.vue')
-rw-r--r--src/tools/json-diff/json-diff.vue42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/tools/json-diff/json-diff.vue b/src/tools/json-diff/json-diff.vue
index 811f7fa..2ef3de0 100644
--- a/src/tools/json-diff/json-diff.vue
+++ b/src/tools/json-diff/json-diff.vue
@@ -1,3 +1,24 @@
+<script setup lang="ts">
+import JSON5 from 'json5';
+
+import DiffsViewer from './diff-viewer/diff-viewer.vue';
+import { withDefaultOnError } from '@/utils/defaults';
+import { isNotThrowing } from '@/utils/boolean';
+
+const rawLeftJson = ref('');
+const rawRightJson = ref('');
+
+const leftJson = computed(() => withDefaultOnError(() => JSON5.parse(rawLeftJson.value), undefined));
+const rightJson = computed(() => withDefaultOnError(() => JSON5.parse(rawRightJson.value), undefined));
+
+const jsonValidationRules = [
+ {
+ validator: (value: string) => value === '' || isNotThrowing(() => JSON5.parse(value)),
+ message: 'Invalid JSON format',
+ },
+];
+</script>
+
<template>
<c-input-text
v-model:value="rawLeftJson"
@@ -23,24 +44,3 @@
<DiffsViewer :left-json="leftJson" :right-json="rightJson" />
</template>
-
-<script setup lang="ts">
-import JSON5 from 'json5';
-
-import { withDefaultOnError } from '@/utils/defaults';
-import { isNotThrowing } from '@/utils/boolean';
-import DiffsViewer from './diff-viewer/diff-viewer.vue';
-
-const rawLeftJson = ref('');
-const rawRightJson = ref('');
-
-const leftJson = computed(() => withDefaultOnError(() => JSON5.parse(rawLeftJson.value), undefined));
-const rightJson = computed(() => withDefaultOnError(() => JSON5.parse(rawRightJson.value), undefined));
-
-const jsonValidationRules = [
- {
- validator: (value: string) => value === '' || isNotThrowing(() => JSON5.parse(value)),
- message: 'Invalid JSON format',
- },
-];
-</script>