performa 1.0.0
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.
- package/LICENSE +21 -0
- package/README.md +850 -0
- package/dist/index.cjs +1623 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +438 -0
- package/dist/index.d.ts +438 -0
- package/dist/index.js +1591 -0
- package/dist/index.js.map +1 -0
- package/dist/nextjs.cjs +1486 -0
- package/dist/nextjs.cjs.map +1 -0
- package/dist/nextjs.d.cts +77 -0
- package/dist/nextjs.d.ts +77 -0
- package/dist/nextjs.js +1483 -0
- package/dist/nextjs.js.map +1 -0
- package/dist/react-router.cjs +1466 -0
- package/dist/react-router.cjs.map +1 -0
- package/dist/react-router.d.cts +50 -0
- package/dist/react-router.d.ts +50 -0
- package/dist/react-router.js +1463 -0
- package/dist/react-router.js.map +1 -0
- package/dist/server-Cjhy29dZ.d.cts +159 -0
- package/dist/server-Cjhy29dZ.d.ts +159 -0
- package/dist/server.cjs +42 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +1 -0
- package/dist/server.d.ts +1 -0
- package/dist/server.js +40 -0
- package/dist/server.js.map +1 -0
- package/dist/tanstack-start.cjs +1499 -0
- package/dist/tanstack-start.cjs.map +1 -0
- package/dist/tanstack-start.d.cts +78 -0
- package/dist/tanstack-start.d.ts +78 -0
- package/dist/tanstack-start.js +1496 -0
- package/dist/tanstack-start.js.map +1 -0
- package/package.json +140 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common MIME types for file validation
|
|
3
|
+
*/
|
|
4
|
+
declare const mimeTypes: {
|
|
5
|
+
readonly JPG: "image/jpeg";
|
|
6
|
+
readonly JPEG: "image/jpeg";
|
|
7
|
+
readonly PNG: "image/png";
|
|
8
|
+
readonly GIF: "image/gif";
|
|
9
|
+
readonly WEBP: "image/webp";
|
|
10
|
+
readonly SVG: "image/svg+xml";
|
|
11
|
+
readonly BMP: "image/bmp";
|
|
12
|
+
readonly TIFF: "image/tiff";
|
|
13
|
+
readonly ICO: "image/x-icon";
|
|
14
|
+
readonly PDF: "application/pdf";
|
|
15
|
+
readonly DOC: "application/msword";
|
|
16
|
+
readonly DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
17
|
+
readonly XLS: "application/vnd.ms-excel";
|
|
18
|
+
readonly XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
19
|
+
readonly PPT: "application/vnd.ms-powerpoint";
|
|
20
|
+
readonly PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
21
|
+
readonly ZIP: "application/zip";
|
|
22
|
+
readonly RAR: "application/x-rar-compressed";
|
|
23
|
+
readonly '7Z': "application/x-7z-compressed";
|
|
24
|
+
readonly TAR: "application/x-tar";
|
|
25
|
+
readonly GZ: "application/x-gzip";
|
|
26
|
+
readonly BZ2: "application/x-bzip2";
|
|
27
|
+
readonly ISO: "application/x-iso9660-image";
|
|
28
|
+
readonly SWF: "application/x-shockwave-flash";
|
|
29
|
+
readonly TTF: "application/x-font-ttf";
|
|
30
|
+
readonly MP4: "video/mp4";
|
|
31
|
+
readonly MP3: "audio/mpeg";
|
|
32
|
+
readonly MOV: "video/quicktime";
|
|
33
|
+
readonly AVI: "video/x-msvideo";
|
|
34
|
+
readonly WMV: "video/x-ms-wmv";
|
|
35
|
+
readonly MPEG: "video/mpeg";
|
|
36
|
+
readonly TXT: "text/plain";
|
|
37
|
+
readonly CSV: "text/csv";
|
|
38
|
+
};
|
|
39
|
+
type MimeTypeKey = keyof typeof mimeTypes;
|
|
40
|
+
/**
|
|
41
|
+
* Validation rules that can be applied to form fields
|
|
42
|
+
*/
|
|
43
|
+
type ValidationRules = {
|
|
44
|
+
required?: boolean;
|
|
45
|
+
minLength?: number;
|
|
46
|
+
maxLength?: number;
|
|
47
|
+
pattern?: RegExp;
|
|
48
|
+
isEmail?: boolean;
|
|
49
|
+
isNumber?: boolean;
|
|
50
|
+
isPhone?: boolean;
|
|
51
|
+
isUrl?: boolean;
|
|
52
|
+
isDate?: boolean;
|
|
53
|
+
isTime?: boolean;
|
|
54
|
+
weakPasswordCheck?: boolean;
|
|
55
|
+
matches?: string;
|
|
56
|
+
denyHtml?: boolean;
|
|
57
|
+
isAlphanumeric?: boolean;
|
|
58
|
+
mimeTypes?: Array<MimeTypeKey>;
|
|
59
|
+
maxFileSize?: number;
|
|
60
|
+
mustBeEither?: Array<string | number>;
|
|
61
|
+
minValue?: number;
|
|
62
|
+
maxValue?: number;
|
|
63
|
+
isInteger?: boolean;
|
|
64
|
+
isSlug?: boolean;
|
|
65
|
+
isUUID?: boolean;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* File metadata returned after upload
|
|
69
|
+
*/
|
|
70
|
+
type FileMetaData = {
|
|
71
|
+
success: boolean;
|
|
72
|
+
fileName?: string;
|
|
73
|
+
fileType?: string;
|
|
74
|
+
fileSize?: number;
|
|
75
|
+
etag?: string;
|
|
76
|
+
lastModified?: string;
|
|
77
|
+
error?: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Supported field types (excluding markdown which is unfinished)
|
|
81
|
+
*/
|
|
82
|
+
type FieldType = 'text' | 'email' | 'password' | 'select' | 'textarea' | 'checkbox' | 'toggle' | 'radio' | 'file' | 'hidden' | 'number' | 'datetime' | 'none' | 'submit';
|
|
83
|
+
/**
|
|
84
|
+
* Option type for select, radio, and similar fields
|
|
85
|
+
*/
|
|
86
|
+
type FieldOption = {
|
|
87
|
+
label: string;
|
|
88
|
+
value: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Grid width options (12-column grid system)
|
|
92
|
+
*/
|
|
93
|
+
type GridWidth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
94
|
+
/**
|
|
95
|
+
* Form field configuration
|
|
96
|
+
*/
|
|
97
|
+
type FormField = {
|
|
98
|
+
label: string;
|
|
99
|
+
placeholder?: string;
|
|
100
|
+
options?: Array<FieldOption>;
|
|
101
|
+
type: FieldType;
|
|
102
|
+
defaultValue?: string | number;
|
|
103
|
+
defaultChecked?: boolean;
|
|
104
|
+
className?: string;
|
|
105
|
+
disabled?: boolean;
|
|
106
|
+
before?: string;
|
|
107
|
+
beforeClassName?: string;
|
|
108
|
+
after?: string;
|
|
109
|
+
afterClassName?: string;
|
|
110
|
+
error?: string;
|
|
111
|
+
hideSpinner?: boolean;
|
|
112
|
+
width?: GridWidth;
|
|
113
|
+
rules?: ValidationRules;
|
|
114
|
+
metaData?: FileMetaData;
|
|
115
|
+
uploadDir?: string;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Form configuration object
|
|
119
|
+
*/
|
|
120
|
+
type FormConfig = {
|
|
121
|
+
key: string;
|
|
122
|
+
method?: 'get' | 'post';
|
|
123
|
+
encType?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain';
|
|
124
|
+
action?: string;
|
|
125
|
+
fields: {
|
|
126
|
+
[key: string]: FormField;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Resolved form field with options always as array
|
|
131
|
+
*/
|
|
132
|
+
type ResolvedFormField = FormField;
|
|
133
|
+
/**
|
|
134
|
+
* Resolved form config with resolved options
|
|
135
|
+
*/
|
|
136
|
+
type ResolvedFormConfig = FormConfig;
|
|
137
|
+
/**
|
|
138
|
+
* Form errors object
|
|
139
|
+
*/
|
|
140
|
+
type FormErrors = {
|
|
141
|
+
[key: string]: string | undefined;
|
|
142
|
+
__server?: string;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Form context state
|
|
146
|
+
*/
|
|
147
|
+
type FormState = {
|
|
148
|
+
errors?: FormErrors;
|
|
149
|
+
isSubmitting: boolean;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Form context value type
|
|
153
|
+
*/
|
|
154
|
+
type FormContextValue = {
|
|
155
|
+
state: FormState;
|
|
156
|
+
config: ResolvedFormConfig;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export { type FormErrors as F, type GridWidth as G, type MimeTypeKey as M, type ResolvedFormConfig as R, type ValidationRules as V, type FormConfig as a, type FormField as b, type FormContextValue as c, type FormState as d, type ResolvedFormField as e, type FileMetaData as f, type FieldType as g, type FieldOption as h, mimeTypes as m };
|
package/dist/server.cjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/core/types.ts
|
|
4
|
+
var mimeTypes = {
|
|
5
|
+
JPG: "image/jpeg",
|
|
6
|
+
JPEG: "image/jpeg",
|
|
7
|
+
PNG: "image/png",
|
|
8
|
+
GIF: "image/gif",
|
|
9
|
+
WEBP: "image/webp",
|
|
10
|
+
SVG: "image/svg+xml",
|
|
11
|
+
BMP: "image/bmp",
|
|
12
|
+
TIFF: "image/tiff",
|
|
13
|
+
ICO: "image/x-icon",
|
|
14
|
+
PDF: "application/pdf",
|
|
15
|
+
DOC: "application/msword",
|
|
16
|
+
DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
17
|
+
XLS: "application/vnd.ms-excel",
|
|
18
|
+
XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
19
|
+
PPT: "application/vnd.ms-powerpoint",
|
|
20
|
+
PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
21
|
+
ZIP: "application/zip",
|
|
22
|
+
RAR: "application/x-rar-compressed",
|
|
23
|
+
"7Z": "application/x-7z-compressed",
|
|
24
|
+
TAR: "application/x-tar",
|
|
25
|
+
GZ: "application/x-gzip",
|
|
26
|
+
BZ2: "application/x-bzip2",
|
|
27
|
+
ISO: "application/x-iso9660-image",
|
|
28
|
+
SWF: "application/x-shockwave-flash",
|
|
29
|
+
TTF: "application/x-font-ttf",
|
|
30
|
+
MP4: "video/mp4",
|
|
31
|
+
MP3: "audio/mpeg",
|
|
32
|
+
MOV: "video/quicktime",
|
|
33
|
+
AVI: "video/x-msvideo",
|
|
34
|
+
WMV: "video/x-ms-wmv",
|
|
35
|
+
MPEG: "video/mpeg",
|
|
36
|
+
TXT: "text/plain",
|
|
37
|
+
CSV: "text/csv"
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.mimeTypes = mimeTypes;
|
|
41
|
+
//# sourceMappingURL=server.cjs.map
|
|
42
|
+
//# sourceMappingURL=server.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/types.ts"],"names":[],"mappings":";;;AAGO,IAAM,SAAA,GAAY;AAAA,EACrB,GAAA,EAAK,YAAA;AAAA,EACL,IAAA,EAAM,YAAA;AAAA,EACN,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK,WAAA;AAAA,EACL,IAAA,EAAM,YAAA;AAAA,EACN,GAAA,EAAK,eAAA;AAAA,EACL,GAAA,EAAK,WAAA;AAAA,EACL,IAAA,EAAM,YAAA;AAAA,EACN,GAAA,EAAK,cAAA;AAAA,EACL,GAAA,EAAK,iBAAA;AAAA,EACL,GAAA,EAAK,oBAAA;AAAA,EACL,IAAA,EAAM,yEAAA;AAAA,EACN,GAAA,EAAK,0BAAA;AAAA,EACL,IAAA,EAAM,mEAAA;AAAA,EACN,GAAA,EAAK,+BAAA;AAAA,EACL,IAAA,EAAM,2EAAA;AAAA,EACN,GAAA,EAAK,iBAAA;AAAA,EACL,GAAA,EAAK,8BAAA;AAAA,EACL,IAAA,EAAM,6BAAA;AAAA,EACN,GAAA,EAAK,mBAAA;AAAA,EACL,EAAA,EAAI,oBAAA;AAAA,EACJ,GAAA,EAAK,qBAAA;AAAA,EACL,GAAA,EAAK,6BAAA;AAAA,EACL,GAAA,EAAK,+BAAA;AAAA,EACL,GAAA,EAAK,wBAAA;AAAA,EACL,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK,YAAA;AAAA,EACL,GAAA,EAAK,iBAAA;AAAA,EACL,GAAA,EAAK,iBAAA;AAAA,EACL,GAAA,EAAK,gBAAA;AAAA,EACL,IAAA,EAAM,YAAA;AAAA,EACN,GAAA,EAAK,YAAA;AAAA,EACL,GAAA,EAAK;AACT","file":"server.cjs","sourcesContent":["/**\n * Common MIME types for file validation\n */\nexport const mimeTypes = {\n JPG: 'image/jpeg',\n JPEG: 'image/jpeg',\n PNG: 'image/png',\n GIF: 'image/gif',\n WEBP: 'image/webp',\n SVG: 'image/svg+xml',\n BMP: 'image/bmp',\n TIFF: 'image/tiff',\n ICO: 'image/x-icon',\n PDF: 'application/pdf',\n DOC: 'application/msword',\n DOCX: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n XLS: 'application/vnd.ms-excel',\n XLSX: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n PPT: 'application/vnd.ms-powerpoint',\n PPTX: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n ZIP: 'application/zip',\n RAR: 'application/x-rar-compressed',\n '7Z': 'application/x-7z-compressed',\n TAR: 'application/x-tar',\n GZ: 'application/x-gzip',\n BZ2: 'application/x-bzip2',\n ISO: 'application/x-iso9660-image',\n SWF: 'application/x-shockwave-flash',\n TTF: 'application/x-font-ttf',\n MP4: 'video/mp4',\n MP3: 'audio/mpeg',\n MOV: 'video/quicktime',\n AVI: 'video/x-msvideo',\n WMV: 'video/x-ms-wmv',\n MPEG: 'video/mpeg',\n TXT: 'text/plain',\n CSV: 'text/csv',\n} as const;\n\nexport type MimeTypeKey = keyof typeof mimeTypes;\n\n/**\n * Validation rules that can be applied to form fields\n */\nexport type ValidationRules = {\n required?: boolean;\n minLength?: number;\n maxLength?: number;\n pattern?: RegExp;\n isEmail?: boolean;\n isNumber?: boolean;\n isPhone?: boolean;\n isUrl?: boolean;\n isDate?: boolean;\n isTime?: boolean;\n weakPasswordCheck?: boolean;\n matches?: string;\n denyHtml?: boolean;\n isAlphanumeric?: boolean;\n mimeTypes?: Array<MimeTypeKey>;\n maxFileSize?: number;\n mustBeEither?: Array<string | number>;\n minValue?: number;\n maxValue?: number;\n isInteger?: boolean;\n isSlug?: boolean;\n isUUID?: boolean;\n};\n\n/**\n * File metadata returned after upload\n */\nexport type FileMetaData = {\n success: boolean;\n fileName?: string;\n fileType?: string;\n fileSize?: number;\n etag?: string;\n lastModified?: string;\n error?: string;\n};\n\n/**\n * Supported field types (excluding markdown which is unfinished)\n */\nexport type FieldType =\n | 'text'\n | 'email'\n | 'password'\n | 'select'\n | 'textarea'\n | 'checkbox'\n | 'toggle'\n | 'radio'\n | 'file'\n | 'hidden'\n | 'number'\n | 'datetime'\n | 'none'\n | 'submit';\n\n/**\n * Option type for select, radio, and similar fields\n */\nexport type FieldOption = {\n label: string;\n value: string;\n};\n\n/**\n * Grid width options (12-column grid system)\n */\nexport type GridWidth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * Form field configuration\n */\nexport type FormField = {\n label: string;\n placeholder?: string;\n options?: Array<FieldOption>;\n type: FieldType;\n defaultValue?: string | number;\n defaultChecked?: boolean;\n className?: string;\n disabled?: boolean;\n before?: string;\n beforeClassName?: string;\n after?: string;\n afterClassName?: string;\n error?: string;\n hideSpinner?: boolean;\n width?: GridWidth;\n rules?: ValidationRules;\n metaData?: FileMetaData;\n uploadDir?: string;\n};\n\n/**\n * Form configuration object\n */\nexport type FormConfig = {\n key: string;\n method?: 'get' | 'post';\n encType?:\n | 'application/x-www-form-urlencoded'\n | 'multipart/form-data'\n | 'text/plain';\n action?: string;\n fields: {\n [key: string]: FormField;\n };\n};\n\n/**\n * Resolved form field with options always as array\n */\nexport type ResolvedFormField = FormField;\n\n/**\n * Resolved form config with resolved options\n */\nexport type ResolvedFormConfig = FormConfig;\n\n/**\n * Form errors object\n */\nexport type FormErrors = {\n [key: string]: string | undefined;\n __server?: string;\n};\n\n/**\n * Form context state\n */\nexport type FormState = {\n errors?: FormErrors;\n isSubmitting: boolean;\n};\n\n/**\n * Form context value type\n */\nexport type FormContextValue = {\n state: FormState;\n config: ResolvedFormConfig;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as FormConfig, F as FormErrors, b as FormField, M as MimeTypeKey, V as ValidationRules, m as mimeTypes } from './server-Cjhy29dZ.cjs';
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { a as FormConfig, F as FormErrors, b as FormField, M as MimeTypeKey, V as ValidationRules, m as mimeTypes } from './server-Cjhy29dZ.js';
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/core/types.ts
|
|
2
|
+
var mimeTypes = {
|
|
3
|
+
JPG: "image/jpeg",
|
|
4
|
+
JPEG: "image/jpeg",
|
|
5
|
+
PNG: "image/png",
|
|
6
|
+
GIF: "image/gif",
|
|
7
|
+
WEBP: "image/webp",
|
|
8
|
+
SVG: "image/svg+xml",
|
|
9
|
+
BMP: "image/bmp",
|
|
10
|
+
TIFF: "image/tiff",
|
|
11
|
+
ICO: "image/x-icon",
|
|
12
|
+
PDF: "application/pdf",
|
|
13
|
+
DOC: "application/msword",
|
|
14
|
+
DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
15
|
+
XLS: "application/vnd.ms-excel",
|
|
16
|
+
XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
17
|
+
PPT: "application/vnd.ms-powerpoint",
|
|
18
|
+
PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
19
|
+
ZIP: "application/zip",
|
|
20
|
+
RAR: "application/x-rar-compressed",
|
|
21
|
+
"7Z": "application/x-7z-compressed",
|
|
22
|
+
TAR: "application/x-tar",
|
|
23
|
+
GZ: "application/x-gzip",
|
|
24
|
+
BZ2: "application/x-bzip2",
|
|
25
|
+
ISO: "application/x-iso9660-image",
|
|
26
|
+
SWF: "application/x-shockwave-flash",
|
|
27
|
+
TTF: "application/x-font-ttf",
|
|
28
|
+
MP4: "video/mp4",
|
|
29
|
+
MP3: "audio/mpeg",
|
|
30
|
+
MOV: "video/quicktime",
|
|
31
|
+
AVI: "video/x-msvideo",
|
|
32
|
+
WMV: "video/x-ms-wmv",
|
|
33
|
+
MPEG: "video/mpeg",
|
|
34
|
+
TXT: "text/plain",
|
|
35
|
+
CSV: "text/csv"
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export { mimeTypes };
|
|
39
|
+
//# sourceMappingURL=server.js.map
|
|
40
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/types.ts"],"names":[],"mappings":";AAGO,IAAM,SAAA,GAAY;AAAA,EACrB,GAAA,EAAK,YAAA;AAAA,EACL,IAAA,EAAM,YAAA;AAAA,EACN,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK,WAAA;AAAA,EACL,IAAA,EAAM,YAAA;AAAA,EACN,GAAA,EAAK,eAAA;AAAA,EACL,GAAA,EAAK,WAAA;AAAA,EACL,IAAA,EAAM,YAAA;AAAA,EACN,GAAA,EAAK,cAAA;AAAA,EACL,GAAA,EAAK,iBAAA;AAAA,EACL,GAAA,EAAK,oBAAA;AAAA,EACL,IAAA,EAAM,yEAAA;AAAA,EACN,GAAA,EAAK,0BAAA;AAAA,EACL,IAAA,EAAM,mEAAA;AAAA,EACN,GAAA,EAAK,+BAAA;AAAA,EACL,IAAA,EAAM,2EAAA;AAAA,EACN,GAAA,EAAK,iBAAA;AAAA,EACL,GAAA,EAAK,8BAAA;AAAA,EACL,IAAA,EAAM,6BAAA;AAAA,EACN,GAAA,EAAK,mBAAA;AAAA,EACL,EAAA,EAAI,oBAAA;AAAA,EACJ,GAAA,EAAK,qBAAA;AAAA,EACL,GAAA,EAAK,6BAAA;AAAA,EACL,GAAA,EAAK,+BAAA;AAAA,EACL,GAAA,EAAK,wBAAA;AAAA,EACL,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK,YAAA;AAAA,EACL,GAAA,EAAK,iBAAA;AAAA,EACL,GAAA,EAAK,iBAAA;AAAA,EACL,GAAA,EAAK,gBAAA;AAAA,EACL,IAAA,EAAM,YAAA;AAAA,EACN,GAAA,EAAK,YAAA;AAAA,EACL,GAAA,EAAK;AACT","file":"server.js","sourcesContent":["/**\n * Common MIME types for file validation\n */\nexport const mimeTypes = {\n JPG: 'image/jpeg',\n JPEG: 'image/jpeg',\n PNG: 'image/png',\n GIF: 'image/gif',\n WEBP: 'image/webp',\n SVG: 'image/svg+xml',\n BMP: 'image/bmp',\n TIFF: 'image/tiff',\n ICO: 'image/x-icon',\n PDF: 'application/pdf',\n DOC: 'application/msword',\n DOCX: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n XLS: 'application/vnd.ms-excel',\n XLSX: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n PPT: 'application/vnd.ms-powerpoint',\n PPTX: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n ZIP: 'application/zip',\n RAR: 'application/x-rar-compressed',\n '7Z': 'application/x-7z-compressed',\n TAR: 'application/x-tar',\n GZ: 'application/x-gzip',\n BZ2: 'application/x-bzip2',\n ISO: 'application/x-iso9660-image',\n SWF: 'application/x-shockwave-flash',\n TTF: 'application/x-font-ttf',\n MP4: 'video/mp4',\n MP3: 'audio/mpeg',\n MOV: 'video/quicktime',\n AVI: 'video/x-msvideo',\n WMV: 'video/x-ms-wmv',\n MPEG: 'video/mpeg',\n TXT: 'text/plain',\n CSV: 'text/csv',\n} as const;\n\nexport type MimeTypeKey = keyof typeof mimeTypes;\n\n/**\n * Validation rules that can be applied to form fields\n */\nexport type ValidationRules = {\n required?: boolean;\n minLength?: number;\n maxLength?: number;\n pattern?: RegExp;\n isEmail?: boolean;\n isNumber?: boolean;\n isPhone?: boolean;\n isUrl?: boolean;\n isDate?: boolean;\n isTime?: boolean;\n weakPasswordCheck?: boolean;\n matches?: string;\n denyHtml?: boolean;\n isAlphanumeric?: boolean;\n mimeTypes?: Array<MimeTypeKey>;\n maxFileSize?: number;\n mustBeEither?: Array<string | number>;\n minValue?: number;\n maxValue?: number;\n isInteger?: boolean;\n isSlug?: boolean;\n isUUID?: boolean;\n};\n\n/**\n * File metadata returned after upload\n */\nexport type FileMetaData = {\n success: boolean;\n fileName?: string;\n fileType?: string;\n fileSize?: number;\n etag?: string;\n lastModified?: string;\n error?: string;\n};\n\n/**\n * Supported field types (excluding markdown which is unfinished)\n */\nexport type FieldType =\n | 'text'\n | 'email'\n | 'password'\n | 'select'\n | 'textarea'\n | 'checkbox'\n | 'toggle'\n | 'radio'\n | 'file'\n | 'hidden'\n | 'number'\n | 'datetime'\n | 'none'\n | 'submit';\n\n/**\n * Option type for select, radio, and similar fields\n */\nexport type FieldOption = {\n label: string;\n value: string;\n};\n\n/**\n * Grid width options (12-column grid system)\n */\nexport type GridWidth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;\n\n/**\n * Form field configuration\n */\nexport type FormField = {\n label: string;\n placeholder?: string;\n options?: Array<FieldOption>;\n type: FieldType;\n defaultValue?: string | number;\n defaultChecked?: boolean;\n className?: string;\n disabled?: boolean;\n before?: string;\n beforeClassName?: string;\n after?: string;\n afterClassName?: string;\n error?: string;\n hideSpinner?: boolean;\n width?: GridWidth;\n rules?: ValidationRules;\n metaData?: FileMetaData;\n uploadDir?: string;\n};\n\n/**\n * Form configuration object\n */\nexport type FormConfig = {\n key: string;\n method?: 'get' | 'post';\n encType?:\n | 'application/x-www-form-urlencoded'\n | 'multipart/form-data'\n | 'text/plain';\n action?: string;\n fields: {\n [key: string]: FormField;\n };\n};\n\n/**\n * Resolved form field with options always as array\n */\nexport type ResolvedFormField = FormField;\n\n/**\n * Resolved form config with resolved options\n */\nexport type ResolvedFormConfig = FormConfig;\n\n/**\n * Form errors object\n */\nexport type FormErrors = {\n [key: string]: string | undefined;\n __server?: string;\n};\n\n/**\n * Form context state\n */\nexport type FormState = {\n errors?: FormErrors;\n isSubmitting: boolean;\n};\n\n/**\n * Form context value type\n */\nexport type FormContextValue = {\n state: FormState;\n config: ResolvedFormConfig;\n};\n"]}
|