ui-ingredients 0.0.48 → 0.0.49
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.
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { Action } from 'svelte/action';
|
1
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
2
3
|
export interface PresenceStrategyProps {
|
3
4
|
/** @default false */
|
@@ -11,7 +12,7 @@ export interface CreatePresenceProps extends PresenceStrategyProps {
|
|
11
12
|
export interface CreatePresenceReturn extends ReturnType<typeof createPresence> {
|
12
13
|
}
|
13
14
|
export declare function createPresence(props: CreatePresenceProps): {
|
14
|
-
ref:
|
15
|
+
ref: Action<HTMLElement, undefined, Record<never, any>>;
|
15
16
|
getPresenceProps: () => HTMLAttributes<HTMLElement>;
|
16
17
|
readonly mounted: boolean;
|
17
18
|
};
|
package/dist/types.d.ts
CHANGED
@@ -3,20 +3,22 @@ import type { Action } from 'svelte/action';
|
|
3
3
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
4
4
|
export type GenericObject = Record<string, any>;
|
5
5
|
export type Assign<Target extends GenericObject, Source extends GenericObject> = Source & Omit<Target, keyof Source>;
|
6
|
-
export type
|
6
|
+
export type SvelteHTMLElement = keyof {
|
7
7
|
[K in keyof SvelteHTMLElements as string extends K ? never : number extends K ? never : K]: string;
|
8
8
|
};
|
9
|
-
export type HtmlProps<
|
10
|
-
type
|
11
|
-
|
12
|
-
] ? Snippet<[
|
13
|
-
type AsChildWithoutRef<
|
14
|
-
export type AsChild<
|
15
|
-
|
9
|
+
export type HtmlProps<TElement extends SvelteHTMLElement> = SvelteHTMLElements[TElement];
|
10
|
+
type AsChildWithAction<TAction extends Action, TContext = never> = [
|
11
|
+
TContext
|
12
|
+
] extends [never] ? Snippet<[action: TAction, attrs: GenericObject]> : Snippet<[action: TAction, attrs: GenericObject, context: TContext]>;
|
13
|
+
type AsChildWithoutRef<TContext = never> = [TContext] extends [never] ? Snippet<[attrs: GenericObject]> : Snippet<[attrs: GenericObject, context: TContext]>;
|
14
|
+
export type AsChild<TAction extends Action, Context = never> = [
|
15
|
+
TAction
|
16
|
+
] extends [never] ? AsChildWithoutRef<Context> : AsChildWithAction<TAction, Context>;
|
17
|
+
type Children<TContext = never> = [TContext] extends [never] ? Snippet : Snippet<[context: TContext]>;
|
16
18
|
type PropsWithoutChildren<T> = Omit<T, 'children'>;
|
17
|
-
export type HtmlIngredientProps<
|
19
|
+
export type HtmlIngredientProps<TElement extends SvelteHTMLElement, TContext = never, TAction extends Action = never> = PropsWithoutChildren<HtmlProps<TElement>> & {
|
18
20
|
this?: any;
|
19
|
-
asChild?: AsChild<
|
20
|
-
children?: Children<
|
21
|
+
asChild?: AsChild<TAction, TContext>;
|
22
|
+
children?: Children<TContext>;
|
21
23
|
};
|
22
24
|
export {};
|