run prettier

This commit is contained in:
2023-06-02 00:04:18 +02:00
parent c21538c09f
commit 33737167b4
18 changed files with 70 additions and 63 deletions

View File

@@ -24,7 +24,7 @@ export default defineComponent({
model: { model: {
prop: 'modelValue', prop: 'modelValue',
event: 'update:modelValue', event: 'update:modelValue'
}, },
props: { props: {
@@ -32,28 +32,28 @@ export default defineComponent({
type: Function as unknown as PropType<{ type: Function as unknown as PropType<{
create(...args: any): Promise<Editor> create(...args: any): Promise<Editor>
}>, }>,
required: true, required: true
}, },
config: { config: {
type: Object as PropType<EditorConfig>, type: Object as PropType<EditorConfig>,
default: () => ({}), default: () => ({})
}, },
modelValue: { modelValue: {
type: String, type: String,
default: '', default: ''
}, },
tagName: { tagName: {
type: String, type: String,
default: 'div', default: 'div'
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false, default: false
}, },
disableTwoWayDataBinding: { disableTwoWayDataBinding: {
type: Boolean, type: Boolean,
default: false, default: false
}, }
}, },
emits: [ emits: [
@@ -66,7 +66,7 @@ export default defineComponent({
'click', 'click',
'editorReady', 'editorReady',
'contextedLinkAutocomplete', 'contextedLinkAutocomplete',
'contextedKeypress', 'contextedKeypress'
], ],
data(): CKEditorComponentData { data(): CKEditorComponentData {
@@ -74,7 +74,7 @@ export default defineComponent({
// Don't define it in #props because it produces a warning. // Don't define it in #props because it produces a warning.
// https://v3.vuejs.org/guide/component-props.html#one-way-data-flow // https://v3.vuejs.org/guide/component-props.html#one-way-data-flow
instance: null, instance: null,
lastEditorData: null, lastEditorData: null
} }
}, },
@@ -114,7 +114,7 @@ export default defineComponent({
} else { } else {
this.instance!.disableReadOnlyMode(SAMPLE_READ_ONLY_LOCK_ID) this.instance!.disableReadOnlyMode(SAMPLE_READ_ONLY_LOCK_ID)
} }
}, }
}, },
created() { created() {
@@ -124,9 +124,7 @@ export default defineComponent({
const [major] = CKEDITOR_VERSION.split('.').map(Number) const [major] = CKEDITOR_VERSION.split('.').map(Number)
if (major < 37) { if (major < 37) {
console.warn( console.warn('The <CKEditor> component requires using CKEditor 5 in version 37 or higher.')
'The <CKEditor> component requires using CKEditor 5 in version 37 or higher.'
)
} }
} else { } else {
console.warn('Cannot find the "CKEDITOR_VERSION" in the "window" scope.') console.warn('Cannot find the "CKEDITOR_VERSION" in the "window" scope.')
@@ -233,10 +231,10 @@ export default defineComponent({
editor.model.document.on('contextedKeypress', (_, eventData) => { editor.model.document.on('contextedKeypress', (_, eventData) => {
this.$emit('contextedKeypress', eventData) this.$emit('contextedKeypress', eventData)
}) })
}, }
}, },
render() { render() {
return h(this.tagName) return h(this.tagName)
}, }
}) })

View File

@@ -43,5 +43,8 @@ onMounted(() => ui.start('#auth', uiConfig))
</script> </script>
<template> <template>
<div id="auth" v-show="!props.authenticating"></div> <div id="auth" v-show="!props.authenticating"></div>
<progress v-show="props.authenticating" class="dui-progress dui-progress-primary w-full"></progress> <progress
v-show="props.authenticating"
class="dui-progress dui-progress-primary w-full"
></progress>
</template> </template>

View File

@@ -21,8 +21,10 @@ const element = ref<HTMLElement | null>(null)
:disabled="activeNote?.id === result.id" :disabled="activeNote?.id === result.id"
:active="props.activeResult?.id === result.id" :active="props.activeResult?.id === result.id"
> >
<UIBadge size="sm" variant="ghost" class="mr-0.5" v-if="activeNote?.id === result.id">current</UIBadge> <UIBadge size="sm" variant="ghost" class="mr-0.5" v-if="activeNote?.id === result.id">
<span class="truncate flex-grow">{{ result.title }}</span> current
</UIBadge>
<span class="flex-grow truncate">{{ result.title }}</span>
<span class="whitespace-nowrap">{{ formatDate(result.modified) }}</span> <span class="whitespace-nowrap">{{ formatDate(result.modified) }}</span>
</UIMenuItem> </UIMenuItem>
</template> </template>

View File

@@ -6,7 +6,7 @@ const props = defineProps<{
</script> </script>
<template> <template>
<a <a
class="max-sm:mt-2 mt-1 block w-full cursor-pointer truncate rounded hover:bg-gray-200 active:bg-primary active:text-primary-content" class="mt-1 block w-full cursor-pointer truncate rounded hover:bg-gray-200 active:bg-primary active:text-primary-content max-sm:mt-2"
:class="props.active ? 'font-bold text-primary' : 'text-secondary'" :class="props.active ? 'font-bold text-primary' : 'text-secondary'"
> >
<i :class="props.icon" class="mr-2" v-if="props.icon"></i> <i :class="props.icon" class="mr-2" v-if="props.icon"></i>

View File

@@ -5,21 +5,21 @@
<div class="h-[2.25rem] flex-grow rounded bg-secondary"></div> <div class="h-[2.25rem] flex-grow rounded bg-secondary"></div>
</div> </div>
<div class="flex flex-grow flex-col gap-2"> <div class="flex flex-grow flex-col gap-2">
<div class="h-[1.25rem] my-1 w-full rounded bg-secondary"></div> <div class="my-1 h-[1.25rem] w-full rounded bg-secondary"></div>
<div class="h-[1.25rem] my-1 w-full rounded bg-secondary"></div> <div class="my-1 h-[1.25rem] w-full rounded bg-secondary"></div>
<div class="h-[1.25rem] my-1 w-5/12 rounded bg-secondary"></div> <div class="my-1 h-[1.25rem] w-5/12 rounded bg-secondary"></div>
<div class="mt-2 h-[2rem] w-full rounded bg-secondary"></div> <div class="mt-2 h-[2rem] w-full rounded bg-secondary"></div>
<div class="h-[1.25rem] my-1 w-full rounded bg-secondary"></div> <div class="my-1 h-[1.25rem] w-full rounded bg-secondary"></div>
<div class="h-[1.25rem] my-1 w-4/6 rounded bg-secondary"></div> <div class="my-1 h-[1.25rem] w-4/6 rounded bg-secondary"></div>
<div class="ml-8 h-[1.25rem] my-1 w-5/12 rounded bg-secondary"></div> <div class="my-1 ml-8 h-[1.25rem] w-5/12 rounded bg-secondary"></div>
<div class="ml-8 h-[1.25rem] my-1 w-7/12 rounded bg-secondary"></div> <div class="my-1 ml-8 h-[1.25rem] w-7/12 rounded bg-secondary"></div>
<div class="ml-8 h-[1.25rem] my-1 w-6/12 rounded bg-secondary"></div> <div class="my-1 ml-8 h-[1.25rem] w-6/12 rounded bg-secondary"></div>
<div class="h-[1.25rem] my-1 w-full rounded bg-secondary"></div> <div class="my-1 h-[1.25rem] w-full rounded bg-secondary"></div>
</div> </div>
<hr class="my-3" /> <hr class="my-3" />
<div class="flex gap-2"> <div class="flex gap-2">
<div class="h-[1.25rem] w-2/12 rounded bg-secondary"></div> <div class="h-[1.25rem] w-2/12 rounded bg-secondary"></div>
<div class="h-[1.25rem] w-4/12 rounded bg-secondary ml-auto"></div> <div class="ml-auto h-[1.25rem] w-4/12 rounded bg-secondary"></div>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -8,7 +8,7 @@ const props = withDefaults(
</script> </script>
<template> <template>
<div class="flex w-full animate-pulse flex-col"> <div class="flex w-full animate-pulse flex-col">
<div class="h-[1.35rem] w-full rounded bg-secondary mt-1" v-for="i in props.n" :key="i"></div> <div class="mt-1 h-[1.35rem] w-full rounded bg-secondary" v-for="i in props.n" :key="i"></div>
</div> </div>
</template> </template>
<style scoped> <style scoped>

View File

@@ -30,10 +30,7 @@ const handleSignIn = async (close: () => Promise<boolean>) => {
} }
</script> </script>
<template> <template>
<div <div class="z-[500] flex items-end bg-primary" :class="searchActive && 'search-active'">
class="z-[500] flex items-end bg-primary"
:class="searchActive && 'search-active'"
>
<div <div
class="mx-auto flex w-full max-w-app items-center py-2.5 text-white" class="mx-auto flex w-full max-w-app items-center py-2.5 text-white"
:style="{ height: `${props.height}px` }" :style="{ height: `${props.height}px` }"
@@ -93,9 +90,14 @@ const handleSignIn = async (close: () => Promise<boolean>) => {
#logo { #logo {
@apply cursor-pointer transition-all duration-200 hover:text-primary; @apply cursor-pointer transition-all duration-200 hover:text-primary;
} }
@media (hover: hover) and (pointer: fine) {
#logo:hover { #logo:hover {
text-shadow: 0 0 5px white, 0 0 10px white, 0 0 15px white; text-shadow: 0 0 5px white, 0 0 10px white, 0 0 15px white;
} }
}
#logo:active {
text-shadow: 0 0 5px white, 0 0 10px white, 0 0 15px white;
}
.topbar-button { .topbar-button {
@apply hover:border-white hover:bg-white hover:text-primary focus-visible:outline-white; @apply hover:border-white hover:bg-white hover:text-primary focus-visible:outline-white;
} }

View File

@@ -5,12 +5,7 @@ import { OnClickOutside } from '@vueuse/components'
<OnClickOutside> <OnClickOutside>
<UIDropdown class="search-active-hide"> <UIDropdown class="search-active-hide">
<template #activator> <template #activator>
<UIButton <UIButton :dropdown="true" size="sm" variant="outline" class="topbar-button text-white">
:dropdown="true"
size="sm"
variant="outline"
class="topbar-button text-white"
>
<i class="fa-fw fa-solid fa-user-gear" /> <i class="fa-fw fa-solid fa-user-gear" />
</UIButton> </UIButton>
</template> </template>

View File

@@ -30,7 +30,7 @@ const deleteSelectedNotes = (closeModal: () => void) => {
} }
</script> </script>
<template> <template>
<div class="flex flex-col gap-2 w-full"> <div class="flex w-full flex-col gap-2">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<div class="flex items-center"> <div class="flex items-center">
<span class="whitespace-nowrap"> <span class="whitespace-nowrap">
@@ -63,7 +63,7 @@ const deleteSelectedNotes = (closeModal: () => void) => {
<div class="overflow-x-auto"> <div class="overflow-x-auto">
<UITable size="md" class="w-full"> <UITable size="md" class="w-full">
<thead> <thead>
<tr class="text-sm bg-base-200 text-base-content"> <tr class="bg-base-200 text-sm text-base-content">
<th class="w-[48px]"></th> <th class="w-[48px]"></th>
<th>Note title</th> <th>Note title</th>
<th class="w-[75px]">Words</th> <th class="w-[75px]">Words</th>

View File

@@ -3,7 +3,7 @@
<slot name="activator" tabindex="0"></slot> <slot name="activator" tabindex="0"></slot>
<ul <ul
tabindex="0" tabindex="0"
class="dui-dropdown-content dui-menu dui-menu-compact rounded-box mt-1 w-52 bg-base-100 p-2 text-base-content shadow" class="dui-menu-compact dui-dropdown-content dui-menu rounded-box mt-1 w-52 bg-base-100 p-2 text-base-content shadow"
> >
<slot name="items"></slot> <slot name="items"></slot>
</ul> </ul>

View File

@@ -18,7 +18,7 @@ const styleClass = computed(() => {
<li :class="styleClass"> <li :class="styleClass">
<span class="flex items-center" v-if="props.title"><slot></slot></span> <span class="flex items-center" v-if="props.title"><slot></slot></span>
<a <a
class="w-full rounded-md flex" class="flex w-full rounded-md"
:class="{ 'dui-disabled': props.disabled, 'dui-active': props.active }" :class="{ 'dui-disabled': props.disabled, 'dui-active': props.active }"
v-else v-else
> >

View File

@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { onClickOutside } from '@vueuse/core' import { onClickOutside } from '@vueuse/core'
import { Haptics, ImpactStyle } from '@capacitor/haptics'
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
@@ -18,7 +19,12 @@ const props = withDefaults(
const show = ref<boolean>(false) const show = ref<boolean>(false)
watch( watch(
() => props.open, () => props.open,
() => (show.value = props.open), () => {
if (show.value) {
Haptics.impact({ style: ImpactStyle.Light })
}
show.value = props.open
},
{ immediate: true } { immediate: true }
) )

View File

@@ -8,10 +8,10 @@ const props = withDefaults(defineProps<Props>(), {
const styleClass = computed(() => { const styleClass = computed(() => {
const sizeVariants = { const sizeVariants = {
'xs': 'dui-table-xs', xs: 'dui-table-xs',
'sm': 'dui-table-sm', sm: 'dui-table-sm',
'md': 'dui-table-md', md: 'dui-table-md',
'lg': 'dui-table-lg', lg: 'dui-table-lg'
} }
const sizeClass = sizeVariants[props.size] const sizeClass = sizeVariants[props.size]
return [sizeClass] return [sizeClass]

View File

@@ -1,6 +1,6 @@
export const viewModes: ViewMode[] = [ export const viewModes: ViewMode[] = [
{ name: 'Note', icon: 'fas fa-sticky-note fa-fw' }, { name: 'Note', icon: 'fas fa-sticky-note fa-fw' },
{ name: 'List', icon: 'fas fa-list fa-fw' }, { name: 'List', icon: 'fas fa-list fa-fw' },
{ name: 'Mindmap', icon: 'fas fa-project-diagram fa-fw' }, { name: 'Mindmap', icon: 'fas fa-project-diagram fa-fw' }
] ]
export const activeViewMode = ref<ViewMode>(viewModes[0]) export const activeViewMode = ref<ViewMode>(viewModes[0])

View File

@@ -9,16 +9,16 @@ export const defaultNotes: BaseNote[] = [
* Create a new note by typing words between [[brackets]] * Create a new note by typing words between [[brackets]]
* Click on **Mindmap mode** in the menu left to visualize your notes * Click on **Mindmap mode** in the menu left to visualize your notes
\n \n
Let's get started!`, Let's get started!`
}, },
{ {
title: 'brackets', title: 'brackets',
content: `If you type square brackets around text a link is created automatically. Like magic!`, content: `If you type square brackets around text a link is created automatically. Like magic!`,
isRoot: false isRoot: false
}, }
].map((note) => ({ ].map((note) => ({
id: shortid.generate(), id: shortid.generate(),
created: new Date().getTime(), created: new Date().getTime(),
modified: new Date().getTime(), modified: new Date().getTime(),
...note, ...note
})) }))

View File

@@ -1,11 +1,9 @@
import { formatDistance, format, isToday } from 'date-fns' import { formatDistance, format, isToday } from 'date-fns'
export const formatDate = (date: Date | number): string => { export const formatDate = (date: Date | number): string => {
const dateToFormat = ['number', 'string'].includes(typeof date) const dateToFormat = ['number', 'string'].includes(typeof date) ? new Date(date) : date
? new Date(date)
: date
const dateDistanceInWords = formatDistance(dateToFormat, new Date()) + ' ago' const dateDistanceInWords = formatDistance(dateToFormat, new Date()) + ' ago'
return isToday(date) ? dateDistanceInWords : format(date, 'd MMMM \'at\' HH:mm ') return isToday(date) ? dateDistanceInWords : format(date, "d MMMM 'at' HH:mm ")
} }
export const getAllMatches = (regex: RegExp, input: string): RegExpExecArray[] => { export const getAllMatches = (regex: RegExp, input: string): RegExpExecArray[] => {

View File

@@ -31,7 +31,7 @@ export function htmlToMd(htmlText: string): string {
// [/\]/g, '\\]'], // [/\]/g, '\\]'],
[/^>/g, '\\>'], [/^>/g, '\\>'],
[/_/g, '\\_'], [/_/g, '\\_'],
[/^(\d+)\. /g, '$1\\. '], [/^(\d+)\. /g, '$1\\. ']
] ]
turndown.escape = (string) => turndown.escape = (string) =>
escapes.reduce((accumulator, escape) => { escapes.reduce((accumulator, escape) => {

View File

@@ -8,6 +8,9 @@ const secondary = colors.gray[500]
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
export default { export default {
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
future: {
hoverOnlyWhenSupported: true
},
theme: { theme: {
extend: { extend: {
colors: { colors: {
@@ -35,10 +38,10 @@ export default {
themes: [ themes: [
{ {
contexted: { contexted: {
...require("daisyui/src/theming/themes")["[data-theme=light]"], ...require('daisyui/src/theming/themes')['[data-theme=light]'],
primary, primary,
secondary, secondary,
"--btn-text-case": "uppercase", // set default text transform for buttons '--btn-text-case': 'uppercase' // set default text transform for buttons
// accent: '#37CDBE', // accent: '#37CDBE',
// neutral: '#F7F7F7', // neutral: '#F7F7F7',
// 'base-100': '#FFFFFF', // 'base-100': '#FFFFFF',