fix: break import cycles
import/no-cycle (now active) flagged 17 cycles across 12 files: - shared/ui self-barrel cycles (Logo/Stat/StatGroup/ComboControl/ FilterGroup/SectionHeader): import siblings relatively instead of through the $shared/ui barrel that re-exports them - shared/lib/utils: roundToStepPrecision imports getDecimalPlaces relatively instead of via the utils barrel - routes: lazy-load Redirect in the router so it no longer statically imports a component that imports navigate back from it
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { createRouter } from 'sv-router';
|
||||
import Home from './Home.svelte';
|
||||
import Redirect from './Redirect.svelte';
|
||||
|
||||
/**
|
||||
* Single-page router for glyphdiff.
|
||||
@@ -18,6 +17,8 @@ export const {
|
||||
'/': Home,
|
||||
/**
|
||||
* Any unmatched path redirects to home until additional routes exist.
|
||||
* Lazy-loaded so `router` doesn't statically import `Redirect`, which
|
||||
* imports `navigate` from here — breaks the import cycle.
|
||||
*/
|
||||
'*notfound': Redirect,
|
||||
'*notfound': () => import('./Redirect.svelte'),
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getDecimalPlaces } from '$shared/lib/utils';
|
||||
import { getDecimalPlaces } from '../getDecimalPlaces/getDecimalPlaces';
|
||||
|
||||
/**
|
||||
* Rounds a value to match the precision of a given step
|
||||
|
||||
@@ -5,13 +5,11 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { cn } from '$shared/lib';
|
||||
import {
|
||||
Popover,
|
||||
Slider,
|
||||
} from '$shared/ui';
|
||||
import { Button } from '$shared/ui/Button';
|
||||
import MinusIcon from '@lucide/svelte/icons/minus';
|
||||
import PlusIcon from '@lucide/svelte/icons/plus';
|
||||
import { Button } from '../Button';
|
||||
import Popover from '../Popover/Popover.svelte';
|
||||
import Slider from '../Slider/Slider.svelte';
|
||||
import TechText from '../TechText/TechText.svelte';
|
||||
import type {
|
||||
ControlLabels,
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
<script lang="ts">
|
||||
import type { Filter } from '$shared/lib';
|
||||
import { cn } from '$shared/lib';
|
||||
import { Button } from '$shared/ui';
|
||||
import { Label } from '$shared/ui';
|
||||
import ChevronUpIcon from '@lucide/svelte/icons/chevron-up';
|
||||
import EllipsisIcon from '@lucide/svelte/icons/ellipsis';
|
||||
import { cubicOut } from 'svelte/easing';
|
||||
@@ -14,6 +12,8 @@ import {
|
||||
draw,
|
||||
fly,
|
||||
} from 'svelte/transition';
|
||||
import { Button } from '../Button';
|
||||
import Label from '../Label/Label.svelte';
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { cn } from '$shared/lib';
|
||||
import { Badge } from '$shared/ui';
|
||||
import Badge from '../Badge/Badge.svelte';
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { cn } from '$shared/lib';
|
||||
import { Label } from '$shared/ui';
|
||||
import Label from '../../Label/Label.svelte';
|
||||
|
||||
interface Props {
|
||||
/**
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { cn } from '$shared/lib';
|
||||
import { Label } from '$shared/ui';
|
||||
import type { ComponentProps } from 'svelte';
|
||||
import Label from '../Label/Label.svelte';
|
||||
|
||||
interface Props extends Pick<ComponentProps<typeof Label>, 'variant'> {
|
||||
/**
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { cn } from '$shared/lib';
|
||||
import { Stat } from '$shared/ui';
|
||||
import type { ComponentProps } from 'svelte';
|
||||
import Stat from './Stat.svelte';
|
||||
|
||||
interface StatItem extends Partial<Pick<ComponentProps<typeof Stat>, 'variant'>> {
|
||||
label: string;
|
||||
|
||||
Reference in New Issue
Block a user