@humanspeak/svelte-motion 0.5.4 → 0.6.0
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/components/motionDomProjection.context.d.ts +13 -0
- package/dist/components/motionDomProjection.context.js +18 -0
- package/dist/html/_MotionContainer.svelte +548 -60
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/utils/layout.d.ts +9 -6
- package/dist/utils/layout.js +141 -14
- package/dist/utils/motionDomProjection.d.ts +126 -0
- package/dist/utils/motionDomProjection.js +212 -0
- package/dist/utils/optimizedAppear.d.ts +141 -0
- package/dist/utils/optimizedAppear.js +311 -0
- package/dist/utils/presence.d.ts +3 -2
- package/dist/utils/presence.js +49 -12
- package/dist/utils/projection.d.ts +3 -3
- package/dist/utils/projection.js +1 -1
- package/dist/utils/svg.d.ts +4 -4
- package/dist/utils/svg.js +44 -25
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MotionDomProjectionAdapter } from '../utils/motionDomProjection';
|
|
2
|
+
/**
|
|
3
|
+
* Publish the current upstream motion-dom projection adapter to descendants.
|
|
4
|
+
*
|
|
5
|
+
* @param node Current component projection adapter, or `null` to clear.
|
|
6
|
+
*/
|
|
7
|
+
export declare const setMotionDomProjectionParent: (node: MotionDomProjectionAdapter | null) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Read the nearest upstream motion-dom projection adapter.
|
|
10
|
+
*
|
|
11
|
+
* @returns Parent projection adapter, or `null` when no motion ancestor exists.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getMotionDomProjectionParent: () => MotionDomProjectionAdapter | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
|
+
const MOTION_DOM_PROJECTION_CONTEXT_KEY = Symbol('svelte-motion:motion-dom-projection-parent');
|
|
3
|
+
/**
|
|
4
|
+
* Publish the current upstream motion-dom projection adapter to descendants.
|
|
5
|
+
*
|
|
6
|
+
* @param node Current component projection adapter, or `null` to clear.
|
|
7
|
+
*/
|
|
8
|
+
export const setMotionDomProjectionParent = (node) => {
|
|
9
|
+
setContext(MOTION_DOM_PROJECTION_CONTEXT_KEY, node);
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Read the nearest upstream motion-dom projection adapter.
|
|
13
|
+
*
|
|
14
|
+
* @returns Parent projection adapter, or `null` when no motion ancestor exists.
|
|
15
|
+
*/
|
|
16
|
+
export const getMotionDomProjectionParent = () => {
|
|
17
|
+
return getContext(MOTION_DOM_PROJECTION_CONTEXT_KEY) ?? null;
|
|
18
|
+
};
|