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.
@@ -0,0 +1,2 @@
1
+ /// <reference types="svelte" />
2
+ export declare let drawerTransitionX: import("svelte/store").Writable<number>;
@@ -0,0 +1,2 @@
1
+ import { writable } from 'svelte/store';
2
+ export let drawerTransitionX = writable(0);
@@ -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={{ x: clientWidth, duration, opacity: 1 }}
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 declare const drawerFlyTransition: import("svelte/store").Writable<{
4
- x: number;
5
- y: number;
6
- }>;
7
- export declare function drawerFly(node: HTMLElement, { delay, duration, easing, x, y, opacity }?: FlyParams): TransitionConfig;
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
- import { writable } from 'svelte/store';
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
- drawerFlyTransition.set({ x: t * xValue, y: t * yValue });
17
+ onTransition({ x: t * xValue, y: t * yValue });
20
18
  }
21
19
  };
22
20
  }
@@ -21,7 +21,6 @@ export function createEventEmitter() {
21
21
  emit(...args) {
22
22
  if (!events[args[0]])
23
23
  events[args[0]] = [];
24
- // @ts-ignore
25
24
  events[args[0]].forEach((callback) => callback(args[1]));
26
25
  }
27
26
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "0.3.36",
3
+ "version": "0.3.37",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",