mirror of
https://github.com/vector-im/element-web.git
synced 2025-08-07 14:57:08 +02:00
Move number.ts
to utils in shared components (#30498)
* refactor: move `number.ts` in shared components * chore: include ts test file in sonar config
This commit is contained in:
parent
9be2b973d0
commit
24f923feac
@ -6,7 +6,7 @@ sonar.organization=element-hq
|
|||||||
|
|
||||||
sonar.sources=src,res
|
sonar.sources=src,res
|
||||||
sonar.tests=test,playwright,src
|
sonar.tests=test,playwright,src
|
||||||
sonar.test.inclusions=test/*,playwright/*,src/**/*.test.tsx
|
sonar.test.inclusions=test/*,playwright/*,src/**/*.test.*
|
||||||
sonar.exclusions=__mocks__,docs,element.io,nginx
|
sonar.exclusions=__mocks__,docs,element.io,nginx
|
||||||
|
|
||||||
sonar.cpd.exclusions=src/i18n/strings/*.json
|
sonar.cpd.exclusions=src/i18n/strings/*.json
|
||||||
|
@ -15,7 +15,7 @@ import { arrayFastResample } from "../utils/arrays";
|
|||||||
import { type IDestroyable } from "../utils/IDestroyable";
|
import { type IDestroyable } from "../utils/IDestroyable";
|
||||||
import { PlaybackClock } from "./PlaybackClock";
|
import { PlaybackClock } from "./PlaybackClock";
|
||||||
import { createAudioContext, decodeOgg } from "./compat";
|
import { createAudioContext, decodeOgg } from "./compat";
|
||||||
import { clamp } from "../utils/numbers";
|
import { clamp } from "../shared-components/utils/numbers";
|
||||||
import { DEFAULT_WAVEFORM, PLAYBACK_WAVEFORM_SAMPLES } from "./consts";
|
import { DEFAULT_WAVEFORM, PLAYBACK_WAVEFORM_SAMPLES } from "./consts";
|
||||||
import { PlaybackEncoder } from "../PlaybackEncoder";
|
import { PlaybackEncoder } from "../PlaybackEncoder";
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ Please see LICENSE files in the repository root for full details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { type IAmplitudePayload, type ITimingPayload, PayloadEvent, WORKLET_NAME } from "./consts";
|
import { type IAmplitudePayload, type ITimingPayload, PayloadEvent, WORKLET_NAME } from "./consts";
|
||||||
import { percentageOf } from "../utils/numbers";
|
import { percentageOf } from "../shared-components/utils/numbers";
|
||||||
|
|
||||||
// from AudioWorkletGlobalScope: https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletGlobalScope
|
// from AudioWorkletGlobalScope: https://developer.mozilla.org/en-US/docs/Web/API/AudioWorkletGlobalScope
|
||||||
declare const currentTime: number;
|
declare const currentTime: number;
|
||||||
|
@ -19,7 +19,7 @@ import { PayloadEvent, WORKLET_NAME } from "./consts";
|
|||||||
import { UPDATE_EVENT } from "../stores/AsyncStore";
|
import { UPDATE_EVENT } from "../stores/AsyncStore";
|
||||||
import { createAudioContext } from "./compat";
|
import { createAudioContext } from "./compat";
|
||||||
import { FixedRollingArray } from "../utils/FixedRollingArray";
|
import { FixedRollingArray } from "../utils/FixedRollingArray";
|
||||||
import { clamp } from "../utils/numbers";
|
import { clamp } from "../shared-components/utils/numbers";
|
||||||
import recorderWorkletFactory from "./recorderWorkletFactory";
|
import recorderWorkletFactory from "./recorderWorkletFactory";
|
||||||
|
|
||||||
const CHANNELS = 1; // stereo isn't important
|
const CHANNELS = 1; // stereo isn't important
|
||||||
|
@ -11,7 +11,7 @@ import React from "react";
|
|||||||
import { arraySeed, arrayTrimFill } from "../../../utils/arrays";
|
import { arraySeed, arrayTrimFill } from "../../../utils/arrays";
|
||||||
import Waveform from "./Waveform";
|
import Waveform from "./Waveform";
|
||||||
import { type Playback } from "../../../audio/Playback";
|
import { type Playback } from "../../../audio/Playback";
|
||||||
import { percentageOf } from "../../../utils/numbers";
|
import { percentageOf } from "../../../shared-components/utils/numbers";
|
||||||
import { PLAYBACK_WAVEFORM_SAMPLES } from "../../../audio/consts";
|
import { PLAYBACK_WAVEFORM_SAMPLES } from "../../../audio/consts";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
@ -10,7 +10,7 @@ import React, { type ChangeEvent, type CSSProperties, type ReactNode } from "rea
|
|||||||
|
|
||||||
import { type PlaybackInterface } from "../../../audio/Playback";
|
import { type PlaybackInterface } from "../../../audio/Playback";
|
||||||
import { MarkedExecution } from "../../../utils/MarkedExecution";
|
import { MarkedExecution } from "../../../utils/MarkedExecution";
|
||||||
import { percentageOf } from "../../../utils/numbers";
|
import { percentageOf } from "../../../shared-components/utils/numbers";
|
||||||
import { _t } from "../../../languageHandler";
|
import { _t } from "../../../languageHandler";
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
|
@ -26,7 +26,7 @@ import {
|
|||||||
Type,
|
Type,
|
||||||
} from "../../../accessibility/RovingTabIndex";
|
} from "../../../accessibility/RovingTabIndex";
|
||||||
import { Key } from "../../../Keyboard";
|
import { Key } from "../../../Keyboard";
|
||||||
import { clamp } from "../../../utils/numbers";
|
import { clamp } from "../../../shared-components/utils/numbers";
|
||||||
import { type ButtonEvent } from "../elements/AccessibleButton";
|
import { type ButtonEvent } from "../elements/AccessibleButton";
|
||||||
|
|
||||||
export const CATEGORY_HEADER_HEIGHT = 20;
|
export const CATEGORY_HEADER_HEIGHT = 20;
|
||||||
|
@ -22,7 +22,7 @@ import ResizeHandle from "../elements/ResizeHandle";
|
|||||||
import Resizer, { type IConfig } from "../../../resizer/resizer";
|
import Resizer, { type IConfig } from "../../../resizer/resizer";
|
||||||
import PercentageDistributor from "../../../resizer/distributors/percentage";
|
import PercentageDistributor from "../../../resizer/distributors/percentage";
|
||||||
import { Container, WidgetLayoutStore } from "../../../stores/widgets/WidgetLayoutStore";
|
import { Container, WidgetLayoutStore } from "../../../stores/widgets/WidgetLayoutStore";
|
||||||
import { clamp, percentageOf, percentageWithin } from "../../../utils/numbers";
|
import { clamp, percentageOf, percentageWithin } from "../../../shared-components/utils/numbers";
|
||||||
import UIStore from "../../../stores/UIStore";
|
import UIStore from "../../../stores/UIStore";
|
||||||
import { type ActionPayload } from "../../../dispatcher/payloads";
|
import { type ActionPayload } from "../../../dispatcher/payloads";
|
||||||
import Spinner from "../elements/Spinner";
|
import Spinner from "../elements/Spinner";
|
||||||
|
@ -6,7 +6,7 @@ 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.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { clamp, defaultNumber, percentageOf, percentageWithin, sum } from "../../../src/utils/numbers";
|
import { clamp, defaultNumber, percentageOf, percentageWithin, sum } from "./numbers";
|
||||||
|
|
||||||
describe("numbers", () => {
|
describe("numbers", () => {
|
||||||
describe("defaultNumber", () => {
|
describe("defaultNumber", () => {
|
@ -14,7 +14,7 @@ import { type IWidget } from "matrix-widget-api";
|
|||||||
import SettingsStore from "../../settings/SettingsStore";
|
import SettingsStore from "../../settings/SettingsStore";
|
||||||
import WidgetStore, { type IApp } from "../WidgetStore";
|
import WidgetStore, { type IApp } from "../WidgetStore";
|
||||||
import { WidgetType } from "../../widgets/WidgetType";
|
import { WidgetType } from "../../widgets/WidgetType";
|
||||||
import { clamp, defaultNumber, sum } from "../../utils/numbers";
|
import { clamp, defaultNumber, sum } from "../../shared-components/utils/numbers";
|
||||||
import defaultDispatcher from "../../dispatcher/dispatcher";
|
import defaultDispatcher from "../../dispatcher/dispatcher";
|
||||||
import { ReadyWatchingStore } from "../ReadyWatchingStore";
|
import { ReadyWatchingStore } from "../ReadyWatchingStore";
|
||||||
import { SettingLevel } from "../../settings/SettingLevel";
|
import { SettingLevel } from "../../settings/SettingLevel";
|
||||||
|
@ -6,7 +6,7 @@ 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.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { percentageOf, percentageWithin } from "./numbers";
|
import { percentageOf, percentageWithin } from "../shared-components/utils/numbers";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quickly resample an array to have less/more data points. If an input which is larger
|
* Quickly resample an array to have less/more data points. If an input which is larger
|
||||||
|
Loading…
Reference in New Issue
Block a user