@functionalcms/svelte-components 4.10.32 → 4.10.35

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.
@@ -4,7 +4,7 @@
4
4
  import Input from './Input.svelte';
5
5
  import Select from './Select.svelte';
6
6
  import Switch from './Switch.svelte';
7
- import { Placement } from '../Styling.ts';
7
+ import { Placement } from '../Styling.js';
8
8
  import { addTransactionSupport } from 'ioredis/built/transaction.js';
9
9
  import Button from './Button.svelte';
10
10
 
@@ -1,5 +1,5 @@
1
1
  import { type Field } from './form.js';
2
- import { Placement } from '../Styling.ts';
2
+ import { Placement } from '../Styling.js';
3
3
  declare const Form: import("svelte").Component<Partial<{
4
4
  buttons: Array<{
5
5
  label: string;
@@ -5,7 +5,7 @@ export interface Field {
5
5
  meta: any;
6
6
  isRequired: boolean;
7
7
  }
8
- export declare function serialize(schema: any): Array<Field>;
8
+ export declare function serialize(schema: any): Promise<import("sveltekit-superforms").SuperValidated<{}, any, {}>>;
9
9
  export declare function mapEntiresToOptions(field: Field): {
10
10
  label: string;
11
11
  value: string;
@@ -1,18 +1,22 @@
1
- export function serialize(schema) {
2
- const keys = schema._nodes.reverse();
3
- const fields = keys.map((key) => {
4
- const field = schema.fields[key];
5
- const hasEntries = field._whitelist.size > 0;
6
- const isOptional = field.spec.optional ?? true;
7
- return {
8
- name: key,
9
- type: hasEntries ? "enum" : field.type,
10
- entries: hasEntries ? [...field._whitelist] : [],
11
- meta: field.spec.meta ?? {},
12
- isRequired: !isOptional,
13
- };
14
- });
15
- return fields;
1
+ import { superValidate } from 'sveltekit-superforms';
2
+ import { yup } from 'sveltekit-superforms/adapters';
3
+ export async function serialize(schema) {
4
+ // const keys = schema._nodes.reverse();
5
+ // const fields: Array<Field> = keys.map((key: string) => {
6
+ // const field = schema.fields[key];
7
+ // const hasEntries = field._whitelist.size > 0;
8
+ // const isOptional = field.spec.optional ?? true;
9
+ // return {
10
+ // name: key,
11
+ // type: hasEntries ? "enum" : field.type,
12
+ // entries: hasEntries ? [...field._whitelist] : [],
13
+ // meta: field.spec.meta ?? {},
14
+ // isRequired: !isOptional,
15
+ // };
16
+ // });
17
+ // return fields;
18
+ const form = await superValidate(yup(schema));
19
+ return form;
16
20
  }
17
21
  export function mapEntiresToOptions(field) {
18
22
  return (field?.entries?.map((entry) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionalcms/svelte-components",
3
- "version": "4.10.32",
3
+ "version": "4.10.35",
4
4
  "watch": {
5
5
  "build": {
6
6
  "patterns": [