fuma 0.3.36 → 0.3.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/private/store.d.ts +2 -0
- package/dist/private/store.js +2 -0
- package/dist/ui/drawer/Drawer.svelte +10 -1
- package/dist/ui/drawer/Drawer.svelte.d.ts +1 -0
- package/dist/ui/drawer/drawerFly.d.ts +7 -5
- package/dist/ui/drawer/drawerFly.js +2 -4
- package/dist/utils/eventEmitter.js +0 -1
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import { Icon } from "../icon/index.js";
|
|
|
7
7
|
import { subscibeDrawerLayers } from "./layers.js";
|
|
8
8
|
import { contextContainer } from "../context.js";
|
|
9
9
|
import { drawerFly } from "./drawerFly.js";
|
|
10
|
+
import { writable } from "svelte/store";
|
|
10
11
|
export let title = "";
|
|
11
12
|
export let key;
|
|
12
13
|
let klass = "";
|
|
@@ -16,6 +17,7 @@ export let classHeader = "";
|
|
|
16
17
|
export let classBody = "";
|
|
17
18
|
export let duration = 180;
|
|
18
19
|
export let noOverlay = false;
|
|
20
|
+
export let transitionX = 0;
|
|
19
21
|
export function open(value = 1, options = {}) {
|
|
20
22
|
return goto($urlParam.with({ [key]: value }), {
|
|
21
23
|
...options,
|
|
@@ -46,7 +48,14 @@ let clientWidth = 0;
|
|
|
46
48
|
{#if $isActive}
|
|
47
49
|
<aside
|
|
48
50
|
bind:clientWidth
|
|
49
|
-
transition:drawerFly|local={{
|
|
51
|
+
transition:drawerFly|local={{
|
|
52
|
+
x: clientWidth,
|
|
53
|
+
duration,
|
|
54
|
+
opacity: 1,
|
|
55
|
+
onTransition(pos) {
|
|
56
|
+
transitionX = pos.x
|
|
57
|
+
}
|
|
58
|
+
}}
|
|
50
59
|
style="
|
|
51
60
|
z-index: {10 + $index};
|
|
52
61
|
max-width: min(100%, {maxWidth});
|
|
@@ -9,6 +9,7 @@ declare const __propDef: {
|
|
|
9
9
|
classBody?: string | undefined;
|
|
10
10
|
duration?: number | undefined;
|
|
11
11
|
noOverlay?: boolean | undefined;
|
|
12
|
+
transitionX?: number | undefined;
|
|
12
13
|
open?: ((value?: number, options?: {
|
|
13
14
|
replaceState?: boolean | undefined;
|
|
14
15
|
noScroll?: boolean | undefined;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
2
|
import type { FlyParams, TransitionConfig } from 'svelte/transition';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export type DrawerFlyParams = FlyParams & {
|
|
4
|
+
onTransition?: (pos: {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
}) => unknown;
|
|
8
|
+
};
|
|
9
|
+
export declare function drawerFly(node: HTMLElement, { delay, duration, easing, x, y, opacity, onTransition }?: DrawerFlyParams): TransitionConfig;
|
|
8
10
|
export declare function split_css_unit(value: number | string): [number, string];
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { cubicOut } from 'svelte/easing';
|
|
2
|
-
|
|
3
|
-
export const drawerFlyTransition = writable({ x: 0, y: 0 });
|
|
4
|
-
export function drawerFly(node, { delay = 0, duration = 400, easing = cubicOut, x = 0, y = 0, opacity = 0 } = {}) {
|
|
2
|
+
export function drawerFly(node, { delay = 0, duration = 400, easing = cubicOut, x = 0, y = 0, opacity = 0, onTransition = () => { } } = {}) {
|
|
5
3
|
const style = getComputedStyle(node);
|
|
6
4
|
const target_opacity = +style.opacity;
|
|
7
5
|
const transform = style.transform === 'none' ? '' : style.transform;
|
|
@@ -16,7 +14,7 @@ export function drawerFly(node, { delay = 0, duration = 400, easing = cubicOut,
|
|
|
16
14
|
transform: ${transform} translate(${(1 - t) * xValue}${xUnit}, ${(1 - t) * yValue}${yUnit});
|
|
17
15
|
opacity: ${target_opacity - od * u}`,
|
|
18
16
|
tick: (t, u) => {
|
|
19
|
-
|
|
17
|
+
onTransition({ x: t * xValue, y: t * yValue });
|
|
20
18
|
}
|
|
21
19
|
};
|
|
22
20
|
}
|