forked from Mirrors/elk
refactor: flatten composables and enable auto-imports on dirs (#608)
This commit is contained in:
parent
d569754b09
commit
aeb5a40948
14 changed files with 17 additions and 26 deletions
|
@ -1,6 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { AriaAnnounceType, AriaLive } from '~/composables/aria/types'
|
import type { AriaAnnounceType, AriaLive } from '~/composables/aria'
|
||||||
import { useAriaAnnouncer } from '~/composables/aria'
|
|
||||||
import type { LocaleObject } from '#i18n'
|
import type { LocaleObject } from '#i18n'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { AriaLive } from '~/composables/aria/types'
|
import type { AriaLive } from '~/composables/aria'
|
||||||
import { useAriaLog } from '~/composables/aria'
|
|
||||||
|
|
||||||
// tsc complaining when using $defineProps
|
// tsc complaining when using $defineProps
|
||||||
withDefaults(defineProps<{
|
withDefaults(defineProps<{
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { AriaLive } from '~/composables/aria/types'
|
import type { AriaLive } from '~/composables/aria'
|
||||||
import { useAriaStatus } from '~/composables/aria'
|
|
||||||
|
|
||||||
// tsc complaining when using $defineProps
|
// tsc complaining when using $defineProps
|
||||||
withDefaults(defineProps<{
|
withDefaults(defineProps<{
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { decode } from 'blurhash'
|
import { decode } from 'blurhash'
|
||||||
import { getDataUrlFromArr } from '~/composables/utils'
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import type { Emoji } from 'masto'
|
import type { Emoji } from 'masto'
|
||||||
import { emojisArrayToObject } from '~/composables/utils'
|
|
||||||
import { currentCustomEmojis } from '~/composables/emojis'
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'ContentRich',
|
name: 'ContentRich',
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
||||||
import { useDeactivated } from '~/composables/lifecycle'
|
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
/** v-model dislog visibility */
|
/** v-model dislog visibility */
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { usePushManager } from '~/composables/push-notifications/usePushManager'
|
|
||||||
|
|
||||||
defineProps<{ show: boolean }>()
|
defineProps<{ show: boolean }>()
|
||||||
|
|
||||||
let busy = $ref<boolean>(false)
|
let busy = $ref<boolean>(false)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Picker } from 'emoji-mart'
|
import type { Picker } from 'emoji-mart'
|
||||||
import { updateCustomEmojis } from '~/composables/emojis'
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'select', code: string): void
|
(e: 'select', code: string): void
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { AriaAnnounceType } from '~/composables/aria/types'
|
export type AriaLive = 'off' | 'polite' | 'assertive'
|
||||||
|
export type AriaAnnounceType = 'announce' | 'mute' | 'unmute'
|
||||||
|
|
||||||
const ariaAnnouncer = useEventBus<AriaAnnounceType, string | undefined>(Symbol('aria-announcer'))
|
const ariaAnnouncer = useEventBus<AriaAnnounceType, string | undefined>(Symbol('aria-announcer'))
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
export type AriaLive = 'off' | 'polite' | 'assertive'
|
|
||||||
export type AriaAnnounceType = 'announce' | 'mute' | 'unmute'
|
|
|
@ -1,7 +1,6 @@
|
||||||
import type { Emoji } from 'masto'
|
import type { Emoji } from 'masto'
|
||||||
import type { CustomEmojisInfo } from './push-notifications/types'
|
import type { CustomEmojisInfo } from './push-notifications/types'
|
||||||
import { STORAGE_KEY_CUSTOM_EMOJIS } from '~/constants'
|
import { STORAGE_KEY_CUSTOM_EMOJIS } from '~/constants'
|
||||||
import { useUserLocalStorage } from '~/composables/users'
|
|
||||||
|
|
||||||
const TTL = 1000 * 60 * 60 * 24 // 1 day
|
const TTL = 1000 * 60 * 60 * 24 // 1 day
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@ import type {
|
||||||
PushManagerSubscriptionInfo,
|
PushManagerSubscriptionInfo,
|
||||||
RequiredUserLogin,
|
RequiredUserLogin,
|
||||||
} from '~/composables/push-notifications/types'
|
} from '~/composables/push-notifications/types'
|
||||||
import { useMasto } from '~/composables/masto'
|
|
||||||
import { currentUser, removePushNotificationData, removePushNotifications } from '~/composables/users'
|
|
||||||
|
|
||||||
export const createPushSubscription = async (
|
export const createPushSubscription = async (
|
||||||
user: RequiredUserLogin,
|
user: RequiredUserLogin,
|
||||||
|
|
|
@ -5,14 +5,12 @@ import type {
|
||||||
PushNotificationRequest,
|
PushNotificationRequest,
|
||||||
SubscriptionResult,
|
SubscriptionResult,
|
||||||
} from '~/composables/push-notifications/types'
|
} from '~/composables/push-notifications/types'
|
||||||
import { createPushSubscription } from '~/composables/push-notifications/createPushSubscription'
|
|
||||||
import { STORAGE_KEY_NOTIFICATION, STORAGE_KEY_NOTIFICATION_POLICY } from '~/constants'
|
import { STORAGE_KEY_NOTIFICATION, STORAGE_KEY_NOTIFICATION_POLICY } from '~/constants'
|
||||||
import { currentUser, removePushNotifications } from '~/composables/users'
|
|
||||||
|
|
||||||
const supportsPushNotifications = typeof window !== 'undefined'
|
const supportsPushNotifications = typeof window !== 'undefined'
|
||||||
&& 'serviceWorker' in navigator
|
&& 'serviceWorker' in navigator
|
||||||
&& 'PushManager' in window
|
&& 'PushManager' in window
|
||||||
&& 'getKey' in PushSubscription.prototype
|
&& 'getKey' in PushSubscription.prototype
|
||||||
|
|
||||||
export const usePushManager = () => {
|
export const usePushManager = () => {
|
||||||
const masto = useMasto()
|
const masto = useMasto()
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { fileURLToPath } from 'node:url'
|
import { createResolver } from '@nuxt/kit'
|
||||||
import Inspect from 'vite-plugin-inspect'
|
import Inspect from 'vite-plugin-inspect'
|
||||||
import { isCI, isDevelopment } from 'std-env'
|
import { isCI, isDevelopment } from 'std-env'
|
||||||
import { i18n } from './config/i18n'
|
import { i18n } from './config/i18n'
|
||||||
import { pwa } from './config/pwa'
|
import { pwa } from './config/pwa'
|
||||||
|
|
||||||
|
const { resolve } = createResolver(import.meta.url)
|
||||||
const isPreview = process.env.PULL_REQUEST === 'true' || process.env.CONTEXT === 'deploy-preview' || process.env.CONTEXT === 'dev'
|
const isPreview = process.env.PULL_REQUEST === 'true' || process.env.CONTEXT === 'deploy-preview' || process.env.CONTEXT === 'dev'
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
|
@ -44,6 +45,12 @@ export default defineNuxtConfig({
|
||||||
'change-case': 'scule',
|
'change-case': 'scule',
|
||||||
'semver': 'unenv/runtime/mock/empty',
|
'semver': 'unenv/runtime/mock/empty',
|
||||||
},
|
},
|
||||||
|
imports: {
|
||||||
|
dirs: [
|
||||||
|
'./composables/push-notifications',
|
||||||
|
'./composables/tiptap',
|
||||||
|
],
|
||||||
|
},
|
||||||
vite: {
|
vite: {
|
||||||
define: {
|
define: {
|
||||||
'process.env.VSCODE_TEXTMATE_DEBUG': 'false',
|
'process.env.VSCODE_TEXTMATE_DEBUG': 'false',
|
||||||
|
@ -100,7 +107,7 @@ export default defineNuxtConfig({
|
||||||
},
|
},
|
||||||
nitro: {
|
nitro: {
|
||||||
publicAssets: [
|
publicAssets: [
|
||||||
...(!isCI || isPreview ? [{ dir: fileURLToPath(new URL('./public-dev', import.meta.url)) }] : []),
|
...(!isCI || isPreview ? [{ dir: resolve('./public-dev') }] : []),
|
||||||
],
|
],
|
||||||
prerender: {
|
prerender: {
|
||||||
crawlLinks: false,
|
crawlLinks: false,
|
||||||
|
|
Loading…
Reference in a new issue