@matter/model 0.16.0-alpha.0-20251018-dd1ea6a8a → 0.16.0-alpha.0-20251020-3f6e46245

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 (265) hide show
  1. package/dist/cjs/common/Metatype.d.ts +1 -1
  2. package/dist/cjs/decoration/decorators/attribute.d.ts +11 -0
  3. package/dist/cjs/decoration/decorators/attribute.d.ts.map +1 -0
  4. package/dist/cjs/decoration/decorators/attribute.js +32 -0
  5. package/dist/cjs/decoration/decorators/attribute.js.map +6 -0
  6. package/dist/cjs/decoration/decorators/cluster.d.ts +11 -0
  7. package/dist/cjs/decoration/decorators/cluster.d.ts.map +1 -0
  8. package/dist/cjs/decoration/decorators/cluster.js +32 -0
  9. package/dist/cjs/decoration/decorators/cluster.js.map +6 -0
  10. package/dist/cjs/decoration/decorators/command.d.ts +12 -0
  11. package/dist/cjs/decoration/decorators/command.d.ts.map +1 -0
  12. package/dist/cjs/decoration/decorators/command.js +34 -0
  13. package/dist/cjs/decoration/decorators/command.js.map +6 -0
  14. package/dist/cjs/decoration/decorators/datatype.d.ts +11 -0
  15. package/dist/cjs/decoration/decorators/datatype.d.ts.map +1 -0
  16. package/dist/cjs/decoration/decorators/datatype.js +32 -0
  17. package/dist/cjs/decoration/decorators/datatype.js.map +6 -0
  18. package/dist/cjs/decoration/decorators/element.d.ts +40 -0
  19. package/dist/cjs/decoration/decorators/element.d.ts.map +1 -0
  20. package/dist/cjs/decoration/decorators/element.js +101 -0
  21. package/dist/cjs/decoration/decorators/element.js.map +6 -0
  22. package/dist/cjs/decoration/decorators/event.d.ts +14 -0
  23. package/dist/cjs/decoration/decorators/event.d.ts.map +1 -0
  24. package/dist/cjs/decoration/decorators/event.js +32 -0
  25. package/dist/cjs/decoration/decorators/event.js.map +6 -0
  26. package/dist/cjs/decoration/decorators/field.d.ts +14 -0
  27. package/dist/cjs/decoration/decorators/field.d.ts.map +1 -0
  28. package/dist/cjs/decoration/decorators/field.js +32 -0
  29. package/dist/cjs/decoration/decorators/field.js.map +6 -0
  30. package/dist/cjs/decoration/decorators/index.d.ts +16 -0
  31. package/dist/cjs/decoration/decorators/index.d.ts.map +1 -0
  32. package/dist/cjs/decoration/decorators/index.js +33 -0
  33. package/dist/cjs/decoration/decorators/index.js.map +6 -0
  34. package/dist/cjs/decoration/decorators/listOf.d.ts +12 -0
  35. package/dist/cjs/decoration/decorators/listOf.d.ts.map +1 -0
  36. package/dist/cjs/decoration/decorators/listOf.js +47 -0
  37. package/dist/cjs/decoration/decorators/listOf.js.map +6 -0
  38. package/dist/cjs/decoration/decorators/mandatory.d.ts +11 -0
  39. package/dist/cjs/decoration/decorators/mandatory.d.ts.map +1 -0
  40. package/dist/cjs/decoration/decorators/mandatory.js +41 -0
  41. package/dist/cjs/decoration/decorators/mandatory.js.map +6 -0
  42. package/dist/cjs/decoration/decorators/nonvolatile.d.ts +11 -0
  43. package/dist/cjs/decoration/decorators/nonvolatile.d.ts.map +1 -0
  44. package/dist/cjs/decoration/decorators/nonvolatile.js +41 -0
  45. package/dist/cjs/decoration/decorators/nonvolatile.js.map +6 -0
  46. package/dist/cjs/decoration/decorators/nullable.d.ts +11 -0
  47. package/dist/cjs/decoration/decorators/nullable.d.ts.map +1 -0
  48. package/dist/cjs/decoration/decorators/nullable.js +41 -0
  49. package/dist/cjs/decoration/decorators/nullable.js.map +6 -0
  50. package/dist/cjs/decoration/decorators/response.d.ts +12 -0
  51. package/dist/cjs/decoration/decorators/response.d.ts.map +1 -0
  52. package/dist/cjs/decoration/decorators/response.js +49 -0
  53. package/dist/cjs/decoration/decorators/response.js.map +6 -0
  54. package/dist/cjs/decoration/errors.d.ts +29 -0
  55. package/dist/cjs/decoration/errors.d.ts.map +1 -0
  56. package/dist/cjs/decoration/errors.js +44 -0
  57. package/dist/cjs/decoration/errors.js.map +6 -0
  58. package/dist/cjs/decoration/index.d.ts +9 -0
  59. package/dist/cjs/decoration/index.d.ts.map +1 -0
  60. package/dist/cjs/decoration/index.js +26 -0
  61. package/dist/cjs/decoration/index.js.map +6 -0
  62. package/dist/cjs/decoration/semantics/ClassSemantics.d.ts +84 -0
  63. package/dist/cjs/decoration/semantics/ClassSemantics.d.ts.map +1 -0
  64. package/dist/cjs/decoration/semantics/ClassSemantics.js +266 -0
  65. package/dist/cjs/decoration/semantics/ClassSemantics.js.map +6 -0
  66. package/dist/cjs/decoration/semantics/FieldSemantics.d.ts +21 -0
  67. package/dist/cjs/decoration/semantics/FieldSemantics.d.ts.map +1 -0
  68. package/dist/cjs/decoration/semantics/FieldSemantics.js +57 -0
  69. package/dist/cjs/decoration/semantics/FieldSemantics.js.map +6 -0
  70. package/dist/cjs/decoration/semantics/Semantics.d.ts +68 -0
  71. package/dist/cjs/decoration/semantics/Semantics.d.ts.map +1 -0
  72. package/dist/cjs/decoration/semantics/Semantics.js +156 -0
  73. package/dist/cjs/decoration/semantics/Semantics.js.map +6 -0
  74. package/dist/cjs/decoration/semantics/index.d.ts +9 -0
  75. package/dist/cjs/decoration/semantics/index.d.ts.map +1 -0
  76. package/dist/cjs/decoration/semantics/index.js +26 -0
  77. package/dist/cjs/decoration/semantics/index.js.map +6 -0
  78. package/dist/cjs/index.d.ts +1 -0
  79. package/dist/cjs/index.d.ts.map +1 -1
  80. package/dist/cjs/index.js +1 -0
  81. package/dist/cjs/index.js.map +1 -1
  82. package/dist/cjs/models/AttributeModel.d.ts +1 -0
  83. package/dist/cjs/models/AttributeModel.d.ts.map +1 -1
  84. package/dist/cjs/models/AttributeModel.js +1 -0
  85. package/dist/cjs/models/AttributeModel.js.map +1 -1
  86. package/dist/cjs/models/Children.js +3 -3
  87. package/dist/cjs/models/Children.js.map +1 -1
  88. package/dist/cjs/models/CommandModel.d.ts +1 -0
  89. package/dist/cjs/models/CommandModel.d.ts.map +1 -1
  90. package/dist/cjs/models/CommandModel.js +1 -0
  91. package/dist/cjs/models/CommandModel.js.map +1 -1
  92. package/dist/cjs/models/EventModel.d.ts +1 -0
  93. package/dist/cjs/models/EventModel.d.ts.map +1 -1
  94. package/dist/cjs/models/EventModel.js +1 -0
  95. package/dist/cjs/models/EventModel.js.map +1 -1
  96. package/dist/cjs/models/Globals.d.ts +1 -1
  97. package/dist/cjs/models/Model.d.ts +12 -3
  98. package/dist/cjs/models/Model.d.ts.map +1 -1
  99. package/dist/cjs/models/Model.js +16 -10
  100. package/dist/cjs/models/Model.js.map +1 -1
  101. package/dist/cjs/models/Schema.d.ts +14 -0
  102. package/dist/cjs/models/Schema.d.ts.map +1 -1
  103. package/dist/cjs/models/Schema.js +29 -1
  104. package/dist/cjs/models/Schema.js.map +1 -1
  105. package/dist/cjs/models/ScopeModel.d.ts +1 -1
  106. package/dist/cjs/models/ScopeModel.d.ts.map +1 -1
  107. package/dist/cjs/models/ScopeModel.js +2 -2
  108. package/dist/cjs/models/ScopeModel.js.map +1 -1
  109. package/dist/cjs/standard/elements/definitions.d.ts +1 -1
  110. package/dist/cjs/standard/elements/definitions.js +1 -1
  111. package/dist/cjs/standard/elements/{interval.element.d.ts → duration.element.d.ts} +1 -1
  112. package/dist/cjs/standard/elements/duration.element.d.ts.map +1 -0
  113. package/dist/cjs/standard/elements/{interval.element.js → duration.element.js} +4 -4
  114. package/dist/cjs/standard/elements/{interval.element.js.map → duration.element.js.map} +1 -1
  115. package/dist/cjs/standard/elements/models.d.ts +1 -1
  116. package/dist/cjs/standard/elements/models.js +2 -2
  117. package/dist/esm/common/Metatype.d.ts +1 -1
  118. package/dist/esm/decoration/decorators/attribute.d.ts +11 -0
  119. package/dist/esm/decoration/decorators/attribute.d.ts.map +1 -0
  120. package/dist/esm/decoration/decorators/attribute.js +12 -0
  121. package/dist/esm/decoration/decorators/attribute.js.map +6 -0
  122. package/dist/esm/decoration/decorators/cluster.d.ts +11 -0
  123. package/dist/esm/decoration/decorators/cluster.d.ts.map +1 -0
  124. package/dist/esm/decoration/decorators/cluster.js +12 -0
  125. package/dist/esm/decoration/decorators/cluster.js.map +6 -0
  126. package/dist/esm/decoration/decorators/command.d.ts +12 -0
  127. package/dist/esm/decoration/decorators/command.d.ts.map +1 -0
  128. package/dist/esm/decoration/decorators/command.js +14 -0
  129. package/dist/esm/decoration/decorators/command.js.map +6 -0
  130. package/dist/esm/decoration/decorators/datatype.d.ts +11 -0
  131. package/dist/esm/decoration/decorators/datatype.d.ts.map +1 -0
  132. package/dist/esm/decoration/decorators/datatype.js +12 -0
  133. package/dist/esm/decoration/decorators/datatype.js.map +6 -0
  134. package/dist/esm/decoration/decorators/element.d.ts +40 -0
  135. package/dist/esm/decoration/decorators/element.d.ts.map +1 -0
  136. package/dist/esm/decoration/decorators/element.js +81 -0
  137. package/dist/esm/decoration/decorators/element.js.map +6 -0
  138. package/dist/esm/decoration/decorators/event.d.ts +14 -0
  139. package/dist/esm/decoration/decorators/event.d.ts.map +1 -0
  140. package/dist/esm/decoration/decorators/event.js +12 -0
  141. package/dist/esm/decoration/decorators/event.js.map +6 -0
  142. package/dist/esm/decoration/decorators/field.d.ts +14 -0
  143. package/dist/esm/decoration/decorators/field.d.ts.map +1 -0
  144. package/dist/esm/decoration/decorators/field.js +12 -0
  145. package/dist/esm/decoration/decorators/field.js.map +6 -0
  146. package/dist/esm/decoration/decorators/index.d.ts +16 -0
  147. package/dist/esm/decoration/decorators/index.d.ts.map +1 -0
  148. package/dist/esm/decoration/decorators/index.js +16 -0
  149. package/dist/esm/decoration/decorators/index.js.map +6 -0
  150. package/dist/esm/decoration/decorators/listOf.d.ts +12 -0
  151. package/dist/esm/decoration/decorators/listOf.d.ts.map +1 -0
  152. package/dist/esm/decoration/decorators/listOf.js +27 -0
  153. package/dist/esm/decoration/decorators/listOf.js.map +6 -0
  154. package/dist/esm/decoration/decorators/mandatory.d.ts +11 -0
  155. package/dist/esm/decoration/decorators/mandatory.d.ts.map +1 -0
  156. package/dist/esm/decoration/decorators/mandatory.js +21 -0
  157. package/dist/esm/decoration/decorators/mandatory.js.map +6 -0
  158. package/dist/esm/decoration/decorators/nonvolatile.d.ts +11 -0
  159. package/dist/esm/decoration/decorators/nonvolatile.d.ts.map +1 -0
  160. package/dist/esm/decoration/decorators/nonvolatile.js +21 -0
  161. package/dist/esm/decoration/decorators/nonvolatile.js.map +6 -0
  162. package/dist/esm/decoration/decorators/nullable.d.ts +11 -0
  163. package/dist/esm/decoration/decorators/nullable.d.ts.map +1 -0
  164. package/dist/esm/decoration/decorators/nullable.js +21 -0
  165. package/dist/esm/decoration/decorators/nullable.js.map +6 -0
  166. package/dist/esm/decoration/decorators/response.d.ts +12 -0
  167. package/dist/esm/decoration/decorators/response.d.ts.map +1 -0
  168. package/dist/esm/decoration/decorators/response.js +29 -0
  169. package/dist/esm/decoration/decorators/response.js.map +6 -0
  170. package/dist/esm/decoration/errors.d.ts +29 -0
  171. package/dist/esm/decoration/errors.d.ts.map +1 -0
  172. package/dist/esm/decoration/errors.js +24 -0
  173. package/dist/esm/decoration/errors.js.map +6 -0
  174. package/dist/esm/decoration/index.d.ts +9 -0
  175. package/dist/esm/decoration/index.d.ts.map +1 -0
  176. package/dist/esm/decoration/index.js +9 -0
  177. package/dist/esm/decoration/index.js.map +6 -0
  178. package/dist/esm/decoration/semantics/ClassSemantics.d.ts +84 -0
  179. package/dist/esm/decoration/semantics/ClassSemantics.d.ts.map +1 -0
  180. package/dist/esm/decoration/semantics/ClassSemantics.js +246 -0
  181. package/dist/esm/decoration/semantics/ClassSemantics.js.map +6 -0
  182. package/dist/esm/decoration/semantics/FieldSemantics.d.ts +21 -0
  183. package/dist/esm/decoration/semantics/FieldSemantics.d.ts.map +1 -0
  184. package/dist/esm/decoration/semantics/FieldSemantics.js +37 -0
  185. package/dist/esm/decoration/semantics/FieldSemantics.js.map +6 -0
  186. package/dist/esm/decoration/semantics/Semantics.d.ts +68 -0
  187. package/dist/esm/decoration/semantics/Semantics.d.ts.map +1 -0
  188. package/dist/esm/decoration/semantics/Semantics.js +126 -0
  189. package/dist/esm/decoration/semantics/Semantics.js.map +6 -0
  190. package/dist/esm/decoration/semantics/index.d.ts +9 -0
  191. package/dist/esm/decoration/semantics/index.d.ts.map +1 -0
  192. package/dist/esm/decoration/semantics/index.js +9 -0
  193. package/dist/esm/decoration/semantics/index.js.map +6 -0
  194. package/dist/esm/index.d.ts +1 -0
  195. package/dist/esm/index.d.ts.map +1 -1
  196. package/dist/esm/index.js +1 -0
  197. package/dist/esm/index.js.map +1 -1
  198. package/dist/esm/models/AttributeModel.d.ts +1 -0
  199. package/dist/esm/models/AttributeModel.d.ts.map +1 -1
  200. package/dist/esm/models/AttributeModel.js +1 -0
  201. package/dist/esm/models/AttributeModel.js.map +1 -1
  202. package/dist/esm/models/Children.js +3 -3
  203. package/dist/esm/models/Children.js.map +1 -1
  204. package/dist/esm/models/CommandModel.d.ts +1 -0
  205. package/dist/esm/models/CommandModel.d.ts.map +1 -1
  206. package/dist/esm/models/CommandModel.js +1 -0
  207. package/dist/esm/models/CommandModel.js.map +1 -1
  208. package/dist/esm/models/EventModel.d.ts +1 -0
  209. package/dist/esm/models/EventModel.d.ts.map +1 -1
  210. package/dist/esm/models/EventModel.js +1 -0
  211. package/dist/esm/models/EventModel.js.map +1 -1
  212. package/dist/esm/models/Globals.d.ts +1 -1
  213. package/dist/esm/models/Model.d.ts +12 -3
  214. package/dist/esm/models/Model.d.ts.map +1 -1
  215. package/dist/esm/models/Model.js +16 -10
  216. package/dist/esm/models/Model.js.map +1 -1
  217. package/dist/esm/models/Schema.d.ts +14 -0
  218. package/dist/esm/models/Schema.d.ts.map +1 -1
  219. package/dist/esm/models/Schema.js +29 -1
  220. package/dist/esm/models/Schema.js.map +1 -1
  221. package/dist/esm/models/ScopeModel.d.ts +1 -1
  222. package/dist/esm/models/ScopeModel.d.ts.map +1 -1
  223. package/dist/esm/models/ScopeModel.js +2 -2
  224. package/dist/esm/models/ScopeModel.js.map +1 -1
  225. package/dist/esm/standard/elements/definitions.d.ts +1 -1
  226. package/dist/esm/standard/elements/definitions.js +1 -1
  227. package/dist/esm/standard/elements/{interval.element.d.ts → duration.element.d.ts} +1 -1
  228. package/dist/esm/standard/elements/duration.element.d.ts.map +1 -0
  229. package/dist/esm/standard/elements/{interval.element.js → duration.element.js} +1 -1
  230. package/dist/esm/standard/elements/{interval.element.js.map → duration.element.js.map} +1 -1
  231. package/dist/esm/standard/elements/models.d.ts +1 -1
  232. package/dist/esm/standard/elements/models.js +2 -2
  233. package/package.json +4 -4
  234. package/src/decoration/decorators/attribute.ts +13 -0
  235. package/src/decoration/decorators/cluster.ts +13 -0
  236. package/src/decoration/decorators/command.ts +16 -0
  237. package/src/decoration/decorators/datatype.ts +13 -0
  238. package/src/decoration/decorators/element.ts +128 -0
  239. package/src/decoration/decorators/event.ts +16 -0
  240. package/src/decoration/decorators/field.ts +16 -0
  241. package/src/decoration/decorators/index.ts +16 -0
  242. package/src/decoration/decorators/listOf.ts +30 -0
  243. package/src/decoration/decorators/mandatory.ts +22 -0
  244. package/src/decoration/decorators/nonvolatile.ts +22 -0
  245. package/src/decoration/decorators/nullable.ts +22 -0
  246. package/src/decoration/decorators/response.ts +34 -0
  247. package/src/decoration/errors.ts +29 -0
  248. package/src/decoration/index.ts +9 -0
  249. package/src/decoration/semantics/ClassSemantics.ts +374 -0
  250. package/src/decoration/semantics/FieldSemantics.ts +49 -0
  251. package/src/decoration/semantics/Semantics.ts +170 -0
  252. package/src/decoration/semantics/index.ts +9 -0
  253. package/src/index.ts +1 -0
  254. package/src/models/AttributeModel.ts +1 -0
  255. package/src/models/Children.ts +3 -3
  256. package/src/models/CommandModel.ts +1 -0
  257. package/src/models/EventModel.ts +1 -0
  258. package/src/models/Model.ts +34 -12
  259. package/src/models/Schema.ts +51 -0
  260. package/src/models/ScopeModel.ts +2 -2
  261. package/src/standard/elements/definitions.ts +1 -1
  262. package/src/standard/elements/models.ts +1 -1
  263. package/dist/cjs/standard/elements/interval.element.d.ts.map +0 -1
  264. package/dist/esm/standard/elements/interval.element.d.ts.map +0 -1
  265. /package/src/standard/elements/{interval.element.ts → duration.element.ts} +0 -0
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Quality } from "#aspects/Quality.js";
7
+ import { InvalidMetadataError } from "#decoration/errors.js";
8
+ import { FieldSemantics } from "#decoration/semantics/FieldSemantics.js";
9
+ import { Decorator } from "#general";
10
+ import { ValueModel } from "#models/ValueModel.js";
11
+ const nullable = Decorator((_target, context) => {
12
+ const model = FieldSemantics.of(context).mutableModel;
13
+ if (!(model instanceof ValueModel)) {
14
+ throw new InvalidMetadataError("Only value models may be nullable");
15
+ }
16
+ model.quality = new Quality({ ...model.quality, nullable: true });
17
+ });
18
+ export {
19
+ nullable
20
+ };
21
+ //# sourceMappingURL=nullable.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/decoration/decorators/nullable.ts"],
4
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,eAAe;AACxB,SAAS,4BAA4B;AACrC,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAKpB,MAAM,WAAW,UAAuC,CAAC,SAAS,YAAY;AACjF,QAAM,QAAQ,eAAe,GAAG,OAAO,EAAE;AACzC,MAAI,EAAE,iBAAiB,aAAa;AAChC,UAAM,IAAI,qBAAqB,mCAAmC;AAAA,EACtE;AACA,QAAM,UAAU,IAAI,QAAQ,EAAE,GAAG,MAAM,SAAS,UAAU,KAAK,CAAC;AACpE,CAAC;",
5
+ "names": []
6
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Decorator } from "#general";
7
+ import { DatatypeModel } from "#models/DatatypeModel.js";
8
+ /**
9
+ * Specify the response type for a command.
10
+ */
11
+ export declare function response(type: DatatypeModel): Decorator.ClassMethod;
12
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/decoration/decorators/response.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC,WAAW,CAkBnE"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { FieldSemantics } from "#decoration/semantics/FieldSemantics.js";
7
+ import { CommandElement } from "#elements/CommandElement.js";
8
+ import { Decorator } from "#general";
9
+ import { CommandModel } from "#models/CommandModel.js";
10
+ function response(type) {
11
+ return Decorator((_target, context) => {
12
+ const requestSemantics = FieldSemantics.of(context);
13
+ requestSemantics.modelType = CommandModel;
14
+ const request = requestSemantics.mutableModel;
15
+ const name = `${request.name}Response`;
16
+ new CommandModel({
17
+ name,
18
+ id: request.id,
19
+ parent: request.parent,
20
+ direction: CommandElement.Direction.Response,
21
+ operationalBase: type
22
+ });
23
+ request.response = name;
24
+ });
25
+ }
26
+ export {
27
+ response
28
+ };
29
+ //# sourceMappingURL=response.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/decoration/decorators/response.ts"],
4
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAC1B,SAAS,oBAAoB;AAMtB,SAAS,SAAS,MAA4C;AACjE,SAAO,UAAU,CAAC,SAAS,YAAY;AACnC,UAAM,mBAAmB,eAAe,GAAG,OAAO;AAElD,qBAAiB,YAAY;AAC7B,UAAM,UAAU,iBAAiB;AAEjC,UAAM,OAAO,GAAG,QAAQ,IAAI;AAC5B,QAAI,aAAa;AAAA,MACb;AAAA,MACA,IAAI,QAAQ;AAAA,MACZ,QAAQ,QAAQ;AAAA,MAChB,WAAW,eAAe,UAAU;AAAA,MACpC,iBAAiB;AAAA,IACrB,CAAC;AAED,YAAQ,WAAW;AAAA,EACvB,CAAC;AACL;",
5
+ "names": []
6
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { ImplementationError } from "#general";
7
+ export declare class MetadataError extends ImplementationError {
8
+ }
9
+ /**
10
+ * Thrown when a type is assigned to a class or property that is already typed.
11
+ */
12
+ export declare class MetadataConflictError extends MetadataError {
13
+ }
14
+ /**
15
+ * Thrown when metadata is inappropriate for the decorated language element.
16
+ */
17
+ export declare class InvalidMetadataError extends MetadataError {
18
+ }
19
+ /**
20
+ * Thrown when an error occurs instantiating a dummy instance of a class for introspection purposes.
21
+ */
22
+ export declare class ClassIntrospectionError extends MetadataError {
23
+ }
24
+ /**
25
+ * Thrown when required metadata is missing.
26
+ */
27
+ export declare class MissingMetadataError extends MetadataError {
28
+ }
29
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/decoration/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,qBAAa,aAAc,SAAQ,mBAAmB;CAAG;AAEzD;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;CAAG;AAE3D;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;CAAG;AAE1D;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,aAAa;CAAG;AAE7D;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,aAAa;CAAG"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { ImplementationError } from "#general";
7
+ class MetadataError extends ImplementationError {
8
+ }
9
+ class MetadataConflictError extends MetadataError {
10
+ }
11
+ class InvalidMetadataError extends MetadataError {
12
+ }
13
+ class ClassIntrospectionError extends MetadataError {
14
+ }
15
+ class MissingMetadataError extends MetadataError {
16
+ }
17
+ export {
18
+ ClassIntrospectionError,
19
+ InvalidMetadataError,
20
+ MetadataConflictError,
21
+ MetadataError,
22
+ MissingMetadataError
23
+ };
24
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/decoration/errors.ts"],
4
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,2BAA2B;AAE7B,MAAM,sBAAsB,oBAAoB;AAAC;AAKjD,MAAM,8BAA8B,cAAc;AAAC;AAKnD,MAAM,6BAA6B,cAAc;AAAC;AAKlD,MAAM,gCAAgC,cAAc;AAAC;AAKrD,MAAM,6BAA6B,cAAc;AAAC;",
5
+ "names": []
6
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export * from "./decorators/index.js";
7
+ export * from "./errors.js";
8
+ export * from "./semantics/index.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/decoration/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ export * from "./decorators/index.js";
7
+ export * from "./errors.js";
8
+ export * from "./semantics/index.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/decoration/index.ts"],
4
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,cAAc;AACd,cAAc;AACd,cAAc;",
5
+ "names": []
6
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { Model } from "#models/index.js";
7
+ import { FieldSemantics } from "./FieldSemantics.js";
8
+ import { Semantics } from "./Semantics.js";
9
+ /**
10
+ * Matter semantic metadata attached to a class via decorators.
11
+ *
12
+ * We use decorators to allow for definition of model elements in the context of a specific type.
13
+ *
14
+ * Currently there are JavaScript/TypeScript limitations to be aware of when decorating type definitions:
15
+ *
16
+ * * Decorators may only be applied to JavaScript classes. So if you want to define an interface without
17
+ * implementation, you must implement as a class and use as an interface. That's why this is "class" metadata.
18
+ *
19
+ * * Decorators may not affect the TypeScript type of an object. This means that you must define both the Matter type
20
+ * (e.g. {@link uint32}) and TypeScript type (e.g. `number`).
21
+ */
22
+ export declare class ClassSemantics extends Semantics {
23
+ #private;
24
+ /**
25
+ * The model that represents the semantics for this class.
26
+ *
27
+ * This may be {@link localModel} or {@link prototypeBaseModel}
28
+ */
29
+ get semanticModel(): Model<import("../../index.js").BaseElement, Model<import("../../index.js").BaseElement, any>> | undefined;
30
+ /**
31
+ * Get the class constructor
32
+ */
33
+ get new(): ClassSemantics.Constructor | undefined;
34
+ /**
35
+ * Assign the constructor for the class.
36
+ */
37
+ set new(fn: ClassSemantics.Constructor);
38
+ /**
39
+ * The class {@link Model} inherited from {@link new}'s prototype chain, if any.
40
+ */
41
+ get prototypeBaseModel(): Model | undefined;
42
+ /**
43
+ * Obtain a {@link FieldSemantics} for the named field.
44
+ */
45
+ fieldFor(name: string | symbol): FieldSemantics;
46
+ /**
47
+ * Add logical fields for unrecognized members of an object.
48
+ *
49
+ * This extends the model with untyped fields for properties that are not otherwise typed.
50
+ */
51
+ defineUnknownMembers(instance: unknown): void;
52
+ /**
53
+ * Obtain the {@link ClassSemantics} for {@link source}.
54
+ */
55
+ static of(source: ClassSemantics.Source): ClassSemantics;
56
+ /**
57
+ * Determine {@link new} has semantic decoration.
58
+ */
59
+ static hasOwnSemantics(source: ClassSemantics.Constructor): boolean;
60
+ /**
61
+ * Access the {@link ClassSemantics} of {@link new} if it is defined.
62
+ */
63
+ static maybeOf(source: ClassSemantics.Constructor): ClassSemantics | undefined;
64
+ finalize(): void;
65
+ protected integrateModel(model: Model): Model<import("../../index.js").BaseElement, Model<import("../../index.js").BaseElement, any>>;
66
+ protected createModel(type?: Model.ConcreteType): Model<import("../../index.js").BaseElement, Model<import("../../index.js").BaseElement, any>>;
67
+ }
68
+ export declare namespace ClassSemantics {
69
+ /**
70
+ * A standard constructor with an optional decoration extension point.
71
+ */
72
+ interface Constructor extends NewableFunction {
73
+ /**
74
+ * If present, invoked for custom decoration after installing constructor.
75
+ */
76
+ [extend]?: (semantics: ClassSemantics) => void;
77
+ }
78
+ /**
79
+ * An object for which you may obtain {@link ClassSemantics}.
80
+ */
81
+ type Source = Constructor | DecoratorContext | ClassSemantics;
82
+ const extend: unique symbol;
83
+ }
84
+ //# sourceMappingURL=ClassSemantics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClassSemantics.d.ts","sourceRoot":"","sources":["../../../../src/decoration/semantics/ClassSemantics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAA6B,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAMpE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAmB3C;;;;;;;;;;;;GAYG;AACH,qBAAa,cAAe,SAAQ,SAAS;;IAIzC;;;;OAIG;IACH,IAAI,aAAa,8GAahB;IAED;;OAEG;IACH,IAAI,GAAG,IAAI,cAAc,CAAC,WAAW,GAAG,SAAS,CAEhD;IAED;;OAEG;IACH,IAAI,GAAG,CAAC,EAAE,EAAE,cAAc,CAAC,WAAW,EA6BrC;IAED;;OAEG;IACH,IAAI,kBAAkB,IAAI,KAAK,GAAG,SAAS,CAsB1C;IAED;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAmB9B;;;;OAIG;IACH,oBAAoB,CAAC,QAAQ,EAAE,OAAO;IAuDtC;;OAEG;WACa,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM;IAuChD;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,cAAc,CAAC,WAAW;IAIzD;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,WAAW;IAUxC,QAAQ;cA6CE,cAAc,CAAC,KAAK,EAAE,KAAK;cAoB3B,WAAW,CAAC,IAAI,GAAE,KAAK,CAAC,YAA4B;CAO1E;AAED,yBAAiB,cAAc,CAAC;IAC5B;;OAEG;IACH,UAAiB,WAAY,SAAQ,eAAe;QAChD;;WAEG;QACH,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,IAAI,CAAC;KAClD;IAED;;OAEG;IACH,KAAY,MAAM,GAAG,WAAW,GAAG,gBAAgB,GAAG,cAAc,CAAC;IAE9D,MAAM,MAAM,eAAmB,CAAC;CAC1C"}
@@ -0,0 +1,246 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { DatatypeModel } from "#models/index.js";
7
+ import { camelize } from "#general";
8
+ import { Scope } from "#logic/Scope.js";
9
+ import { any, struct } from "#standard/elements/models.js";
10
+ import { InvalidMetadataError, MetadataConflictError } from "../errors.js";
11
+ import { FieldSemantics } from "./FieldSemantics.js";
12
+ import { Semantics } from "./Semantics.js";
13
+ const matter = Symbol("matter");
14
+ class ClassSemantics extends Semantics {
15
+ #new;
16
+ #definedFields;
17
+ /**
18
+ * The model that represents the semantics for this class.
19
+ *
20
+ * This may be {@link localModel} or {@link prototypeBaseModel}
21
+ */
22
+ get semanticModel() {
23
+ if (this.localModel) {
24
+ return this.localModel;
25
+ }
26
+ if (this.#definedFields) {
27
+ return this.mutableModel;
28
+ }
29
+ return this.prototypeBaseModel;
30
+ }
31
+ /**
32
+ * Get the class constructor
33
+ */
34
+ get new() {
35
+ return this.#new;
36
+ }
37
+ /**
38
+ * Assign the constructor for the class.
39
+ */
40
+ set new(fn) {
41
+ if (this.#new === fn) {
42
+ return;
43
+ }
44
+ if (this.isFinal) {
45
+ throw new MetadataConflictError(
46
+ `Cannot install semantic constructor ${fn.name} because semantics are final`
47
+ );
48
+ }
49
+ this.#new = fn;
50
+ if (this.localModel && !this.localModel.isFinal && this.localModel.name !== this.#new?.name) {
51
+ this.localModel.name = this.#new?.name;
52
+ }
53
+ if (this.localModel) {
54
+ this.#applyBaseSemantics();
55
+ } else {
56
+ const base = this.prototypeBaseModel;
57
+ if (base !== void 0) {
58
+ this.mutableModel = base;
59
+ }
60
+ }
61
+ }
62
+ /**
63
+ * The class {@link Model} inherited from {@link new}'s prototype chain, if any.
64
+ */
65
+ get prototypeBaseModel() {
66
+ let current = this.#new?.prototype;
67
+ let base;
68
+ while (current) {
69
+ current = Object.getPrototypeOf(current);
70
+ if (typeof current !== "object" || current === null) {
71
+ return;
72
+ }
73
+ const constructor = current.constructor;
74
+ if (constructor === Object) {
75
+ return;
76
+ }
77
+ base = ClassSemantics.maybeOf(constructor);
78
+ if (base?.localModel) {
79
+ base.finalize();
80
+ return base.localModel;
81
+ }
82
+ }
83
+ }
84
+ /**
85
+ * Obtain a {@link FieldSemantics} for the named field.
86
+ */
87
+ fieldFor(name) {
88
+ if (typeof name !== "string") {
89
+ throw new InvalidMetadataError(`Cannot decorate symbolic function ${String(name)}`);
90
+ }
91
+ if (this.#definedFields === void 0) {
92
+ this.#definedFields = /* @__PURE__ */ new Map();
93
+ }
94
+ let field = this.#definedFields.get(name);
95
+ if (field === void 0) {
96
+ if (this.isFinal) {
97
+ throw new MetadataConflictError(`Cannot install field ${name} because semantics are final`);
98
+ }
99
+ this.#definedFields.set(name, field = new FieldSemantics(this, name));
100
+ }
101
+ return field;
102
+ }
103
+ /**
104
+ * Add logical fields for unrecognized members of an object.
105
+ *
106
+ * This extends the model with untyped fields for properties that are not otherwise typed.
107
+ */
108
+ defineUnknownMembers(instance) {
109
+ if (instance === void 0 || instance === null) {
110
+ return;
111
+ }
112
+ const known = this.semanticModel ? new Set(
113
+ Scope(this.semanticModel).membersOf(this.semanticModel).map((model) => camelize(model.name))
114
+ ) : /* @__PURE__ */ new Set();
115
+ const descriptors = Object.getOwnPropertyDescriptors(instance);
116
+ for (const name in descriptors) {
117
+ if (known.has(camelize(name))) {
118
+ continue;
119
+ }
120
+ if (typeof name !== "string") {
121
+ continue;
122
+ }
123
+ const descriptor = descriptors[name];
124
+ if (descriptor.set && !descriptor.get) {
125
+ continue;
126
+ }
127
+ try {
128
+ if (typeof instance[name] === "function") {
129
+ continue;
130
+ }
131
+ } catch (e) {
132
+ continue;
133
+ }
134
+ const model = this.fieldFor(name).mutableModel;
135
+ model.operationalBase = any;
136
+ if (!descriptor.writable && !descriptor.set) {
137
+ model.quality = { ...model.quality, fixed: true };
138
+ }
139
+ this.fieldFor(name).mutableModel.operationalBase = any;
140
+ }
141
+ }
142
+ /**
143
+ * Obtain the {@link ClassSemantics} for {@link source}.
144
+ */
145
+ static of(source) {
146
+ if (source instanceof ClassSemantics) {
147
+ return source;
148
+ }
149
+ if (typeof source !== "function") {
150
+ const metadata2 = source.metadata;
151
+ if (Object.hasOwn(metadata2, matter)) {
152
+ return metadata2[matter];
153
+ }
154
+ return metadata2[matter] = new ClassSemantics();
155
+ }
156
+ let metadata;
157
+ if (!Object.hasOwn(source, Symbol.metadata)) {
158
+ metadata = source[Symbol.metadata] = {};
159
+ } else {
160
+ metadata = source[Symbol.metadata];
161
+ }
162
+ let semantics;
163
+ if (!Object.hasOwn(metadata, matter)) {
164
+ semantics = metadata[matter] = new ClassSemantics();
165
+ } else {
166
+ semantics = metadata[matter];
167
+ }
168
+ if (!semantics.new) {
169
+ semantics.new = source;
170
+ }
171
+ return semantics;
172
+ }
173
+ /**
174
+ * Determine {@link new} has semantic decoration.
175
+ */
176
+ static hasOwnSemantics(source) {
177
+ return Object.hasOwn(source, Symbol.metadata) && Object.hasOwn(source[Symbol.metadata], matter);
178
+ }
179
+ /**
180
+ * Access the {@link ClassSemantics} of {@link new} if it is defined.
181
+ */
182
+ static maybeOf(source) {
183
+ if (this.hasOwnSemantics(source)) {
184
+ return ClassSemantics.of(source);
185
+ }
186
+ }
187
+ static {
188
+ Semantics.classOf = this.of;
189
+ }
190
+ finalize() {
191
+ if (this.isFinal) {
192
+ return;
193
+ }
194
+ this.#new?.[ClassSemantics.extend]?.(this);
195
+ super.finalize();
196
+ if (this.#definedFields) {
197
+ for (const field of this.#definedFields.values()) {
198
+ field.finalize();
199
+ }
200
+ }
201
+ }
202
+ #applyBaseSemantics() {
203
+ const base = this.prototypeBaseModel;
204
+ if (base === void 0) {
205
+ return;
206
+ }
207
+ const { type, base: currentBase } = this.mutableModel;
208
+ if (type === void 0 && (currentBase === void 0 || currentBase === struct)) {
209
+ const operationalBase = this.prototypeBaseModel;
210
+ if (operationalBase) {
211
+ this.mutableModel.operationalBase = operationalBase;
212
+ }
213
+ }
214
+ if (base && base.tag !== "datatype" && this.mutableModel.tag !== base.tag) {
215
+ this.modelType = base.constructor;
216
+ }
217
+ if (this.mutableModel.id === void 0 && base.id !== void 0) {
218
+ this.mutableModel.id = base.id;
219
+ }
220
+ }
221
+ integrateModel(model) {
222
+ if (this.localModel === void 0 || this.localModel.isFinal) {
223
+ return model;
224
+ }
225
+ if (model.isFinal) {
226
+ this.localModel.operationalBase = model;
227
+ return this.localModel;
228
+ }
229
+ model.children.push(...this.localModel.children);
230
+ return model;
231
+ }
232
+ createModel(type = DatatypeModel) {
233
+ let name = this.#new?.name;
234
+ if (name === void 0 || name === "") {
235
+ name = "Unnamed";
236
+ }
237
+ return new type({ name, operationalBase: struct });
238
+ }
239
+ }
240
+ ((ClassSemantics2) => {
241
+ ClassSemantics2.extend = Symbol("extend");
242
+ })(ClassSemantics || (ClassSemantics = {}));
243
+ export {
244
+ ClassSemantics
245
+ };
246
+ //# sourceMappingURL=ClassSemantics.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/decoration/semantics/ClassSemantics.ts"],
4
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,SAAS,qBAAwC;AAEjD,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,KAAK,cAAc;AAC5B,SAAS,sBAAsB,6BAA6B;AAC5D,SAAS,sBAAsB;AAC/B,SAAS,iBAAiB;AAO1B,MAAM,SAAS,OAAO,QAAQ;AAyBvB,MAAM,uBAAuB,UAAU;AAAA,EAC1C;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAI,gBAAgB;AAChB,QAAI,KAAK,YAAY;AAEjB,aAAO,KAAK;AAAA,IAChB;AAEA,QAAI,KAAK,gBAAgB;AAErB,aAAO,KAAK;AAAA,IAChB;AAGA,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,MAA8C;AAC9C,WAAO,KAAK;AAAA,EAChB;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,IAAI,IAAgC;AACpC,QAAI,KAAK,SAAS,IAAI;AAClB;AAAA,IACJ;AAEA,QAAI,KAAK,SAAS;AACd,YAAM,IAAI;AAAA,QACN,uCAAuC,GAAG,IAAI;AAAA,MAClD;AAAA,IACJ;AAEA,SAAK,OAAO;AAGZ,QAAI,KAAK,cAAc,CAAC,KAAK,WAAW,WAAW,K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AQ,KAAK,KAAK;AACvE,WAAK,YAAY,KAAK;AAAA,IAC1B;AAGA,QAAI,KAAK,aAAa,OAAO,UAAa,KAAK,OAAO,QAAW;AAC7D,WAAK,aAAa,KAAK,KAAK;AAAA,IAChC;AAAA,EACJ;AAAA,EAEmB,eAAe,OAAc;AAE5C,QAAI,KAAK,eAAe,UAAa,KAAK,WAAW,SAAS;AAC1D,aAAO;AAAA,IACX;AAIA,QAAI,MAAM,SAAS;AACf,WAAK,WAAW,kBAAkB;AAClC,aAAO,KAAK;AAAA,IAChB;AAIA,UAAM,SAAS,KAAK,GAAG,KAAK,WAAW,QAAQ;AAE/C,WAAO;AAAA,EACX;AAAA,EAEmB,YAAY,OAA2B,eAAe;AACrE,QAAI,OAAO,KAAK,MAAM;AACtB,QAAI,SAAS,UAAa,SAAS,IAAI;AACnC,aAAO;AAAA,IACX;AACA,WAAO,IAAI,KAAK,EAAE,MAAM,iBAAiB,OAAO,CAAC;AAAA,EACrD;AACJ;AAAA,CAEO,CAAUC,oBAAV;AAgBI,EAAMA,gBAAA,SAAS,OAAO,QAAQ;AAAA,GAhBxB;",
5
+ "names": ["metadata", "ClassSemantics"]
6
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import type { Model } from "#models/Model.js";
7
+ import type { ClassSemantics } from "./ClassSemantics.js";
8
+ import { Semantics } from "./Semantics.js";
9
+ /**
10
+ * Decorator metadata associated with a specific class field.
11
+ */
12
+ export declare class FieldSemantics extends Semantics {
13
+ constructor(owner: ClassSemantics, name: string);
14
+ protected createModel(): Model;
15
+ protected integrateModel(model: Model): Model;
16
+ static of(source: FieldSemantics.Source): FieldSemantics;
17
+ }
18
+ export declare namespace FieldSemantics {
19
+ type Source = DecoratorContext;
20
+ }
21
+ //# sourceMappingURL=FieldSemantics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldSemantics.d.ts","sourceRoot":"","sources":["../../../../src/decoration/semantics/FieldSemantics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,qBAAa,cAAe,SAAQ,SAAS;gBAC7B,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM;cAM5B,WAAW,IAAI,KAAK;cAKpB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK;WAQtC,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM;CAQnD;AAED,yBAAiB,cAAc,CAAC;IAC5B,KAAY,MAAM,GAAG,gBAAgB,CAAC;CACzC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2022-2025 Matter.js Authors
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ import { InvalidMetadataError } from "#decoration/errors.js";
7
+ import { InternalError } from "#general";
8
+ import { FieldModel } from "#models/FieldModel.js";
9
+ import { Semantics } from "./Semantics.js";
10
+ class FieldSemantics extends Semantics {
11
+ constructor(owner, name) {
12
+ super();
13
+ this.mutableModel = new FieldModel({ name, parent: owner.mutableModel });
14
+ }
15
+ createModel() {
16
+ throw new InternalError("Unexpected FieldSemantics.createModel");
17
+ }
18
+ integrateModel(model) {
19
+ if (this.localModel === void 0) {
20
+ return model;
21
+ }
22
+ this.mutableModel.operationalBase = model;
23
+ return this.mutableModel;
24
+ }
25
+ static of(source) {
26
+ if (source.kind === "class") {
27
+ throw new InvalidMetadataError(
28
+ `Cannot retrieve field semantics for class decorator ${source.name ?? "of anonymous class"}`
29
+ );
30
+ }
31
+ return Semantics.classOf(source).fieldFor(source.name);
32
+ }
33
+ }
34
+ export {
35
+ FieldSemantics
36
+ };
37
+ //# sourceMappingURL=FieldSemantics.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/decoration/semantics/FieldSemantics.ts"],
4
+ "mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,4BAA4B;AACrC,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAG3B,SAAS,iBAAiB;AAKnB,MAAM,uBAAuB,UAAU;AAAA,EAC1C,YAAY,OAAuB,MAAc;AAC7C,UAAM;AAEN,SAAK,eAAe,IAAI,WAAW,EAAE,MAAM,QAAQ,MAAM,aAAa,CAAC;AAAA,EAC3E;AAAA,EAEmB,cAAqB;AAEpC,UAAM,IAAI,cAAc,uCAAuC;AAAA,EACnE;AAAA,EAEmB,eAAe,OAAqB;AACnD,QAAI,KAAK,eAAe,QAAW;AAC/B,aAAO;AAAA,IACX;AACA,SAAK,aAAa,kBAAkB;AACpC,WAAO,KAAK;AAAA,EAChB;AAAA,EAEA,OAAgB,GAAG,QAA+B;AAC9C,QAAI,OAAO,SAAS,SAAS;AACzB,YAAM,IAAI;AAAA,QACN,uDAAuD,OAAO,QAAQ,oBAAoB;AAAA,MAC9F;AAAA,IACJ;AACA,WAAO,UAAU,QAAQ,MAAM,EAAE,SAAS,OAAO,IAAI;AAAA,EACzD;AACJ;",
5
+ "names": []
6
+ }