Skip to content

Commit

Permalink
♻️ [App] Replace all utilities imports with beeftools
Browse files Browse the repository at this point in the history
  • Loading branch information
beefchimi committed Apr 28, 2024
1 parent d3bfb62 commit 924d4c2
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 72 deletions.
2 changes: 1 addition & 1 deletion app/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false"
},
"dependencies": {
"@earwurm/utilities": "workspace:*",
"beeftools": "^0.0.5",
"earwurm": "workspace:*",
"vue": "^3.4.25"
},
Expand Down
4 changes: 2 additions & 2 deletions app/website/src/components/DragHandle.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import {classNames} from '@/helpers';
import {clx} from 'beeftools';
export interface DragHandleProps {
invert?: boolean;
Expand All @@ -9,7 +9,7 @@ defineProps<DragHandleProps>();
</script>

<template>
<div :class="classNames('DragHandle', {invert})">
<div :class="clx('DragHandle', {invert})">
<div class="Column">
<div class="Dot" />
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/website/src/components/IconAction.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import {classNames} from '@/helpers';
import {clx} from 'beeftools';
import {
MotionFadeScale,
SquareAction,
Expand Down Expand Up @@ -29,7 +29,7 @@ defineEmits<IconActionEmits>();
<template>
<SquareAction
:classes="
classNames('IconAction', {
clx('IconAction', {
hasLabel: label?.length,
disabled,
filledLabel,
Expand Down
5 changes: 2 additions & 3 deletions app/website/src/components/MuteBar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import {computed} from 'vue';
import {arrayOfLength} from '@earwurm/utilities';
import {classNames} from '@/helpers';
import {arrayOfLength, clx} from 'beeftools';
export interface MuteBarProps {
count?: number;
Expand All @@ -16,7 +15,7 @@ const barItems = computed(() => arrayOfLength(Math.max(count + 1, 1)));
</script>

<template>
<ul :class="classNames('MuteBar', {collapsed})">
<ul :class="clx('MuteBar', {collapsed})">
<li v-for="bar in barItems" :key="`MuteBar-Item-${bar}`" class="Item" />
</ul>
</template>
Expand Down
5 changes: 2 additions & 3 deletions app/website/src/components/SpeedSlider.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script setup lang="ts">
import {computed} from 'vue';
import {calcProgress, clx} from 'beeftools';
import {tokens} from 'earwurm';
import {calcProgress} from '@earwurm/utilities';
import {classNames} from '@/helpers';
import {InputRange, type InputRangeProps} from '@/primitives';
import {MuteBar} from '@/components';
Expand Down Expand Up @@ -37,7 +36,7 @@ const stripes = computed(() => {

<template>
<div
:class="classNames('SpeedSlider', {disabled})"
:class="clx('SpeedSlider', {disabled})"
:style="{'--slider-progress': progress}"
>
<div class="BackgroundStripes">
Expand Down
6 changes: 3 additions & 3 deletions app/website/src/components/StackLabel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import {classNames} from '@/helpers';
import {clx} from 'beeftools';
export interface StackLabelProps {
label: string;
Expand All @@ -11,8 +11,8 @@ defineProps<StackLabelProps>();
</script>

<template>
<div :class="classNames('StackLabel', {populated})">
<p :class="classNames('Text', {truncate})">{{ label }}</p>
<div :class="clx('StackLabel', {populated})">
<p :class="clx('Text', {truncate})">{{ label }}</p>
</div>
</template>

Expand Down
5 changes: 2 additions & 3 deletions app/website/src/components/VolumeManager.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script setup lang="ts">
import {computed} from 'vue';
import {calcProgress} from '@earwurm/utilities';
import {calcProgress, clx} from 'beeftools';
import {classNames} from '@/helpers';
import {InputRange, type InputRangeProps} from '@/primitives';
import {DragHandle, MuteBar} from '@/components';
Expand All @@ -27,7 +26,7 @@ const progress = computed(() => {

<template>
<div class="VolumeManager" :style="{'--slider-progress': progress}">
<div :class="classNames('MuteBarWrapper', {show: disabled})">
<div :class="clx('MuteBarWrapper', {show: disabled})">
<MuteBar :count="MUTE_BAR_COUNT" />
</div>

Expand Down
9 changes: 4 additions & 5 deletions app/website/src/components/VolumeSound.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<script setup lang="ts">
import {computed, ref} from 'vue';
import {arrayOfLength, clamp, roundNumber} from '@earwurm/utilities';
import {arrayOfLength, clamp, clx, roundNumber} from 'beeftools';
import {classNames} from '@/helpers';
import {MuteBar} from '@/components';
export interface VolumeSoundProps {
Expand Down Expand Up @@ -52,8 +51,8 @@ function handleChange(volume: number) {
</script>

<template>
<div :class="classNames('VolumeSound', {disabled})">
<div :class="classNames('MuteBarWrapper', {show: disabled})">
<div :class="clx('VolumeSound', {disabled})">
<div :class="clx('MuteBarWrapper', {show: disabled})">
<MuteBar :count="TICK_LENGTH" />
</div>

Expand All @@ -66,7 +65,7 @@ function handleChange(volume: number) {
<button
type="button"
:class="
classNames(
clx(
'Action',
interactIndex !== undefined
? {
Expand Down
3 changes: 1 addition & 2 deletions app/website/src/components/VolumeStack.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import {computed} from 'vue';
import {calcProgress} from '@earwurm/utilities';
import {calcProgress} from 'beeftools';
import {InputRange, type InputRangeProps} from '@/primitives';
import {MuteBar} from '@/components';
Expand Down
36 changes: 0 additions & 36 deletions app/website/src/helpers/classNames.ts

This file was deleted.

3 changes: 0 additions & 3 deletions app/website/src/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
export {assertSynthType, assertSynthValues, filterSynthValues} from './app';

export {classNames, variationName} from './classNames';

export {toValue, tryOnScopeDispose} from './vue';
2 changes: 1 addition & 1 deletion app/website/src/hooks/useMediaQuery.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ref, watchEffect} from 'vue';
import {supportMatchMedia} from '@earwurm/utilities';
import {supportMatchMedia} from 'beeftools';

import type {MaybeRefOrGetter} from '@/types';
import {toValue, tryOnScopeDispose} from '@/helpers';
Expand Down
2 changes: 1 addition & 1 deletion app/website/src/hooks/useMetronome.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {computed, ref} from 'vue';
import {clamp} from '@earwurm/utilities';
import {clamp} from 'beeftools';

// TODO: `volume` range may actually need to be `0-100`.
const INITIAL_VOLUME = 1;
Expand Down
5 changes: 2 additions & 3 deletions app/website/src/primitives/ProgressBar.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import {computed} from 'vue';
import {clamp, calcProgress} from '@earwurm/utilities';
import {classNames} from '@/helpers';
import {calcProgress, clamp, clx} from 'beeftools';
export interface ProgressBarProps {
id: string;
Expand All @@ -19,7 +18,7 @@ const progress = computed(() => calcProgress(value, {min, max, round: true}));
<template>
<div
:class="
classNames('ProgressBar', 'pattern-diagonal', {
clx('ProgressBar', 'pattern-diagonal', {
'pattern-diagonal--animated': speed,
disabled,
})
Expand Down
6 changes: 3 additions & 3 deletions app/website/src/primitives/SquareAction.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import {classNames} from '@/helpers';
import {clx} from 'beeftools';
export interface SquareActionProps {
classes?: string;
Expand All @@ -24,7 +24,7 @@ defineEmits<SquareActionEmits>();
<a
v-if="url?.length"
:href="url"
:class="classNames('SquareAction', 'link', {disabled}, classes)"
:class="clx('SquareAction', 'link', {disabled}, classes)"
:target="external ? '_blank' : undefined"
:rel="external ? 'noopener noreferrer' : undefined"
>
Expand All @@ -34,7 +34,7 @@ defineEmits<SquareActionEmits>();
<button
v-else
type="button"
:class="classNames('SquareAction', 'button', classes)"
:class="clx('SquareAction', 'button', classes)"
:aria-label="a11y"
:aria-pressed="pressed ? true : undefined"
:disabled="disabled"
Expand Down
2 changes: 1 addition & 1 deletion app/website/src/store/useDebugManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type ErrorResponse = Parameters<ManagerEventMap['error']>[0];
const MAX_HISTORY_LENGTH = 44;

// TODO: Consider enabling a auto-suspension option.
// import {clamp, timeMeasurement} from '@earwurm/utilities';
// import {clamp, timeMeasurement} from 'beeftools';
// const safeAutoSuspend = clamp(0, autoSuspend, timeMeasurement.msPerMin);

const {manager, activeStacks} = useEarwurmStore();
Expand Down

0 comments on commit 924d4c2

Please sign in to comment.