typecomposer 0.1.44 → 0.1.45

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 (349) hide show
  1. package/core/components/AlertPanel.d.ts +7 -6
  2. package/core/components/AlertPanel.js +3 -2
  3. package/core/components/AlertPanel.js.map +1 -1
  4. package/core/components/AvatarPanel.d.ts +3 -2
  5. package/core/components/AvatarPanel.js +2 -2
  6. package/core/components/AvatarPanel.js.map +1 -1
  7. package/core/components/BorderPanel.d.ts +3 -2
  8. package/core/components/BorderPanel.js +2 -1
  9. package/core/components/BorderPanel.js.map +1 -1
  10. package/core/components/CardPanel.d.ts +3 -2
  11. package/core/components/CardPanel.js +2 -1
  12. package/core/components/CardPanel.js.map +1 -1
  13. package/core/components/CheckBox.d.ts +4 -2
  14. package/core/components/CheckBox.js +7 -5
  15. package/core/components/CheckBox.js.map +1 -1
  16. package/core/components/ColorPicker.d.ts +3 -2
  17. package/core/components/ColorPicker.js +11 -8
  18. package/core/components/ColorPicker.js.map +1 -1
  19. package/core/components/ContextMenu.d.ts +5 -3
  20. package/core/components/ContextMenu.js +5 -3
  21. package/core/components/ContextMenu.js.map +1 -1
  22. package/core/components/DialogPanel.d.ts +3 -2
  23. package/core/components/DialogPanel.js +2 -2
  24. package/core/components/DialogPanel.js.map +1 -1
  25. package/core/components/DropDown.d.ts +5 -3
  26. package/core/components/DropDown.js +5 -3
  27. package/core/components/DropDown.js.map +1 -1
  28. package/core/components/FlowPanel.d.ts +3 -2
  29. package/core/components/FlowPanel.js +3 -2
  30. package/core/components/FlowPanel.js.map +1 -1
  31. package/core/components/ForEach.d.ts +3 -2
  32. package/core/components/ForEach.js +2 -1
  33. package/core/components/ForEach.js.map +1 -1
  34. package/core/components/GridPanel.d.ts +3 -2
  35. package/core/components/GridPanel.js +2 -1
  36. package/core/components/GridPanel.js.map +1 -1
  37. package/core/components/HBox.d.ts +3 -2
  38. package/core/components/HBox.js +2 -1
  39. package/core/components/HBox.js.map +1 -1
  40. package/core/components/LazyLoading.d.ts +3 -2
  41. package/core/components/LazyLoading.js +3 -2
  42. package/core/components/LazyLoading.js.map +1 -1
  43. package/core/components/ListPanel.d.ts +3 -2
  44. package/core/components/ListPanel.js +2 -1
  45. package/core/components/ListPanel.js.map +1 -1
  46. package/core/components/PopUpButton.d.ts +3 -2
  47. package/core/components/PopUpButton.js +6 -3
  48. package/core/components/PopUpButton.js.map +1 -1
  49. package/core/components/ScrollPanel.d.ts +3 -2
  50. package/core/components/ScrollPanel.js +2 -1
  51. package/core/components/ScrollPanel.js.map +1 -1
  52. package/core/components/SliderPanel.d.ts +3 -2
  53. package/core/components/SliderPanel.js +4 -5
  54. package/core/components/SliderPanel.js.map +1 -1
  55. package/core/components/StackPanel.d.ts +3 -2
  56. package/core/components/StackPanel.js +2 -1
  57. package/core/components/StackPanel.js.map +1 -1
  58. package/core/components/TabItem.d.ts +1 -0
  59. package/core/components/TabItem.js +7 -4
  60. package/core/components/TabItem.js.map +1 -1
  61. package/core/components/TabPanel.d.ts +3 -2
  62. package/core/components/TabPanel.js +2 -1
  63. package/core/components/TabPanel.js.map +1 -1
  64. package/core/components/TablePanel.d.ts +6 -4
  65. package/core/components/TablePanel.js +4 -2
  66. package/core/components/TablePanel.js.map +1 -1
  67. package/core/components/TextEdit.d.ts +1 -0
  68. package/core/components/TextEdit.js +4 -2
  69. package/core/components/TextEdit.js.map +1 -1
  70. package/core/components/TextField.d.ts +1 -0
  71. package/core/components/TextField.js +3 -2
  72. package/core/components/TextField.js.map +1 -1
  73. package/core/components/ToggleButton.d.ts +3 -2
  74. package/core/components/ToggleButton.js +2 -1
  75. package/core/components/ToggleButton.js.map +1 -1
  76. package/core/components/Tooltip.d.ts +3 -2
  77. package/core/components/Tooltip.js +2 -1
  78. package/core/components/Tooltip.js.map +1 -1
  79. package/core/components/VBox.d.ts +3 -2
  80. package/core/components/VBox.js +2 -1
  81. package/core/components/VBox.js.map +1 -1
  82. package/core/components/VirtualScroll copy 2.d.ts +2 -2
  83. package/core/components/VirtualScroll copy 2.js +2 -8
  84. package/core/components/VirtualScroll copy 2.js.map +1 -1
  85. package/core/components/VirtualScroll.d.ts +3 -2
  86. package/core/components/VirtualScroll.js +3 -2
  87. package/core/components/VirtualScroll.js.map +1 -1
  88. package/core/element/AbbreviationElement.d.ts +3 -2
  89. package/core/element/AbbreviationElement.js +2 -3
  90. package/core/element/AbbreviationElement.js.map +1 -1
  91. package/core/element/AnchorElement.d.ts +4 -3
  92. package/core/element/AnchorElement.js +2 -1
  93. package/core/element/AnchorElement.js.map +1 -1
  94. package/core/element/AreaElement.d.ts +3 -2
  95. package/core/element/AreaElement.js +2 -1
  96. package/core/element/AreaElement.js.map +1 -1
  97. package/core/element/ArticleElement.d.ts +3 -2
  98. package/core/element/ArticleElement.js +2 -1
  99. package/core/element/ArticleElement.js.map +1 -1
  100. package/core/element/AudioElement.d.ts +3 -2
  101. package/core/element/AudioElement.js +2 -1
  102. package/core/element/AudioElement.js.map +1 -1
  103. package/core/element/BaseElement.d.ts +3 -2
  104. package/core/element/BaseElement.js +2 -1
  105. package/core/element/BaseElement.js.map +1 -1
  106. package/core/element/BodyElement.d.ts +3 -2
  107. package/core/element/BodyElement.js +2 -1
  108. package/core/element/BodyElement.js.map +1 -1
  109. package/core/element/BoldElement.d.ts +3 -2
  110. package/core/element/BoldElement.js +2 -1
  111. package/core/element/BoldElement.js.map +1 -1
  112. package/core/element/BreakElement.d.ts +3 -2
  113. package/core/element/BreakElement.js +2 -1
  114. package/core/element/BreakElement.js.map +1 -1
  115. package/core/element/ButtonElement.d.ts +3 -2
  116. package/core/element/ButtonElement.js +2 -1
  117. package/core/element/ButtonElement.js.map +1 -1
  118. package/core/element/CanvasElement.d.ts +3 -2
  119. package/core/element/CanvasElement.js +2 -1
  120. package/core/element/CanvasElement.js.map +1 -1
  121. package/core/element/CaptionElement.d.ts +3 -2
  122. package/core/element/CaptionElement.js +2 -1
  123. package/core/element/CaptionElement.js.map +1 -1
  124. package/core/element/CiteElement.d.ts +3 -2
  125. package/core/element/CiteElement.js +2 -1
  126. package/core/element/CiteElement.js.map +1 -1
  127. package/core/element/CodeElement.d.ts +3 -2
  128. package/core/element/CodeElement.js +2 -1
  129. package/core/element/CodeElement.js.map +1 -1
  130. package/core/element/DataListElement.d.ts +3 -2
  131. package/core/element/DataListElement.js +2 -1
  132. package/core/element/DataListElement.js.map +1 -1
  133. package/core/element/DefinitionDescriptionElement.d.ts +3 -2
  134. package/core/element/DefinitionDescriptionElement.js +2 -1
  135. package/core/element/DefinitionDescriptionElement.js.map +1 -1
  136. package/core/element/DefinitionElement.d.ts +3 -2
  137. package/core/element/DefinitionElement.js +2 -1
  138. package/core/element/DefinitionElement.js.map +1 -1
  139. package/core/element/DeletedTextElement.d.ts +3 -2
  140. package/core/element/DeletedTextElement.js +2 -1
  141. package/core/element/DeletedTextElement.js.map +1 -1
  142. package/core/element/DetailsElement.d.ts +3 -2
  143. package/core/element/DetailsElement.js +2 -1
  144. package/core/element/DetailsElement.js.map +1 -1
  145. package/core/element/DialogElement.d.ts +3 -2
  146. package/core/element/DialogElement.js +2 -1
  147. package/core/element/DialogElement.js.map +1 -1
  148. package/core/element/DivElement.d.ts +3 -2
  149. package/core/element/DivElement.js +2 -1
  150. package/core/element/DivElement.js.map +1 -1
  151. package/core/element/EmElement.d.ts +3 -2
  152. package/core/element/EmElement.js +2 -1
  153. package/core/element/EmElement.js.map +1 -1
  154. package/core/element/EmbedElement.d.ts +3 -2
  155. package/core/element/EmbedElement.js +2 -1
  156. package/core/element/EmbedElement.js.map +1 -1
  157. package/core/element/FieldSetElement.d.ts +3 -2
  158. package/core/element/FieldSetElement.js +2 -1
  159. package/core/element/FieldSetElement.js.map +1 -1
  160. package/core/element/FooterElement.d.ts +3 -2
  161. package/core/element/FooterElement.js +2 -1
  162. package/core/element/FooterElement.js.map +1 -1
  163. package/core/element/FormElement.d.ts +3 -2
  164. package/core/element/FormElement.js +2 -1
  165. package/core/element/FormElement.js.map +1 -1
  166. package/core/element/Fragment.d.ts +0 -1
  167. package/core/element/Fragment.js +6 -50
  168. package/core/element/Fragment.js.map +1 -1
  169. package/core/element/H1Element.d.ts +3 -2
  170. package/core/element/H1Element.js +2 -1
  171. package/core/element/H1Element.js.map +1 -1
  172. package/core/element/H2Element.d.ts +3 -2
  173. package/core/element/H2Element.js +2 -1
  174. package/core/element/H2Element.js.map +1 -1
  175. package/core/element/H3Element.d.ts +3 -2
  176. package/core/element/H3Element.js +2 -1
  177. package/core/element/H3Element.js.map +1 -1
  178. package/core/element/H4Element.d.ts +3 -2
  179. package/core/element/H4Element.js +2 -1
  180. package/core/element/H4Element.js.map +1 -1
  181. package/core/element/H5Element.d.ts +3 -2
  182. package/core/element/H5Element.js +2 -1
  183. package/core/element/H5Element.js.map +1 -1
  184. package/core/element/H6Element.d.ts +3 -2
  185. package/core/element/H6Element.js +2 -1
  186. package/core/element/H6Element.js.map +1 -1
  187. package/core/element/HeadElement.d.ts +3 -2
  188. package/core/element/HeadElement.js +2 -1
  189. package/core/element/HeadElement.js.map +1 -1
  190. package/core/element/HeaderElement.d.ts +3 -2
  191. package/core/element/HeaderElement.js +2 -1
  192. package/core/element/HeaderElement.js.map +1 -1
  193. package/core/element/HorizontalRuleElement.d.ts +3 -2
  194. package/core/element/HorizontalRuleElement.js +2 -1
  195. package/core/element/HorizontalRuleElement.js.map +1 -1
  196. package/core/element/HtmlElement.d.ts +3 -2
  197. package/core/element/HtmlElement.js +2 -1
  198. package/core/element/HtmlElement.js.map +1 -1
  199. package/core/element/IFrameElement.d.ts +3 -2
  200. package/core/element/IFrameElement.js +2 -1
  201. package/core/element/IFrameElement.js.map +1 -1
  202. package/core/element/ILayout.d.ts +3 -2
  203. package/core/element/ILayout.js +2 -1
  204. package/core/element/ILayout.js.map +1 -1
  205. package/core/element/IconElement.d.ts +3 -2
  206. package/core/element/IconElement.js +2 -1
  207. package/core/element/IconElement.js.map +1 -1
  208. package/core/element/IdiomaticElement.d.ts +1 -0
  209. package/core/element/IdiomaticElement.js +2 -1
  210. package/core/element/IdiomaticElement.js.map +1 -1
  211. package/core/element/ImageElement.d.ts +3 -2
  212. package/core/element/ImageElement.js +2 -1
  213. package/core/element/ImageElement.js.map +1 -1
  214. package/core/element/InputElement.d.ts +3 -2
  215. package/core/element/InputElement.js +2 -1
  216. package/core/element/InputElement.js.map +1 -1
  217. package/core/element/LabelElement.d.ts +3 -2
  218. package/core/element/LabelElement.js +2 -1
  219. package/core/element/LabelElement.js.map +1 -1
  220. package/core/element/LegendElement.d.ts +3 -2
  221. package/core/element/LegendElement.js +2 -1
  222. package/core/element/LegendElement.js.map +1 -1
  223. package/core/element/ListItemElement.d.ts +3 -2
  224. package/core/element/ListItemElement.js +2 -1
  225. package/core/element/ListItemElement.js.map +1 -1
  226. package/core/element/MainElement.d.ts +3 -2
  227. package/core/element/MainElement.js +2 -1
  228. package/core/element/MainElement.js.map +1 -1
  229. package/core/element/NavElement.d.ts +3 -2
  230. package/core/element/NavElement.js +2 -1
  231. package/core/element/NavElement.js.map +1 -1
  232. package/core/element/OrderedListElement.d.ts +3 -2
  233. package/core/element/OrderedListElement.js +2 -1
  234. package/core/element/OrderedListElement.js.map +1 -1
  235. package/core/element/ParagraphElement.d.ts +3 -2
  236. package/core/element/ParagraphElement.js +2 -1
  237. package/core/element/ParagraphElement.js.map +1 -1
  238. package/core/element/PreElement.d.ts +3 -2
  239. package/core/element/PreElement.js +2 -1
  240. package/core/element/PreElement.js.map +1 -1
  241. package/core/element/SectionElement.d.ts +3 -2
  242. package/core/element/SectionElement.js +2 -1
  243. package/core/element/SectionElement.js.map +1 -1
  244. package/core/element/SelectElement.d.ts +3 -2
  245. package/core/element/SelectElement.js +2 -1
  246. package/core/element/SelectElement.js.map +1 -1
  247. package/core/element/SourceElement.d.ts +3 -2
  248. package/core/element/SourceElement.js +2 -1
  249. package/core/element/SourceElement.js.map +1 -1
  250. package/core/element/SpanElement.d.ts +3 -2
  251. package/core/element/SpanElement.js +2 -1
  252. package/core/element/SpanElement.js.map +1 -1
  253. package/core/element/StrongElement.d.ts +3 -2
  254. package/core/element/StrongElement.js +2 -1
  255. package/core/element/StrongElement.js.map +1 -1
  256. package/core/element/StyleElement.d.ts +3 -2
  257. package/core/element/StyleElement.js +2 -1
  258. package/core/element/StyleElement.js.map +1 -1
  259. package/core/element/SummaryElement.d.ts +3 -2
  260. package/core/element/SummaryElement.js +2 -1
  261. package/core/element/SummaryElement.js.map +1 -1
  262. package/core/element/SvgElement.d.ts +4 -3
  263. package/core/element/SvgElement.js +1 -0
  264. package/core/element/SvgElement.js.map +1 -1
  265. package/core/element/TableBodyElement.d.ts +3 -2
  266. package/core/element/TableBodyElement.js +2 -1
  267. package/core/element/TableBodyElement.js.map +1 -1
  268. package/core/element/TableCellElement.d.ts +3 -2
  269. package/core/element/TableCellElement.js +2 -1
  270. package/core/element/TableCellElement.js.map +1 -1
  271. package/core/element/TableColElement.d.ts +3 -2
  272. package/core/element/TableColElement.js +2 -1
  273. package/core/element/TableColElement.js.map +1 -1
  274. package/core/element/TableColGroupElement.d.ts +3 -2
  275. package/core/element/TableColGroupElement.js +2 -1
  276. package/core/element/TableColGroupElement.js.map +1 -1
  277. package/core/element/TableElement.d.ts +3 -2
  278. package/core/element/TableElement.js +2 -1
  279. package/core/element/TableElement.js.map +1 -1
  280. package/core/element/TableFootElement.d.ts +3 -2
  281. package/core/element/TableFootElement.js +2 -1
  282. package/core/element/TableFootElement.js.map +1 -1
  283. package/core/element/TableFootRowElement.d.ts +3 -2
  284. package/core/element/TableFootRowElement.js +2 -1
  285. package/core/element/TableFootRowElement.js.map +1 -1
  286. package/core/element/TableHeadCellElement.d.ts +3 -2
  287. package/core/element/TableHeadCellElement.js +2 -1
  288. package/core/element/TableHeadCellElement.js.map +1 -1
  289. package/core/element/TableHeadElement.d.ts +3 -2
  290. package/core/element/TableHeadElement.js +2 -1
  291. package/core/element/TableHeadElement.js.map +1 -1
  292. package/core/element/TableHeadRowElement.d.ts +3 -2
  293. package/core/element/TableHeadRowElement.js +2 -1
  294. package/core/element/TableHeadRowElement.js.map +1 -1
  295. package/core/element/TableRowElement.d.ts +3 -2
  296. package/core/element/TableRowElement.js +2 -1
  297. package/core/element/TableRowElement.js.map +1 -1
  298. package/core/element/TextAreaElement.d.ts +3 -2
  299. package/core/element/TextAreaElement.js +2 -1
  300. package/core/element/TextAreaElement.js.map +1 -1
  301. package/core/element/UListElement.d.ts +3 -2
  302. package/core/element/UListElement.js +2 -1
  303. package/core/element/UListElement.js.map +1 -1
  304. package/core/element/VideoElement.d.ts +3 -2
  305. package/core/element/VideoElement.js +2 -1
  306. package/core/element/VideoElement.js.map +1 -1
  307. package/core/ref/Computed.d.ts +3 -0
  308. package/core/ref/Computed.js +75 -0
  309. package/core/ref/Computed.js.map +1 -0
  310. package/core/ref/RefBoolean.d.ts +7 -11
  311. package/core/ref/RefBoolean.js +7 -10
  312. package/core/ref/RefBoolean.js.map +1 -1
  313. package/core/ref/RefContainer.d.ts +4 -2
  314. package/core/ref/RefContainer.js +11 -6
  315. package/core/ref/RefContainer.js.map +1 -1
  316. package/core/ref/RefList.d.ts +7 -11
  317. package/core/ref/RefList.js +35 -23
  318. package/core/ref/RefList.js.map +1 -1
  319. package/core/ref/RefMap.d.ts +7 -11
  320. package/core/ref/RefMap.js +13 -12
  321. package/core/ref/RefMap.js.map +1 -1
  322. package/core/ref/RefNumber.d.ts +7 -12
  323. package/core/ref/RefNumber.js +7 -10
  324. package/core/ref/RefNumber.js.map +1 -1
  325. package/core/ref/RefObject copy.d.ts +124 -0
  326. package/core/ref/RefObject copy.js +271 -0
  327. package/core/ref/RefObject copy.js.map +1 -0
  328. package/core/ref/RefObject.d.ts +9 -14
  329. package/core/ref/RefObject.js +55 -81
  330. package/core/ref/RefObject.js.map +1 -1
  331. package/core/ref/RefSet.d.ts +3 -7
  332. package/core/ref/RefSet.js +12 -12
  333. package/core/ref/RefSet.js.map +1 -1
  334. package/core/ref/RefString.d.ts +7 -10
  335. package/core/ref/RefString.js +7 -12
  336. package/core/ref/RefString.js.map +1 -1
  337. package/core/ref/index.d.ts +1 -0
  338. package/core/ref/index.js +1 -0
  339. package/core/ref/index.js.map +1 -1
  340. package/core/router/RouteView.d.ts +3 -2
  341. package/core/router/RouteView.js +2 -1
  342. package/core/router/RouteView.js.map +1 -1
  343. package/core/styles/index.d.ts +2 -2
  344. package/core/styles/index.js.map +1 -1
  345. package/global/index.d.ts +5 -4
  346. package/global/index.js +335 -159
  347. package/global/index.js.map +1 -1
  348. package/package.json +1 -1
  349. package/typings/index.d.ts +11 -2
@@ -0,0 +1,124 @@
1
+ import { refBoolean, RefNumber, refNumber, refString, RefString, RefBoolean, RefMap, RefList, refMap, refList, RefState } from ".";
2
+ import { RefSet, refSet } from "./RefSet";
3
+ type refObject<T> = {
4
+ [K in keyof T]: T[K] extends string | String ? refString : T[K] extends number | Number ? refNumber : T[K] extends boolean | Boolean ? refBoolean : T[K] extends Array<infer U> ? refList<U> : T[K] extends Map<infer MK, infer MV> ? refMap<MK, MV> : T[K] extends Set<infer SU> ? refSet<SU> : T[K] extends object ? refObject<T[K]> : T[K];
5
+ };
6
+ /**
7
+ * Represents a reactive reference object that holds a value of type T,
8
+ * allowing observers to subscribe to changes in that value.
9
+ */
10
+ interface RefObject<T> {
11
+ readonly id: string;
12
+ /**
13
+ * The internal reference to another RefObject instance (if applicable).
14
+ */
15
+ value: refObject<T>;
16
+ /**
17
+ * Subscribes a function to be notified whenever the value changes.
18
+ * The subscriber will immediately receive the current value.
19
+ *
20
+ * @param target - A function that will be called with the new value.
21
+ * @returns true if the subscription was successful, false otherwise.
22
+ */
23
+ subscribe(target: (value: T, oldValue: T) => void): boolean;
24
+ /**
25
+ * Subscribes a function to be notified on value change, with an optional unsubscribe callback.
26
+ *
27
+ * @param target - A function that will be called with the new value.
28
+ * @param onUnsubscribe - A callback that will be called when unsubscribed.
29
+ * @returns true if the subscription was successful, false otherwise.
30
+ */
31
+ subscribe(target: (value: T, oldValue: T) => void, onUnsubscribe: Function): boolean;
32
+ /**
33
+ * Subscribes a property of an object to receive updates when the value changes.
34
+ * The property will immediately be set to the current value.
35
+ *
36
+ * @param target - The target object to bind the value to.
37
+ * @param propertyName - The name of the property to update on value change.
38
+ * @returns true if the subscription was successful, false otherwise.
39
+ */
40
+ subscribe(target: object, propertyName: string | symbol): boolean;
41
+ /**
42
+ * Subscribes a property of an object with an optional unsubscribe callback.
43
+ * The property will immediately be set to the current value.
44
+ *
45
+ * @param target - The target object to bind the value to.
46
+ * @param propertyName - The name of the property to update.
47
+ * @param onUnsubscribe - A callback that will be called when unsubscribed.
48
+ * @returns true if the subscription was successful, false otherwise.
49
+ */
50
+ subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
51
+ /**
52
+ * Overloaded generic subscribe method that supports both function and object property subscriptions.
53
+ * In all cases, the current value will be emitted immediately upon subscription.
54
+ */
55
+ subscribe(target: object | ((args: T) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
56
+ /**
57
+ * Subscribes to value changes without immediately emitting the current value.
58
+ * Use this to listen only for future changes.
59
+ *
60
+ * @param target - A function to be called on future value changes.
61
+ * @returns true if the listener was successfully registered, false otherwise.
62
+ */
63
+ listen(target: (value: T, oldValue: T) => void): boolean;
64
+ /**
65
+ * Subscribes to value changes without emitting the current value,
66
+ * with an optional unsubscribe callback.
67
+ *
68
+ * @param target - A function to be called on future value changes.
69
+ * @param onUnsubscribe - A callback that will be triggered on unsubscription.
70
+ * @returns true if the listener was successfully registered, false otherwise.
71
+ */
72
+ listen(target: (arg: T, oldValue: T) => void, onUnsubscribe?: Function): boolean;
73
+ /**
74
+ * Unsubscribes a previously registered function subscriber.
75
+ *
76
+ * @param target - The function that was subscribed.
77
+ * @returns true if unsubscribed successfully, false otherwise.
78
+ */
79
+ unsubscribe(target: (args: T) => void): boolean;
80
+ /**
81
+ * Unsubscribes a previously registered object property subscriber.
82
+ *
83
+ * @param target - The target object.
84
+ * @param propertyName - The name of the property that was bound to value changes.
85
+ * @returns true if unsubscribed successfully, false otherwise.
86
+ */
87
+ unsubscribe(target: object, propertyName: string | symbol): boolean;
88
+ /**
89
+ * General unsubscribe method supporting both function and object property unsubscriptions.
90
+ */
91
+ unsubscribe(target: object | ((args: T) => void), propertyName: string | symbol): boolean;
92
+ /**
93
+ * Returns a string representation of the current value.
94
+ */
95
+ toString(): string;
96
+ /**
97
+ * Serializes the current value to JSON.
98
+ */
99
+ toJSON(): DynamicJSON<T>;
100
+ /**
101
+ * Returns the raw value of the RefObject.
102
+ */
103
+ valueOf(): T;
104
+ /**
105
+ * A unique key identifying this reference object.
106
+ */
107
+ readonly refKey: string;
108
+ /**
109
+ * Allows iteration over the reference value.
110
+ */
111
+ [Symbol.iterator](): Iterator<T>;
112
+ }
113
+ type DynamicJSON<T> = T extends object ? T : {
114
+ value: T;
115
+ };
116
+ export type DynamicRef<T> = T extends string | String ? RefString : T extends number | Number ? RefNumber : T extends boolean | Boolean ? RefBoolean : T extends Array<infer U> ? RefList<U> : T extends Set<infer U> ? RefSet<U> : T extends Map<infer K, infer V> ? RefMap<K, V> : T extends object ? RefObject<T> : never;
117
+ export declare function ref<T = any>(value?: T, refKey?: string): DynamicRef<T>;
118
+ export type ref<T = any> = DynamicRef<T>;
119
+ export type refType = RefString | RefNumber | RefBoolean | RefList<any> | RefSet<any> | RefMap<any, any> | RefObject<any> | RefState<any>;
120
+ export declare const Interface: {
121
+ empty: <T extends Record<string, any>>() => T;
122
+ };
123
+ export type Interface = typeof Interface;
124
+ export {};
@@ -0,0 +1,271 @@
1
+ import { RefNumber, RefString, RefBoolean, RefMap, RefList, Ref, RefState } from ".";
2
+ import { RefContainer } from "./RefContainer";
3
+ import { RefSet } from "./RefSet";
4
+ class RefObjectContainer extends RefContainer {
5
+ refKey;
6
+ root;
7
+ instance = { value: null };
8
+ constructor(value, refKey, root) {
9
+ super(value, root);
10
+ this.refKey = refKey;
11
+ this.root = root;
12
+ this.value = createObservador(value, this);
13
+ // if (isApplyProxy(value)) {
14
+ // RefObjectContainer.createObject.bind(this)(this.value, value, this);
15
+ // }
16
+ // else
17
+ // this.value = value;
18
+ }
19
+ valueOf() {
20
+ return this.instance.value;
21
+ }
22
+ static create;
23
+ static createObject(proxy, value, container) {
24
+ if (Object.getPrototypeOf(proxy) === Object.prototype) {
25
+ for (const key in value) {
26
+ try {
27
+ if (Object.getOwnPropertyDescriptor(proxy, key)?.writable === false
28
+ || Object.getOwnPropertyDescriptor(proxy, key)?.get
29
+ || Object.getOwnPropertyDescriptor(proxy, key)?.set) {
30
+ continue;
31
+ }
32
+ if (value[key] === undefined || value[key] === null) {
33
+ proxy[key] = value[key];
34
+ continue;
35
+ }
36
+ const refKey = container.refKey && `${container.refKey}:${key}`;
37
+ if (value[key] instanceof Array) {
38
+ // @ts-ignore
39
+ proxy[key] = new RefList(value[key], refKey);
40
+ }
41
+ else if (value[key] instanceof Set) {
42
+ // @ts-ignore
43
+ proxy[key] = new RefSet(value[key], refKey);
44
+ }
45
+ else if (value[key] instanceof Map) {
46
+ // @ts-ignore
47
+ proxy[key] = new RefMap(value[key], refKey);
48
+ }
49
+ else if (typeof value[key] === "string" || value[key] instanceof String) {
50
+ // @ts-ignore
51
+ proxy[key] = new RefString(value[key].valueOf(), refKey);
52
+ }
53
+ else if (typeof value[key] === "number" || value[key] instanceof Number) {
54
+ // @ts-ignore
55
+ proxy[key] = new RefNumber(value[key].valueOf(), refKey);
56
+ }
57
+ else if (typeof value[key] === "boolean" || value[key] instanceof Boolean) {
58
+ // @ts-ignore
59
+ proxy[key] = new RefBoolean(value[key].valueOf(), refKey);
60
+ }
61
+ else if (value[key] instanceof Element) {
62
+ //proxy[key] =
63
+ }
64
+ else if (value[key] instanceof Object) {
65
+ if (Object.getPrototypeOf(proxy) === Object.prototype) {
66
+ const con = new RefObjectContainer(value[key], refKey, (container["root"] || this));
67
+ proxy[key] = con.value;
68
+ }
69
+ else
70
+ proxy[key] = value[key];
71
+ }
72
+ if (proxy[key] instanceof ref) {
73
+ // @ts-ignore
74
+ proxy[key]["container"].root = container.root || this;
75
+ }
76
+ }
77
+ catch (e) {
78
+ }
79
+ }
80
+ }
81
+ }
82
+ static applyObject(proxy, value, container) {
83
+ const keysOld = Object.keys(proxy);
84
+ const keys = Object.keys(value);
85
+ const keysRemove = keysOld.filter((k) => !keys.includes(k));
86
+ const keysUpdate = keys.filter((k) => keysOld.includes(k));
87
+ const keysNew = keys.filter((k) => !keysOld.includes(k));
88
+ for (const key of keysRemove) {
89
+ if (!keys.includes(key)) {
90
+ // @ts-ignore
91
+ delete proxy[key];
92
+ }
93
+ }
94
+ for (const key of keysUpdate) {
95
+ // @ts-ignore
96
+ if (proxy[key] instanceof ref) {
97
+ // @ts-ignore
98
+ proxy[key].emit(key, value[key]);
99
+ }
100
+ // @ts-ignore
101
+ else if (!(proxy[key] instanceof Element) && proxy[key] instanceof Object) {
102
+ // @ts-ignore
103
+ RefObjectContainer.applyObject.bind(this)(proxy[key], value[key], container);
104
+ }
105
+ }
106
+ if (keysNew.length === 0)
107
+ return;
108
+ const newObject = {};
109
+ for (const key of keysNew) {
110
+ // @ts-ignore
111
+ newObject[key] = value[key];
112
+ }
113
+ RefObjectContainer.createObject.bind(this)(proxy, newObject, container);
114
+ }
115
+ emitAll(propertyName, value) {
116
+ super.emitAll(propertyName, value, value);
117
+ }
118
+ }
119
+ // @ts-ignore
120
+ function applyProxy(target, key, value, receiver, container) {
121
+ if (target[key] instanceof ref) {
122
+ // @ts-ignore
123
+ target[key].emit(key, value);
124
+ }
125
+ else if (!(target[key] instanceof Element) && target[key] instanceof Object) {
126
+ if (Object.getPrototypeOf(target[key]) === Object.prototype)
127
+ RefObjectContainer.applyObject(target[key], value, container);
128
+ }
129
+ else if (value !== undefined && value !== null) {
130
+ RefObjectContainer.createObject(target, { [key]: value }, container);
131
+ }
132
+ else
133
+ Reflect.set(target, key, value, receiver);
134
+ return receiver;
135
+ }
136
+ function isApplyProxy(value) {
137
+ if (!value)
138
+ return false;
139
+ if (typeof value !== "object")
140
+ return true;
141
+ return (Object.getPrototypeOf(value) === Object.prototype || Array.isArray(value)
142
+ || value instanceof Map || value instanceof Set || value instanceof Number || value instanceof Boolean || value instanceof String);
143
+ }
144
+ function createObservador(obj, container) {
145
+ const refObject = new Proxy(obj, {
146
+ // @ts-ignore
147
+ get(target, key, receiver) {
148
+ if (key == "toString")
149
+ return JSON.stringify(obj);
150
+ if (key == "toJSON")
151
+ return () => {
152
+ return JSON.parse(JSON.stringify(obj));
153
+ };
154
+ if (key == "valueOf")
155
+ return JSON.parse(JSON.stringify(obj));
156
+ return Reflect.get(target, key, receiver);
157
+ },
158
+ // @ts-ignore
159
+ set(target, key, value, receiver) {
160
+ if (value && value instanceof ref)
161
+ value = value?.valueOf() || value;
162
+ if (isApplyProxy(value))
163
+ receiver = applyProxy(target, key, value, receiver, container);
164
+ else {
165
+ receiver = Reflect.set(target, key, value, receiver);
166
+ }
167
+ container.emitAll(key, value);
168
+ return receiver;
169
+ },
170
+ });
171
+ container.value = refObject;
172
+ return refObject;
173
+ }
174
+ export function ref(value, refKey) {
175
+ if (value === undefined || value === null)
176
+ throw new Error("ref: value cannot be null or undefined");
177
+ value = deepCopy(value);
178
+ if (typeof value === "string" || value instanceof String) {
179
+ return new RefString(value.valueOf(), refKey);
180
+ }
181
+ else if (typeof value === "number" || value instanceof Number) {
182
+ return new RefNumber(value.valueOf(), refKey);
183
+ }
184
+ else if (typeof value === "boolean" || value instanceof Boolean) {
185
+ return new RefBoolean(value.valueOf(), refKey);
186
+ }
187
+ else if (value instanceof Array) {
188
+ return new RefList(value, refKey);
189
+ }
190
+ else if (value instanceof Set) {
191
+ return new RefSet(value, refKey);
192
+ }
193
+ else if (value instanceof Map) {
194
+ return new RefMap(value, refKey);
195
+ }
196
+ const container = new RefObjectContainer(value, refKey || "");
197
+ const instance = {
198
+ value: container.value,
199
+ subscribe: container.subscribe.bind(container),
200
+ listen: container.listen.bind(container),
201
+ unsubscribe: container.unsubscribe.bind(container),
202
+ toString: container.toString.bind(container),
203
+ toJSON: container.toJSON.bind(container),
204
+ valueOf: container.valueOf.bind(container),
205
+ id: container.id
206
+ };
207
+ container["instance"] = instance;
208
+ Object.defineProperty(instance, Symbol.iterator, {
209
+ value: function* () {
210
+ for (const key in instance.value) {
211
+ yield instance.value[key]?.valueOf() || instance.value[key];
212
+ }
213
+ },
214
+ });
215
+ Object.defineProperty(instance, "value", {
216
+ get() {
217
+ return container.value;
218
+ },
219
+ set(value) {
220
+ RefObjectContainer.applyObject(container.value, value, container);
221
+ container.emitAll("value", value);
222
+ },
223
+ });
224
+ Object.setPrototypeOf(instance, ref.prototype);
225
+ // @ts-ignore
226
+ if (refKey)
227
+ Ref.set(refKey, instance);
228
+ return instance;
229
+ }
230
+ Object.defineProperty(ref, Symbol.hasInstance, {
231
+ value: function (instance) {
232
+ return (!!instance && typeof instance === "object" &&
233
+ (instance === ref ||
234
+ Object.getPrototypeOf(instance) === ref.prototype ||
235
+ instance instanceof RefString ||
236
+ instance instanceof RefNumber ||
237
+ instance instanceof RefBoolean ||
238
+ instance instanceof RefList ||
239
+ instance instanceof RefSet ||
240
+ instance instanceof RefMap ||
241
+ instance instanceof RefState));
242
+ },
243
+ });
244
+ // function computedTemplateStringsArray<T>(fn: TemplateStringsArray, ...values: any[]): DynamicRef<T> {
245
+ // const observers: any[] = values.pop();
246
+ // console.log("computed", fn, "values", values);
247
+ // const r = ref(fn.reduce((acc, str, i) => {
248
+ // // @ts-ignore
249
+ // return acc + str + (values[i] !== undefined ? (values[i] instanceof ref) ? values[i].value : values[i] : "");
250
+ // }, ""));
251
+ // const func = () => {
252
+ // r.value = fn.reduce((acc, str, i) => {
253
+ // // @ts-ignore
254
+ // return acc + str + (values[i] !== undefined ? (values[i] instanceof ref) ? values[i].value : values[i] : "");
255
+ // }, "");
256
+ // }
257
+ // for (const item of observers) {
258
+ // if (item instanceof ref) {
259
+ // // @ts-ignore
260
+ // item.listen(func);
261
+ // }
262
+ // }
263
+ // // @ts-ignore
264
+ // return r
265
+ // }
266
+ export const Interface = {
267
+ empty: function () {
268
+ return {};
269
+ },
270
+ };
271
+ //# sourceMappingURL=RefObject%20copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RefObject copy.js","sourceRoot":"","sources":["../../../src/core/ref/RefObject copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAwB,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAmB,GAAG,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC;AACxI,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAU,MAAM,UAAU,CAAC;AAE1C,MAAM,kBAAmB,SAAQ,YAAY;IAKhC;IACA;IAJX,QAAQ,GAAmB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC3C,YACE,KAAa,EACJ,MAAc,EACd,IAAmB;QAE5B,KAAK,CAAC,KAAK,EAAE,IAAW,CAAC,CAAC;QAHjB,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAe;QAG5B,IAAI,CAAC,KAAK,GAAG,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QAC3C,6BAA6B;QAC7B,yEAAyE;QACzE,IAAI;QACJ,OAAO;QACP,wBAAwB;IAC1B,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED,MAAM,CAAC,MAAM,CAAA;IAEb,MAAM,CAAC,YAAY,CAAC,KAAU,EAAE,KAAU,EAAE,SAA6B;QACvE,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC;YACtD,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;gBACxB,IAAI,CAAC;oBACH,IAAI,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,GA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AAQ,YAAY,SAAS;gBAC7B,QAAQ,YAAY,UAAU;gBAC9B,QAAQ,YAAY,OAAO;gBAC3B,QAAQ,YAAY,MAAM;gBAC1B,QAAQ,YAAY,MAAM;gBAC1B,QAAQ,YAAY,QAAQ,CAAC,CAChC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAOH,wGAAwG;AACxG,2CAA2C;AAC3C,mDAAmD;AAEnD,gDAAgD;AAChD,sBAAsB;AACtB,sHAAsH;AACtH,aAAa;AACb,yBAAyB;AACzB,6CAA6C;AAC7C,sBAAsB;AACtB,sHAAsH;AACtH,cAAc;AACd,MAAM;AACN,oCAAoC;AACpC,iCAAiC;AACjC,oBAAoB;AACpB,2BAA2B;AAC3B,QAAQ;AACR,MAAM;AACN,kBAAkB;AAClB,aAAa;AACb,IAAI;AAIJ,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE;QACL,OAAO,EAAO,CAAC;IACjB,CAAC;CACF,CAAA"}
@@ -1,13 +1,14 @@
1
1
  import { refBoolean, RefNumber, refNumber, refString, RefString, RefBoolean, RefMap, RefList, refMap, refList, RefState } from ".";
2
2
  import { RefSet, refSet } from "./RefSet";
3
- type refObject<T> = {
4
- [K in keyof T]: T[K] extends string | String ? refString : T[K] extends number | Number ? refNumber : T[K] extends boolean | Boolean ? refBoolean : T[K] extends Array<infer U> ? refList<U> : T[K] extends Map<infer MK, infer MV> ? refMap<MK, MV> : T[K] extends Set<infer SU> ? refSet<SU> : T[K] extends object ? refObject<T[K]> : T[K];
5
- };
3
+ type refObject<T> = T extends string | String ? refString : T extends number | Number ? refNumber : T extends boolean | Boolean ? refBoolean : T extends Array<infer U> ? refList<U> : T extends Map<infer MK, infer MV> ? refMap<MK, MV> : T extends Set<infer SU> ? refSet<SU> : T extends object ? {
4
+ [K in keyof T]: refObject<T[K]>;
5
+ } : T extends never ? T : T;
6
6
  /**
7
7
  * Represents a reactive reference object that holds a value of type T,
8
8
  * allowing observers to subscribe to changes in that value.
9
9
  */
10
10
  interface RefObject<T> {
11
+ readonly id: string;
11
12
  /**
12
13
  * The internal reference to another RefObject instance (if applicable).
13
14
  */
@@ -19,7 +20,7 @@ interface RefObject<T> {
19
20
  * @param target - A function that will be called with the new value.
20
21
  * @returns true if the subscription was successful, false otherwise.
21
22
  */
22
- subscribe(target: (arg: T) => void): boolean;
23
+ subscribe(target: (value: T, oldValue: T) => void): boolean;
23
24
  /**
24
25
  * Subscribes a function to be notified on value change, with an optional unsubscribe callback.
25
26
  *
@@ -27,7 +28,7 @@ interface RefObject<T> {
27
28
  * @param onUnsubscribe - A callback that will be called when unsubscribed.
28
29
  * @returns true if the subscription was successful, false otherwise.
29
30
  */
30
- subscribe(target: (arg: T) => void, onUnsubscribe: Function): boolean;
31
+ subscribe(target: (value: T, oldValue: T) => void, onUnsubscribe: Function): boolean;
31
32
  /**
32
33
  * Subscribes a property of an object to receive updates when the value changes.
33
34
  * The property will immediately be set to the current value.
@@ -59,7 +60,7 @@ interface RefObject<T> {
59
60
  * @param target - A function to be called on future value changes.
60
61
  * @returns true if the listener was successfully registered, false otherwise.
61
62
  */
62
- listen(target: (arg: T) => void): boolean;
63
+ listen(target: (value: T, oldValue: T) => void): boolean;
63
64
  /**
64
65
  * Subscribes to value changes without emitting the current value,
65
66
  * with an optional unsubscribe callback.
@@ -68,7 +69,7 @@ interface RefObject<T> {
68
69
  * @param onUnsubscribe - A callback that will be triggered on unsubscription.
69
70
  * @returns true if the listener was successfully registered, false otherwise.
70
71
  */
71
- listen(target: (arg: T) => void, onUnsubscribe?: Function): boolean;
72
+ listen(target: (arg: T, oldValue: T) => void, onUnsubscribe?: Function): boolean;
72
73
  /**
73
74
  * Unsubscribes a previously registered function subscriber.
74
75
  *
@@ -100,10 +101,6 @@ interface RefObject<T> {
100
101
  * Returns the raw value of the RefObject.
101
102
  */
102
103
  valueOf(): T;
103
- /**
104
- * A unique key identifying this reference object.
105
- */
106
- readonly refKey: string;
107
104
  /**
108
105
  * Allows iteration over the reference value.
109
106
  */
@@ -113,11 +110,9 @@ type DynamicJSON<T> = T extends object ? T : {
113
110
  value: T;
114
111
  };
115
112
  export type DynamicRef<T> = T extends string | String ? RefString : T extends number | Number ? RefNumber : T extends boolean | Boolean ? RefBoolean : T extends Array<infer U> ? RefList<U> : T extends Set<infer U> ? RefSet<U> : T extends Map<infer K, infer V> ? RefMap<K, V> : T extends object ? RefObject<T> : never;
116
- export declare function ref<T = any>(value?: T, refKey?: string): DynamicRef<T>;
113
+ export declare function ref<T = any>(value?: T): DynamicRef<T>;
117
114
  export type ref<T = any> = DynamicRef<T>;
118
115
  export type refType = RefString | RefNumber | RefBoolean | RefList<any> | RefSet<any> | RefMap<any, any> | RefObject<any> | RefState<any>;
119
- export declare function computed<T>(fn: () => Exclude<T, void>): DynamicRef<T>;
120
- export declare function computed<T>(fn: TemplateStringsArray, ...values: any[]): DynamicRef<T>;
121
116
  export declare const Interface: {
122
117
  empty: <T extends Record<string, any>>() => T;
123
118
  };