@decaf-ts/ui-decorators 0.5.26 → 0.5.28

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 (82) hide show
  1. package/LICENSE.md +173 -17
  2. package/README.md +24 -6
  3. package/dist/ui-decorators.cjs +2 -1550
  4. package/dist/ui-decorators.cjs.map +1 -0
  5. package/dist/ui-decorators.js +2 -0
  6. package/dist/ui-decorators.js.map +1 -0
  7. package/lib/esm/index.d.ts +1 -1
  8. package/lib/esm/index.js +2 -2
  9. package/lib/esm/index.js.map +1 -0
  10. package/lib/esm/model/Renderable.js +1 -1
  11. package/lib/esm/model/Renderable.js.map +1 -0
  12. package/lib/esm/model/decorators.d.ts +94 -12
  13. package/lib/esm/model/decorators.js +111 -15
  14. package/lib/esm/model/decorators.js.map +1 -0
  15. package/lib/esm/model/index.js +1 -1
  16. package/lib/esm/model/index.js.map +1 -0
  17. package/lib/esm/model/model.js +1 -1
  18. package/lib/esm/model/model.js.map +1 -0
  19. package/lib/esm/model/overrides.js +1 -1
  20. package/lib/esm/model/overrides.js.map +1 -0
  21. package/lib/esm/ui/Rendering.d.ts +1 -1
  22. package/lib/esm/ui/Rendering.js +8 -7
  23. package/lib/esm/ui/Rendering.js.map +1 -0
  24. package/lib/esm/ui/constants.d.ts +4 -3
  25. package/lib/esm/ui/constants.js +5 -4
  26. package/lib/esm/ui/constants.js.map +1 -0
  27. package/lib/esm/ui/decorators.d.ts +76 -13
  28. package/lib/esm/ui/decorators.js +81 -16
  29. package/lib/esm/ui/decorators.js.map +1 -0
  30. package/lib/esm/ui/errors.js +1 -1
  31. package/lib/esm/ui/errors.js.map +1 -0
  32. package/lib/esm/ui/handlers.js +1 -1
  33. package/lib/esm/ui/handlers.js.map +1 -0
  34. package/lib/esm/ui/index.js +1 -1
  35. package/lib/esm/ui/index.js.map +1 -0
  36. package/lib/esm/ui/interfaces.d.ts +31 -0
  37. package/lib/esm/ui/interfaces.js +1 -1
  38. package/lib/esm/ui/interfaces.js.map +1 -0
  39. package/lib/esm/ui/types.d.ts +8 -6
  40. package/lib/esm/ui/types.js +1 -1
  41. package/lib/esm/ui/types.js.map +1 -0
  42. package/lib/esm/ui/utils.js +1 -1
  43. package/lib/esm/ui/utils.js.map +1 -0
  44. package/lib/index.cjs +2 -2
  45. package/lib/index.d.ts +1 -1
  46. package/lib/index.js.map +1 -0
  47. package/lib/model/Renderable.cjs +1 -1
  48. package/lib/model/Renderable.js.map +1 -0
  49. package/lib/model/decorators.cjs +113 -16
  50. package/lib/model/decorators.d.ts +94 -12
  51. package/lib/model/decorators.js.map +1 -0
  52. package/lib/model/index.cjs +1 -1
  53. package/lib/model/index.js.map +1 -0
  54. package/lib/model/model.cjs +1 -1
  55. package/lib/model/model.js.map +1 -0
  56. package/lib/model/overrides.cjs +1 -1
  57. package/lib/model/overrides.js.map +1 -0
  58. package/lib/ui/Rendering.cjs +8 -7
  59. package/lib/ui/Rendering.d.ts +1 -1
  60. package/lib/ui/Rendering.js.map +1 -0
  61. package/lib/ui/constants.cjs +5 -4
  62. package/lib/ui/constants.d.ts +4 -3
  63. package/lib/ui/constants.js.map +1 -0
  64. package/lib/ui/decorators.cjs +83 -17
  65. package/lib/ui/decorators.d.ts +76 -13
  66. package/lib/ui/decorators.js.map +1 -0
  67. package/lib/ui/errors.cjs +1 -1
  68. package/lib/ui/errors.js.map +1 -0
  69. package/lib/ui/handlers.cjs +1 -1
  70. package/lib/ui/handlers.js.map +1 -0
  71. package/lib/ui/index.cjs +1 -1
  72. package/lib/ui/index.js.map +1 -0
  73. package/lib/ui/interfaces.cjs +1 -1
  74. package/lib/ui/interfaces.d.ts +31 -0
  75. package/lib/ui/interfaces.js.map +1 -0
  76. package/lib/ui/types.cjs +1 -1
  77. package/lib/ui/types.d.ts +8 -6
  78. package/lib/ui/types.js.map +1 -0
  79. package/lib/ui/utils.cjs +1 -1
  80. package/lib/ui/utils.js.map +1 -0
  81. package/package.json +24 -51
  82. package/dist/ui-decorators.esm.cjs +0 -1519
package/LICENSE.md CHANGED
@@ -1,22 +1,178 @@
1
- MIT License
1
+ Mozilla Public License Version 2.0
2
2
 
3
- Copyright (c) 2025 Tiago Venceslau and Contributors
3
+ 1. Definitions
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ "Contributor"
6
+ means each individual or legal entity that creates, contributes to the
7
+ creation of, or owns Covered Software.
11
8
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
9
+ "Contributor Version"
10
+ means the combination of the Contributions of others (if any) used by a
11
+ Contributor and that particular Contributor's Contribution.
14
12
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
13
+ "Covered Software"
14
+ means Source Code Form to which the initial Contributor has attached the
15
+ notice in Exhibit A, the Executable Form of such Source Code Form, and
16
+ Modifications of such Source Code Form.
22
17
 
18
+ "Executable Form"
19
+ means any form of the work other than Source Code Form.
20
+
21
+ "Larger Work"
22
+ means a work which combines Covered Software with other material, in a
23
+ separate file or files, that is not Covered Software.
24
+
25
+ "License"
26
+ means this document.
27
+
28
+ "Licensable"
29
+ means having the right to grant, to the maximum extent possible, whether
30
+ at the time of the making or afterwards, any and all of the rights
31
+ conveyed by this License.
32
+
33
+ "Modifications"
34
+ means any addition to or deletion from the contents of Covered Software
35
+ or any new file that contains Covered Software.
36
+
37
+ "Patent Claims"
38
+ means any patent claim(s), now owned or hereafter acquired, including
39
+ without limitation, method, process, and apparatus claims, in any patent
40
+ Licensable by grantor.
41
+
42
+ "Secondary License"
43
+ means either the GNU General Public License, Version 2.0, the GNU Lesser
44
+ General Public License, Version 2.1, the European Union Public License 1.1,
45
+ or any subsequent versions of those licenses that are designated as a
46
+ Secondary License in the notice in Exhibit A.
47
+
48
+ "Source Code Form"
49
+ means the form of the work preferred for making modifications.
50
+
51
+ "You" (or "Your")
52
+ means an individual or a legal entity exercising rights under, and
53
+ complying with all of the terms of, this License. For legal entities,
54
+ "You" includes any entity that controls, is controlled by, or is under
55
+ common control with You. For purposes of this definition, "control"
56
+ means (a) the power, direct or indirect, to cause the direction or
57
+ management of such entity, whether by contract or otherwise, or (b)
58
+ ownership of more than fifty percent (50%) of the outstanding shares or
59
+ beneficial ownership of such entity.
60
+
61
+ 2. License Grants and Conditions
62
+
63
+ Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive
64
+ license:
65
+
66
+ a. under intellectual property rights (other than patent or trademark)
67
+ Licensable by such Contributor to use, reproduce, make available,
68
+ modify, display, perform, distribute, and otherwise exploit its
69
+ Contributions, either on an exclusive or non-exclusive basis; and
70
+
71
+ b. under Patent Claims to make, use, sell, offer for sale, have made,
72
+ import, and otherwise transfer the Contribution(s) of such
73
+ Contributor, if any, in the Covered Software.
74
+
75
+ This license does not grant rights to any trademarks, service marks, or logos
76
+ of any Contributor (except as may be necessary to comply with the notice
77
+ requirements in Section 3.4).
78
+
79
+ 3. Distribution Obligations
80
+
81
+ 3.1. Distribution of Source Form
82
+
83
+ All distribution of Covered Software in Source Code Form, including any
84
+ Modifications that You create or to which You contribute, must be under the
85
+ terms of this License. You must inform recipients that the Source Code Form
86
+ of the Covered Software is governed by the terms of this License and include
87
+ a copy of this License in or with the Source Code Form.
88
+
89
+ 3.2. Distribution of Executable Form
90
+
91
+ If You distribute Covered Software in Executable Form then:
92
+
93
+ a. such Covered Software must also be made available in Source Code Form,
94
+ as described in Section 3.1, and You must inform recipients of the
95
+ Executable Form how to obtain a complete copy of the corresponding
96
+ Source Code Form in a reasonable manner on or through a medium
97
+ customarily used for software exchange; and
98
+
99
+ b. You may distribute the Executable Form under terms of your choice,
100
+ provided that You do not attempt to limit or alter the recipients'
101
+ rights in the Source Code Form under this License.
102
+
103
+ 3.3. Distribution of a Larger Work
104
+
105
+ You may create and distribute a work that combines Covered Software with
106
+ other material, and distribute the Larger Work as a single product. In such
107
+ case, the Covered Software must still be made available under this License
108
+ and must include the notices described in Exhibit A relating to the Covered
109
+ Software.
110
+
111
+ 3.4. Notices
112
+
113
+ You must cause each file that You distribute containing Covered Software to
114
+ carry the legal notices described in Exhibit A.
115
+
116
+ 4. Incompatible With Secondary Licenses
117
+
118
+ If the Covered Software is made available under the terms of this License
119
+ and also made available under the terms of a Secondary License, then the
120
+ terms of the Secondary License apply to the Covered Software in addition to
121
+ this License to the extent the Secondary License grants additional
122
+ permissions. If the Covered Software is not made available under a Secondary
123
+ License, then this License governs its use.
124
+
125
+ 5. Disclaimer of Warranty
126
+
127
+ Covered Software is provided "as is" without warranty of any kind, either
128
+ express or implied, including, but not limited to, the implied warranties of
129
+ merchantability, fitness for a particular purpose, and noninfringement.
130
+
131
+ 6. Limitation of Liability
132
+
133
+ In no event and under no legal theory, whether in tort (including
134
+ negligence), contract, or otherwise, unless required by applicable law (such
135
+ as deliberate and grossly negligent acts) or agreed to in writing, shall any
136
+ Contributor be liable to You for damages, including any direct, indirect,
137
+ special, incidental, or consequential damages of any character arising as a
138
+ result of this License or out of the use or inability to use the Covered
139
+ Software (including but not limited to damages for loss of goodwill, work
140
+ stoppage, computer failure or malfunction, or any and all other commercial
141
+ damages or losses), even if such Contributor has been advised of the
142
+ possibility of such damages.
143
+
144
+ 7. Termination
145
+
146
+ This License and the rights granted hereunder will terminate automatically
147
+ if You fail to comply with terms of this License and do not cure such
148
+ breach within thirty (30) days of becoming aware of the breach.
149
+
150
+ 8. Miscellaneous
151
+
152
+ This License constitutes the entire agreement between the parties with
153
+ respect to the subject matter hereof. If any provision of this License is
154
+ held to be unenforceable, that provision shall be reformed only to the
155
+ extent necessary to make it enforceable. The headings are for convenience
156
+ only and do not affect the interpretation.
157
+
158
+ Exhibit A - Source Code Form License Notice
159
+
160
+ This Source Code Form is subject to the terms of the Mozilla Public
161
+ License, v. 2.0. If a copy of the MPL was not distributed with this
162
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
163
+
164
+ Copyright (c) 2025 Tiago Venceslau and Contributors
165
+
166
+ ---
167
+
168
+ # Decaf‑TS Fair Usage Addendum (MPL‑2.0 baseline — AGPL‑3.0 trigger)
169
+
170
+ > Placement: This Addendum is intended to be appended to the canonical
171
+ > Mozilla Public License v2.0 text distributed with a package (after
172
+ > Exhibit A). The MPL‑2.0 text itself remains the baseline license for the
173
+ > package sources. This Addendum describes when an alternative licensing
174
+ > outcome (AGPL‑3.0) SHALL apply for certain AI‑driven code‑generation uses.
175
+
176
+ ---
177
+
178
+ ... (Addendum continues)
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Banner](./workdocs/assets/Banner.png)
1
+ ![Banner](./workdocs/assets/decaf-logo.svg)
2
2
 
3
3
  ## User Interface Decorators
4
4
 
@@ -46,7 +46,7 @@ The UI Decorators library is an extension of `@decaf-ts/decorator-validation` an
46
46
 
47
47
  - **`@uimodel(tag?, props?)`**: Marks a class as a UI model and specifies how it should be rendered, including the HTML tag to use and additional properties
48
48
  - **`@renderedBy(engine)`**: Specifies which rendering engine implementation should be used for a particular model
49
- - **`@uilistitem(tag?, props?)`**: Defines how a model should be rendered when it appears as an item in a list
49
+ - **`@uilistmodel(tag?, props?)`**: Defines how a model should be rendered when it appears as an item in a list
50
50
 
51
51
  #### Property Decorators
52
52
 
@@ -242,15 +242,15 @@ class User extends Model {
242
242
 
243
243
  ### Rendering Lists of Models
244
244
 
245
- You can render lists of models using the `@uilistitem` and `@uilistprop` decorators:
245
+ You can render lists of models using the `@uilistmodel` and `@uilistprop` decorators:
246
246
 
247
247
  ```typescript
248
248
  import { Model, list } from '@decaf-ts/decorator-validation';
249
- import { uimodel, uilistitem, uilistprop, uielement } from '@decaf-ts/ui-decorators';
249
+ import { uimodel, uilistmodel, uilistprop, uielement } from '@decaf-ts/ui-decorators';
250
250
 
251
251
  // Define a list item model
252
252
  @uimodel()
253
- @uilistitem('li', { class: 'todo-item' })
253
+ @uilistmodel('li', { class: 'todo-item' })
254
254
  class TodoItem extends Model {
255
255
  @uielement('span', { class: 'todo-text' })
256
256
  text: string;
@@ -462,6 +462,24 @@ if (errors) {
462
462
  This example demonstrates how to create a complete registration form with various input types and validation rules, all defined declaratively using decorators.
463
463
 
464
464
 
465
+ ## Coding Principles
466
+
467
+ - group similar functionality in folders (analog to namespaces but without any namespace declaration)
468
+ - one class per file;
469
+ - one interface per file (unless interface is just used as a type);
470
+ - group types as other interfaces in a types.ts file per folder;
471
+ - group constants or enums in a constants.ts file per folder;
472
+ - group decorators in a decorators.ts file per folder;
473
+ - always import from the specific file, never from a folder or index file (exceptions for dependencies on other packages);
474
+ - prefer the usage of established design patters where applicable:
475
+ - Singleton (can be an anti-pattern. use with care);
476
+ - factory;
477
+ - observer;
478
+ - strategy;
479
+ - builder;
480
+ - etc;
481
+
482
+
465
483
  ### Related
466
484
 
467
485
  [![decaf-ts](https://github-readme-stats.vercel.app/api/pin/?username=decaf-ts&repo=decaf-ts)](https://github.com/decaf-ts/decaf-ts)
@@ -501,6 +519,6 @@ So if you can, if this project in any way. either by learning something or simpl
501
519
 
502
520
  ## License
503
521
 
504
- This project is released under the [MIT License](./LICENSE.md).
522
+ This project is licensed under the Mozilla Public License 2.0 (MPL-2.0). See `./LICENSE.md` for a Fair Usage Addendum that explains when AGPL-3.0 applies (automated AI/Decaf MCP code generation and non-deterministic UI generation).
505
523
 
506
524
  By developers, for developers...