/* * SPDX-FileCopyrightText: syuilo and misskey-project * SPDX-License-Identifier: AGPL-3.0-only */ import { markRaw } from 'vue'; import * as Misskey from 'misskey-js'; import { prefersReducedMotion } from '@@/js/config.js'; import { hemisphere } from '@@/js/intl-const.js'; import type { DeviceKind } from '@/utility/device-kind.js'; import type { TIPS } from '@/tips.js'; import { Pizzax } from '@/lib/pizzax.js'; import { DEFAULT_DEVICE_KIND } from '@/utility/device-kind.js'; /** * 「状態」を管理するストア(not「設定」) */ export const store = markRaw(new Pizzax('base', { accountSetupWizard: { where: 'account', default: 0, }, tips: { where: 'device', default: {} as Partial>, // true = 既読 }, memo: { where: 'account', default: null as string | null, }, reactionAcceptance: { where: 'account', default: 'nonSensitiveOnly' as 'likeOnly' | 'likeOnlyForRemote' | 'nonSensitiveOnly' | 'nonSensitiveOnlyForLocalLikeOnlyForRemote' | null, }, mutedAds: { where: 'account', default: [] as string[], }, visibility: { where: 'deviceAccount', default: 'public' as (typeof Misskey.noteVisibilities)[number], }, localOnly: { where: 'deviceAccount', default: false, }, showPreview: { where: 'device', default: false, }, tl: { where: 'deviceAccount', default: { src: 'home' as 'home' | 'local' | 'social' | 'global' | `list:${string}`, userList: null as Misskey.entities.UserList | null, filter: { withReplies: true, withRenotes: true, withSensitive: true, onlyFiles: false, }, }, }, darkMode: { where: 'device', default: false, }, realtimeMode: { where: 'device', default: true, }, recentlyUsedEmojis: { where: 'device', default: [] as string[], }, recentlyUsedUsers: { where: 'device', default: [] as string[], }, menuDisplay: { where: 'device', default: 'sideFull' as 'sideFull' | 'sideIcon'/* | 'top' */, }, postFormWithHashtags: { where: 'device', default: false, }, postFormHashtags: { where: 'device', default: '', }, additionalUnicodeEmojiIndexes: { where: 'device', default: {} as Record>, }, pluginTokens: { where: 'deviceAccount', default: {} as Record, // plugin id, token }, accountTokens: { where: 'device', default: {} as Record, // host/userId, token }, accountInfos: { where: 'device', default: {} as Record, // host/userId, user }, enablePreferencesAutoCloudBackup: { where: 'device', default: false, }, showPreferencesAutoCloudBackupSuggestion: { where: 'device', default: true, }, showStoragePersistenceSuggestion: { where: 'device', default: true, }, })); // TODO: 他のタブと永続化されたstateを同期 const PREFIX = 'miux:' as const; interface Watcher { key: string; callback: (value: unknown) => void; }