commit dc0c4a302f0308301c0c94a9366149065443cffe Author: Michaล‚ Sieciechowicz Date: Wed Aug 6 12:38:25 2025 +0200 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..df5c8a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +dist +.angular diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..bfba7af --- /dev/null +++ b/.npmignore @@ -0,0 +1,30 @@ +# Source files +src/ +*.ts +!*.d.ts + +# Config files +tsconfig*.json +ng-package.json +angular.json +.angular/ +.git/ +.gitignore + +# Development files +**/*.spec.ts +**/*.spec.js +test/ +tests/ +spec/ + +# Documentation (keep only README.md and LICENSE) +docs/ +*.md +!README.md + +# Build artifacts +node_modules/ +dist/ +build/ +out-tsc/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..26d7f91 --- /dev/null +++ b/LICENSE @@ -0,0 +1,58 @@ +Workshack Form Builder Library License + +Copyright (c) 2025 Workshack Team + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to use, +copy, modify, merge, publish, and distribute the Software, subject to the +following conditions: + +NON-COMMERCIAL USE: +For non-commercial applications (applications that do not generate revenue, +do not contain paid features, subscriptions, advertisements, or any form of +monetization), the Software may be used freely without any additional +requirements. + +COMMERCIAL USE: +For commercial applications (applications that generate revenue through sales, +subscriptions, advertisements, in-app purchases, or any other form of +monetization), the following additional requirement applies: + +- The application MUST include attribution to the Workshack Form Builder Library in a + publicly accessible location within the application. This can be: + * An "About" page or section + * A "Credits" or "Acknowledgments" page + * A "For Developers" page + * Any other location where users can reasonably find it + +The attribution must include: +- The name "Workshack Form Builder Library" +- A link to the library's repository or npm package page +- The copyright notice "ยฉ 2025 Workshack Team" + +Example attribution: +"This application uses Workshack Form Builder Library (https://www.npmjs.com/package/@workshack/form-builder) ยฉ 2025 Workshack Team" + +GENERAL CONDITIONS: +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +DEFINITIONS: +- "Commercial application" means any software application, website, or service + that generates revenue or is intended to generate revenue through any means + including but not limited to: sales, subscriptions, advertisements, in-app + purchases, premium features, licensing fees, or any other monetization + strategy. + +- "Non-commercial application" means any software application, website, or + service that does not generate revenue and is not intended to generate + revenue through any means, including personal projects, educational projects, + open-source projects, and research projects. diff --git a/README.md b/README.md new file mode 100644 index 0000000..9f62d2e --- /dev/null +++ b/README.md @@ -0,0 +1,105 @@ +# @workshack/form-builder + +Workshack Form Builder Library provides typed FormGroup helpers and utilities for Angular reactive forms. This library integrates seamlessly with `@workshack/ui` and `@workshack/input` to provide a complete form building solution with strong TypeScript typing. + +## Features + +- ๐Ÿ”ง **Typed FormGroup Helpers** - Strongly typed reactive forms with IntelliSense support +- ๐ŸŽฎ **Gaming UI Integration** - Works seamlessly with @workshack/ui components +- ๐ŸŽฏ **Input Navigation** - Integrates with @workshack/input for gamepad/keyboard navigation +- ๐Ÿ“ **Form Validation** - Enhanced validation helpers with typed error messages +- ๐Ÿš€ **Angular 20+** - Built for modern Angular applications +- ๐Ÿ’ก **TypeScript First** - Full TypeScript support with strict typing + +## Installation + +```bash +npm install @workshack/form-builder @workshack/ui @workshack/input +``` + +## Quick Start + +```typescript +import { FormBuilderModule } from '@workshack/form-builder'; + +@NgModule({ + imports: [ + FormBuilderModule, + // ... other imports + ], +}) +export class AppModule { } +``` + +## Dependencies + +This library requires the following peer dependencies: + +- `@angular/core`: ^20.1.3 +- `@angular/common`: ^20.1.3 +- `@angular/forms`: ^20.1.3 +- `@workshack/ui`: ^1.0.0 +- `@workshack/input`: ^1.0.0 + +## Documentation + +> ๐Ÿ“š **Coming Soon**: Detailed documentation and examples will be added when the typed FormGroup helpers are implemented. + +### Planned Features + +- **TypedFormGroup** - Strongly typed FormGroup with IntelliSense +- **FormBuilderService** - Service for creating typed forms +- **ValidationHelpers** - Typed validation functions +- **FormFieldComponents** - Pre-built form field components +- **FormLayoutComponents** - Layout components for forms + +## Example Usage (Planned) + +```typescript +// Example of planned API - will be implemented soon +interface UserForm { + name: string; + email: string; + age: number; +} + +const form = this.typedFormBuilder.group({ + name: ['', [Validators.required]], + email: ['', [Validators.required, Validators.email]], + age: [0, [Validators.required, Validators.min(18)]] +}); + +// Full TypeScript support +form.get('name')?.value; // string | null +form.value; // Partial +``` + +## Integration with Workshack Libraries + +This library is designed to work seamlessly with: + +- **@workshack/ui** - Gaming-inspired UI components +- **@workshack/input** - Gamepad and keyboard navigation support + +## License + +This library is licensed under a custom license. See [LICENSE](./LICENSE) for details. + +### Commercial Use + +For commercial applications, attribution is required. Include the following in your application: + +``` +This application uses Workshack Form Builder Library (https://www.npmjs.com/package/@workshack/form-builder) ยฉ 2025 Workshack Team +``` + +## Contributing + +This library is part of the Workshack ecosystem. For contributions and issues, please refer to the main repository. + +## Changelog + +### 1.0.0 +- Initial release with basic module structure +- Ready for typed FormGroup helpers implementation +- Integration foundation for @workshack/ui and @workshack/input diff --git a/ng-package.json b/ng-package.json new file mode 100644 index 0000000..4816fc4 --- /dev/null +++ b/ng-package.json @@ -0,0 +1,7 @@ +{ + "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", + "dest": "../../dist/form-builder", + "lib": { + "entryFile": "src/public-api.ts" + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..298bb78 --- /dev/null +++ b/package.json @@ -0,0 +1,34 @@ +{ + "name": "@workshack/form-builder", + "version": "1.0.0", + "description": "Workshack form builder library with typed FormGroup helpers for Angular applications", + "author": "Workshack Team", + "license": "SEE LICENSE IN LICENSE", + "keywords": ["angular", "forms", "form-builder", "typed", "formgroup", "workshack", "reactive-forms"], + "repository": { + "type": "git", + "url": "https://git.fufle.net/Tools/FormBuilder.git", + "directory": "." + }, + "homepage": "https://git.fufle.net/Tools/FormBuilder", + "bugs": { + "url": "https://git.fufle.net/Tools/FormBuilder/issues" + }, + "main": "bundles/workshack-form-builder.umd.js", + "module": "fesm2022/workshack-form-builder.mjs", + "typings": "index.d.ts", + "peerDependencies": { + "@angular/common": "^20.1.3", + "@angular/core": "^20.1.3", + "@angular/forms": "^20.1.3", + "@workshack/ui": "^1.0.0", + "@workshack/input": "^1.0.0" + }, + "dependencies": { + "tslib": "^2.3.0" + }, + "sideEffects": false, + "publishConfig": { + "access": "public" + } +} diff --git a/src/lib/form-builder.module.ts b/src/lib/form-builder.module.ts new file mode 100644 index 0000000..68ec234 --- /dev/null +++ b/src/lib/form-builder.module.ts @@ -0,0 +1,33 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ReactiveFormsModule } from '@angular/forms'; + +/** + * Workshack Form Builder Module + * + * This module provides typed FormGroup helpers and utilities for Angular reactive forms. + * It integrates with @workshack/ui and @workshack/input libraries to provide + * a complete form building solution. + * + * @example + * ```typescript + * import { FormBuilderModule } from '@workshack/form-builder'; + * + * @NgModule({ + * imports: [FormBuilderModule], + * // ... + * }) + * export class AppModule { } + * ``` + */ +@NgModule({ + imports: [ + CommonModule, + ReactiveFormsModule + ], + exports: [ + CommonModule, + ReactiveFormsModule + ] +}) +export class FormBuilderModule { } diff --git a/src/public-api.ts b/src/public-api.ts new file mode 100644 index 0000000..32ed5c5 --- /dev/null +++ b/src/public-api.ts @@ -0,0 +1,11 @@ +/* + * Public API Surface of form-builder + */ + +// Form Builder Module +export * from './lib/form-builder.module'; + +// TODO: Add exports for typed FormGroup helpers when implemented +// export * from './lib/helpers'; +// export * from './lib/types'; +// export * from './lib/interfaces'; diff --git a/tsconfig.lib.json b/tsconfig.lib.json new file mode 100644 index 0000000..e4b2d80 --- /dev/null +++ b/tsconfig.lib.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/lib", + "target": "es2022", + "declaration": true, + "declarationMap": true, + "inlineSources": true, + "types": [], + "lib": [ + "es2022", + "dom" + ] + }, + "exclude": [ + "src/test.ts", + "**/*.spec.ts" + ] +} diff --git a/tsconfig.lib.prod.json b/tsconfig.lib.prod.json new file mode 100644 index 0000000..2a2faa8 --- /dev/null +++ b/tsconfig.lib.prod.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "declarationMap": false + }, + "angularCompilerOptions": { + "compilationMode": "partial" + } +} diff --git a/tsconfig.spec.json b/tsconfig.spec.json new file mode 100644 index 0000000..eae9b9a --- /dev/null +++ b/tsconfig.spec.json @@ -0,0 +1,13 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "../../out-tsc/spec", + "types": [ + "jasmine" + ] + }, + "include": [ + "**/*.spec.ts", + "**/*.d.ts" + ] +}