Skip to content

Export transition interfaces so they can be used and extended #5207

@Kruhlmann

Description

@Kruhlmann

Is your feature request related to a problem? Please describe.

I'd like to be able to import the transition interfaces defined in https://github.com/sveltejs/svelte/blob/master/src/runtime/transition/index.ts

This would be useful, in my case, for creating transitions which use the same parameters as one of the existing transitions.

I was creating a new sliding animation which happened to use the same parameters defined in the existing SlideParams interface. My solution was to simply re-define this interface in my source, which is inelegant:

import { cubicOut } from "svelte/easing";
import { TransitionConfig } from "svelte/types/runtime/transition";

type EasingFunction = (time: number) => number;

interface SlideParams {
    delay?: number;
    duration?: number;
    easing?: EasingFunction;
}

export function my_custom_sliding_transition(
    node: Element,
    { delay = 0, duration = 400, easing = cubicOut }: SlideParams,
): TransitionConfig {
    //...
}

Ideal:

import { cubicOut } from "svelte/easing";
import {
    TransitionConfig,
    SlideParams,
    EasingFunction
} from "svelte/types/runtime/transition";

export function my_custom_sliding_transition(
    node: Element,
    { delay = 0, duration = 400, easing = cubicOut }: SlideParams,
): TransitionConfig {
    //...
}

Describe the solution you'd like
A isolution would be to simply prefix the existing interfaces with export.

Describe alternatives you've considered

How important is this feature to you?
It has no functional purpose so it is not very important, it would simply make code more elegant, and avoid dupplicating code.

Additional context
I can create the merge request myself, but I'd rather wait too see if I missed something stupid, which solves my problem, before creating it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions