Update dependency knip to v6 (#33008)
* Update dependency knip to v6 * Make knip happy --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
co-authored by
renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Michael Telatynski
parent
2d3e2fcb70
commit
063e0802f4
@@ -27,13 +27,12 @@ const EffectsOverlay: FunctionComponent<IProps> = ({ roomWidth }) => {
|
||||
if (!name) return null;
|
||||
let effect: ICanvasEffect | null = effectsRef.current.get(name) || null;
|
||||
if (effect === null) {
|
||||
const options = CHAT_EFFECTS.find((e) => e.command === name)?.options;
|
||||
const definition = CHAT_EFFECTS.find((e) => e.command === name)!;
|
||||
try {
|
||||
const { default: Effect } = await import(`../../../effects/${name}`);
|
||||
effect = new Effect(options);
|
||||
effectsRef.current.set(name, effect!);
|
||||
effect = await definition.getRenderer();
|
||||
effectsRef.current.set(name, effect);
|
||||
} catch (err) {
|
||||
logger.warn(`Unable to load effect module at '../../../effects/${name}.`, err);
|
||||
logger.warn(`Unable to run effect module.`, err);
|
||||
}
|
||||
}
|
||||
return effect;
|
||||
|
||||
@@ -6,10 +6,11 @@ Copyright 2020 Nordeck IT + Consulting GmbH.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
*/
|
||||
|
||||
import type ICanvasEffect from "../ICanvasEffect";
|
||||
|
||||
export type ConfettiOptions = {
|
||||
type ConfettiOptions = {
|
||||
/**
|
||||
* max confetti count
|
||||
*/
|
||||
@@ -54,7 +55,7 @@ export const DefaultOptions: ConfettiOptions = {
|
||||
export default class Confetti implements ICanvasEffect {
|
||||
private readonly options: ConfettiOptions;
|
||||
|
||||
public constructor(options: { [key: string]: any }) {
|
||||
public constructor(options: Partial<ConfettiOptions>) {
|
||||
this.options = { ...DefaultOptions, ...options };
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Com
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
export type Effect<TOptions extends { [key: string]: any }> = {
|
||||
import type ICanvasEffect from "./ICanvasEffect.ts";
|
||||
|
||||
export type Effect = {
|
||||
/**
|
||||
* one or more emojis that will trigger this effect
|
||||
*/
|
||||
@@ -29,7 +31,7 @@ export type Effect<TOptions extends { [key: string]: any }> = {
|
||||
*/
|
||||
fallbackMessage: () => string;
|
||||
/**
|
||||
* animation options
|
||||
* animation options TODO
|
||||
*/
|
||||
options: TOptions;
|
||||
getRenderer(): Promise<ICanvasEffect>;
|
||||
};
|
||||
|
||||
@@ -6,11 +6,11 @@ Copyright 2020 Nordeck IT + Consulting GmbH.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
*/
|
||||
|
||||
import type ICanvasEffect from "../ICanvasEffect";
|
||||
|
||||
export type FireworksOptions = {
|
||||
type FireworksOptions = {
|
||||
/**
|
||||
* max fireworks count
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ export const DefaultOptions: FireworksOptions = {
|
||||
export default class Fireworks implements ICanvasEffect {
|
||||
private readonly options: FireworksOptions;
|
||||
|
||||
public constructor(options: { [key: string]: any }) {
|
||||
public constructor(options: Partial<FireworksOptions>) {
|
||||
this.options = { ...DefaultOptions, ...options };
|
||||
}
|
||||
|
||||
|
||||
@@ -5,11 +5,12 @@ Copyright 2022 Arseny Uskov
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
*/
|
||||
|
||||
import type ICanvasEffect from "../ICanvasEffect";
|
||||
import { arrayFastClone } from "../../utils/arrays";
|
||||
|
||||
export type HeartOptions = {
|
||||
type HeartOptions = {
|
||||
/**
|
||||
* The maximum number of hearts to render at a given time
|
||||
*/
|
||||
@@ -51,7 +52,7 @@ const KEY_FRAME_INTERVAL = 15; // 15ms, roughly
|
||||
export default class Hearts implements ICanvasEffect {
|
||||
private readonly options: HeartOptions;
|
||||
|
||||
public constructor(options: { [key: string]: any }) {
|
||||
public constructor(options: Partial<HeartOptions>) {
|
||||
this.options = { ...DefaultOptions, ...options };
|
||||
}
|
||||
|
||||
|
||||
@@ -5,88 +5,101 @@ Copyright 2020 Nordeck IT + Consulting GmbH.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
*/
|
||||
|
||||
import { _t, _td } from "../languageHandler";
|
||||
import { type ConfettiOptions } from "./confetti";
|
||||
import { type Effect } from "./effect";
|
||||
import { type FireworksOptions } from "./fireworks";
|
||||
import { type RainfallOptions } from "./rainfall";
|
||||
import { type SnowfallOptions } from "./snowfall";
|
||||
import { type SpaceInvadersOptions } from "./spaceinvaders";
|
||||
import { type HeartOptions } from "./hearts";
|
||||
import { type Effect } from "./effect.ts";
|
||||
|
||||
/**
|
||||
* This configuration defines room effects that can be triggered by custom message types and emojis
|
||||
*/
|
||||
export const CHAT_EFFECTS: Array<Effect<{ [key: string]: any }>> = [
|
||||
export const CHAT_EFFECTS: Array<Effect> = [
|
||||
{
|
||||
emojis: ["🎊", "🎉"],
|
||||
msgType: "nic.custom.confetti",
|
||||
command: "confetti",
|
||||
description: () => _td("chat_effects|confetti_description"),
|
||||
fallbackMessage: () => _t("chat_effects|confetti_message") + " 🎉",
|
||||
options: {
|
||||
maxCount: 150,
|
||||
speed: 3,
|
||||
frameInterval: 15,
|
||||
alpha: 1.0,
|
||||
gradient: false,
|
||||
getRenderer: async () => {
|
||||
const { default: Effect } = await import("./confetti/index.ts");
|
||||
return new Effect({
|
||||
maxCount: 150,
|
||||
speed: 3,
|
||||
frameInterval: 15,
|
||||
alpha: 1.0,
|
||||
gradient: false,
|
||||
});
|
||||
},
|
||||
} as Effect<ConfettiOptions>,
|
||||
},
|
||||
{
|
||||
emojis: ["🎆"],
|
||||
msgType: "nic.custom.fireworks",
|
||||
command: "fireworks",
|
||||
description: () => _td("chat_effects|fireworks_description"),
|
||||
fallbackMessage: () => _t("chat_effects|fireworks_message") + " 🎆",
|
||||
options: {
|
||||
maxCount: 500,
|
||||
gravity: 0.05,
|
||||
getRenderer: async () => {
|
||||
const { default: Effect } = await import("./fireworks/index.ts");
|
||||
return new Effect({
|
||||
maxCount: 500,
|
||||
gravity: 0.05,
|
||||
});
|
||||
},
|
||||
} as Effect<FireworksOptions>,
|
||||
},
|
||||
{
|
||||
emojis: ["🌧️", "⛈️", "🌦️"],
|
||||
msgType: "io.element.effect.rainfall",
|
||||
command: "rainfall",
|
||||
description: () => _td("chat_effects|rainfall_description"),
|
||||
fallbackMessage: () => _t("chat_effects|rainfall_message") + " 🌧️",
|
||||
options: {
|
||||
maxCount: 600,
|
||||
speed: 10,
|
||||
getRenderer: async () => {
|
||||
const { default: Effect } = await import("./rainfall/index.ts");
|
||||
return new Effect({
|
||||
maxCount: 600,
|
||||
speed: 10,
|
||||
});
|
||||
},
|
||||
} as Effect<RainfallOptions>,
|
||||
},
|
||||
{
|
||||
emojis: ["❄", "🌨"],
|
||||
msgType: "io.element.effect.snowfall",
|
||||
command: "snowfall",
|
||||
description: () => _td("chat_effects|snowfall_description"),
|
||||
fallbackMessage: () => _t("chat_effects|snowfall_message") + " ❄",
|
||||
options: {
|
||||
maxCount: 200,
|
||||
gravity: 0.05,
|
||||
maxDrift: 5,
|
||||
getRenderer: async () => {
|
||||
const { default: Effect } = await import("./snowfall/index.ts");
|
||||
return new Effect({
|
||||
maxCount: 200,
|
||||
gravity: 0.05,
|
||||
maxDrift: 5,
|
||||
});
|
||||
},
|
||||
} as Effect<SnowfallOptions>,
|
||||
},
|
||||
{
|
||||
emojis: ["👾", "🌌"],
|
||||
msgType: "io.element.effects.space_invaders",
|
||||
command: "spaceinvaders",
|
||||
description: () => _td("chat_effects|spaceinvaders_description"),
|
||||
fallbackMessage: () => _t("chat_effects|spaceinvaders_message") + " 👾",
|
||||
options: {
|
||||
maxCount: 50,
|
||||
gravity: 0.01,
|
||||
getRenderer: async () => {
|
||||
const { default: Effect } = await import("./spaceinvaders/index.ts");
|
||||
return new Effect({
|
||||
maxCount: 50,
|
||||
gravity: 0.01,
|
||||
});
|
||||
},
|
||||
} as Effect<SpaceInvadersOptions>,
|
||||
},
|
||||
{
|
||||
emojis: ["💝"],
|
||||
msgType: "io.element.effect.hearts",
|
||||
command: "hearts",
|
||||
description: () => _td("chat_effects|hearts_description"),
|
||||
fallbackMessage: () => _t("chat_effects|hearts_message") + " 💝",
|
||||
options: {
|
||||
maxCount: 120,
|
||||
gravity: 3.2,
|
||||
getRenderer: async () => {
|
||||
const { default: Effect } = await import("./hearts/index.ts");
|
||||
return new Effect({
|
||||
maxCount: 120,
|
||||
gravity: 3.2,
|
||||
});
|
||||
},
|
||||
} as Effect<HeartOptions>,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -5,11 +5,12 @@ Copyright 2021 Josias Allestad
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
*/
|
||||
|
||||
import type ICanvasEffect from "../ICanvasEffect";
|
||||
import { arrayFastClone } from "../../utils/arrays";
|
||||
|
||||
export type RainfallOptions = {
|
||||
type RainfallOptions = {
|
||||
/**
|
||||
* The maximum number of raindrops to render at a given time
|
||||
*/
|
||||
@@ -38,7 +39,7 @@ const KEY_FRAME_INTERVAL = 15;
|
||||
export default class Rainfall implements ICanvasEffect {
|
||||
private readonly options: RainfallOptions;
|
||||
|
||||
public constructor(options: { [key: string]: any }) {
|
||||
public constructor(options: Partial<RainfallOptions>) {
|
||||
this.options = { ...DefaultOptions, ...options };
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ Copyright 2020-2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
*/
|
||||
|
||||
import type ICanvasEffect from "../ICanvasEffect";
|
||||
import { arrayFastClone } from "../../utils/arrays";
|
||||
|
||||
export type SnowfallOptions = {
|
||||
type SnowfallOptions = {
|
||||
/**
|
||||
* The maximum number of snowflakes to render at a given time
|
||||
*/
|
||||
@@ -43,7 +44,7 @@ const KEY_FRAME_INTERVAL = 15; // 15ms, roughly
|
||||
export default class Snowfall implements ICanvasEffect {
|
||||
private readonly options: SnowfallOptions;
|
||||
|
||||
public constructor(options: { [key: string]: any }) {
|
||||
public constructor(options: Partial<SnowfallOptions>) {
|
||||
this.options = { ...DefaultOptions, ...options };
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ Copyright 2021-2023 The Matrix.org Foundation C.I.C.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
*/
|
||||
|
||||
import type ICanvasEffect from "../ICanvasEffect";
|
||||
import { arrayFastClone } from "../../utils/arrays";
|
||||
|
||||
export type SpaceInvadersOptions = {
|
||||
type SpaceInvadersOptions = {
|
||||
/**
|
||||
* The maximum number of invaders to render at a given time
|
||||
*/
|
||||
@@ -37,7 +38,7 @@ const GLYPH = "👾";
|
||||
export default class SpaceInvaders implements ICanvasEffect {
|
||||
private readonly options: SpaceInvadersOptions;
|
||||
|
||||
public constructor(options: { [key: string]: any }) {
|
||||
public constructor(options: Partial<SpaceInvadersOptions>) {
|
||||
this.options = { ...DefaultOptions, ...options };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user