initial commit

This commit is contained in:
Michał Sieciechowicz 2025-08-06 12:38:25 +02:00
commit dc0c4a302f
11 changed files with 322 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules
dist
.angular

30
.npmignore Normal file
View File

@ -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/

58
LICENSE Normal file
View File

@ -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.

105
README.md Normal file
View File

@ -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<T>** - 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<UserForm>({
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<UserForm>
```
## 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

7
ng-package.json Normal file
View File

@ -0,0 +1,7 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/form-builder",
"lib": {
"entryFile": "src/public-api.ts"
}
}

34
package.json Normal file
View File

@ -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"
}
}

View File

@ -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 { }

11
src/public-api.ts Normal file
View File

@ -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';

19
tsconfig.lib.json Normal file
View File

@ -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"
]
}

9
tsconfig.lib.prod.json Normal file
View File

@ -0,0 +1,9 @@
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}

13
tsconfig.spec.json Normal file
View File

@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine"
]
},
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}