@wawjs/ngx-bos 22.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.
Files changed (90) hide show
  1. package/AGENTS.md +23 -0
  2. package/README.md +105 -0
  3. package/RELEASES.md +21 -0
  4. package/ai/architecture.md +40 -0
  5. package/ai/code-style.md +33 -0
  6. package/ai/decisions/2026-06-02-browser-only-bos-spa.md +16 -0
  7. package/ai/decisions/2026-06-02-package-boundary.md +22 -0
  8. package/ai/decisions/2026-06-02-version-start.md +12 -0
  9. package/ai/decisions/index.md +7 -0
  10. package/ai/onboarding.md +19 -0
  11. package/ai/task-execution.md +35 -0
  12. package/ai/tooling.md +33 -0
  13. package/fesm2022/wawjs-ngx-bos.mjs +2287 -0
  14. package/fesm2022/wawjs-ngx-bos.mjs.map +1 -0
  15. package/package.json +38 -0
  16. package/src/feature/file/file.component.html +123 -0
  17. package/src/feature/file/file.component.scss +209 -0
  18. package/src/feature/file/file.component.ts +220 -0
  19. package/src/feature/file/file.const.ts +20 -0
  20. package/src/feature/file/file.interface.ts +12 -0
  21. package/src/feature/file/file.service.ts +34 -0
  22. package/src/feature/file/file.util.ts +72 -0
  23. package/src/feature/file/index.ts +9 -0
  24. package/src/feature/file/pages/files/files.component.html +12 -0
  25. package/src/feature/file/pages/files/files.component.ts +117 -0
  26. package/src/feature/file/pages/files/files.routes.ts +9 -0
  27. package/src/feature/file/selectors/file/file-selector.component.html +11 -0
  28. package/src/feature/file/selectors/file/file-selector.component.ts +27 -0
  29. package/src/feature/user/LICENSE +21 -0
  30. package/src/feature/user/README.md +1 -0
  31. package/src/feature/user/components/user-preview/user-preview.component.html +7 -0
  32. package/src/feature/user/components/user-preview/user-preview.component.scss +27 -0
  33. package/src/feature/user/components/user-preview/user-preview.component.ts +16 -0
  34. package/src/feature/user/guards/admins.guard.ts +22 -0
  35. package/src/feature/user/guards/authenticated.guard.ts +14 -0
  36. package/src/feature/user/guards/guest.guard.ts +14 -0
  37. package/src/feature/user/module.json +1 -0
  38. package/src/feature/user/pages/clients/clients.component.html +8 -0
  39. package/src/feature/user/pages/clients/clients.component.scss +0 -0
  40. package/src/feature/user/pages/clients/clients.component.ts +45 -0
  41. package/src/feature/user/pages/clients/clients.routes.ts +9 -0
  42. package/src/feature/user/pages/users/users.component.html +18 -0
  43. package/src/feature/user/pages/users/users.component.ts +57 -0
  44. package/src/feature/user/pages/users/users.routes.ts +9 -0
  45. package/src/feature/user/selectors/user/user-selector.component.html +6 -0
  46. package/src/feature/user/selectors/user/user-selector.component.scss +0 -0
  47. package/src/feature/user/selectors/user/user-selector.component.ts +17 -0
  48. package/src/feature/user/user.const.ts +13 -0
  49. package/src/feature/user/user.form.ts +54 -0
  50. package/src/feature/user/user.interface.ts +12 -0
  51. package/src/feature/user/user.service.ts +176 -0
  52. package/src/form-components/ace/ace.component.html +14 -0
  53. package/src/form-components/ace/ace.component.scss +22 -0
  54. package/src/form-components/ace/ace.component.ts +210 -0
  55. package/src/form-components/ace/ace.form.ts +184 -0
  56. package/src/form-components/button/button.component.html +15 -0
  57. package/src/form-components/button/button.component.ts +31 -0
  58. package/src/form-components/button/button.form.ts +74 -0
  59. package/src/form-components/file/file.component.html +73 -0
  60. package/src/form-components/file/file.component.ts +91 -0
  61. package/src/form-components/file/file.form.ts +112 -0
  62. package/src/form-components/form-bridge.interface.ts +27 -0
  63. package/src/form-components/index.ts +85 -0
  64. package/src/form-components/input/input.component.html +16 -0
  65. package/src/form-components/input/input.component.ts +31 -0
  66. package/src/form-components/input/input.form.ts +117 -0
  67. package/src/form-components/select/select.component.html +24 -0
  68. package/src/form-components/select/select.component.ts +31 -0
  69. package/src/form-components/select/select.form.ts +88 -0
  70. package/src/form-components/tinymce/tinymce.component.html +13 -0
  71. package/src/form-components/tinymce/tinymce.component.scss +19 -0
  72. package/src/form-components/tinymce/tinymce.component.ts +221 -0
  73. package/src/form-components/tinymce/tinymce.form.ts +191 -0
  74. package/src/icons/spider/LICENSE +21 -0
  75. package/src/icons/spider/README.md +127 -0
  76. package/src/icons/spider/index.ts +1 -0
  77. package/src/icons/spider/module.json +4 -0
  78. package/src/icons/spider/spider.component.html +115 -0
  79. package/src/icons/spider/spider.component.scss +20 -0
  80. package/src/icons/spider/spider.component.ts +20 -0
  81. package/src/ngx-bos.config.ts +55 -0
  82. package/src/pages/form/form.component.html +9 -0
  83. package/src/pages/form/form.component.ts +86 -0
  84. package/src/pages/form/form.routes.ts +9 -0
  85. package/src/pages/forms/forms.component.html +9 -0
  86. package/src/pages/forms/forms.component.ts +77 -0
  87. package/src/pages/forms/forms.routes.ts +9 -0
  88. package/src/pipes/phone.pipe.ts +17 -0
  89. package/src/public-api.ts +36 -0
  90. package/types/wawjs-ngx-bos.d.ts +332 -0
@@ -0,0 +1,20 @@
1
+ .spider {
2
+ /* sizing tokens */
3
+ --spider-w: 100%;
4
+ --spider-h: auto;
5
+
6
+ display: inline-block;
7
+ inline-size: var(--spider-w);
8
+ block-size: var(--spider-h);
9
+ line-height: 0; /* remove gaps */
10
+
11
+ &__svg {
12
+ display: block;
13
+ inline-size: 100%;
14
+ block-size: 100%;
15
+ max-inline-size: 100%;
16
+ max-block-size: 100%;
17
+ /* keep original ratio (72 x 84) when only width is provided */
18
+ aspect-ratio: 72 / 84;
19
+ }
20
+ }
@@ -0,0 +1,20 @@
1
+ import { Component, input } from '@angular/core';
2
+
3
+ @Component({
4
+ selector: 'icon-spider',
5
+ templateUrl: './spider.component.html',
6
+ styleUrl: './spider.component.scss',
7
+ host: {
8
+ class: 'spider',
9
+ '[style.--spider-w]': 'width',
10
+ '[style.--spider-h]': 'height',
11
+ '[style.--spider-start]': 'start',
12
+ '[style.--spider-end]': 'end',
13
+ },
14
+ })
15
+ export class SpiderComponent {
16
+ width = input('');
17
+ height = input('');
18
+ start = input('');
19
+ end = input('');
20
+ }
@@ -0,0 +1,55 @@
1
+ import {
2
+ EnvironmentProviders,
3
+ InjectionToken,
4
+ Provider,
5
+ makeEnvironmentProviders,
6
+ } from '@angular/core';
7
+ import { FormComponentInterface } from '@wawjs/ngx-form';
8
+
9
+ export interface NgxBosConfig {
10
+ appId?: string;
11
+ url?: string;
12
+ cdnUrl?: string;
13
+ roles?: string[];
14
+ userFields?: string[];
15
+ userForm?: FormComponentInterface[];
16
+ signPath?: string;
17
+ profilePath?: string;
18
+ defaultUserThumb?: string;
19
+ }
20
+
21
+ export const DEFAULT_NGX_BOS_CONFIG: Required<NgxBosConfig> = {
22
+ appId: '',
23
+ url: '',
24
+ cdnUrl: 'https://cdn.webart.work',
25
+ roles: [],
26
+ userFields: [],
27
+ userForm: [],
28
+ signPath: '/sign',
29
+ profilePath: '/profile',
30
+ defaultUserThumb: 'assets/default.png',
31
+ };
32
+
33
+ export const NGX_BOS_CONFIG = new InjectionToken<Required<NgxBosConfig>>(
34
+ 'NGX_BOS_CONFIG',
35
+ {
36
+ factory: () => DEFAULT_NGX_BOS_CONFIG,
37
+ },
38
+ );
39
+
40
+ export function ngxBosProvide(config: NgxBosConfig = {}): EnvironmentProviders {
41
+ return makeEnvironmentProviders([
42
+ {
43
+ provide: NGX_BOS_CONFIG,
44
+ useValue: {
45
+ ...DEFAULT_NGX_BOS_CONFIG,
46
+ ...config,
47
+ roles: config.roles ?? DEFAULT_NGX_BOS_CONFIG.roles,
48
+ userFields: config.userFields ?? DEFAULT_NGX_BOS_CONFIG.userFields,
49
+ userForm: config.userForm ?? DEFAULT_NGX_BOS_CONFIG.userForm,
50
+ },
51
+ } satisfies Provider,
52
+ ]);
53
+ }
54
+
55
+ export const provideNgxBos = ngxBosProvide;
@@ -0,0 +1,9 @@
1
+ <!--==== Table Module ====-->
2
+ <wtable
3
+ [rows]="documents()"
4
+ [columns]="columns"
5
+ [config]="config"
6
+ title="Forms"
7
+ >
8
+ </wtable>
9
+ <!-- ==================== -->
@@ -0,0 +1,86 @@
1
+ import { Component, effect, inject } from '@angular/core';
2
+ import { Router } from '@angular/router';
3
+ import { TableComponent } from '@wawjs/ngx-ui';
4
+ import {
5
+ Formcomponent,
6
+ FormcomponentService,
7
+ formcomponentForm,
8
+ FormInterface,
9
+ FormService,
10
+ } from '@wawjs/ngx-form';
11
+ import { CrudComponent } from '@wawjs/ngx-crud';
12
+ import { FORM_COMPONENT_FORM } from '../../form-components';
13
+ import { NGX_BOS_CONFIG } from '../../ngx-bos.config';
14
+
15
+ @Component({
16
+ imports: [TableComponent],
17
+ templateUrl: './form.component.html',
18
+ })
19
+ export class FormComponent extends CrudComponent<
20
+ FormcomponentService,
21
+ Formcomponent,
22
+ FormInterface
23
+ > {
24
+ private _router = inject(Router);
25
+ private _bosConfig = inject(NGX_BOS_CONFIG);
26
+
27
+ readonly formId = this._router.url.split('form/')[1];
28
+
29
+ protected override configType: 'server' | 'local' = 'local';
30
+
31
+ protected override preCreate(doc: Formcomponent) {
32
+ doc.formId = this.formId;
33
+
34
+ doc.appId = this._bosConfig.appId;
35
+ }
36
+
37
+ protected override localDocumentsFilter = (doc: Formcomponent) => {
38
+ return doc.formId === this.formId;
39
+ };
40
+
41
+ protected override allowUrl() {
42
+ return false;
43
+ }
44
+
45
+ /** Basic columns for clients table */
46
+ columns = ['name', 'key'];
47
+
48
+ /** wtable config built by CrudComponent, aware of server mode */
49
+ config = this.getConfig();
50
+
51
+ constructor(
52
+ _formcomponentService: FormcomponentService,
53
+ _formService: FormService,
54
+ ) {
55
+ super(formcomponentForm, _formService, _formcomponentService, 'user');
56
+
57
+ effect(() => {
58
+ if (_formcomponentService.isLoaded()) {
59
+ this.setDocuments();
60
+ }
61
+ });
62
+
63
+ this.config.buttons.unshift({
64
+ icon: 'settings',
65
+ click: (doc: Formcomponent) => {
66
+ _formService.modal<Record<string, unknown>>(
67
+ FORM_COMPONENT_FORM(doc.name),
68
+ {
69
+ label: 'Update',
70
+ click: async (updated: unknown, close: () => void) => {
71
+ close();
72
+
73
+ doc.props = {
74
+ ...doc.props,
75
+ ...(updated as object),
76
+ };
77
+
78
+ _formcomponentService.update(doc);
79
+ },
80
+ },
81
+ doc.props || {},
82
+ );
83
+ },
84
+ });
85
+ }
86
+ }
@@ -0,0 +1,9 @@
1
+ import { Routes } from '@angular/router';
2
+
3
+ export const formRoutes: Routes = [
4
+ {
5
+ path: '',
6
+ loadComponent: () =>
7
+ import('./form.component').then((m) => m.FormComponent),
8
+ },
9
+ ];
@@ -0,0 +1,9 @@
1
+ <!--==== Table Module ====-->
2
+ <wtable
3
+ [rows]="documents()"
4
+ [columns]="columns"
5
+ [config]="config"
6
+ title="Forms"
7
+ >
8
+ </wtable>
9
+ <!-- ==================== -->
@@ -0,0 +1,77 @@
1
+ import {
2
+ Component,
3
+ effect,
4
+ inject,
5
+ signal,
6
+ } from '@angular/core';
7
+ import { Form, formForm, FormService } from '@wawjs/ngx-form';
8
+ import { TableComponent } from '@wawjs/ngx-ui';
9
+ import { NGX_BOS_CONFIG } from '../../ngx-bos.config';
10
+
11
+ @Component({
12
+ imports: [TableComponent],
13
+ templateUrl: './forms.component.html',
14
+ })
15
+ export class FormsComponent {
16
+ private _formService = inject(FormService);
17
+ private _bosConfig = inject(NGX_BOS_CONFIG);
18
+
19
+ columns: string[] = ['formId', 'title'];
20
+
21
+ config = {
22
+ buttons: [
23
+ {
24
+ icon: 'edit',
25
+ click: (form: Form) => {
26
+ this._formService.modal<Record<string, unknown>>(
27
+ formForm,
28
+ {
29
+ label: 'Update',
30
+ click: async (
31
+ updated: unknown,
32
+ close: () => void,
33
+ ) => {
34
+ close();
35
+
36
+ if (form._id) {
37
+ this._formService.update(updated as Form);
38
+ } else {
39
+ this._formService.create({
40
+ ...(updated as Form),
41
+ appId: this._bosConfig.appId,
42
+ });
43
+ }
44
+ },
45
+ },
46
+ form,
47
+ );
48
+ },
49
+ },
50
+ {
51
+ icon: 'build',
52
+ hrefFunc: (form: Form) => {
53
+ return '/admin/form/' + form.formId;
54
+ },
55
+ },
56
+ ],
57
+ };
58
+
59
+ documents = signal<Form[]>([]);
60
+
61
+ constructor() {
62
+ effect(() => {
63
+ const byFormId = this._formService.getFieldSignals('formId')();
64
+
65
+ this.documents.set(
66
+ this._formService.formIds().map((formId) => {
67
+ return {
68
+ formId,
69
+ ...(byFormId[formId]?.length
70
+ ? byFormId[formId][0]()
71
+ : {}),
72
+ } as Form;
73
+ }),
74
+ );
75
+ });
76
+ }
77
+ }
@@ -0,0 +1,9 @@
1
+ import { Routes } from '@angular/router';
2
+
3
+ export const formsRoutes: Routes = [
4
+ {
5
+ path: '',
6
+ loadComponent: () =>
7
+ import('./forms.component').then((m) => m.FormsComponent),
8
+ },
9
+ ];
@@ -0,0 +1,17 @@
1
+ import { Pipe, PipeTransform } from '@angular/core';
2
+ import { CountryCode, parsePhoneNumberFromString } from 'libphonenumber-js';
3
+
4
+ @Pipe({ name: 'phone' })
5
+ export class PhonePipe implements PipeTransform {
6
+ transform(
7
+ value: string | null | undefined,
8
+ country: CountryCode = 'US',
9
+ ): string {
10
+ const raw = String(value ?? '').trim();
11
+ if (!raw) return '';
12
+
13
+ const phone = parsePhoneNumberFromString(raw, country);
14
+
15
+ return phone ? phone.formatInternational() : raw;
16
+ }
17
+ }
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Public API surface for @wawjs/ngx-bos.
3
+ *
4
+ * Reusable BOS contracts and services will be exported here as code moves from
5
+ * the source app into the package.
6
+ */
7
+
8
+ export const NGX_BOS_VERSION = '22.0.0' as const;
9
+
10
+ export type NgxBosVersion = typeof NGX_BOS_VERSION;
11
+
12
+ export * from './ngx-bos.config';
13
+ export * from './feature/file';
14
+ export * from './feature/file/selectors/file/file-selector.component';
15
+ export * from './feature/file/pages/files/files.component';
16
+ export * from './feature/file/pages/files/files.routes';
17
+ export * from './form-components';
18
+ export * from './feature/user/user.interface';
19
+ export * from './feature/user/user.const';
20
+ export * from './feature/user/user.form';
21
+ export * from './feature/user/user.service';
22
+ export * from './feature/user/guards/admins.guard';
23
+ export * from './feature/user/guards/authenticated.guard';
24
+ export * from './feature/user/guards/guest.guard';
25
+ export * from './feature/user/selectors/user/user-selector.component';
26
+ export * from './feature/user/components/user-preview/user-preview.component';
27
+ export * from './feature/user/pages/users/users.component';
28
+ export * from './feature/user/pages/users/users.routes';
29
+ export * from './feature/user/pages/clients/clients.component';
30
+ export * from './feature/user/pages/clients/clients.routes';
31
+ export * from './pages/form/form.component';
32
+ export * from './pages/form/form.routes';
33
+ export * from './pages/forms/forms.component';
34
+ export * from './pages/forms/forms.routes';
35
+ export * from './icons/spider';
36
+ export * from './pipes/phone.pipe';