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.
@@ -86,6 +86,7 @@ export function createField(props) {
86
86
  }
87
87
  function getHelperTextProps() {
88
88
  return {
89
+ ...parts.helperText.attrs,
89
90
  id: ids.helperText,
90
91
  'data-invalid': dataAttr(invalid),
91
92
  'data-disabled': dataAttr(disabled),
@@ -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: (node: HTMLElement) => void;
15
+ ref: Action<HTMLElement, undefined, Record<never, any>>;
15
16
  getPresenceProps: () => HTMLAttributes<HTMLElement>;
16
17
  readonly mounted: boolean;
17
18
  };
@@ -34,9 +34,9 @@ export function createPresence(props) {
34
34
  return true;
35
35
  return false;
36
36
  });
37
- function ref(node) {
37
+ const ref = (node) => {
38
38
  api.setNode(node);
39
- }
39
+ };
40
40
  return {
41
41
  ref,
42
42
  getPresenceProps,
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 IntrinsicElement = keyof {
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<T extends IntrinsicElement> = SvelteHTMLElements[T];
10
- type AsChildWithRef<Ref extends Action, Context = never> = [Context] extends [
11
- never
12
- ] ? Snippet<[ref: Ref, attrs: GenericObject]> : Snippet<[ref: Ref, attrs: GenericObject, context: Context]>;
13
- type AsChildWithoutRef<Context = never> = [Context] extends [never] ? Snippet<[attrs: GenericObject]> : Snippet<[attrs: GenericObject, context: Context]>;
14
- export type AsChild<Ref extends Action, Context = never> = [Ref] extends [never] ? AsChildWithoutRef<Context> : AsChildWithRef<Ref, Context>;
15
- type Children<T = never> = [T] extends [never] ? Snippet : Snippet<[context: T]>;
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<Element extends IntrinsicElement, Context = never, Ref extends Action = never> = PropsWithoutChildren<HtmlProps<Element>> & {
19
+ export type HtmlIngredientProps<TElement extends SvelteHTMLElement, TContext = never, TAction extends Action = never> = PropsWithoutChildren<HtmlProps<TElement>> & {
18
20
  this?: any;
19
- asChild?: AsChild<Ref, Context>;
20
- children?: Children<Context>;
21
+ asChild?: AsChild<TAction, TContext>;
22
+ children?: Children<TContext>;
21
23
  };
22
24
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui-ingredients",
3
3
  "type": "module",
4
- "version": "0.0.48",
4
+ "version": "0.0.49",
5
5
  "packageManager": "pnpm@9.7.0",
6
6
  "svelte": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",