Skip to content

Commit

Permalink
possible definition?
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffordkleinsr committed Dec 10, 2024
1 parent c0a55b5 commit ef38928
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/motion-start/animation/utils/is-animatable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ based on [email protected],
Copyright (c) 2018 Framer B.V.
*/

import { complex } from 'style-value-types';
// import { complex } from "../../value/types/complex"
// import { complex } from 'style-value-types';
import { complex } from "../../value/types/complex"
import type { ValueKeyframesDefinition } from '../types';

/**
Expand Down
23 changes: 22 additions & 1 deletion src/lib/motion-start/components/AnimatePresence/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,34 @@ based on [email protected],
Copyright (c) 2018 Framer B.V.
*/

import type { Snippet } from 'svelte';
import { writable } from 'svelte/store';
import type { ConditionalGeneric } from '.';

export const Children$ = writable<{ key: string }[]>();

export type ComponentKey = number | undefined;

export const getChildKey = (child: { key: number | undefined }): ComponentKey => child.key || undefined;
export const getChildKey = (child: {
key: ComponentKey;
}): ComponentKey =>
child.key || undefined;

function isSvelteComponent(thing: { prototype: { $destroy: any; }; render: any; }) {
return (thing && typeof window !== 'undefined')
? typeof thing.prototype.$destroy === 'function' // client-side
: typeof thing.render === 'function'; // server-side
}
export function onlyElements(children: Snippet<[ConditionalGeneric<any> | {
key: number;
}]>[] | undefined): Snippet<any>[] {
const filtered: Snippet<any>[] = []
children?.forEach((child:any) => {
if (isSvelteComponent(child)) filtered.push(child)
})

return filtered
}

// export function onlyElements(children: (Element & { key: number })[]): (Element & { key: number })[] {
// return children.filter();
Expand Down

0 comments on commit ef38928

Please sign in to comment.