feat(frontend): ノート・ユーザータイムライン埋め込み (#13929)
* fix
* navhookをbootに移動
* サーバーサイドのbootも分けるように
* 埋め込みページかどうかの判定は最初の一回だけに
* tooltipは出せるように
* fix design
* 埋め込み独自のtooltipを削除
* ロジックの分岐が多かったMkNoteDetailedを分離
* fix indent
* プレビュー用iframeにフォーカスが当たるのを修正
* popupの制御を出す側で行うように
* パラメータが逆になっていたのを修正
* Update MkEmbedCodeGenDialog.vue
* fix
* eliminate misskey-js lint warns
* fix
* add appropriate attributes to embed html
* enhance: サーバーサイドのembed系をさらに分離
* enhance: embed routerを分離(route定義をboot時に変更できるようにする改修を含む)
* type
* lint
* fix indent
* server-side styleを完全に分離
* Revert "refactor: 画面サイズのしきい値をconstにまとめる"
This reverts commit 05ca36f400889456981e89489ae0ae242fa09b67.
* fix
* revert all changes in base.pug
* embedドメインをまとめた
* embedドメインをまとめた
* prevent calling contextmenu in embed page by stopping at the caller
* fix import
* fix import
* improve directory structure
* fix import
* register timeline ui as a container
* wa-
* rename
* wa-
* Update EmMediaList.vue
* Update EmMediaList.vue
* Update EmMediaList.vue
* Update EmMediaImage.vue
* Update EmNote.vue
* revert mkmedialist changes
* 戻し漏れ
* wip
* tweak embed media ui
* revert original media components
* Update boot.embed.js
* rename
* wip
* Update MkNote.vue
* wip
* Update MkSubNoteContent.vue
* Update EmNote.vue
* Update packages/frontend/src/router/definition.ts
* Revert "Update packages/frontend/src/router/definition.ts"
This reverts commit 937ae44521cdb0f250796943b20142b65f8ed944.
* refactor EmMediaImage
* fix import
* remove unused imports
* Update router.ts
* wip
* Update boot.ts
* wip
* wip
* wip
* wip
* Update EmNote.vue
* Update EmNote.vue
* Create EmA.vue
* Create EmAvatar.vue
* Update EmAvatar.vue
* wip
* wip
* wip
* Create EmImgWithBlurhash.vue
* Update EmImgWithBlurhash.vue
* Create EmPagination.vue
* wip
* Update boot.ts
* wip
* wip
* wi@p
* wip
* wip
* wiop
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Update boot.ts
* wip
* Update MkMisskeyFlavoredMarkdown.ts
* wip
* wip
* wip
* wip
* wip
* Update post-message.ts
* wip
* Update EmNoteDetailed.vue
* Update EmNoteDetailed.vue
* Create instance.ts
* Update EmNoteDetailed.vue
* wip
* Update EmNoteDetailed.vue
* wip
* wip
* wip
* Update pnpm-lock.yaml
* wip
* wip
* wp
* wip
* Update ClientServerService.ts
* wip
* Update boot.ts
* Update vite.config.local-dev.ts
* Update vite.config.ts
* Create index.html
* wa-
* wip
* Update boot.ts
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* Create EmLink.vue
* Create EmMention.vue
* Update EmMfm.ts
* wip
* wip
* wip
* wip
* Update vite.config.ts
* Update boot.ts
* Update EmA.vue
* うぃp
* wip
* wip
* Create EmError.vue
* wip
* Update MkEmbedCodeGenDialog.vue
* Update EmNote.vue
* wip
* wip
* Update user-timeline.vue
* Update check-spdx-license-id.yml
* wip
* wip
* style(frontend-shared): lint fixes on build.js
* fix(frontend-shared): include `*.{js,json}` files in js-built
* wip
* use alias
* refactor
* refactor
* Update scroll.ts
* refactor
* refactor
* refactor
* wip
* wip
* wip
* wip
* Update roles.vue
* Update branding.vue
* wip
* wip
* wip
* Update page.vue
* wip
* fix import
* add missing css variables
* 絵文字をtwemojiに変更
クライアントデフォルトにあわせるため
* force empoll readonly
* fix compiler error
* fix broken imports
* tweak button style
* run api extractor
* fix storybook theme preloads
* fix storybook instance imports
* Update preview.ts
* Update preview.ts
* Update preview.ts
* Revert "Update preview.ts"
This reverts commit 12bab1c6fbd3baf753515df760ff19d027b85155.
* Revert "Update preview.ts"
This reverts commit 5c0ce01dbdf2194ffe94aba950f747a9968f29c4.
* Revert "Update preview.ts"
This reverts commit f4863524d7e5ca0f25470808849c24a72bea000a.
* Revert "fix storybook instance imports"
This reverts commit ed8eabb246edf731d31adffbe3c77c539e53ae9e.
* Revert "wip"
This reverts commit d3c1926519878155193a1654f49141e515d49683.
* Revert "Update page.vue"
This reverts commit 27c7900b0c1ae296b56075e8a9c22585d9cd744b.
* Revert "Update branding.vue"
This reverts commit c08ccb65ba66774c3e2b3dcfc6153004b5c0aa16.
* Revert "Update roles.vue"
This reverts commit 1488b670660cb1803d17d8f5c78f2d79e59fa52d.
* Revert "wip"
This reverts commit aab1c769814b08c257cad3025422a0eea3bfba4f.
* refactor: use common media proxy
* fix imports
* fix
* fix: MediaProxyの初期化を保証する(storybook対策?)
* enhance(frontend-embed): improve embedParams provide
* fix(backend): MK_DEV_PREFER=backendのときにembed viteが読み込めないのを修正
* fix
* embed-pageを共通化
* fix import
* fix import
* fix import
* const.jsを共通化
(たぶんrevertしすぎた)
* fix type error
* fix duplicated import
* fix lint
* fix
* コメントとして残す
* sharedとembedをlint対象にする
* lint
* attempt to fix eslint (frontend-shared)
* lint fixes
---------
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Co-authored-by: zyoshoka <107108195+zyoshoka@users.noreply.github.com>
This commit is contained in:
parent
0d0cd738f8
commit
2cbe1d1210
236 changed files with 9470 additions and 454 deletions
|
|
@ -551,7 +551,7 @@ type Channel = components['schemas']['Channel'];
|
|||
// Warning: (ae-forgotten-export) The symbol "AnyOf" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public (undocumented)
|
||||
export abstract class ChannelConnection<Channel extends AnyOf<Channels> = AnyOf<Channels>> extends EventEmitter<Channel['events']> {
|
||||
export abstract class ChannelConnection<Channel extends AnyOf<Channels> = AnyOf<Channels>> extends EventEmitter<Channel['events']> implements IChannelConnection<Channel> {
|
||||
constructor(stream: Stream, channel: string, name?: string);
|
||||
// (undocumented)
|
||||
channel: string;
|
||||
|
|
@ -2119,6 +2119,24 @@ type IAuthorizedAppsResponse = operations['i___authorized-apps']['responses']['2
|
|||
// @public (undocumented)
|
||||
type IChangePasswordRequest = operations['i___change-password']['requestBody']['content']['application/json'];
|
||||
|
||||
// @public (undocumented)
|
||||
export interface IChannelConnection<Channel extends AnyOf<Channels> = AnyOf<Channels>> extends EventEmitter<Channel['events']> {
|
||||
// (undocumented)
|
||||
channel: string;
|
||||
// (undocumented)
|
||||
dispose(): void;
|
||||
// (undocumented)
|
||||
id: string;
|
||||
// (undocumented)
|
||||
inCount: number;
|
||||
// (undocumented)
|
||||
name?: string;
|
||||
// (undocumented)
|
||||
outCount: number;
|
||||
// (undocumented)
|
||||
send<T extends keyof Channel['receives']>(type: T, body: Channel['receives'][T]): void;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
type IClaimAchievementRequest = operations['i___claim-achievement']['requestBody']['content']['application/json'];
|
||||
|
||||
|
|
@ -2281,6 +2299,40 @@ type ISigninHistoryResponse = operations['i___signin-history']['responses']['200
|
|||
// @public (undocumented)
|
||||
function isPureRenote(note: Note): note is PureRenote;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface IStream extends EventEmitter<StreamEvents> {
|
||||
// (undocumented)
|
||||
close(): void;
|
||||
// Warning: (ae-forgotten-export) The symbol "NonSharedConnection" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
disconnectToChannel(connection: NonSharedConnection): void;
|
||||
// (undocumented)
|
||||
heartbeat(): void;
|
||||
// (undocumented)
|
||||
ping(): void;
|
||||
// Warning: (ae-forgotten-export) The symbol "SharedConnection" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
removeSharedConnection(connection: SharedConnection): void;
|
||||
// Warning: (ae-forgotten-export) The symbol "Pool" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
removeSharedConnectionPool(pool: Pool): void;
|
||||
// (undocumented)
|
||||
send(typeOrPayload: string): void;
|
||||
// (undocumented)
|
||||
send(typeOrPayload: string, payload: unknown): void;
|
||||
// (undocumented)
|
||||
send(typeOrPayload: Record<string, unknown> | unknown[]): void;
|
||||
// (undocumented)
|
||||
send(typeOrPayload: string | Record<string, unknown> | unknown[], payload?: unknown): void;
|
||||
// (undocumented)
|
||||
state: 'initializing' | 'reconnecting' | 'connected';
|
||||
// (undocumented)
|
||||
useChannel<C extends keyof Channels>(channel: C, params?: Channels[C]['params'], name?: string): IChannelConnection<Channels[C]>;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
type IUnpinRequest = operations['i___unpin']['requestBody']['content']['application/json'];
|
||||
|
||||
|
|
@ -2707,6 +2759,9 @@ type NotificationsCreateRequest = operations['notifications___create']['requestB
|
|||
// @public (undocumented)
|
||||
export const notificationTypes: readonly ["note", "follow", "mention", "reply", "renote", "quote", "reaction", "pollVote", "pollEnded", "receiveFollowRequest", "followRequestAccepted", "groupInvited", "app", "roleAssigned", "achievementEarned"];
|
||||
|
||||
// @public (undocumented)
|
||||
export function nyaize(text: string): string;
|
||||
|
||||
// @public (undocumented)
|
||||
type Page = components['schemas']['Page'];
|
||||
|
||||
|
|
@ -2997,10 +3052,8 @@ type SignupResponse = MeDetailed & {
|
|||
// @public (undocumented)
|
||||
type StatsResponse = operations['stats']['responses']['200']['content']['application/json'];
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "StreamEvents" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public (undocumented)
|
||||
export class Stream extends EventEmitter<StreamEvents> {
|
||||
export class Stream extends EventEmitter<StreamEvents> implements IStream {
|
||||
constructor(origin: string, user: {
|
||||
token: string;
|
||||
} | null, options?: {
|
||||
|
|
@ -3008,20 +3061,14 @@ export class Stream extends EventEmitter<StreamEvents> {
|
|||
});
|
||||
// (undocumented)
|
||||
close(): void;
|
||||
// Warning: (ae-forgotten-export) The symbol "NonSharedConnection" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
disconnectToChannel(connection: NonSharedConnection): void;
|
||||
// (undocumented)
|
||||
heartbeat(): void;
|
||||
// (undocumented)
|
||||
ping(): void;
|
||||
// Warning: (ae-forgotten-export) The symbol "SharedConnection" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
removeSharedConnection(connection: SharedConnection): void;
|
||||
// Warning: (ae-forgotten-export) The symbol "Pool" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// (undocumented)
|
||||
removeSharedConnectionPool(pool: Pool): void;
|
||||
// (undocumented)
|
||||
|
|
@ -3036,6 +3083,14 @@ export class Stream extends EventEmitter<StreamEvents> {
|
|||
useChannel<C extends keyof Channels>(channel: C, params?: Channels[C]['params'], name?: string): ChannelConnection<Channels[C]>;
|
||||
}
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "BroadcastEvents" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type StreamEvents = {
|
||||
_connected_: void;
|
||||
_disconnected_: void;
|
||||
} & BroadcastEvents;
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "SwitchCase" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "IsCaseMatched" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "GetCaseResult" needs to be exported by the entry point index.d.ts
|
||||
|
|
|
|||
|
|
@ -1,15 +1,6 @@
|
|||
import { type Endpoints } from './api.types.js';
|
||||
import Stream, { Connection } from './streaming.js';
|
||||
import { type Channels } from './streaming.types.js';
|
||||
import { type Acct } from './acct.js';
|
||||
import * as consts from './consts.js';
|
||||
|
||||
export type {
|
||||
Endpoints,
|
||||
Channels,
|
||||
Acct,
|
||||
};
|
||||
|
||||
export {
|
||||
Stream,
|
||||
Connection as ChannelConnection,
|
||||
|
|
@ -31,4 +22,21 @@ import * as api from './api.js';
|
|||
import * as entities from './entities.js';
|
||||
import * as acct from './acct.js';
|
||||
import * as note from './note.js';
|
||||
export { api, entities, acct, note };
|
||||
import { nyaize } from './nyaize.js';
|
||||
export { api, entities, acct, note, nyaize };
|
||||
|
||||
//#region standalone types
|
||||
import type { Endpoints } from './api.types.js';
|
||||
import type { StreamEvents, IStream, IChannelConnection } from './streaming.js';
|
||||
import type { Channels } from './streaming.types.js';
|
||||
import type { Acct } from './acct.js';
|
||||
|
||||
export type {
|
||||
Endpoints,
|
||||
Channels,
|
||||
Acct,
|
||||
StreamEvents,
|
||||
IStream,
|
||||
IChannelConnection,
|
||||
};
|
||||
//#endregion
|
||||
|
|
|
|||
27
packages/misskey-js/src/nyaize.ts
Normal file
27
packages/misskey-js/src/nyaize.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
const enRegex1 = /(?<=n)a/gi;
|
||||
const enRegex2 = /(?<=morn)ing/gi;
|
||||
const enRegex3 = /(?<=every)one/gi;
|
||||
const koRegex1 = /[나-낳]/g;
|
||||
const koRegex2 = /(다$)|(다(?=\.))|(다(?= ))|(다(?=!))|(다(?=\?))/gm;
|
||||
const koRegex3 = /(야(?=\?))|(야$)|(야(?= ))/gm;
|
||||
|
||||
export function nyaize(text: string): string {
|
||||
return text
|
||||
// ja-JP
|
||||
.replaceAll('な', 'にゃ').replaceAll('ナ', 'ニャ').replaceAll('ナ', 'ニャ')
|
||||
// en-US
|
||||
.replace(enRegex1, x => x === 'A' ? 'YA' : 'ya')
|
||||
.replace(enRegex2, x => x === 'ING' ? 'YAN' : 'yan')
|
||||
.replace(enRegex3, x => x === 'ONE' ? 'NYAN' : 'nyan')
|
||||
// ko-KR
|
||||
.replace(koRegex1, match => !isNaN(match.charCodeAt(0)) ? String.fromCharCode(
|
||||
match.charCodeAt(0) + '냐'.charCodeAt(0) - '나'.charCodeAt(0),
|
||||
) : match)
|
||||
.replace(koRegex2, '다냥')
|
||||
.replace(koRegex3, '냥');
|
||||
}
|
||||
|
|
@ -17,16 +17,32 @@ export function urlQuery(obj: Record<string, string | number | boolean | undefin
|
|||
|
||||
type AnyOf<T extends Record<PropertyKey, unknown>> = T[keyof T];
|
||||
|
||||
type StreamEvents = {
|
||||
export type StreamEvents = {
|
||||
_connected_: void;
|
||||
_disconnected_: void;
|
||||
} & BroadcastEvents;
|
||||
|
||||
export interface IStream extends EventEmitter<StreamEvents> {
|
||||
state: 'initializing' | 'reconnecting' | 'connected';
|
||||
|
||||
useChannel<C extends keyof Channels>(channel: C, params?: Channels[C]['params'], name?: string): IChannelConnection<Channels[C]>;
|
||||
removeSharedConnection(connection: SharedConnection): void;
|
||||
removeSharedConnectionPool(pool: Pool): void;
|
||||
disconnectToChannel(connection: NonSharedConnection): void;
|
||||
send(typeOrPayload: string): void;
|
||||
send(typeOrPayload: string, payload: unknown): void;
|
||||
send(typeOrPayload: Record<string, unknown> | unknown[]): void;
|
||||
send(typeOrPayload: string | Record<string, unknown> | unknown[], payload?: unknown): void;
|
||||
ping(): void;
|
||||
heartbeat(): void;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Misskey stream connection
|
||||
*/
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default class Stream extends EventEmitter<StreamEvents> {
|
||||
export default class Stream extends EventEmitter<StreamEvents> implements IStream {
|
||||
private stream: _ReconnectingWebsocket.default;
|
||||
public state: 'initializing' | 'reconnecting' | 'connected' = 'initializing';
|
||||
private sharedConnectionPools: Pool[] = [];
|
||||
|
|
@ -277,7 +293,18 @@ class Pool {
|
|||
}
|
||||
}
|
||||
|
||||
export abstract class Connection<Channel extends AnyOf<Channels> = AnyOf<Channels>> extends EventEmitter<Channel['events']> {
|
||||
export interface IChannelConnection<Channel extends AnyOf<Channels> = AnyOf<Channels>> extends EventEmitter<Channel['events']> {
|
||||
id: string;
|
||||
name?: string;
|
||||
inCount: number;
|
||||
outCount: number;
|
||||
channel: string;
|
||||
|
||||
send<T extends keyof Channel['receives']>(type: T, body: Channel['receives'][T]): void;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
export abstract class Connection<Channel extends AnyOf<Channels> = AnyOf<Channels>> extends EventEmitter<Channel['events']> implements IChannelConnection<Channel> {
|
||||
public channel: string;
|
||||
protected stream: Stream;
|
||||
public abstract id: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue