ui-ingredients 0.0.40 → 0.0.41

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
5
  export interface AccordionItemContentProps
5
- extends HtmlIngredientProps<'div'> {}
6
+ extends HtmlIngredientProps<'div', never, Action> {}
6
7
  </script>
7
8
 
8
9
  <script lang="ts">
@@ -34,7 +35,7 @@
34
35
  </script>
35
36
 
36
37
  {#if asChild}
37
- {@render asChild(mergedProps)}
38
+ {@render asChild(presence.ref, mergedProps)}
38
39
  {:else}
39
40
  <div use:presence.ref {...mergedProps}>
40
41
  {@render children?.()}
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface ColorPickerContentProps extends HtmlIngredientProps<'div'> {}
5
+ export interface ColorPickerContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface ComboboxContentProps extends HtmlIngredientProps<'div'> {}
5
+ export interface ComboboxContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -20,7 +22,7 @@
20
22
  </script>
21
23
 
22
24
  {#if asChild}
23
- {@render asChild(mergedProps)}
25
+ {@render asChild(presence.ref, mergedProps)}
24
26
  {:else}
25
27
  <div use:presence.ref {...mergedProps}>
26
28
  {@render children?.()}
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface DatePickerContentProps extends HtmlIngredientProps<'div'> {}
5
+ export interface DatePickerContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -24,7 +26,7 @@
24
26
  </script>
25
27
 
26
28
  {#if asChild}
27
- {@render asChild(mergedProps)}
29
+ {@render asChild(presence.ref, mergedProps)}
28
30
  {:else}
29
31
  <div use:presence.ref {...mergedProps}>
30
32
  {@render children?.()}
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface DialogBackdropProps extends HtmlIngredientProps<'div'> {}
5
+ export interface DialogBackdropProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -24,7 +26,7 @@
24
26
  </script>
25
27
 
26
28
  {#if asChild}
27
- {@render asChild(mergedProps)}
29
+ {@render asChild(presence.ref, mergedProps)}
28
30
  {:else}
29
31
  <div use:presence.ref {...mergedProps}>
30
32
  {@render children?.()}
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface DialogContentProps extends HtmlIngredientProps<'div'> {}
5
+ export interface DialogContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -20,7 +22,7 @@
20
22
  </script>
21
23
 
22
24
  {#if asChild}
23
- {@render asChild(mergedProps)}
25
+ {@render asChild(presence.ref, mergedProps)}
24
26
  {:else}
25
27
  <div use:presence.ref {...mergedProps}>
26
28
  {@render children?.()}
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface HoverCardContentProps extends HtmlIngredientProps<'div'> {}
5
+ export interface HoverCardContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -20,7 +22,7 @@
20
22
  </script>
21
23
 
22
24
  {#if asChild}
23
- {@render asChild(mergedProps)}
25
+ {@render asChild(presence.ref, mergedProps)}
24
26
  {:else}
25
27
  <div use:presence.ref {...mergedProps}>
26
28
  {@render children?.()}
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface MenuContentProps extends HtmlIngredientProps<'div'> {}
5
+ export interface MenuContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -20,7 +22,7 @@
20
22
  </script>
21
23
 
22
24
  {#if asChild}
23
- {@render asChild(mergedProps)}
25
+ {@render asChild(presence.ref, mergedProps)}
24
26
  {:else}
25
27
  <div use:presence.ref {...mergedProps}>
26
28
  {@render children?.()}
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface PopoverContentProps extends HtmlIngredientProps<'div'> {}
5
+ export interface PopoverContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -20,7 +22,7 @@
20
22
  </script>
21
23
 
22
24
  {#if asChild}
23
- {@render asChild(mergedProps)}
25
+ {@render asChild(presence.ref, mergedProps)}
24
26
  {:else}
25
27
  <div use:presence.ref {...mergedProps}>
26
28
  {@render children?.()}
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface SelectContentProps extends HtmlIngredientProps<'div'> {}
5
+ export interface SelectContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -20,7 +22,7 @@
20
22
  </script>
21
23
 
22
24
  {#if asChild}
23
- {@render asChild(mergedProps)}
25
+ {@render asChild(presence.ref, mergedProps)}
24
26
  {:else}
25
27
  <div use:presence.ref {...mergedProps}>
26
28
  {@render children?.()}
@@ -1,7 +1,9 @@
1
1
  <script lang="ts" module>
2
2
  import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
3
4
 
4
- export interface TooltipContentProps extends HtmlIngredientProps<'div'> {}
5
+ export interface TooltipContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
5
7
  </script>
6
8
 
7
9
  <script lang="ts">
@@ -20,7 +22,7 @@
20
22
  </script>
21
23
 
22
24
  {#if asChild}
23
- {@render asChild(mergedProps)}
25
+ {@render asChild(presence.ref, mergedProps)}
24
26
  {:else}
25
27
  <div use:presence.ref {...mergedProps}>
26
28
  {@render children?.()}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Snippet } from 'svelte';
2
+ import type { Action } from 'svelte/action';
2
3
  import type { SvelteHTMLElements } from 'svelte/elements';
3
4
  import type { TransitionConfig } from 'svelte/transition';
4
5
  export type GenericObject = Record<string, any>;
@@ -13,10 +14,14 @@ export interface TransitionProps {
13
14
  out?: TransitionFunction;
14
15
  transition?: TransitionFunction;
15
16
  }
16
- export type AsChild<Context = never> = [Context] extends [never] ? Snippet<[attrs: GenericObject]> : Snippet<[attrs: GenericObject, context: Context]>;
17
+ export type AsChildWithRef<Ref extends Action, Context = never> = [
18
+ Context
19
+ ] extends [never] ? Snippet<[ref: Ref, attrs: GenericObject]> : Snippet<[ref: Ref, attrs: GenericObject, context: Context]>;
20
+ export type AsChildWithoutRef<Context = never> = [Context] extends [never] ? Snippet<[attrs: GenericObject]> : Snippet<[attrs: GenericObject, context: Context]>;
21
+ export type AsChild<Ref extends Action, Context = never> = [Ref] extends [never] ? AsChildWithoutRef<Context> : AsChildWithRef<Ref, Context>;
17
22
  export type Children<T = never> = [T] extends [never] ? Snippet : Snippet<[context: T]>;
18
23
  export type PropsWithoutChildren<T> = Omit<T, 'children'>;
19
- export type HtmlIngredientProps<T extends IntrinsicElements, Context = never> = TransitionProps & PropsWithoutChildren<HtmlProps<T>> & {
20
- asChild?: AsChild<Context>;
24
+ export type HtmlIngredientProps<Element extends IntrinsicElements, Context = never, Ref extends Action = never> = TransitionProps & PropsWithoutChildren<HtmlProps<Element>> & {
21
25
  children?: Children<Context>;
26
+ asChild?: AsChild<Ref, Context>;
22
27
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui-ingredients",
3
3
  "type": "module",
4
- "version": "0.0.40",
4
+ "version": "0.0.41",
5
5
  "packageManager": "pnpm@9.7.0",
6
6
  "svelte": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",