@dmitryvim/form-builder 0.1.22 → 0.1.25

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.
@@ -13,7 +13,7 @@ Core requirements and specifications for the Form Builder library.
13
13
  ### Core Value Propositions
14
14
 
15
15
  1. **Rapid Form Development**: Schema → Form in minutes, not hours
16
- 2. **Consistent UX**: Standardized form behavior across applications
16
+ 2. **Consistent UX**: Standardized form behavior across applications
17
17
  3. **Zero Dependencies**: No framework lock-in or bundle bloat
18
18
  4. **File Upload Ready**: Built-in support for modern file workflows
19
19
  5. **Deployment Flexibility**: CDN, NPM, or self-hosted options
@@ -30,8 +30,9 @@ Core requirements and specifications for the Form Builder library.
30
30
  ### 1. Form Generation Engine
31
31
 
32
32
  **MUST support field types:**
33
+
33
34
  - `text` - Single line input with validation
34
- - `textarea` - Multi-line text input
35
+ - `textarea` - Multi-line text input
35
36
  - `number` - Numeric input with constraints
36
37
  - `select` - Dropdown with options
37
38
  - `file` - Single file upload with preview
@@ -46,7 +47,7 @@ Core requirements and specifications for the Form Builder library.
46
47
  "elements": [
47
48
  {
48
49
  "type": "files",
49
- "key": "assets",
50
+ "key": "assets",
50
51
  "label": "Images",
51
52
  "maxCount": 10,
52
53
  "accept": { "extensions": ["jpg", "png"] }
@@ -58,15 +59,17 @@ Core requirements and specifications for the Form Builder library.
58
59
  ### 2. Validation System
59
60
 
60
61
  **MUST provide:**
62
+
61
63
  - Real-time field validation
62
64
  - Required field checking
63
65
  - String length limits (minLength/maxLength)
64
- - Numeric ranges (min/max)
66
+ - Numeric ranges (min/max)
65
67
  - Pattern matching (regex)
66
68
  - File type restrictions
67
69
  - Custom validation rules
68
70
 
69
71
  **MUST support:**
72
+
70
73
  - Form submission with full validation
71
74
  - Draft saving without validation
72
75
  - Field-level error display
@@ -74,17 +77,19 @@ Core requirements and specifications for the Form Builder library.
74
77
  ### 3. File Upload System
75
78
 
76
79
  **Upload Handler Requirements:**
80
+
77
81
  ```javascript
78
82
  // Handler MUST return resource ID for download/submission
79
83
  uploadHandler: async (file) => {
80
- // Upload logic...
81
- return resourceId; // NOT file URL
82
- }
84
+ // Upload logic...
85
+ return resourceId; // NOT file URL
86
+ };
83
87
  ```
84
88
 
85
89
  **MUST provide:**
90
+
86
91
  - Visual file previews (thumbnails + icons)
87
- - Upload progress indicators
92
+ - Upload progress indicators
88
93
  - Individual file removal
89
94
  - Drag & drop support
90
95
  - File metadata display (name, size, type)
@@ -92,17 +97,20 @@ uploadHandler: async (file) => {
92
97
  ### 4. Form Modes
93
98
 
94
99
  **Submission Mode** (default):
100
+
95
101
  - Full editing capabilities
96
102
  - Real-time validation
97
103
  - Submit button requires all validation to pass
98
104
 
99
105
  **Read-Only Mode**:
106
+
100
107
  - Display form data without editing
101
108
  - Show file download links
102
109
  - Disable all form interactions
103
110
  - Support nested object display
104
111
 
105
112
  **Draft Mode**:
113
+
106
114
  - Save incomplete forms
107
115
  - Skip required field validation
108
116
  - Preserve user input
@@ -111,6 +119,7 @@ uploadHandler: async (file) => {
111
119
  ### 5. Integration Capabilities
112
120
 
113
121
  **MUST support:**
122
+
114
123
  - CDN via iframe embedding
115
124
  - NPM package installation
116
125
  - Direct HTML integration
@@ -120,15 +129,19 @@ uploadHandler: async (file) => {
120
129
 
121
130
  ```html
122
131
  <!-- CDN Integration -->
123
- <iframe src="https://picazru.github.io/form-builder/dist/index.html"
124
- width="100%" height="600px"></iframe>
132
+ <iframe
133
+ src="https://picazru.github.io/form-builder/dist/index.html"
134
+ width="100%"
135
+ height="600px"
136
+ ></iframe>
125
137
  ```
126
138
 
127
139
  ### 6. Styling System
128
140
 
129
141
  **MUST use Tailwind CSS** for all styling:
142
+
130
143
  - Consistent design system
131
- - Responsive layouts
144
+ - Responsive layouts
132
145
  - Dark/light theme support
133
146
  - Custom CSS property integration
134
147
  - Framework compatibility
@@ -138,12 +151,14 @@ uploadHandler: async (file) => {
138
151
  ### 1. Architecture
139
152
 
140
153
  **Core Stack:**
154
+
141
155
  - HTML5 semantic markup
142
156
  - CSS3 with custom properties
143
157
  - Vanilla JavaScript (ES6+)
144
158
  - Web APIs (FormData, PostMessage, Crypto)
145
159
 
146
160
  **Performance:**
161
+
147
162
  - Library size <500KB uncompressed
148
163
  - Form rendering <2s for 1000 fields
149
164
  - Real-time validation without UI blocking
@@ -151,6 +166,7 @@ uploadHandler: async (file) => {
151
166
  ### 2. Browser Support
152
167
 
153
168
  **MUST support:**
169
+
154
170
  - Chrome 80+, Firefox 75+, Safari 13+, Edge 80+
155
171
  - Mobile browsers with touch interfaces
156
172
  - Progressive enhancement for older browsers
@@ -158,6 +174,7 @@ uploadHandler: async (file) => {
158
174
  ### 3. Security
159
175
 
160
176
  **MUST implement:**
177
+
161
178
  - Input sanitization for all user data
162
179
  - File type validation (MIME + extension)
163
180
  - Secure resource ID generation
@@ -167,6 +184,7 @@ uploadHandler: async (file) => {
167
184
  ### 4. Data Formats
168
185
 
169
186
  **Schema Format (v0.3):**
187
+
170
188
  ```typescript
171
189
  interface FormSchema {
172
190
  version: "0.3";
@@ -176,6 +194,7 @@ interface FormSchema {
176
194
  ```
177
195
 
178
196
  **Output Format:**
197
+
179
198
  ```json
180
199
  {
181
200
  "textField": "value",
@@ -190,17 +209,20 @@ interface FormSchema {
190
209
  ## Quality Requirements
191
210
 
192
211
  ### Performance Metrics
212
+
193
213
  - **Form Rendering**: <2 seconds for 1000 fields
194
214
  - **File Upload**: >95% success rate under size limits
195
215
  - **Validation Speed**: <100ms per field
196
216
  - **Memory Usage**: <50MB for large forms
197
217
 
198
218
  ### Reliability
219
+
199
220
  - **Browser Compatibility**: >99% success rate on target browsers
200
221
  - **Error Recovery**: Graceful fallback for all error conditions
201
222
  - **Data Integrity**: No data loss during form interactions
202
223
 
203
224
  ### Usability
225
+
204
226
  - **Accessibility**: WCAG 2.1 AA compliance
205
227
  - **Mobile Support**: Touch-friendly interfaces
206
228
  - **Error Messages**: Clear, actionable feedback
@@ -209,17 +231,20 @@ interface FormSchema {
209
231
  ## Deployment Requirements
210
232
 
211
233
  ### 1. CDN Distribution
234
+
212
235
  - GitHub Pages hosting for global availability
213
236
  - Versioned URLs for stable integration
214
237
  - Automatic deployment on releases
215
238
 
216
239
  ### 2. NPM Package
240
+
217
241
  - Published as `@dmitryvim/form-builder`
218
242
  - ES6 module support
219
243
  - CommonJS compatibility
220
244
  - TypeScript definitions
221
245
 
222
246
  ### 3. Versioning
247
+
223
248
  - Semantic versioning (SemVer)
224
249
  - Backwards compatibility within major versions
225
250
  - Migration guides for breaking changes
@@ -227,16 +252,18 @@ interface FormSchema {
227
252
  ## Success Criteria
228
253
 
229
254
  ### Acceptance Criteria
255
+
230
256
  - [ ] All field types render and validate correctly
231
257
  - [ ] File uploads work with custom handlers
232
258
  - [ ] Read-only mode displays data properly
233
259
  - [ ] Draft saving works without validation
234
260
  - [ ] Tailwind CSS styling applies correctly
235
261
  - [ ] Cross-browser compatibility verified
236
- - [ ] >80% test coverage achieved
262
+ - [ ] > 80% test coverage achieved
237
263
  - [ ] Performance benchmarks met
238
264
 
239
265
  ### Business Metrics
266
+
240
267
  - **Developer Adoption**: Measurable NPM downloads
241
268
  - **Integration Success**: Working implementations in production
242
269
  - **Performance Goals**: Sub-2-second form rendering
@@ -245,18 +272,21 @@ interface FormSchema {
245
272
  ## Constraints & Assumptions
246
273
 
247
274
  ### Technical Constraints
275
+
248
276
  - No external dependencies allowed
249
277
  - Must work in iframe sandboxes
250
278
  - File handling delegated to integrating application
251
279
  - Cannot make direct network requests (CORS limitations)
252
280
 
253
- ### Business Constraints
281
+ ### Business Constraints
282
+
254
283
  - Open source MIT license
255
284
  - Community-driven development
256
285
  - GitHub-only deployment pipeline
257
286
  - No specific backend requirements
258
287
 
259
288
  ### Assumptions
289
+
260
290
  - Integrating applications handle file storage
261
291
  - Modern browser environment (ES6+ support)
262
292
  - Developers familiar with JSON Schema concepts
@@ -265,6 +295,7 @@ interface FormSchema {
265
295
  ## Future Considerations
266
296
 
267
297
  ### Potential Enhancements
298
+
268
299
  - Conditional field logic (show/hide based on values)
269
300
  - Custom field type plugins
270
301
  - Advanced file processing (image cropping, etc.)
@@ -272,10 +303,11 @@ interface FormSchema {
272
303
  - Real-time collaboration features
273
304
 
274
305
  ### Not In Scope
306
+
275
307
  - Backend file storage implementation
276
308
  - Database integration
277
309
  - User authentication/authorization
278
310
  - Advanced form analytics
279
311
  - Multi-page form wizards
280
312
 
281
- This requirements document defines the core functionality and quality standards for the Form Builder library, ensuring it meets both current needs and provides a foundation for future growth.
313
+ This requirements document defines the core functionality and quality standards for the Form Builder library, ensuring it meets both current needs and provides a foundation for future growth.