From 9384f5399da39e53855beb8e7f8ded1aa56bf72e Mon Sep 17 00:00:00 2001 From: syuilo Date: Tue, 27 Dec 2022 14:36:33 +0900 Subject: rename: client -> frontend --- packages/client/src/ui/_common_/common.vue | 139 ------ .../client/src/ui/_common_/navbar-for-mobile.vue | 314 ------------- packages/client/src/ui/_common_/navbar.vue | 521 --------------------- .../src/ui/_common_/statusbar-federation.vue | 108 ----- packages/client/src/ui/_common_/statusbar-rss.vue | 93 ---- .../client/src/ui/_common_/statusbar-user-list.vue | 113 ----- packages/client/src/ui/_common_/statusbars.vue | 92 ---- .../client/src/ui/_common_/stream-indicator.vue | 61 --- packages/client/src/ui/_common_/sw-inject.ts | 35 -- packages/client/src/ui/_common_/upload.vue | 129 ----- packages/client/src/ui/classic.header.vue | 217 --------- packages/client/src/ui/classic.sidebar.vue | 268 ----------- packages/client/src/ui/classic.vue | 320 ------------- packages/client/src/ui/classic.widgets.vue | 84 ---- packages/client/src/ui/deck.vue | 435 ----------------- packages/client/src/ui/deck/antenna-column.vue | 70 --- packages/client/src/ui/deck/column-core.vue | 34 -- packages/client/src/ui/deck/column.vue | 398 ---------------- packages/client/src/ui/deck/deck-store.ts | 296 ------------ packages/client/src/ui/deck/direct-column.vue | 31 -- packages/client/src/ui/deck/list-column.vue | 58 --- packages/client/src/ui/deck/main-column.vue | 68 --- packages/client/src/ui/deck/mentions-column.vue | 28 -- .../client/src/ui/deck/notifications-column.vue | 44 -- packages/client/src/ui/deck/tl-column.vue | 119 ----- packages/client/src/ui/deck/widgets-column.vue | 69 --- packages/client/src/ui/universal.vue | 390 --------------- packages/client/src/ui/universal.widgets.vue | 71 --- packages/client/src/ui/visitor.vue | 19 - packages/client/src/ui/visitor/a.vue | 259 ---------- packages/client/src/ui/visitor/b.vue | 248 ---------- packages/client/src/ui/visitor/header.vue | 228 --------- packages/client/src/ui/visitor/kanban.vue | 257 ---------- packages/client/src/ui/zen.vue | 34 -- 34 files changed, 5650 deletions(-) delete mode 100644 packages/client/src/ui/_common_/common.vue delete mode 100644 packages/client/src/ui/_common_/navbar-for-mobile.vue delete mode 100644 packages/client/src/ui/_common_/navbar.vue delete mode 100644 packages/client/src/ui/_common_/statusbar-federation.vue delete mode 100644 packages/client/src/ui/_common_/statusbar-rss.vue delete mode 100644 packages/client/src/ui/_common_/statusbar-user-list.vue delete mode 100644 packages/client/src/ui/_common_/statusbars.vue delete mode 100644 packages/client/src/ui/_common_/stream-indicator.vue delete mode 100644 packages/client/src/ui/_common_/sw-inject.ts delete mode 100644 packages/client/src/ui/_common_/upload.vue delete mode 100644 packages/client/src/ui/classic.header.vue delete mode 100644 packages/client/src/ui/classic.sidebar.vue delete mode 100644 packages/client/src/ui/classic.vue delete mode 100644 packages/client/src/ui/classic.widgets.vue delete mode 100644 packages/client/src/ui/deck.vue delete mode 100644 packages/client/src/ui/deck/antenna-column.vue delete mode 100644 packages/client/src/ui/deck/column-core.vue delete mode 100644 packages/client/src/ui/deck/column.vue delete mode 100644 packages/client/src/ui/deck/deck-store.ts delete mode 100644 packages/client/src/ui/deck/direct-column.vue delete mode 100644 packages/client/src/ui/deck/list-column.vue delete mode 100644 packages/client/src/ui/deck/main-column.vue delete mode 100644 packages/client/src/ui/deck/mentions-column.vue delete mode 100644 packages/client/src/ui/deck/notifications-column.vue delete mode 100644 packages/client/src/ui/deck/tl-column.vue delete mode 100644 packages/client/src/ui/deck/widgets-column.vue delete mode 100644 packages/client/src/ui/universal.vue delete mode 100644 packages/client/src/ui/universal.widgets.vue delete mode 100644 packages/client/src/ui/visitor.vue delete mode 100644 packages/client/src/ui/visitor/a.vue delete mode 100644 packages/client/src/ui/visitor/b.vue delete mode 100644 packages/client/src/ui/visitor/header.vue delete mode 100644 packages/client/src/ui/visitor/kanban.vue delete mode 100644 packages/client/src/ui/zen.vue (limited to 'packages/client/src/ui') diff --git a/packages/client/src/ui/_common_/common.vue b/packages/client/src/ui/_common_/common.vue deleted file mode 100644 index 7f3fc0e4af..0000000000 --- a/packages/client/src/ui/_common_/common.vue +++ /dev/null @@ -1,139 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/_common_/navbar-for-mobile.vue b/packages/client/src/ui/_common_/navbar-for-mobile.vue deleted file mode 100644 index 50b28de063..0000000000 --- a/packages/client/src/ui/_common_/navbar-for-mobile.vue +++ /dev/null @@ -1,314 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/_common_/navbar.vue b/packages/client/src/ui/_common_/navbar.vue deleted file mode 100644 index b82da15f13..0000000000 --- a/packages/client/src/ui/_common_/navbar.vue +++ /dev/null @@ -1,521 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/_common_/statusbar-federation.vue b/packages/client/src/ui/_common_/statusbar-federation.vue deleted file mode 100644 index 24fc4f6f6d..0000000000 --- a/packages/client/src/ui/_common_/statusbar-federation.vue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/_common_/statusbar-rss.vue b/packages/client/src/ui/_common_/statusbar-rss.vue deleted file mode 100644 index e7f88e4984..0000000000 --- a/packages/client/src/ui/_common_/statusbar-rss.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/_common_/statusbar-user-list.vue b/packages/client/src/ui/_common_/statusbar-user-list.vue deleted file mode 100644 index f4d989c387..0000000000 --- a/packages/client/src/ui/_common_/statusbar-user-list.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/_common_/statusbars.vue b/packages/client/src/ui/_common_/statusbars.vue deleted file mode 100644 index 114ca5be8c..0000000000 --- a/packages/client/src/ui/_common_/statusbars.vue +++ /dev/null @@ -1,92 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/_common_/stream-indicator.vue b/packages/client/src/ui/_common_/stream-indicator.vue deleted file mode 100644 index a855de8ab9..0000000000 --- a/packages/client/src/ui/_common_/stream-indicator.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/_common_/sw-inject.ts b/packages/client/src/ui/_common_/sw-inject.ts deleted file mode 100644 index 8676d2d48d..0000000000 --- a/packages/client/src/ui/_common_/sw-inject.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { inject } from 'vue'; -import { post } from '@/os'; -import { $i, login } from '@/account'; -import { defaultStore } from '@/store'; -import { getAccountFromId } from '@/scripts/get-account-from-id'; -import { mainRouter } from '@/router'; - -export function swInject() { - navigator.serviceWorker.addEventListener('message', ev => { - if (_DEV_) { - console.log('sw msg', ev.data); - } - - if (ev.data.type !== 'order') return; - - if (ev.data.loginId !== $i?.id) { - return getAccountFromId(ev.data.loginId).then(account => { - if (!account) return; - return login(account.token, ev.data.url); - }); - } - - switch (ev.data.order) { - case 'post': - return post(ev.data.options); - case 'push': - if (mainRouter.currentRoute.value.path === ev.data.url) { - return window.scroll({ top: 0, behavior: 'smooth' }); - } - return mainRouter.push(ev.data.url); - default: - return; - } - }); -} diff --git a/packages/client/src/ui/_common_/upload.vue b/packages/client/src/ui/_common_/upload.vue deleted file mode 100644 index 70882bd251..0000000000 --- a/packages/client/src/ui/_common_/upload.vue +++ /dev/null @@ -1,129 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/classic.header.vue b/packages/client/src/ui/classic.header.vue deleted file mode 100644 index 46d79e6355..0000000000 --- a/packages/client/src/ui/classic.header.vue +++ /dev/null @@ -1,217 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/classic.sidebar.vue b/packages/client/src/ui/classic.sidebar.vue deleted file mode 100644 index dac09ea703..0000000000 --- a/packages/client/src/ui/classic.sidebar.vue +++ /dev/null @@ -1,268 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/classic.vue b/packages/client/src/ui/classic.vue deleted file mode 100644 index 0e726c11ed..0000000000 --- a/packages/client/src/ui/classic.vue +++ /dev/null @@ -1,320 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/classic.widgets.vue b/packages/client/src/ui/classic.widgets.vue deleted file mode 100644 index 163ec982ce..0000000000 --- a/packages/client/src/ui/classic.widgets.vue +++ /dev/null @@ -1,84 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/deck.vue b/packages/client/src/ui/deck.vue deleted file mode 100644 index f3415cfd09..0000000000 --- a/packages/client/src/ui/deck.vue +++ /dev/null @@ -1,435 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/deck/antenna-column.vue b/packages/client/src/ui/deck/antenna-column.vue deleted file mode 100644 index ba14530662..0000000000 --- a/packages/client/src/ui/deck/antenna-column.vue +++ /dev/null @@ -1,70 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/deck/column-core.vue b/packages/client/src/ui/deck/column-core.vue deleted file mode 100644 index 30c0dc5e1c..0000000000 --- a/packages/client/src/ui/deck/column-core.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - diff --git a/packages/client/src/ui/deck/column.vue b/packages/client/src/ui/deck/column.vue deleted file mode 100644 index 2a99b621e6..0000000000 --- a/packages/client/src/ui/deck/column.vue +++ /dev/null @@ -1,398 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/deck/deck-store.ts b/packages/client/src/ui/deck/deck-store.ts deleted file mode 100644 index 56db7398e5..0000000000 --- a/packages/client/src/ui/deck/deck-store.ts +++ /dev/null @@ -1,296 +0,0 @@ -import { throttle } from 'throttle-debounce'; -import { markRaw } from 'vue'; -import { notificationTypes } from 'misskey-js'; -import { Storage } from '../../pizzax'; -import { i18n } from '@/i18n'; -import { api } from '@/os'; -import { deepClone } from '@/scripts/clone'; - -type ColumnWidget = { - name: string; - id: string; - data: Record; -}; - -export type Column = { - id: string; - type: 'main' | 'widgets' | 'notifications' | 'tl' | 'antenna' | 'list' | 'mentions' | 'direct'; - name: string | null; - width: number; - widgets?: ColumnWidget[]; - active?: boolean; - flexible?: boolean; - antennaId?: string; - listId?: string; - includingTypes?: typeof notificationTypes[number][]; - tl?: 'home' | 'local' | 'social' | 'global'; -}; - -export const deckStore = markRaw(new Storage('deck', { - profile: { - where: 'deviceAccount', - default: 'default', - }, - columns: { - where: 'deviceAccount', - default: [] as Column[], - }, - layout: { - where: 'deviceAccount', - default: [] as Column['id'][][], - }, - columnAlign: { - where: 'deviceAccount', - default: 'left' as 'left' | 'right' | 'center', - }, - alwaysShowMainColumn: { - where: 'deviceAccount', - default: true, - }, - navWindow: { - where: 'deviceAccount', - default: true, - }, -})); - -export const loadDeck = async () => { - let deck; - - try { - deck = await api('i/registry/get', { - scope: ['client', 'deck', 'profiles'], - key: deckStore.state.profile, - }); - } catch (err) { - if (err.code === 'NO_SUCH_KEY') { - // 後方互換性のため - if (deckStore.state.profile === 'default') { - saveDeck(); - return; - } - - deckStore.set('columns', []); - deckStore.set('layout', []); - return; - } - throw err; - } - - deckStore.set('columns', deck.columns); - deckStore.set('layout', deck.layout); -}; - -// TODO: deckがloadされていない状態でsaveすると意図せず上書きが発生するので対策する -export const saveDeck = throttle(1000, () => { - api('i/registry/set', { - scope: ['client', 'deck', 'profiles'], - key: deckStore.state.profile, - value: { - columns: deckStore.reactiveState.columns.value, - layout: deckStore.reactiveState.layout.value, - }, - }); -}); - -export async function getProfiles(): Promise { - return await api('i/registry/keys', { - scope: ['client', 'deck', 'profiles'], - }); -} - -export async function deleteProfile(key: string): Promise { - return await api('i/registry/remove', { - scope: ['client', 'deck', 'profiles'], - key: key, - }); -} - -export function addColumn(column: Column) { - if (column.name === undefined) column.name = null; - deckStore.push('columns', column); - deckStore.push('layout', [column.id]); - saveDeck(); -} - -export function removeColumn(id: Column['id']) { - deckStore.set('columns', deckStore.state.columns.filter(c => c.id !== id)); - deckStore.set('layout', deckStore.state.layout - .map(ids => ids.filter(_id => _id !== id)) - .filter(ids => ids.length > 0)); - saveDeck(); -} - -export function swapColumn(a: Column['id'], b: Column['id']) { - const aX = deckStore.state.layout.findIndex(ids => ids.indexOf(a) !== -1); - const aY = deckStore.state.layout[aX].findIndex(id => id === a); - const bX = deckStore.state.layout.findIndex(ids => ids.indexOf(b) !== -1); - const bY = deckStore.state.layout[bX].findIndex(id => id === b); - const layout = deepClone(deckStore.state.layout); - layout[aX][aY] = b; - layout[bX][bY] = a; - deckStore.set('layout', layout); - saveDeck(); -} - -export function swapLeftColumn(id: Column['id']) { - const layout = deepClone(deckStore.state.layout); - deckStore.state.layout.some((ids, i) => { - if (ids.includes(id)) { - const left = deckStore.state.layout[i - 1]; - if (left) { - layout[i - 1] = deckStore.state.layout[i]; - layout[i] = left; - deckStore.set('layout', layout); - } - return true; - } - }); - saveDeck(); -} - -export function swapRightColumn(id: Column['id']) { - const layout = deepClone(deckStore.state.layout); - deckStore.state.layout.some((ids, i) => { - if (ids.includes(id)) { - const right = deckStore.state.layout[i + 1]; - if (right) { - layout[i + 1] = deckStore.state.layout[i]; - layout[i] = right; - deckStore.set('layout', layout); - } - return true; - } - }); - saveDeck(); -} - -export function swapUpColumn(id: Column['id']) { - const layout = deepClone(deckStore.state.layout); - const idsIndex = deckStore.state.layout.findIndex(ids => ids.includes(id)); - const ids = deepClone(deckStore.state.layout[idsIndex]); - ids.some((x, i) => { - if (x === id) { - const up = ids[i - 1]; - if (up) { - ids[i - 1] = id; - ids[i] = up; - - layout[idsIndex] = ids; - deckStore.set('layout', layout); - } - return true; - } - }); - saveDeck(); -} - -export function swapDownColumn(id: Column['id']) { - const layout = deepClone(deckStore.state.layout); - const idsIndex = deckStore.state.layout.findIndex(ids => ids.includes(id)); - const ids = deepClone(deckStore.state.layout[idsIndex]); - ids.some((x, i) => { - if (x === id) { - const down = ids[i + 1]; - if (down) { - ids[i + 1] = id; - ids[i] = down; - - layout[idsIndex] = ids; - deckStore.set('layout', layout); - } - return true; - } - }); - saveDeck(); -} - -export function stackLeftColumn(id: Column['id']) { - let layout = deepClone(deckStore.state.layout); - const i = deckStore.state.layout.findIndex(ids => ids.includes(id)); - layout = layout.map(ids => ids.filter(_id => _id !== id)); - layout[i - 1].push(id); - layout = layout.filter(ids => ids.length > 0); - deckStore.set('layout', layout); - saveDeck(); -} - -export function popRightColumn(id: Column['id']) { - let layout = deepClone(deckStore.state.layout); - const i = deckStore.state.layout.findIndex(ids => ids.includes(id)); - const affected = layout[i]; - layout = layout.map(ids => ids.filter(_id => _id !== id)); - layout.splice(i + 1, 0, [id]); - layout = layout.filter(ids => ids.length > 0); - deckStore.set('layout', layout); - - const columns = deepClone(deckStore.state.columns); - for (const column of columns) { - if (affected.includes(column.id)) { - column.active = true; - } - } - deckStore.set('columns', columns); - - saveDeck(); -} - -export function addColumnWidget(id: Column['id'], widget: ColumnWidget) { - const columns = deepClone(deckStore.state.columns); - const columnIndex = deckStore.state.columns.findIndex(c => c.id === id); - const column = deepClone(deckStore.state.columns[columnIndex]); - if (column == null) return; - if (column.widgets == null) column.widgets = []; - column.widgets.unshift(widget); - columns[columnIndex] = column; - deckStore.set('columns', columns); - saveDeck(); -} - -export function removeColumnWidget(id: Column['id'], widget: ColumnWidget) { - const columns = deepClone(deckStore.state.columns); - const columnIndex = deckStore.state.columns.findIndex(c => c.id === id); - const column = deepClone(deckStore.state.columns[columnIndex]); - if (column == null) return; - column.widgets = column.widgets.filter(w => w.id !== widget.id); - columns[columnIndex] = column; - deckStore.set('columns', columns); - saveDeck(); -} - -export function setColumnWidgets(id: Column['id'], widgets: ColumnWidget[]) { - const columns = deepClone(deckStore.state.columns); - const columnIndex = deckStore.state.columns.findIndex(c => c.id === id); - const column = deepClone(deckStore.state.columns[columnIndex]); - if (column == null) return; - column.widgets = widgets; - columns[columnIndex] = column; - deckStore.set('columns', columns); - saveDeck(); -} - -export function updateColumnWidget(id: Column['id'], widgetId: string, widgetData: any) { - const columns = deepClone(deckStore.state.columns); - const columnIndex = deckStore.state.columns.findIndex(c => c.id === id); - const column = deepClone(deckStore.state.columns[columnIndex]); - if (column == null) return; - column.widgets = column.widgets.map(w => w.id === widgetId ? { - ...w, - data: widgetData, - } : w); - columns[columnIndex] = column; - deckStore.set('columns', columns); - saveDeck(); -} - -export function updateColumn(id: Column['id'], column: Partial) { - const columns = deepClone(deckStore.state.columns); - const columnIndex = deckStore.state.columns.findIndex(c => c.id === id); - const currentColumn = deepClone(deckStore.state.columns[columnIndex]); - if (currentColumn == null) return; - for (const [k, v] of Object.entries(column)) { - currentColumn[k] = v; - } - columns[columnIndex] = currentColumn; - deckStore.set('columns', columns); - saveDeck(); -} diff --git a/packages/client/src/ui/deck/direct-column.vue b/packages/client/src/ui/deck/direct-column.vue deleted file mode 100644 index 75b018cacd..0000000000 --- a/packages/client/src/ui/deck/direct-column.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - diff --git a/packages/client/src/ui/deck/list-column.vue b/packages/client/src/ui/deck/list-column.vue deleted file mode 100644 index d9f3f7b4e7..0000000000 --- a/packages/client/src/ui/deck/list-column.vue +++ /dev/null @@ -1,58 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/deck/main-column.vue b/packages/client/src/ui/deck/main-column.vue deleted file mode 100644 index 0c66172397..0000000000 --- a/packages/client/src/ui/deck/main-column.vue +++ /dev/null @@ -1,68 +0,0 @@ - - - diff --git a/packages/client/src/ui/deck/mentions-column.vue b/packages/client/src/ui/deck/mentions-column.vue deleted file mode 100644 index 16962956a0..0000000000 --- a/packages/client/src/ui/deck/mentions-column.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/packages/client/src/ui/deck/notifications-column.vue b/packages/client/src/ui/deck/notifications-column.vue deleted file mode 100644 index 9d133035fe..0000000000 --- a/packages/client/src/ui/deck/notifications-column.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - diff --git a/packages/client/src/ui/deck/tl-column.vue b/packages/client/src/ui/deck/tl-column.vue deleted file mode 100644 index 49b29145ff..0000000000 --- a/packages/client/src/ui/deck/tl-column.vue +++ /dev/null @@ -1,119 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/deck/widgets-column.vue b/packages/client/src/ui/deck/widgets-column.vue deleted file mode 100644 index fc61d18ff6..0000000000 --- a/packages/client/src/ui/deck/widgets-column.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/universal.vue b/packages/client/src/ui/universal.vue deleted file mode 100644 index b91bf476e8..0000000000 --- a/packages/client/src/ui/universal.vue +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - diff --git a/packages/client/src/ui/universal.widgets.vue b/packages/client/src/ui/universal.widgets.vue deleted file mode 100644 index 33fb492836..0000000000 --- a/packages/client/src/ui/universal.widgets.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/visitor.vue b/packages/client/src/ui/visitor.vue deleted file mode 100644 index ec9150d346..0000000000 --- a/packages/client/src/ui/visitor.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - diff --git a/packages/client/src/ui/visitor/a.vue b/packages/client/src/ui/visitor/a.vue deleted file mode 100644 index f8db7a9d09..0000000000 --- a/packages/client/src/ui/visitor/a.vue +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - diff --git a/packages/client/src/ui/visitor/b.vue b/packages/client/src/ui/visitor/b.vue deleted file mode 100644 index 275008a8f8..0000000000 --- a/packages/client/src/ui/visitor/b.vue +++ /dev/null @@ -1,248 +0,0 @@ - - - - - - - diff --git a/packages/client/src/ui/visitor/header.vue b/packages/client/src/ui/visitor/header.vue deleted file mode 100644 index 7300b12a75..0000000000 --- a/packages/client/src/ui/visitor/header.vue +++ /dev/null @@ -1,228 +0,0 @@ - - - - - diff --git a/packages/client/src/ui/visitor/kanban.vue b/packages/client/src/ui/visitor/kanban.vue deleted file mode 100644 index 51e47f277d..0000000000 --- a/packages/client/src/ui/visitor/kanban.vue +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - diff --git a/packages/client/src/ui/zen.vue b/packages/client/src/ui/zen.vue deleted file mode 100644 index 84c96a1dae..0000000000 --- a/packages/client/src/ui/zen.vue +++ /dev/null @@ -1,34 +0,0 @@ - - - - - -- cgit v1.2.3-freya