svelte-ag 1.0.6 → 1.0.7

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.
Files changed (132) hide show
  1. package/dist/lib/api/form.svelte.d.ts +4 -4
  2. package/dist/lib/api/form.svelte.d.ts.map +1 -1
  3. package/dist/lib/api/form.svelte.js +6 -3
  4. package/dist/lib/components/breakpoint-badge/BreakpointBadge.svelte +86 -0
  5. package/dist/lib/components/breakpoint-badge/BreakpointBadge.svelte.d.ts +7 -0
  6. package/dist/lib/components/breakpoint-badge/BreakpointBadge.svelte.d.ts.map +1 -0
  7. package/dist/lib/components/breakpoint-badge/index.d.ts +3 -0
  8. package/dist/lib/components/breakpoint-badge/index.d.ts.map +1 -0
  9. package/dist/lib/components/breakpoint-badge/index.js +2 -0
  10. package/dist/lib/components/carousel/carousel-content.svelte +1 -1
  11. package/dist/lib/components/carousel/carousel-dots.svelte +1 -1
  12. package/dist/lib/components/carousel/carousel-item.svelte +1 -1
  13. package/dist/lib/components/carousel/carousel-next.svelte +1 -1
  14. package/dist/lib/components/carousel/carousel-previous.svelte +1 -1
  15. package/dist/lib/components/carousel/carousel.svelte +1 -1
  16. package/dist/lib/components/dnd/sortable.svelte.js +1 -1
  17. package/dist/lib/components/form/form-button.svelte +6 -2
  18. package/dist/lib/components/form/form-button.svelte.d.ts +1 -0
  19. package/dist/lib/components/form/form-button.svelte.d.ts.map +1 -1
  20. package/dist/lib/components/form/form-control.svelte +33 -0
  21. package/dist/lib/components/form/form-control.svelte.d.ts +17 -0
  22. package/dist/lib/components/form/form-control.svelte.d.ts.map +1 -0
  23. package/dist/lib/components/form/form-description.svelte +1 -1
  24. package/dist/lib/components/form/form-field-errors.svelte +2 -1
  25. package/dist/lib/components/form/form-field-errors.svelte.d.ts +6 -1
  26. package/dist/lib/components/form/form-field-errors.svelte.d.ts.map +1 -1
  27. package/dist/lib/components/form/form-field-full.svelte +18 -8
  28. package/dist/lib/components/form/form-field-full.svelte.d.ts +9 -8
  29. package/dist/lib/components/form/form-field-full.svelte.d.ts.map +1 -1
  30. package/dist/lib/components/form/form-field.svelte +12 -2
  31. package/dist/lib/components/form/form-field.svelte.d.ts +5 -2
  32. package/dist/lib/components/form/form-field.svelte.d.ts.map +1 -1
  33. package/dist/lib/components/form/form-label.svelte +2 -1
  34. package/dist/lib/components/form/form-label.svelte.d.ts +1 -1
  35. package/dist/lib/components/form/form-label.svelte.d.ts.map +1 -1
  36. package/dist/lib/components/form/form-message.svelte +31 -0
  37. package/dist/lib/components/form/form-message.svelte.d.ts +8 -0
  38. package/dist/lib/components/form/form-message.svelte.d.ts.map +1 -0
  39. package/dist/lib/components/form/form.svelte +6 -10
  40. package/dist/lib/components/form/form.svelte.d.ts +7 -7
  41. package/dist/lib/components/form/form.svelte.d.ts.map +1 -1
  42. package/dist/lib/components/form/index.d.ts +14 -3
  43. package/dist/lib/components/form/index.d.ts.map +1 -1
  44. package/dist/lib/components/form/index.js +15 -4
  45. package/dist/lib/components/gallery/gallery.svelte +17 -16
  46. package/dist/lib/components/gallery/gallery.svelte.d.ts +1 -0
  47. package/dist/lib/components/gallery/gallery.svelte.d.ts.map +1 -1
  48. package/dist/lib/components/search/combinations/searchPopover.svelte +3 -4
  49. package/dist/lib/components/search/combinations/searchPopover.svelte.d.ts +2 -1
  50. package/dist/lib/components/search/combinations/searchPopover.svelte.d.ts.map +1 -1
  51. package/dist/lib/components/search/components/search-list.svelte +2 -2
  52. package/dist/lib/components/search/components/search.svelte +3 -3
  53. package/dist/lib/components/search/components/search.svelte.d.ts +1 -1
  54. package/dist/lib/components/search/components/search.svelte.d.ts.map +1 -1
  55. package/dist/lib/components/search/search.svelte.d.ts +1 -1
  56. package/dist/lib/components/search/search.svelte.d.ts.map +1 -1
  57. package/dist/lib/components/sidebar/sidebar-content.svelte +1 -1
  58. package/dist/lib/components/sidebar/sidebar-footer.svelte +1 -1
  59. package/dist/lib/components/sidebar/sidebar-group-action.svelte +1 -1
  60. package/dist/lib/components/sidebar/sidebar-group-content.svelte +1 -1
  61. package/dist/lib/components/sidebar/sidebar-group-label.svelte +1 -1
  62. package/dist/lib/components/sidebar/sidebar-group.svelte +1 -1
  63. package/dist/lib/components/sidebar/sidebar-header.svelte +1 -1
  64. package/dist/lib/components/sidebar/sidebar-input.svelte +1 -1
  65. package/dist/lib/components/sidebar/sidebar-inset.svelte +1 -1
  66. package/dist/lib/components/sidebar/sidebar-menu-action.svelte +1 -1
  67. package/dist/lib/components/sidebar/sidebar-menu-badge.svelte +1 -1
  68. package/dist/lib/components/sidebar/sidebar-menu-button.svelte +1 -1
  69. package/dist/lib/components/sidebar/sidebar-menu-item.svelte +1 -1
  70. package/dist/lib/components/sidebar/sidebar-menu-skeleton.svelte +1 -1
  71. package/dist/lib/components/sidebar/sidebar-menu-sub-button.svelte +1 -1
  72. package/dist/lib/components/sidebar/sidebar-menu-sub.svelte +1 -1
  73. package/dist/lib/components/sidebar/sidebar-menu.svelte +1 -1
  74. package/dist/lib/components/sidebar/sidebar-provider.svelte +1 -1
  75. package/dist/lib/components/sidebar/sidebar-rail.svelte +1 -1
  76. package/dist/lib/components/sidebar/sidebar-separator.svelte +1 -1
  77. package/dist/lib/components/sidebar/sidebar-trigger.svelte +3 -4
  78. package/dist/lib/components/sidebar/sidebar-trigger.svelte.d.ts.map +1 -1
  79. package/dist/lib/components/sidebar/sidebar.svelte +1 -1
  80. package/dist/lib/styles/scrollbar.css +11 -0
  81. package/dist/lib/vite/vite-plugin-component-source-collector.d.ts.map +1 -1
  82. package/dist/lib/vite/vite-plugin-component-source-collector.js +29 -15
  83. package/package.json +2 -2
  84. package/src/lib/api/form.svelte.ts +17 -6
  85. package/src/lib/components/breakpoint-badge/BreakpointBadge.svelte +86 -0
  86. package/src/lib/components/breakpoint-badge/index.ts +2 -0
  87. package/src/lib/components/carousel/carousel-content.svelte +1 -1
  88. package/src/lib/components/carousel/carousel-dots.svelte +1 -1
  89. package/src/lib/components/carousel/carousel-item.svelte +1 -1
  90. package/src/lib/components/carousel/carousel-next.svelte +1 -1
  91. package/src/lib/components/carousel/carousel-previous.svelte +1 -1
  92. package/src/lib/components/carousel/carousel.svelte +1 -1
  93. package/src/lib/components/dnd/sortable.svelte.ts +1 -1
  94. package/src/lib/components/form/form-button.svelte +6 -2
  95. package/src/lib/components/form/form-control.svelte +33 -0
  96. package/src/lib/components/form/form-description.svelte +1 -1
  97. package/src/lib/components/form/form-field-errors.svelte +2 -1
  98. package/src/lib/components/form/form-field-full.svelte +18 -8
  99. package/src/lib/components/form/form-field.svelte +12 -2
  100. package/src/lib/components/form/form-label.svelte +2 -1
  101. package/src/lib/components/form/form-message.svelte +31 -0
  102. package/src/lib/components/form/form.svelte +6 -10
  103. package/src/lib/components/form/index.ts +15 -2
  104. package/src/lib/components/gallery/gallery.svelte +17 -16
  105. package/src/lib/components/search/combinations/searchPopover.svelte +3 -4
  106. package/src/lib/components/search/components/search-list.svelte +2 -2
  107. package/src/lib/components/search/components/search.svelte +3 -3
  108. package/src/lib/components/search/search.svelte.ts +1 -1
  109. package/src/lib/components/sidebar/sidebar-content.svelte +1 -1
  110. package/src/lib/components/sidebar/sidebar-footer.svelte +1 -1
  111. package/src/lib/components/sidebar/sidebar-group-action.svelte +1 -1
  112. package/src/lib/components/sidebar/sidebar-group-content.svelte +1 -1
  113. package/src/lib/components/sidebar/sidebar-group-label.svelte +1 -1
  114. package/src/lib/components/sidebar/sidebar-group.svelte +1 -1
  115. package/src/lib/components/sidebar/sidebar-header.svelte +1 -1
  116. package/src/lib/components/sidebar/sidebar-input.svelte +1 -1
  117. package/src/lib/components/sidebar/sidebar-inset.svelte +1 -1
  118. package/src/lib/components/sidebar/sidebar-menu-action.svelte +1 -1
  119. package/src/lib/components/sidebar/sidebar-menu-badge.svelte +1 -1
  120. package/src/lib/components/sidebar/sidebar-menu-button.svelte +1 -1
  121. package/src/lib/components/sidebar/sidebar-menu-item.svelte +1 -1
  122. package/src/lib/components/sidebar/sidebar-menu-skeleton.svelte +1 -1
  123. package/src/lib/components/sidebar/sidebar-menu-sub-button.svelte +1 -1
  124. package/src/lib/components/sidebar/sidebar-menu-sub.svelte +1 -1
  125. package/src/lib/components/sidebar/sidebar-menu.svelte +1 -1
  126. package/src/lib/components/sidebar/sidebar-provider.svelte +1 -1
  127. package/src/lib/components/sidebar/sidebar-rail.svelte +1 -1
  128. package/src/lib/components/sidebar/sidebar-separator.svelte +1 -1
  129. package/src/lib/components/sidebar/sidebar-trigger.svelte +3 -4
  130. package/src/lib/components/sidebar/sidebar.svelte +1 -1
  131. package/src/lib/styles/scrollbar.css +11 -0
  132. package/src/lib/vite/vite-plugin-component-source-collector.ts +31 -17
@@ -1,6 +1,5 @@
1
- import { type SuperForm, type SuperValidated } from 'sveltekit-superforms';
2
- import type { ApiRequestFunction, HTTPMethod, ApiEndpoints, ApiInput, ApiSuccessBody, ApiErrorBody } from 'ts-ag';
3
- import type * as v from 'valibot';
1
+ import { superForm, type SuperForm, type SuperValidated } from 'sveltekit-superforms';
2
+ import type { ApiRequestFunction, HTTPMethod, ApiEndpoints, ApiInput, ApiSuccessBody, ApiErrorBody, ApiSchema } from 'ts-ag';
4
3
  type ValidInput<E extends ApiEndpoints, P extends E['path'], M extends E['method']> = NonNullable<ApiInput<E, P, M>>;
5
4
  export type ApiRequestForm<API extends ApiEndpoints> = <Path extends API['path'], Method extends Extract<API, {
6
5
  path: Path;
@@ -12,7 +11,8 @@ export type ApiRequestForm<API extends ApiEndpoints> = <Path extends API['path']
12
11
  onFail?: (form: SuperValidated<ValidInput<API, Path, Method>>, response: ApiErrorBody<API, Path, Method>) => void | Promise<void>;
13
12
  };
14
13
  defaultValue?: Partial<ApiInput<API, Path, Method>>;
14
+ formProps?: Parameters<typeof superForm<ValidInput<API, Path, Method>>>[1];
15
15
  }) => SuperForm<ValidInput<API, Path, Method>>;
16
- export declare function createFormFunction<API extends ApiEndpoints>(schemas: Record<API['path'], Record<HTTPMethod, v.GenericSchema>>, request: ApiRequestFunction<API>): ApiRequestForm<API>;
16
+ export declare function createFormFunction<API extends ApiEndpoints>(schemas: Partial<Record<API['path'], Partial<Record<HTTPMethod, ApiSchema>>>>, request: ApiRequestFunction<API>): ApiRequestForm<API>;
17
17
  export {};
18
18
  //# sourceMappingURL=form.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.svelte.d.ts","sourceRoot":"","sources":["../../../src/lib/api/form.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtH,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAClH,OAAO,KAAK,KAAK,CAAC,MAAM,SAAS,CAAC;AAElC,KAAK,UAAU,CAAC,CAAC,SAAS,YAAY,EAAE,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAErH,MAAM,MAAM,cAAc,CAAC,GAAG,SAAS,YAAY,IAAI,CACrD,IAAI,SAAS,GAAG,CAAC,MAAM,CAAC,EACxB,MAAM,SAAS,OAAO,CAAC,GAAG,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC,QAAQ,CAAC,EACrD,CAAC,EAAE;IACH,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,CACV,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,EACnD,QAAQ,EAAE,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,KACxC,IAAI,GAAG,OAAO,CAAC,IAAI,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kBAAkB,CAAC,GAAG,CAAC,GAC/B,cAAc,CAAC,GAAG,CAAC,CA4CrB"}
@@ -1,7 +1,7 @@
1
1
  import { superForm, defaults, setError, setMessage } from 'sveltekit-superforms';
2
2
  import { valibot } from 'sveltekit-superforms/adapters';
3
3
  export function createFormFunction(schemas, request) {
4
- return ({ path, method, actions, defaultValue }) => {
4
+ return ({ path, method, actions, defaultValue, formProps }) => {
5
5
  const schema = schemas[path]?.[method];
6
6
  if (schema === undefined)
7
7
  throw new Error('Invalid schema for form');
@@ -20,8 +20,10 @@ export function createFormFunction(schemas, request) {
20
20
  const res = await request(path, method, form.data);
21
21
  if (res.ok === false) {
22
22
  const body = await res.json();
23
+ // TODO set some kind of overall form error if there is no field
23
24
  if (!body.field) {
24
- setError(form, '', body.message);
25
+ setMessage(form, body.message);
26
+ // setError(form, '', body.message);
25
27
  }
26
28
  else {
27
29
  setError(form, body.field.name, body.field.value, { status: res.status });
@@ -37,7 +39,8 @@ export function createFormFunction(schemas, request) {
37
39
  await actions.onSuccess(form, body);
38
40
  }
39
41
  }
40
- }
42
+ },
43
+ ...formProps
41
44
  });
42
45
  };
43
46
  }
@@ -0,0 +1,86 @@
1
+ <script lang="ts" module>
2
+ export type SvelteBreakpointBadgeProps = { dev: boolean };
3
+ </script>
4
+
5
+ <script lang="ts">
6
+ const { dev = true }: SvelteBreakpointBadgeProps = $props();
7
+
8
+ const breakpoints = [
9
+ {
10
+ name: 'default',
11
+ bgClass: 'bg-red-100',
12
+ borderClass: 'border-red-300',
13
+ textClass: 'text-red-600',
14
+ hideClass: 'sm:hidden',
15
+ rounded: 'rounded-md'
16
+ },
17
+ {
18
+ name: 'sm',
19
+ bgClass: 'bg-blue-100',
20
+ borderClass: 'border-blue-300',
21
+ textClass: 'text-blue-600',
22
+ hideClass: 'hidden sm:block md:hidden',
23
+ rounded: 'rounded-md'
24
+ },
25
+ {
26
+ name: 'md',
27
+ bgClass: 'bg-purple-100',
28
+ borderClass: 'border-purple-300',
29
+ textClass: 'text-purple-600',
30
+ hideClass: 'hidden md:block lg:hidden',
31
+ rounded: 'rounded-md'
32
+ },
33
+ {
34
+ name: 'lg',
35
+ bgClass: 'bg-green-100',
36
+ borderClass: 'border-green-300',
37
+ textClass: 'text-green-800',
38
+ hideClass: 'hidden lg:block xl:hidden',
39
+ rounded: 'rounded-md'
40
+ },
41
+ {
42
+ name: 'xl',
43
+ bgClass: 'bg-orange-100',
44
+ borderClass: 'border-orange-300',
45
+ textClass: 'text-orange-600',
46
+ hideClass: 'hidden xl:block 2xl:hidden',
47
+ rounded: 'rounded-md'
48
+ },
49
+ {
50
+ name: '2xl',
51
+ bgClass: 'bg-yellow-100',
52
+ borderClass: 'border-yellow-300',
53
+ textClass: 'text-yellow-600',
54
+ hideClass: 'hidden 2xl:block 3xl:hidden',
55
+ rounded: 'rounded-md'
56
+ },
57
+ {
58
+ name: '3xl',
59
+ bgClass: 'bg-blue-100',
60
+ borderClass: 'border-blue-300',
61
+ textClass: 'text-blue-600',
62
+ hideClass: 'hidden 3xl:block 4xl:hidden',
63
+ rounded: 'rounded-md'
64
+ },
65
+ {
66
+ name: '4xl',
67
+ bgClass: 'bg-red-100',
68
+ borderClass: 'border-red-300',
69
+ textClass: 'text-red-600',
70
+ hideClass: 'hidden 4xl:block 5xl:hidden',
71
+ rounded: 'rounded-md'
72
+ }
73
+ ];
74
+ </script>
75
+
76
+ {#if dev}
77
+ <div class="w-fit">
78
+ {#each breakpoints as bp (bp.name)}
79
+ <div
80
+ class="{bp.rounded} {bp.bgClass} {bp.hideClass} border {bp.borderClass} px-2 text-xs font-bold {bp.textClass}"
81
+ >
82
+ {bp.name}
83
+ </div>
84
+ {/each}
85
+ </div>
86
+ {/if}
@@ -0,0 +1,7 @@
1
+ export type SvelteBreakpointBadgeProps = {
2
+ dev: boolean;
3
+ };
4
+ declare const BreakpointBadge: import("svelte").Component<SvelteBreakpointBadgeProps, {}, "">;
5
+ type BreakpointBadge = ReturnType<typeof BreakpointBadge>;
6
+ export default BreakpointBadge;
7
+ //# sourceMappingURL=BreakpointBadge.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BreakpointBadge.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/breakpoint-badge/BreakpointBadge.svelte.ts"],"names":[],"mappings":"AAGE,MAAM,MAAM,0BAA0B,GAAG;IAAE,GAAG,EAAE,OAAO,CAAA;CAAE,CAAC;AAuF5D,QAAA,MAAM,eAAe,gEAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as BreakpointBadge } from './BreakpointBadge.svelte';
2
+ export * from './BreakpointBadge.svelte';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/breakpoint-badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACtE,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as BreakpointBadge } from './BreakpointBadge.svelte';
2
+ export * from './BreakpointBadge.svelte';
@@ -2,7 +2,7 @@
2
2
  import type { WithElementRef } from 'bits-ui';
3
3
  import type { HTMLAttributes } from 'svelte/elements';
4
4
  import { getEmblaContext } from './context.js';
5
- import { cn } from '$shadcn/utils.js';
5
+ import { cn } from '../../utils/utils.js';
6
6
 
7
7
  let {
8
8
  ref = $bindable(null),
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  import type { WithoutChildren } from 'bits-ui';
3
3
  import { getEmblaContext } from './context.js';
4
- import { cn } from '$shadcn/utils.js';
4
+ import { cn } from '../../utils/utils.js';
5
5
  import { Button, type Props } from '$shadcn/button/index.js';
6
6
 
7
7
  let {
@@ -2,7 +2,7 @@
2
2
  import type { WithElementRef } from 'bits-ui';
3
3
  import type { HTMLAttributes } from 'svelte/elements';
4
4
  import { getEmblaContext } from './context.js';
5
- import { cn } from '$shadcn/utils.js';
5
+ import { cn } from '../../utils/utils.js';
6
6
 
7
7
  let {
8
8
  ref = $bindable(null),
@@ -2,7 +2,7 @@
2
2
  import ArrowRight from '@lucide/svelte/icons/arrow-right';
3
3
  import type { WithoutChildren } from 'bits-ui';
4
4
  import { getEmblaContext } from './context.js';
5
- import { cn } from '$shadcn/utils.js';
5
+ import { cn } from '../../utils/utils.js';
6
6
  import { Button, type Props } from '$shadcn/button/index.js';
7
7
  import { tv, type VariantProps } from 'tailwind-variants';
8
8
 
@@ -2,7 +2,7 @@
2
2
  import ArrowLeft from '@lucide/svelte/icons/arrow-left';
3
3
  import type { WithoutChildren } from 'bits-ui';
4
4
  import { getEmblaContext } from './context.js';
5
- import { cn } from '$shadcn/utils.js';
5
+ import { cn } from '../../utils/utils.js';
6
6
  import { Button, type Props } from '$shadcn/button/index.js';
7
7
  import { type VariantProps, tv } from 'tailwind-variants';
8
8
 
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { type CarouselAPI, type CarouselProps, type EmblaContext, setEmblaContext } from './context.js';
3
- import { cn } from '$shadcn/utils.js';
3
+ import { cn } from '../../utils/utils.js';
4
4
  import emblaCarouselSvelte from 'embla-carousel-svelte';
5
5
 
6
6
  let {
@@ -20,7 +20,7 @@ export function onDragEnd({ active, over, dnd }) {
20
20
  const activeData = data(active);
21
21
  const overData = data(over);
22
22
  // Add this in as well accepts.includes(activeType)
23
- console.log('Acitve/over', $state.snapshot(activeData), $state.snapshot(overData));
23
+ // console.log('Acitve/over', $state.snapshot(activeData), $state.snapshot(overData));
24
24
  const usesId = 'id' in activeData.item.current;
25
25
  if (activeData.type.current === overData.type.current) {
26
26
  if (dnd.activeParent.id === overData.parent.current.id) {
@@ -1,9 +1,13 @@
1
- <script lang="ts">
1
+ <script module lang="ts">
2
2
  import * as Button from '$shadcn/button/index.js';
3
+ export type FormButtonProps = Button.Props;
4
+ </script>
5
+
6
+ <script lang="ts">
3
7
  import { cn, flyAndScale } from '../../utils/utils.js';
4
8
  import { getFormContext } from './form.svelte';
5
9
 
6
- let { ref = $bindable(null), children, class: className, ...restProps }: Button.Props = $props();
10
+ let { ref = $bindable(null), children, class: className, ...restProps }: FormButtonProps = $props();
7
11
 
8
12
  const form = getFormContext();
9
13
  const { submitting, delayed } = form;
@@ -1,4 +1,5 @@
1
1
  import * as Button from '$shadcn/button/index.js';
2
+ export type FormButtonProps = Button.Props;
2
3
  declare const FormButton: import("svelte").Component<Button.Props, {}, "ref">;
3
4
  type FormButton = ReturnType<typeof FormButton>;
4
5
  export default FormButton;
@@ -1 +1 @@
1
- {"version":3,"file":"form-button.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-button.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AA2BlD,QAAA,MAAM,UAAU,qDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"form-button.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-button.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,MAAM,MAAM,yBAAyB,CAAC;AAClD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC;AA8B7C,QAAA,MAAM,UAAU,qDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
@@ -0,0 +1,33 @@
1
+ <script module lang="ts">
2
+ import type { ControlAttrs, ControlProps } from 'formsnap';
3
+ export type FormControlProps = ControlProps;
4
+ </script>
5
+
6
+ <script lang="ts">
7
+ import { Control } from 'formsnap';
8
+ import { getFormContext, type FormContext } from './form.svelte';
9
+ import type { Snippet } from 'svelte';
10
+ import type { Expand } from 'svelte-toolbelt';
11
+
12
+ let {
13
+ children: childrenProp,
14
+ ...restProps
15
+ }: Omit<FormControlProps, 'children'> & {
16
+ children?: Snippet<
17
+ [
18
+ {
19
+ props: Expand<ControlAttrs>;
20
+ formData: FormContext<any, any>['form'];
21
+ }
22
+ ]
23
+ >;
24
+ } = $props();
25
+
26
+ const formData = getFormContext().form;
27
+ </script>
28
+
29
+ <Control {...restProps}>
30
+ {#snippet children({ props })}
31
+ {@render childrenProp?.({ props, formData })}
32
+ {/snippet}
33
+ </Control>
@@ -0,0 +1,17 @@
1
+ import type { ControlAttrs, ControlProps } from 'formsnap';
2
+ export type FormControlProps = ControlProps;
3
+ import { type FormContext } from './form.svelte';
4
+ import type { Snippet } from 'svelte';
5
+ import type { Expand } from 'svelte-toolbelt';
6
+ type $$ComponentProps = Omit<FormControlProps, 'children'> & {
7
+ children?: Snippet<[
8
+ {
9
+ props: Expand<ControlAttrs>;
10
+ formData: FormContext<any, any>['form'];
11
+ }
12
+ ]>;
13
+ };
14
+ declare const FormControl: import("svelte").Component<$$ComponentProps, {}, "">;
15
+ type FormControl = ReturnType<typeof FormControl>;
16
+ export default FormControl;
17
+ //# sourceMappingURL=form-control.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-control.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-control.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC3D,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC;AAI9C,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE7C,KAAK,gBAAgB,GAAI,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,GAAG;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAChB;QACE;YACE,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;YAC5B,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;SACzC;KACF,CACF,CAAC;CACH,CAAC;AAyBJ,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import * as FormPrimitive from 'formsnap';
3
- import { cn } from '$shadcn/utils.js';
3
+ import { cn } from '../../utils/utils.js';
4
4
  import type { WithoutChild } from 'svelte-toolbelt';
5
5
 
6
6
  let {
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
2
  import * as FormPrimitive from 'formsnap';
3
- import { cn, type WithoutChild } from '$shadcn/utils.js';
3
+ import { cn } from '$shadcn/utils.js';
4
+ import type { WithoutChild } from 'svelte-toolbelt';
4
5
 
5
6
  let {
6
7
  ref = $bindable(null),
@@ -1,4 +1,9 @@
1
- declare const FormFieldErrors: import("svelte").Component<any, {}, "ref">;
1
+ import * as FormPrimitive from 'formsnap';
2
+ import type { WithoutChild } from 'svelte-toolbelt';
3
+ type $$ComponentProps = WithoutChild<FormPrimitive.FieldErrorsProps> & {
4
+ errorClasses?: string | undefined | null;
5
+ };
6
+ declare const FormFieldErrors: import("svelte").Component<$$ComponentProps, {}, "ref">;
2
7
  type FormFieldErrors = ReturnType<typeof FormFieldErrors>;
3
8
  export default FormFieldErrors;
4
9
  //# sourceMappingURL=form-field-errors.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-field-errors.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-field-errors.svelte.ts"],"names":[],"mappings":"AAoCA,QAAA,MAAM,eAAe,4CAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"form-field-errors.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-field-errors.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,aAAa,MAAM,UAAU,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnD,KAAK,gBAAgB,GAAI,YAAY,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG;IACrE,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CAC1C,CAAC;AA6BJ,QAAA,MAAM,eAAe,yDAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
@@ -1,30 +1,38 @@
1
+ <script module lang="ts">
2
+ export type FormFullFieldProps<T extends Record<string, unknown>, U extends FormPath<T>> = FormFieldProps<T, U> & {
3
+ label: string;
4
+ description?: string;
5
+ inputProps: HTMLInputAttributes;
6
+ } & WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>>;
7
+ </script>
8
+
1
9
  <script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>">
2
- import Field from './form-field.svelte';
10
+ import Field, { type FormFieldProps } from './form-field.svelte';
3
11
  import Label from './form-label.svelte';
4
12
  import Description from './form-description.svelte';
5
13
  import FieldErrors from './form-field-errors.svelte';
6
14
  import { Input } from '$shadcn/input/index.js';
7
15
  import * as Form from 'formsnap';
8
- import type { FormPath } from 'sveltekit-superforms';
16
+ import { type FormPath } from 'sveltekit-superforms';
17
+ import { get, set } from 'radash';
9
18
  import { type WithElementRef, type WithoutChildren } from 'svelte-toolbelt';
10
19
  import { cn } from '../../utils/index.js';
11
20
  import type { HTMLAttributes, HTMLInputAttributes } from 'svelte/elements';
12
21
  import { mergeProps } from 'svelte-toolbelt';
22
+ import { getFormContext } from './form.svelte';
13
23
 
14
24
  let {
15
25
  ref = $bindable(null),
16
26
  class: className,
17
- form,
27
+ form = getFormContext<T, U>(),
18
28
  name,
19
29
  label,
20
30
  description = '',
21
31
  inputProps,
22
32
  ...restProps
23
- }: Form.FieldProps<T, U> & { label: string; description?: string; inputProps: HTMLInputAttributes } & WithoutChildren<
24
- WithElementRef<HTMLAttributes<HTMLDivElement>>
25
- > = $props();
33
+ }: FormFullFieldProps<T, U> = $props();
26
34
 
27
- const { form: formData } = form;
35
+ const formData = $derived(form.form);
28
36
  </script>
29
37
 
30
38
  <Field {form} {name} class={cn(className)} {...restProps}>
@@ -32,7 +40,9 @@
32
40
  {#snippet children({ props })}
33
41
  {@const inProps = mergeProps({ ...inputProps, ...props }) as typeof props}
34
42
  <Label>{label}</Label>
35
- <Input {...inProps} bind:value={$formData[name]} />
43
+
44
+ <!-- get and set because we need to dynamically index $formData -->
45
+ <Input {...inProps} bind:value={() => get($formData, name), (v) => ($formData = set($formData, name, v))} />
36
46
  {/snippet}
37
47
  </Form.Control>
38
48
 
@@ -1,13 +1,14 @@
1
- import * as Form from 'formsnap';
2
- import type { FormPath } from 'sveltekit-superforms';
3
- import { type WithElementRef } from 'svelte-toolbelt';
1
+ export type FormFullFieldProps<T extends Record<string, unknown>, U extends FormPath<T>> = FormFieldProps<T, U> & {
2
+ label: string;
3
+ description?: string;
4
+ inputProps: HTMLInputAttributes;
5
+ } & WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>>;
6
+ import { type FormFieldProps } from './form-field.svelte';
7
+ import { type FormPath } from 'sveltekit-superforms';
8
+ import { type WithElementRef, type WithoutChildren } from 'svelte-toolbelt';
4
9
  import type { HTMLAttributes, HTMLInputAttributes } from 'svelte/elements';
5
10
  declare class __sveltets_Render<T extends Record<string, unknown>, U extends FormPath<T>> {
6
- props(): Form.FieldProps<T, U, any> & {
7
- label: string;
8
- description?: string;
9
- inputProps: HTMLInputAttributes;
10
- } & Omit<WithElementRef<HTMLAttributes<HTMLDivElement>>, "children">;
11
+ props(): FormFullFieldProps<T, U>;
11
12
  events(): {};
12
13
  slots(): {};
13
14
  bindings(): "ref";
@@ -1 +1 @@
1
- {"version":3,"file":"form-field-full.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-field-full.svelte.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,IAAI,MAAM,UAAU,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAE5E,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AA+C3E,cAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC;IAC3E,KAAK;eAlCoD,MAAM;sBAAgB,MAAM;oBAAc,mBAAmB;;IAqCtH,MAAM;IAGN,KAAK;IAGL,QAAQ;IACR,OAAO;CACV;AAED,UAAU,qBAAqB;IAC3B,KAAK,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;QAAE,UAAU,CAAC,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C,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9b,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACrL,YAAY,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,EAAC,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;CACrE;AACD,QAAA,MAAM,aAAa,EAAE,qBAAmC,CAAC;AACvC,KAAK,aAAa,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,OAAO,aAAa,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC;AACxH,eAAe,aAAa,CAAC"}
@@ -1,18 +1,28 @@
1
+ <script module lang="ts">
2
+ export type FormFieldProps<T extends Record<string, unknown>, U extends FormPath<T>> = Omit<
3
+ FormPrimitive.FieldProps<T, U>,
4
+ 'form'
5
+ > & { form?: FormPrimitive.FieldProps<T, U>['form'] } & WithoutChildren<
6
+ WithElementRef<HTMLAttributes<HTMLDivElement>>
7
+ >;
8
+ </script>
9
+
1
10
  <script lang="ts" generics="T extends Record<string, unknown>, U extends FormPath<T>">
2
11
  import * as FormPrimitive from 'formsnap';
3
12
  import type { FormPath } from 'sveltekit-superforms';
4
13
  import { type WithElementRef, type WithoutChildren } from 'svelte-toolbelt';
5
14
  import { cn } from '../../utils/index.js';
6
15
  import type { HTMLAttributes } from 'svelte/elements';
16
+ import { getFormContext } from './form.svelte';
7
17
 
8
18
  let {
9
19
  ref = $bindable(null),
10
20
  class: className,
11
- form,
21
+ form = getFormContext<T, U>(),
12
22
  name,
13
23
  children: childrenProp,
14
24
  ...restProps
15
- }: FormPrimitive.FieldProps<T, U> & WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>> = $props();
25
+ }: FormFieldProps<T, U> = $props();
16
26
  </script>
17
27
 
18
28
  <FormPrimitive.Field {form} {name}>
@@ -1,9 +1,12 @@
1
+ export type FormFieldProps<T extends Record<string, unknown>, U extends FormPath<T>> = Omit<FormPrimitive.FieldProps<T, U>, 'form'> & {
2
+ form?: FormPrimitive.FieldProps<T, U>['form'];
3
+ } & WithoutChildren<WithElementRef<HTMLAttributes<HTMLDivElement>>>;
1
4
  import * as FormPrimitive from 'formsnap';
2
5
  import type { FormPath } from 'sveltekit-superforms';
3
- import { type WithElementRef } from 'svelte-toolbelt';
6
+ import { type WithElementRef, type WithoutChildren } from 'svelte-toolbelt';
4
7
  import type { HTMLAttributes } from 'svelte/elements';
5
8
  declare class __sveltets_Render<T extends Record<string, unknown>, U extends FormPath<T>> {
6
- props(): FormPrimitive.FieldProps<T, U, any> & Omit<WithElementRef<HTMLAttributes<HTMLDivElement>>, "children">;
9
+ props(): FormFieldProps<T, U>;
7
10
  events(): {};
8
11
  slots(): {};
9
12
  bindings(): "ref";
@@ -1 +1 @@
1
- {"version":3,"file":"form-field.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-field.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,aAAa,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,cAAc,EAAwB,MAAM,iBAAiB,CAAC;AAE5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA6BtD,cAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAC,CAAC,SAAS,QAAQ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AAC,EAAC,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,OAAO,SAAS,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC,CAAC;AAChH,eAAe,SAAS,CAAC"}
@@ -1,7 +1,8 @@
1
1
  <script lang="ts">
2
2
  import * as FormPrimitive from 'formsnap';
3
3
  import { Label } from '$shadcn/label/index.js';
4
- import { cn, type WithoutChild } from '$shadcn/utils.js';
4
+ import { cn } from 'svelte-ag';
5
+ import type { WithoutChild } from 'svelte-toolbelt';
5
6
 
6
7
  let {
7
8
  ref = $bindable(null),
@@ -1,5 +1,5 @@
1
1
  import * as FormPrimitive from 'formsnap';
2
- declare const FormLabel: import("svelte").Component<WithoutChild<FormPrimitive.LabelProps>, {}, "ref">;
2
+ declare const FormLabel: import("svelte").Component<Omit<FormPrimitive.LabelProps, "child">, {}, "ref">;
3
3
  type FormLabel = ReturnType<typeof FormLabel>;
4
4
  export default FormLabel;
5
5
  //# sourceMappingURL=form-label.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"form-label.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-label.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,aAAa,MAAM,UAAU,CAAC;AA2B1C,QAAA,MAAM,SAAS,+EAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"form-label.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-label.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,aAAa,MAAM,UAAU,CAAC;AA6B1C,QAAA,MAAM,SAAS,gFAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ import { cn } from '$shadcn/utils.js';
3
+ import { mergeProps, type WithChild, type WithoutChildren } from 'svelte-toolbelt';
4
+ import { flyAndScale, type HTMLDivAttributes } from '../../utils/index.js';
5
+ import { getFormContext } from './form.svelte';
6
+
7
+ let {
8
+ ref = $bindable(null),
9
+ child,
10
+ class: className,
11
+ ...restProps
12
+ }: WithoutChildren<WithChild<WithoutChildren<HTMLDivAttributes>, { message: string }>> = $props();
13
+
14
+ const form = getFormContext();
15
+
16
+ let message = $state<string>('');
17
+ form.message.subscribe((v) => (message = v as string));
18
+
19
+ const mergedProps = $derived(mergeProps(restProps, {}));
20
+ </script>
21
+
22
+ {#if child}
23
+ {@render child({
24
+ props: mergedProps,
25
+ message
26
+ })}
27
+ {:else if message}
28
+ <div transition:flyAndScale class={cn('', className)} {...mergedProps}>
29
+ {message}
30
+ </div>
31
+ {/if}
@@ -0,0 +1,8 @@
1
+ import { type WithChild } from 'svelte-toolbelt';
2
+ import { type HTMLDivAttributes } from '../../utils/index.js';
3
+ declare const FormMessage: import("svelte").Component<Omit<WithChild<Omit<HTMLDivAttributes, "children">, {
4
+ message: string;
5
+ }>, "children">, {}, "ref">;
6
+ type FormMessage = ReturnType<typeof FormMessage>;
7
+ export default FormMessage;
8
+ //# sourceMappingURL=form-message.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-message.svelte.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/form/form-message.svelte.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,SAAS,EAAwB,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAqCtE,QAAA,MAAM,WAAW;aADqF,MAAM;2BACnD,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
@@ -1,14 +1,16 @@
1
1
  <script module lang="ts">
2
2
  const formContextSymbolKey = 'super-form-context';
3
- export type FormContext = SuperForm<any>;
3
+ export type FormContext<T extends Record<string, unknown>, U> = SuperForm<T, U>;
4
4
 
5
- export function setFormContext(form: FormContext) {
5
+ export function setFormContext<T extends Record<string, unknown>, U>(form: FormContext<T, U>) {
6
6
  setContext(Symbol.for(formContextSymbolKey), form);
7
7
  }
8
8
 
9
- export function getFormContext(): FormContext {
9
+ export function getFormContext<T extends Record<string, unknown>, U>(): FormContext<T, U> {
10
10
  return getContext(Symbol.for(formContextSymbolKey));
11
11
  }
12
+
13
+ export type FormRootProps = WithElementRef<HTMLFormAttributes> & { form: SuperForm<any> };
12
14
  </script>
13
15
 
14
16
  <script lang="ts">
@@ -18,13 +20,7 @@
18
20
  import type { HTMLFormAttributes } from 'svelte/elements';
19
21
  import type { SuperForm } from 'sveltekit-superforms';
20
22
 
21
- let {
22
- class: className,
23
- ref = $bindable(null),
24
- children,
25
- form,
26
- ...restProps
27
- }: WithElementRef<HTMLFormAttributes> & { form: SuperForm<any> } = $props();
23
+ let { class: className, ref = $bindable(null), children, form, ...restProps }: FormRootProps = $props();
28
24
 
29
25
  const { enhance } = form;
30
26