vivth 1.4.9 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (379) hide show
  1. package/README.md +6060 -2037
  2. package/README.src.md +22 -14
  3. package/bun.lock +154 -194
  4. package/dev/auto/.src.ignore +25 -0
  5. package/dev/auto-doc.mjs +137 -0
  6. package/generated/types/generated/vivth/exports/all.d.mts +145 -0
  7. package/generated/types/generated/vivth/exports/neutral.d.mts +105 -0
  8. package/generated/types/generated/vivth/exports/node.d.mts +40 -0
  9. package/generated/types/src/bundler/CompileAS.d.mts +30 -0
  10. package/generated/types/src/bundler/CompileJS.d.mts +109 -0
  11. package/{types → generated/types}/src/bundler/CreateESPlugin.d.mts +1 -1
  12. package/{types → generated/types}/src/bundler/EsBundler.d.mts +9 -7
  13. package/generated/types/src/bundler/FSAnalyzer.d.mts +58 -0
  14. package/generated/types/src/bundler/FSasar.bundled.d.mts +28 -0
  15. package/generated/types/src/bundler/FSasar.d.mts +51 -0
  16. package/generated/types/src/bundler/FileSelfMapper.d.mts +137 -0
  17. package/generated/types/src/bundler/JSDirMapper.d.mts +128 -0
  18. package/generated/types/src/bundler/RunWatchThenCompileJSOnSafeExit.d.mts +63 -0
  19. package/generated/types/src/bundler/adds/BrowserExternals.d.mts +21 -0
  20. package/generated/types/src/bundler/adds/CreateTransform.d.mts +26 -0
  21. package/generated/types/src/bundler/adds/LastEditedUnix.d.mts +5 -0
  22. package/generated/types/src/bundler/adds/NodeModuleList.d.mts +15 -0
  23. package/generated/types/src/bundler/adds/PathFSBundles.bundled.d.mts +25 -0
  24. package/generated/types/src/bundler/adds/PathFSBundles.d.mts +48 -0
  25. package/generated/types/src/bundler/adds/PathFSDir.bundled.d.mts +30 -0
  26. package/generated/types/src/bundler/adds/PathFSDir.d.mts +48 -0
  27. package/generated/types/src/bundler/adds/PathFSFile.bundled.d.mts +25 -0
  28. package/generated/types/src/bundler/adds/PathFSFile.d.mts +40 -0
  29. package/{types → generated/types}/src/bundler/adds/ToBundledJSPlugin.d.mts +6 -6
  30. package/generated/types/src/bundler/adds/autoExternalize.d.mts +2 -0
  31. package/generated/types/src/bundler/adds/emptyBufferValue.d.mts +1 -0
  32. package/generated/types/src/bundler/adds/isModuleTheBundledVersion.d.mts +1 -0
  33. package/generated/types/src/bundler/adds/onEndEsBuildErrorLogger.d.mts +1 -0
  34. package/generated/types/src/bundler/adds/resolveJSDependencyPath.d.mts +1 -0
  35. package/generated/types/src/class/AwaitSignal.d.mts +48 -0
  36. package/generated/types/src/class/Console.d.mts +82 -0
  37. package/generated/types/src/class/DataLog.d.mts +25 -0
  38. package/generated/types/src/class/Derived.d.mts +74 -0
  39. package/generated/types/src/class/Effect.d.mts +213 -0
  40. package/{types → generated/types}/src/class/EnvSignal.d.mts +6 -2
  41. package/generated/types/src/class/EsWatcher.d.mts +36 -0
  42. package/{types → generated/types}/src/class/EventSignal.d.mts +39 -39
  43. package/generated/types/src/class/FSDirArchWatcher.d.mts +110 -0
  44. package/{types → generated/types}/src/class/FileSafe.d.mts +32 -16
  45. package/generated/types/src/class/ForEach.d.mts +57 -0
  46. package/generated/types/src/class/ForSignal.d.mts +63 -0
  47. package/generated/types/src/class/GetterSetter.d.mts +38 -0
  48. package/generated/types/src/class/JSONFileHandler.d.mts +50 -0
  49. package/{types → generated/types}/src/class/ListSignal.d.mts +49 -15
  50. package/{types → generated/types}/src/class/LitExp.d.mts +18 -18
  51. package/generated/types/src/class/ObjectSignal.d.mts +267 -0
  52. package/generated/types/src/class/Paths.d.mts +95 -0
  53. package/generated/types/src/class/Prettivy.d.mts +26 -0
  54. package/{types → generated/types}/src/class/QChannel.d.mts +24 -16
  55. package/generated/types/src/class/SafeExit.d.mts +69 -0
  56. package/{types → generated/types}/src/class/Setup.d.mts +29 -16
  57. package/{types → generated/types}/src/class/Signal.d.mts +29 -15
  58. package/generated/types/src/class/SignalCollection.d.mts +96 -0
  59. package/{types → generated/types}/src/class/WalkThrough.d.mts +4 -19
  60. package/generated/types/src/class/WorkerMainThread.bundled.d.mts +83 -0
  61. package/{types → generated/types}/src/class/WorkerMainThread.d.mts +33 -39
  62. package/{types → generated/types}/src/class/WorkerThread.d.mts +11 -5
  63. package/{types → generated/types}/src/common/Base64URL.d.mts +2 -1
  64. package/generated/types/src/common/Base64URLFromFile.d.mts +20 -0
  65. package/generated/types/src/common/BundledV.bundled.d.mts +3 -0
  66. package/generated/types/src/common/BundledV.d.mts +36 -0
  67. package/{types → generated/types}/src/common/CreateStringID.d.mts +5 -4
  68. package/generated/types/src/common/EnvMode.d.mts +79 -0
  69. package/generated/types/src/common/FactoryKey.d.mts +9 -0
  70. package/generated/types/src/common/Preferrence.d.mts +25 -0
  71. package/{types → generated/types}/src/common/Trace.d.mts +1 -1
  72. package/{types → generated/types}/src/common/TracePath.d.mts +1 -1
  73. package/generated/types/src/common/VivthUnBundledCodeBlock.d.mts +6 -0
  74. package/generated/types/src/doc/JSautoDOC.d.mts +172 -0
  75. package/generated/types/src/doc/cleanPreserveTypedef.d.mts +1 -0
  76. package/{types/src/doc/parsedFile.d.mts → generated/types/src/doc/parsedFileForDOC.d.mts} +56 -27
  77. package/generated/types/src/function/ClearRequireCache.d.mts +1 -0
  78. package/{types → generated/types}/src/function/CreateImmutable.d.mts +5 -4
  79. package/{types → generated/types}/src/function/EventCheck.d.mts +3 -1
  80. package/{types → generated/types}/src/function/EventObject.d.mts +2 -6
  81. package/generated/types/src/function/ForInAsync.d.mts +36 -0
  82. package/generated/types/src/function/ForInSync.d.mts +36 -0
  83. package/generated/types/src/function/ForOfAsync.d.mts +25 -0
  84. package/generated/types/src/function/ForOfSync.d.mts +36 -0
  85. package/generated/types/src/function/GetBufferFromRelativePath.d.mts +15 -0
  86. package/generated/types/src/function/GetFilesFromDir.d.mts +14 -0
  87. package/generated/types/src/function/GetMaxFilenameLength.d.mts +9 -0
  88. package/generated/types/src/function/GetModuleEsbuildPlatform.d.mts +13 -0
  89. package/{types → generated/types}/src/function/GetNamedImportAlias.d.mts +1 -1
  90. package/generated/types/src/function/GetRuntime.d.mts +2 -0
  91. package/generated/types/src/function/InstantiateAssemblyScript.d.mts +15 -0
  92. package/{types → generated/types}/src/function/IsAsync.d.mts +1 -1
  93. package/generated/types/src/function/IsInstanceOf.d.mts +25 -0
  94. package/generated/types/src/function/IsSameFile.d.mts +16 -0
  95. package/generated/types/src/function/IsStringLooksLikeAPath.d.mts +16 -0
  96. package/generated/types/src/function/IsTypeOf.d.mts +25 -0
  97. package/{types → generated/types}/src/function/LazyFactory.d.mts +9 -10
  98. package/generated/types/src/function/MonkeyPatch.d.mts +33 -0
  99. package/generated/types/src/function/NewAnimationTimeline.d.mts +24 -0
  100. package/generated/types/src/function/NewChainable.d.mts +35 -0
  101. package/generated/types/src/function/NewDynamicsExport.d.mts +49 -0
  102. package/generated/types/src/function/NewObjectWrapper.d.mts +10 -0
  103. package/generated/types/src/function/ObjectRegistrar.d.mts +17 -0
  104. package/generated/types/src/function/ParseSQLFile.d.mts +25 -0
  105. package/generated/types/src/function/PipeAsync.d.mts +19 -0
  106. package/generated/types/src/function/PipeSync.d.mts +17 -0
  107. package/generated/types/src/function/SafeImport.d.mts +21 -0
  108. package/generated/types/src/function/TemplateLiteral.d.mts +23 -0
  109. package/{types → generated/types}/src/function/Timeout.d.mts +1 -1
  110. package/{types → generated/types}/src/function/Tries.d.mts +4 -4
  111. package/{types → generated/types}/src/function/TryAsync.d.mts +2 -2
  112. package/{types → generated/types}/src/function/TryNew.d.mts +1 -1
  113. package/generated/types/src/function/TsToMjs.d.mts +27 -0
  114. package/generated/types/src/function/UniqueFSTempName.d.mts +9 -0
  115. package/generated/types/src/function/errorToMessage.d.mts +5 -0
  116. package/generated/types/src/neinth/VivthyNeinth.d.mts +202 -0
  117. package/generated/types/src/typehints/ArrayToKeys.d.mts +23 -0
  118. package/generated/types/src/typehints/AssemblyScriptExportsType.d.mts +4 -0
  119. package/generated/types/src/typehints/AssemblyScriptLoaderInstantiate.d.mts +4 -0
  120. package/generated/types/src/typehints/AutoDocASOptions.d.mts +15 -0
  121. package/generated/types/src/typehints/ChainableType.d.mts +3 -0
  122. package/generated/types/src/typehints/ComponentDecorator_Constructor.d.mts +3 -0
  123. package/generated/types/src/typehints/ConsoleAdditionalSettingType.d.mts +3 -0
  124. package/generated/types/src/typehints/Decorator.d.mts +11 -0
  125. package/generated/types/src/typehints/DecoratorMonkeyPatch.d.mts +15 -0
  126. package/{types/src/types → generated/types/src/typehints}/DevTestCB.d.mts +2 -2
  127. package/generated/types/src/typehints/EnvModeType.d.mts +4 -0
  128. package/generated/types/src/typehints/ListArg.d.mts +4 -0
  129. package/generated/types/src/typehints/MonkeyPatchedType.d.mts +1 -0
  130. package/generated/types/src/typehints/ParametersFollowingN.d.mts +13 -0
  131. package/generated/types/src/typehints/PrefixedKeysOf.d.mts +1 -0
  132. package/generated/types/src/typehints/Runtime.d.mts +4 -0
  133. package/generated/types/src/typehints/SafeImportReturnType.d.mts +1 -0
  134. package/generated/types/src/typehints/StylePropRefType.d.mts +2 -0
  135. package/generated/types/src/typehints/TemplateLiteralValueHandler.d.mts +10 -0
  136. package/generated/types/src/typehints/VLifecycleCallbacks.d.mts +6 -0
  137. package/generated/types/src/typehints/VivthCleanup.d.mts +12 -0
  138. package/generated/types/src/web/BrowserDirMapper.d.mts +70 -0
  139. package/generated/types/src/web/EnsureValidTag.d.mts +7 -0
  140. package/generated/types/src/web/ViteAddDynamics.d.mts +28 -0
  141. package/generated/types/src/web/ViteGetAllHTMLFile.d.mts +9 -0
  142. package/generated/types/src/web/WC_extendsA.d.mts +135 -0
  143. package/generated/types/src/web/WC_extendsB.d.mts +135 -0
  144. package/generated/types/src/web/bindings/WC_StyleProp_bind.d.mts +42 -0
  145. package/generated/types/src/web/bindings/WC_createElement_bind.d.mts +51 -0
  146. package/generated/types/src/web/bindings/WC_createNamedSlot.d.mts +26 -0
  147. package/generated/types/src/web/bindings/WC_litRender_bind.d.mts +20 -0
  148. package/generated/types/src/web/bindings/WC_litStyleMap.d.mts +7 -0
  149. package/generated/types/src/web/common/CSS.d.mts +23 -0
  150. package/generated/types/src/web/common/E.d.mts +41 -0
  151. package/generated/types/src/web/common/NewStyleSheetAsync.d.mts +15 -0
  152. package/generated/types/src/web/common/NewStyleSheetSync.d.mts +15 -0
  153. package/generated/types/src/web/common/WC_TagName_type.d.mts +15 -0
  154. package/generated/types/src/web/signals/IsInViewPortSignal.d.mts +52 -0
  155. package/generated/types/src/web/signals/ObserverSignal.d.mts +32 -0
  156. package/generated/types/src/web/signals/WC_litRef.d.mts +26 -0
  157. package/generated/types/src/web/signals/WC_loopedSiblingsRef.d.mts +44 -0
  158. package/generated/vivth/exports/all.mjs +233 -0
  159. package/generated/vivth/exports/neutral.mjs +193 -0
  160. package/generated/vivth/exports/node.mjs +46 -0
  161. package/package.json +50 -14
  162. package/src/bundler/CompileAS.mjs +36 -0
  163. package/src/bundler/CompileJS.mjs +98 -171
  164. package/src/bundler/CreateESPlugin.mjs +1 -1
  165. package/src/bundler/EsBundler.mjs +38 -13
  166. package/src/bundler/FSAnalyzer.mjs +253 -0
  167. package/src/bundler/FSasar.bundled.mjs +128 -0
  168. package/src/bundler/FSasar.mjs +96 -0
  169. package/src/bundler/FileSelfMapper.mjs +491 -0
  170. package/src/bundler/JSDirMapper.mjs +528 -0
  171. package/src/bundler/RunWatchThenCompileJSOnSafeExit.mjs +129 -0
  172. package/src/bundler/adds/BrowserExternals.mjs +37 -0
  173. package/src/bundler/adds/CreateTransform.mjs +36 -0
  174. package/src/bundler/adds/LastEditedUnix.mjs +12 -0
  175. package/src/bundler/adds/NodeModuleList.mjs +33 -0
  176. package/src/bundler/adds/PathFSBundles.bundled.mjs +41 -0
  177. package/src/bundler/adds/PathFSBundles.mjs +91 -0
  178. package/src/bundler/adds/PathFSDir.bundled.mjs +53 -0
  179. package/src/bundler/adds/PathFSDir.mjs +100 -0
  180. package/src/bundler/adds/PathFSFile.bundled.mjs +40 -0
  181. package/src/bundler/adds/PathFSFile.mjs +85 -0
  182. package/src/bundler/adds/ToBundledJSPlugin.mjs +116 -55
  183. package/src/bundler/adds/autoExternalize.mjs +81 -0
  184. package/src/bundler/adds/emptyBufferValue.mjs +5 -0
  185. package/src/bundler/adds/isModuleTheBundledVersion.mjs +10 -0
  186. package/src/bundler/adds/onEndEsBuildErrorLogger.mjs +34 -0
  187. package/src/bundler/adds/resolveJSDependencyPath.mjs +17 -0
  188. package/src/class/AwaitSignal.mjs +119 -0
  189. package/src/class/Console.mjs +36 -14
  190. package/src/class/DataLog.mjs +29 -0
  191. package/src/class/Derived.mjs +67 -55
  192. package/src/class/Effect.mjs +270 -84
  193. package/src/class/EnvSignal.mjs +11 -8
  194. package/src/class/EsWatcher.mjs +60 -0
  195. package/src/class/EventSignal.mjs +46 -58
  196. package/src/class/FSDirArchWatcher.mjs +246 -0
  197. package/src/class/FileSafe.mjs +72 -24
  198. package/src/class/ForEach.mjs +78 -0
  199. package/src/class/ForSignal.mjs +115 -0
  200. package/src/class/GetterSetter.mjs +40 -0
  201. package/src/class/JSONFileHandler.mjs +90 -0
  202. package/src/class/ListSignal.mjs +68 -26
  203. package/src/class/LitExp.mjs +59 -36
  204. package/src/class/ObjectSignal.mjs +225 -0
  205. package/src/class/Paths.mjs +56 -20
  206. package/src/class/Prettivy.mjs +51 -0
  207. package/src/class/QChannel.mjs +48 -26
  208. package/src/class/SafeExit.mjs +156 -99
  209. package/src/class/Setup.mjs +28 -16
  210. package/src/class/Signal.mjs +50 -27
  211. package/src/class/SignalCollection.mjs +130 -0
  212. package/src/class/WalkThrough.mjs +6 -23
  213. package/src/class/{WorkerMainThreadBundled.mjs → WorkerMainThread.bundled.mjs} +61 -84
  214. package/src/class/WorkerMainThread.mjs +103 -102
  215. package/src/class/WorkerThread.mjs +24 -17
  216. package/src/common/Base64URL.mjs +6 -3
  217. package/src/common/Base64URLFromFile.mjs +17 -4
  218. package/src/common/BundledV.bundled.mjs +7 -0
  219. package/src/common/BundledV.mjs +45 -0
  220. package/src/common/CreateStringID.mjs +8 -7
  221. package/src/common/EnvMode.mjs +172 -0
  222. package/src/common/FactoryKey.mjs +11 -0
  223. package/src/common/Preferrence.mjs +27 -0
  224. package/src/common/Trace.mjs +1 -1
  225. package/src/common/TracePath.mjs +53 -3
  226. package/src/common/VivthUnBundledCodeBlock.mjs +8 -0
  227. package/src/doc/JSautoDOC.mjs +673 -284
  228. package/src/doc/cleanPreserveTypedef.mjs +27 -0
  229. package/src/doc/correctBeforeParse.mjs +57 -48
  230. package/src/doc/{parsedFile.mjs → parsedFileForDOC.mjs} +133 -120
  231. package/src/function/ClearRequireCache.mjs +33 -0
  232. package/src/function/CreateImmutable.mjs +40 -37
  233. package/src/function/EventCheck.mjs +5 -2
  234. package/src/function/EventObject.mjs +2 -6
  235. package/src/function/ForInAsync.mjs +76 -0
  236. package/src/function/ForInSync.mjs +87 -0
  237. package/src/function/ForOfAsync.mjs +61 -0
  238. package/src/function/ForOfSync.mjs +70 -0
  239. package/src/function/GetBufferFromRelativePath.mjs +25 -0
  240. package/src/function/GetFilesFromDir.mjs +49 -0
  241. package/src/function/GetMaxFilenameLength.mjs +32 -0
  242. package/src/function/GetModuleEsbuildPlatform.mjs +118 -0
  243. package/src/function/GetNamedImportAlias.mjs +2 -2
  244. package/src/function/GetRuntime.mjs +10 -14
  245. package/src/function/InstantiateAssemblyScript.mjs +22 -0
  246. package/src/function/IsAsync.mjs +1 -1
  247. package/src/function/IsInstanceOf.mjs +29 -0
  248. package/src/function/IsSameFile.mjs +41 -0
  249. package/src/function/IsStringLooksLikeAPath.mjs +20 -0
  250. package/src/function/IsTypeOf.mjs +27 -0
  251. package/src/function/IsTypeOf.mts +31 -0
  252. package/src/function/LazyFactory.mjs +25 -23
  253. package/src/function/MonkeyPatch.mjs +38 -0
  254. package/src/function/NewAnimationTimeline.mjs +55 -0
  255. package/src/function/NewChainable.mjs +69 -0
  256. package/src/function/NewDynamicsExport.mjs +312 -0
  257. package/src/function/NewObjectWrapper.mjs +14 -0
  258. package/src/function/ObjectRegistrar.mjs +23 -0
  259. package/src/function/ParseSQLFile.mjs +129 -0
  260. package/src/function/PipeAsync.mjs +30 -0
  261. package/src/function/PipeSync.mjs +28 -0
  262. package/src/function/SafeImport.mjs +77 -0
  263. package/src/function/TemplateLiteral.mjs +42 -23
  264. package/src/function/Timeout.mjs +4 -4
  265. package/src/function/Tries.mjs +22 -16
  266. package/src/function/TryAsync.mjs +3 -2
  267. package/src/function/TryNew.mjs +1 -1
  268. package/src/function/TsToMjs.mjs +184 -21
  269. package/src/function/UniqueFSTempName.mjs +33 -0
  270. package/src/function/errorToMessage.mjs +21 -0
  271. package/src/function/resolveErrorArray.mjs +15 -1
  272. package/src/neinth/VivthyNeinth.mjs +487 -0
  273. package/src/typehints/ArrayToKeys.mjs +17 -0
  274. package/src/typehints/ArrayToKeys.mts +31 -0
  275. package/src/typehints/AssemblyScriptExportsType.mjs +7 -0
  276. package/src/typehints/AssemblyScriptLoaderInstantiate.mjs +7 -0
  277. package/src/typehints/AutoDocASOptions.mjs +14 -0
  278. package/src/typehints/ChainableType.mjs +11 -0
  279. package/src/typehints/ComponentDecorator_Constructor.mjs +10 -0
  280. package/src/typehints/ConsoleAdditionalSettingType.mjs +6 -0
  281. package/src/typehints/Decorator.mjs +9 -0
  282. package/src/typehints/Decorator.mts +31 -0
  283. package/src/typehints/DecoratorMonkeyPatch.mjs +10 -0
  284. package/src/typehints/DecoratorMonkeyPatch.mts +43 -0
  285. package/src/{types → typehints}/DevTestCB.mjs +2 -2
  286. package/src/typehints/EnvModeType.mjs +6 -0
  287. package/src/{types → typehints}/ListArg.mjs +1 -1
  288. package/src/{types → typehints}/LitExpResultType.mjs +1 -1
  289. package/src/typehints/MonkeyPatchedType.mjs +13 -0
  290. package/src/typehints/ParametersFollowingN.mjs +8 -0
  291. package/src/typehints/ParametersFollowingN.mts +17 -0
  292. package/src/typehints/PrefixedKeysOf.mjs +9 -0
  293. package/src/typehints/Runtime.mjs +6 -0
  294. package/src/typehints/SafeImportReturnType.mjs +6 -0
  295. package/src/typehints/StylePropRefType.mjs +12 -0
  296. package/src/typehints/TemplateLiteralValueHandler.mjs +14 -0
  297. package/src/typehints/VLifecycleCallbacks.mjs +10 -0
  298. package/src/typehints/VivthCleanup.mjs +14 -0
  299. package/src/web/BrowserDirMapper.mjs +255 -0
  300. package/src/web/EnsureValidTag.mjs +5 -0
  301. package/src/web/EnsureValidTag.mts +10 -0
  302. package/src/web/ViteAddDynamics.mjs +34 -0
  303. package/src/web/ViteGetAllHTMLFile.mjs +97 -0
  304. package/src/web/WC_extendsA.mjs +330 -0
  305. package/src/web/WC_extendsB.mjs +332 -0
  306. package/src/web/bindings/WC_StyleProp_bind.mjs +70 -0
  307. package/src/web/bindings/WC_createElement_bind.mjs +95 -0
  308. package/src/web/bindings/WC_createNamedSlot.mjs +29 -0
  309. package/src/web/bindings/WC_litRender_bind.mjs +26 -0
  310. package/src/web/bindings/WC_litStyleMap.mjs +14 -0
  311. package/src/web/common/CSS.mjs +35 -0
  312. package/src/web/common/E.mjs +126 -0
  313. package/src/web/common/NewStyleSheetAsync.mjs +21 -0
  314. package/src/web/common/NewStyleSheetSync.mjs +21 -0
  315. package/src/web/common/WC_TagName_type.mjs +10 -0
  316. package/src/web/common/WC_TagName_type.mts +36 -0
  317. package/src/web/signals/IsInViewPortSignal.mjs +140 -0
  318. package/src/web/signals/ObserverSignal.mjs +93 -0
  319. package/src/web/signals/WC_litRef.mjs +61 -0
  320. package/src/web/signals/WC_loopedSiblingsRef.mjs +100 -0
  321. package/tsconfig.json +44 -41
  322. package/index.mjs +0 -91
  323. package/src/bundler/FSInline.mjs +0 -67
  324. package/src/bundler/FSInlineAnalyzer.mjs +0 -228
  325. package/src/bundler/FSInlineBundled.mjs +0 -38
  326. package/src/bundler/adds/externals.mjs +0 -8
  327. package/src/class/ListDerived.mjs +0 -42
  328. package/src/common/Dev.mjs +0 -134
  329. package/src/common/DevBundled.mjs +0 -5
  330. package/src/common/lazie.mjs +0 -3
  331. package/src/types/IsListSignal.mjs +0 -6
  332. package/src/types/Runtime.mjs +0 -6
  333. package/src/types/VivthDevCodeBlockStringType.mjs +0 -6
  334. package/types/index.d.mts +0 -58
  335. package/types/src/bundler/CompileJS.d.mts +0 -119
  336. package/types/src/bundler/FSInline.d.mts +0 -50
  337. package/types/src/bundler/FSInlineAnalyzer.d.mts +0 -37
  338. package/types/src/bundler/FSInlineBundled.d.mts +0 -22
  339. package/types/src/bundler/adds/externals.d.mts +0 -1
  340. package/types/src/class/Console.d.mts +0 -71
  341. package/types/src/class/Derived.d.mts +0 -98
  342. package/types/src/class/Effect.d.mts +0 -216
  343. package/types/src/class/ListDerived.d.mts +0 -38
  344. package/types/src/class/Paths.d.mts +0 -69
  345. package/types/src/class/SafeExit.d.mts +0 -103
  346. package/types/src/class/WorkerMainThreadBundled.d.mts +0 -83
  347. package/types/src/common/Base64URLFromFile.d.mts +0 -16
  348. package/types/src/common/Dev.d.mts +0 -68
  349. package/types/src/common/DevBundled.d.mts +0 -3
  350. package/types/src/common/lazie.d.mts +0 -1
  351. package/types/src/doc/JSautoDOC.d.mts +0 -83
  352. package/types/src/function/GetRuntime.d.mts +0 -2
  353. package/types/src/function/TemplateLiteral.d.mts +0 -22
  354. package/types/src/function/TsToMjs.d.mts +0 -23
  355. package/types/src/types/IsListSignal.d.mts +0 -4
  356. package/types/src/types/ListArg.d.mts +0 -4
  357. package/types/src/types/Runtime.d.mts +0 -4
  358. package/types/src/types/VivthDevCodeBlockStringType.d.mts +0 -4
  359. /package/{types → generated/types}/src/bundler/adds/pluginVivthBundle.d.mts +0 -0
  360. /package/{types → generated/types}/src/class/WorkerResult.d.mts +0 -0
  361. /package/{types → generated/types}/src/common/EventNameSpace.d.mts +0 -0
  362. /package/{types → generated/types}/src/common/eventObjects.d.mts +0 -0
  363. /package/{types → generated/types}/src/common/keys.d.mts +0 -0
  364. /package/{types → generated/types}/src/doc/correctBeforeParse.d.mts +0 -0
  365. /package/{types → generated/types}/src/function/TrySync.d.mts +0 -0
  366. /package/{types → generated/types}/src/function/resolveErrorArray.d.mts +0 -0
  367. /package/{types/src/types → generated/types/src/typehints}/AnyButUndefined.d.mts +0 -0
  368. /package/{types/src/types → generated/types/src/typehints}/ExtnameType.d.mts +0 -0
  369. /package/{types/src/types → generated/types/src/typehints}/LitExpKeyType.d.mts +0 -0
  370. /package/{types/src/types → generated/types/src/typehints}/LitExpResultType.d.mts +0 -0
  371. /package/{types/src/types → generated/types/src/typehints}/MutationType.d.mts +0 -0
  372. /package/{types/src/types → generated/types/src/typehints}/QCBFIFOReturn.d.mts +0 -0
  373. /package/{types/src/types → generated/types/src/typehints}/QCBReturn.d.mts +0 -0
  374. /package/src/{types → typehints}/AnyButUndefined.mjs +0 -0
  375. /package/src/{types → typehints}/ExtnameType.mjs +0 -0
  376. /package/src/{types → typehints}/LitExpKeyType.mjs +0 -0
  377. /package/src/{types → typehints}/MutationType.mjs +0 -0
  378. /package/src/{types → typehints}/QCBFIFOReturn.mjs +0 -0
  379. /package/src/{types → typehints}/QCBReturn.mjs +0 -0
@@ -1,17 +1,19 @@
1
1
  // @ts-check
2
2
 
3
+ import { IsTypeOf } from '../function/IsTypeOf.mjs';
3
4
  import { LazyFactory } from '../function/LazyFactory.mjs';
4
5
  import { Console } from './Console.mjs';
6
+ import { DataLog } from './DataLog.mjs';
5
7
  import { Signal } from './Signal.mjs';
6
8
 
7
9
  /**
8
- * @typedef {import('../types/ListArg.mjs').ListArg} ListArg
9
- * @typedef {import('../types/MutationType.mjs').MutationType} MutationType
10
+ * @typedef {import('../typehints/ListArg.mjs').ListArg} ListArg
11
+ * @typedef {import('../typehints/MutationType.mjs').MutationType} MutationType
10
12
  */
11
13
  /**
12
14
  * @description
13
15
  * - class to create list that satisfy `Array<Record<string, string>>`.
14
- * @template {import('../types/ListArg.mjs').ListArg} LISTARG
16
+ * @template {import('../typehints/ListArg.mjs').ListArg} LISTARG
15
17
  * @extends {Signal<LISTARG[]>}
16
18
  */
17
19
  export class ListSignal extends Signal {
@@ -23,7 +25,7 @@ export class ListSignal extends Signal {
23
25
  * @returns {value is Array<Record<string, string>>} True if the first item is a valid string record or array is empty.
24
26
  */
25
27
  static isValid(value) {
26
- if (Array.isArray(value) === false) {
28
+ if (!Array.isArray(value)) {
27
29
  return false;
28
30
  }
29
31
  const first = value[0];
@@ -33,10 +35,10 @@ export class ListSignal extends Signal {
33
35
  }
34
36
  return (
35
37
  first &&
36
- typeof first === 'object' &&
38
+ IsTypeOf(first, 'object') &&
37
39
  !Array.isArray(first) &&
38
40
  Object.entries(first).every(
39
- ([key, val]) => typeof key === 'string' && typeof val === 'string'
41
+ ([key, val]) => IsTypeOf(key, 'string') && IsTypeOf(val, 'string'),
40
42
  )
41
43
  );
42
44
  }
@@ -44,17 +46,24 @@ export class ListSignal extends Signal {
44
46
  * @description
45
47
  * - usefull for `loops`;
46
48
  * @param {LISTARG[]} [value]
49
+ * @param {ConstructorParameters<typeof Signal<LISTARG[]>>[1]} [performanceChangesReport]
50
+ * - the argument passed are `structuredClone` of the array;
47
51
  * @example
48
- * import { ListSignal } from 'vivth';
52
+ * import { ListSignal } from 'vivth/neutral';
49
53
  *
50
54
  * const listExample = new ListSignal([
51
55
  * {key1: "test1",},
52
56
  * {key1: "test2",},
53
57
  * ]);
54
58
  */
55
- constructor(value = []) {
59
+ constructor(value = [], performanceChangesReport = undefined) {
56
60
  super(value);
61
+ this.#performanceChangesReport = performanceChangesReport;
57
62
  }
63
+ /**
64
+ * @type {ConstructorParameters<typeof Signal<LISTARG[]>>[1]}
65
+ */
66
+ #performanceChangesReport;
58
67
  /**
59
68
  * @description
60
69
  * - reference to original inputed `value`;
@@ -74,6 +83,26 @@ export class ListSignal extends Signal {
74
83
  set value(_) {
75
84
  Console.error('`List.value` `setter` are not available outside the class or instance');
76
85
  }
86
+ /**
87
+ * @description
88
+ * - structuredClone of prev
89
+ * @type {LISTARG[]|undefined}
90
+ * @override
91
+ */
92
+ get prev() {
93
+ return structuredClone(super.prev);
94
+ }
95
+ /**
96
+ * @type {()=>void}
97
+ */
98
+ #notifyWithPerformanceChangesReport = () => {
99
+ this.subscribers.notify(async () => {
100
+ if (!this.#performanceChangesReport) {
101
+ return;
102
+ }
103
+ this.#performanceChangesReport(new DataLog(this.arrayMethods.structuredClone));
104
+ });
105
+ };
77
106
  /**
78
107
  * @description
79
108
  * - methods collection that mimics `Array` API;
@@ -84,9 +113,25 @@ export class ListSignal extends Signal {
84
113
  /**
85
114
  * @instance arrayMethods
86
115
  * @description
87
- * - reference to structuredClone elements of `value`;
116
+ * - reference to `structuredClone` elements of `value`;
88
117
  * - calling doesn't notify for changes;
89
118
  * @returns {Array<LISTARG>}
119
+ * - use this getter instead of subscribing the `ListSignal` value;
120
+ * >- as to not accidentally mutate the source value;
121
+ * @example
122
+ * import { ListSignal, Derived } from 'vivth/neutral';
123
+ *
124
+ * const myListSignal = new ListSignal([
125
+ * { key:'a', group:0 },
126
+ * { key:'b', group:1 },
127
+ * { key:'c', group:0 },
128
+ * ]);
129
+ *
130
+ * const myFilteredListSignal = new Derived(async ({ subscribe }) => {
131
+ * return subscribe(myListSignal).structuredClone.filter((val)=>{
132
+ * // return specific val
133
+ * })
134
+ * })
90
135
  */
91
136
  get structuredClone() {
92
137
  return structuredClone(super.value);
@@ -100,7 +145,7 @@ export class ListSignal extends Signal {
100
145
  */
101
146
  push: (...listArg) => {
102
147
  super.value.push(...listArg);
103
- this.subscribers.notify();
148
+ this.#notifyWithPerformanceChangesReport();
104
149
  },
105
150
  /**
106
151
  * @instance arrayMethods
@@ -110,7 +155,7 @@ export class ListSignal extends Signal {
110
155
  */
111
156
  shift: () => {
112
157
  super.value.shift();
113
- this.subscribers.notify();
158
+ this.#notifyWithPerformanceChangesReport();
114
159
  },
115
160
  /**
116
161
  * @instance arrayMethods
@@ -121,7 +166,7 @@ export class ListSignal extends Signal {
121
166
  */
122
167
  unshift: (...listArg) => {
123
168
  super.value.unshift(...listArg);
124
- this.subscribers.notify();
169
+ this.#notifyWithPerformanceChangesReport();
125
170
  },
126
171
  /**
127
172
  * @instance arrayMethods
@@ -162,11 +207,11 @@ export class ListSignal extends Signal {
162
207
  */
163
208
  splice: (start, deleteCount, ...listArg) => {
164
209
  const end = start + deleteCount - 1;
165
- if (this.#checkLength('splice', end) === false) {
210
+ if (!this.#checkLength('splice', end)) {
166
211
  return;
167
212
  }
168
213
  super.value.splice(start, deleteCount, ...listArg);
169
- this.subscribers.notify();
214
+ this.#notifyWithPerformanceChangesReport();
170
215
  },
171
216
  /**
172
217
  * @instance arrayMethods
@@ -177,15 +222,12 @@ export class ListSignal extends Signal {
177
222
  * @returns {void}
178
223
  */
179
224
  swap: (indexA, indexB) => {
180
- if (
181
- this.#checkLength('swap', indexA) === false ||
182
- this.#checkLength('swap', indexB) === false
183
- ) {
225
+ if (!this.#checkLength('swap', indexA) || !this.#checkLength('swap', indexB)) {
184
226
  return;
185
227
  }
186
228
  // @ts-expect-error
187
229
  [super.value[indexA], super.value[indexB]] = [super.value[indexB], super.value[indexA]];
188
- this.subscribers.notify();
230
+ this.#notifyWithPerformanceChangesReport();
189
231
  },
190
232
  /**
191
233
  * @instance arrayMethods
@@ -196,7 +238,7 @@ export class ListSignal extends Signal {
196
238
  * @returns {void}
197
239
  */
198
240
  modify: (index, listArg) => {
199
- if (this.#checkLength('modify', index) === false) {
241
+ if (!this.#checkLength('modify', index)) {
200
242
  return;
201
243
  }
202
244
  for (const key in listArg) {
@@ -206,7 +248,7 @@ export class ListSignal extends Signal {
206
248
  super.value[index][key] = listArgKey;
207
249
  }
208
250
  }
209
- this.subscribers.notify();
251
+ this.#notifyWithPerformanceChangesReport();
210
252
  },
211
253
  /**
212
254
  * @instance arrayMethods
@@ -216,7 +258,7 @@ export class ListSignal extends Signal {
216
258
  * @returns {void}
217
259
  */
218
260
  remove: (index) => {
219
- if (this.#checkLength('remove', index) === false) {
261
+ if (!this.#checkLength('remove', index)) {
220
262
  return;
221
263
  }
222
264
  this.arrayMethods.splice(index, 1);
@@ -225,21 +267,21 @@ export class ListSignal extends Signal {
225
267
  * @instance arrayMethods
226
268
  * @description
227
269
  * - reverses the elements in an `List` in place.
228
- * @returns {void}
270
+ * @type {()=>void}
229
271
  */
230
272
  reverse: () => {
231
273
  super.value.reverse();
232
- this.subscribers.notify();
274
+ this.#notifyWithPerformanceChangesReport();
233
275
  },
234
276
  /**
235
277
  * @instance arrayMethods
236
278
  * @description
237
279
  * - removes the last element;
238
- * @returns {void}
280
+ * @type {()=>void}
239
281
  */
240
282
  pop: () => {
241
283
  super.value.pop();
242
- this.subscribers.notify();
284
+ this.#notifyWithPerformanceChangesReport();
243
285
  },
244
286
  };
245
287
  });
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { LazyFactory } from '../function/LazyFactory.mjs';
4
4
  import { TrySync } from '../function/TrySync.mjs';
5
+ import { Console } from './Console.mjs';
5
6
 
6
7
  /**
7
8
  * @description
@@ -17,7 +18,7 @@ import { TrySync } from '../function/TrySync.mjs';
17
18
  */
18
19
  export class LitExp {
19
20
  /**
20
- * @typedef {import("../types/LitExpKeyType.mjs").LitExpKeyType} LitExpKeyType
21
+ * @typedef {import("../typehints/LitExpKeyType.mjs").LitExpKeyType} LitExpKeyType
21
22
  */
22
23
 
23
24
  /**
@@ -58,7 +59,7 @@ export class LitExp {
58
59
  * - placement of `key` will determine the named capture group will be placed in the template literal;
59
60
  * - it is recomended to not end template literal with any of the `key`s as the regex detection might failed to detects the boundary of the end of matched string of that capture group;
60
61
  * @example
61
- * import { LitExp } from 'vivth';
62
+ * import { LitExp } from 'vivth/neutral';
62
63
  *
63
64
  * (()=>{
64
65
  * const [liteal, errorPrep] = LitExp.prepare({
@@ -77,6 +78,12 @@ export class LitExp {
77
78
  static prepare(keysAndDefaultValuePair) {
78
79
  return TrySync(() => {
79
80
  for (const key in keysAndDefaultValuePair) {
81
+ if (
82
+ !Object.hasOwn(keysAndDefaultValuePair, key) ||
83
+ keysAndDefaultValuePair[key] === undefined
84
+ ) {
85
+ continue;
86
+ }
80
87
  const regex = keysAndDefaultValuePair[key];
81
88
  const capture = !regex ? `[\\s\\S]*?` : regex.source;
82
89
  if (capture.match(/\(\<\w+\>[\s\S]*?\)/g)) {
@@ -129,11 +136,9 @@ export class LitExp {
129
136
  for (let i = 0; i < stringsLength; i++) {
130
137
  const string = strings[i];
131
138
  if (string === undefined) {
132
- throw new Error('string undefined');
139
+ throw 'string undefined';
133
140
  }
134
- if (i + 1 == stringsLength && string === '') {
135
- result.push('(?:\\s+?|;|,|$|\/\/)');
136
- } else {
141
+ if (i + 1 !== stringsLength || string !== '') {
137
142
  result.push(LitExp.escape(string));
138
143
  }
139
144
  if (i < values.length) {
@@ -159,29 +164,39 @@ export class LitExp {
159
164
  #regExp = ({ flags, whiteSpaceSensitive, absoluteLeadAndFollowing }) => {
160
165
  return TrySync(() => {
161
166
  let regExpStringCache;
162
- if (this.#regExpStringCache === undefined) {
167
+ if (
168
+ /** */
169
+ this.#regExpStringCache === undefined
170
+ ) {
163
171
  const [regExpStringCache, error] = LitExp.#processTemplate(
164
172
  this.#keyRules,
165
173
  this.#values,
166
174
  LitExp.#namedChapture,
167
- this.#templateStringArray
175
+ this.#templateStringArray,
168
176
  );
169
- if (error) {
177
+ if (
178
+ /** */
179
+ error
180
+ ) {
170
181
  throw error;
171
182
  }
172
183
  this.#regExpStringCache = regExpStringCache.join('');
173
184
  }
174
- if (whiteSpaceSensitive) {
185
+ if (
186
+ /** */
187
+ whiteSpaceSensitive
188
+ ) {
175
189
  regExpStringCache = this.#regExpStringCache;
176
190
  } else {
177
191
  regExpStringCache = this.#regExpStringCache.replace(/\s+/g, `\\s+`);
178
192
  }
179
193
  return new RegExp(
180
194
  absoluteLeadAndFollowing ? `\^${regExpStringCache}\$` : regExpStringCache,
181
- flags
195
+ flags,
182
196
  );
183
197
  });
184
198
  };
199
+
185
200
  /**
186
201
  * @param {Parameters<LitExp<KEYS>["evaluate"]["matchedAllAndGrouped"]>[1]} options
187
202
  * @returns {ReturnType<typeof TrySync<RegExp>>}
@@ -189,19 +204,29 @@ export class LitExp {
189
204
  #regexToMatchAll = ({ flags, whiteSpaceSensitive }) => {
190
205
  return TrySync(() => {
191
206
  let regExpToMatchStringCache;
192
- if (this.#regExpToMatchStringCache === undefined) {
207
+ if (
208
+ /** */
209
+ this.#regExpToMatchStringCache === undefined
210
+ ) {
193
211
  const [regExpToMatchStringCache, error] = LitExp.#processTemplate(
194
212
  this.#keyRules,
195
213
  this.#values,
196
214
  LitExp.#namedChapture,
197
- this.#templateStringArray
215
+ this.#templateStringArray,
198
216
  );
199
- if (error || regExpToMatchStringCache === undefined) {
217
+ if (
218
+ /** */
219
+ error ||
220
+ regExpToMatchStringCache === undefined
221
+ ) {
200
222
  throw error;
201
223
  }
202
224
  this.#regExpToMatchStringCache = regExpToMatchStringCache.join('');
203
225
  }
204
- if (whiteSpaceSensitive) {
226
+ if (
227
+ /** */
228
+ whiteSpaceSensitive
229
+ ) {
205
230
  regExpToMatchStringCache = this.#regExpToMatchStringCache;
206
231
  } else {
207
232
  regExpToMatchStringCache = this.#regExpToMatchStringCache.replace(/\s+/g, `\\s+`);
@@ -223,7 +248,7 @@ export class LitExp {
223
248
  * @param {Partial<{ [K in keyof KEYS]?: string }>} overrides
224
249
  * @returns {string|undefined}
225
250
  * @example
226
- * import { LitExp } from 'vivth';
251
+ * import { LitExp } from 'vivth/neutral';
227
252
  *
228
253
  * const [literal, errorPreparing] = LitExp.prepare({
229
254
  * myKey: false,
@@ -249,7 +274,7 @@ export class LitExp {
249
274
  return overrides[key];
250
275
  });
251
276
  },
252
- this_.#templateStringArray
277
+ this_.#templateStringArray,
253
278
  );
254
279
  if (error) {
255
280
  throw error;
@@ -271,7 +296,7 @@ export class LitExp {
271
296
  */
272
297
  static #namedChapture(value, regex) {
273
298
  return TrySync(() => {
274
- const capture = regex === false ? `[\\s\\S]*?` : regex.source;
299
+ const capture = !regex ? `[\\s\\S]*?` : regex.source;
275
300
  return `(?<${value.toString()}>${capture})`;
276
301
  });
277
302
  }
@@ -305,7 +330,7 @@ export class LitExp {
305
330
  * regexp:RegExp}>>
306
331
  * }
307
332
  * @example
308
- * import { LitExp } from 'vivth';
333
+ * import { LitExp } from 'vivth/neutral';
309
334
  *
310
335
  * const [literal, errorPreparing] = LitExp.prepare({
311
336
  * myKey: false,
@@ -338,19 +363,19 @@ export class LitExp {
338
363
  }
339
364
  const execResult = regexp.exec(string);
340
365
  if (execResult === null) {
341
- return undefined;
366
+ const error = { string, regexp, message: 'execResult should not be null', execResult };
367
+ Console.error(error);
368
+ throw error;
342
369
  }
343
370
  const whole = execResult[1];
344
371
  const named = execResult?.groups;
345
372
  const result = { named, whole };
346
373
  if (named === undefined) {
347
- throw new Error(
348
- JSON.stringify({
349
- regexpSource: regexp.source,
350
- message: 'no match is found',
351
- sugestion: 'make sure all `keys` values will capture any scenario',
352
- })
353
- );
374
+ throw JSON.stringify({
375
+ regexpSource: regexp.source,
376
+ message: 'no match is found',
377
+ sugestion: 'make sure all `keys` values will capture any scenario',
378
+ });
354
379
  }
355
380
  return { result, regexp };
356
381
  });
@@ -361,10 +386,10 @@ export class LitExp {
361
386
  * - to match all and grouped based on `key`;
362
387
  * @param {Parameters<LitExp<KEYS>["evaluate"]["execGroups"]>[0]} string
363
388
  * @param {Omit<Parameters<LitExp<KEYS>["evaluate"]["execGroups"]>[1], 'absoluteLeadAndFollowing'>} options
364
- * @returns {ReturnType<typeof TrySync<import('../types/LitExpResultType.mjs').LitExpResultType<KEYS>>>
389
+ * @returns {ReturnType<typeof TrySync<import('../typehints/LitExpResultType.mjs').LitExpResultType<KEYS>>>
365
390
  * }
366
391
  * @example
367
- * import { LitExp, Console } from 'vivth';
392
+ * import { LitExp, Console } from 'vivth/neutral';
368
393
  *
369
394
  * const [literal, errorPreparing] = LitExp.prepare({
370
395
  * myKey: false,
@@ -418,13 +443,11 @@ export class LitExp {
418
443
  const matchedAll = string.matchAll(regexp);
419
444
  for (const match of matchedAll) {
420
445
  if (match.groups === undefined) {
421
- throw new Error(
422
- JSON.stringify({
423
- regexpSource: regexp.source,
424
- message: 'no match is found',
425
- sugestion: 'make sure all `keys` values will capture any scenario',
426
- })
427
- );
446
+ throw JSON.stringify({
447
+ regexpSource: regexp.source,
448
+ message: 'no match is found',
449
+ sugestion: 'make sure all `keys` values will capture any scenario',
450
+ });
428
451
  }
429
452
  whole.push(match[1] ?? '');
430
453
  // @ts-expect-error
@@ -0,0 +1,225 @@
1
+ // @ts-check
2
+
3
+ import { LazyFactory } from '../function/LazyFactory.mjs';
4
+ import { Derived } from './Derived.mjs';
5
+ import { QChannel } from './QChannel.mjs';
6
+ import { Signal } from './Signal.mjs';
7
+
8
+ /**
9
+ * @typedef { import('../typehints/VivthCleanup.mjs').VivthCleanup } VivthCleanup
10
+ */
11
+
12
+ /**
13
+ * @description
14
+ * - Signal based on shared/globally available `Object` as key;
15
+ * @template {any} SHAREDOBJECT
16
+ * @implements {VivthCleanup}
17
+ */
18
+ export class ObjectSignal {
19
+ vivthCleanup = async () => {
20
+ this.remove.ref();
21
+ };
22
+ /**
23
+ * @type {QChannel<Object>}
24
+ */
25
+ static #q = LazyFactory(() => new QChannel('ObjectSignal:q'));
26
+ /**
27
+ * @type {WeakMap<Object, ObjectSignal<any>>}
28
+ */
29
+ static #mappedSignal = new WeakMap();
30
+ /**
31
+ * @template {any} SHAREDOBJECT
32
+ * @param {Object} object
33
+ * @returns {Promise<ObjectSignal<SHAREDOBJECT>>}
34
+ */
35
+ static async get(object) {
36
+ const mapped = ObjectSignal.#mappedSignal;
37
+ const { resume } = await ObjectSignal.#q.key(object);
38
+ if (!mapped.has(object)) {
39
+ mapped.set(object, new ObjectSignal());
40
+ }
41
+ resume();
42
+ // @ts-expect-error
43
+ return mapped.get(object);
44
+ }
45
+ /**
46
+ * @private
47
+ */
48
+ constructor() {}
49
+ /**
50
+ * @description
51
+ * - is [Signal](#signal);
52
+ * - if needed to pass along the messages, it can be used as `dispatcher` and `listener` at the same time;
53
+ * - is `lazily` created;
54
+ * @type {Signal<SHAREDOBJECT|undefined>}
55
+ * @example
56
+ * import { ObjectSignal, Effect, Console } from 'vivth/neutral';
57
+ *
58
+ * const myObjectSignal = await ObjectSignal.get('dataEvent', false);
59
+ *
60
+ * new Effect(({ subscribe })=>{
61
+ * const listenValue = subscribe(myObjectSignal.dispatch).value;
62
+ * // dispatch can be used as two way communication;
63
+ * Console.log({ listenValue });
64
+ * })
65
+ * myObjectSignal.dispatch.value = 'hey';
66
+ */
67
+ // @ts-expect-error
68
+ dispatcher = LazyFactory(() => {
69
+ return new Signal(undefined);
70
+ });
71
+ /**
72
+ * @description
73
+ * - is [Derived](#derived);
74
+ * - can be used as listener when passed down value shouldn't be modified manually;
75
+ * - is `lazily` created along with `dispatch`, if `listen` is accessed first, then `dispatch` will also be created automatically;
76
+ * @type {Derived<SHAREDOBJECT|undefined>}
77
+ * @example
78
+ * import { ObjectSignal, Effect, Console } from 'vivth/neutral';
79
+ *
80
+ * const myObjectSignal = await ObjectSignal.get('dataEvent', false);
81
+ *
82
+ * new Effect(({ subscribe })=>{
83
+ * const listenValue = subscribe(myObjectSignal.listen).value;
84
+ * // listen can be used only as listener for one way communication;
85
+ * Console.log({ listenValue });
86
+ * })
87
+ * myObjectSignal.dispatch.value = 'hey';
88
+ */
89
+ listener = LazyFactory(() => {
90
+ const dispatch = this.dispatcher;
91
+ return new Derived(async ({ subscribe }) => {
92
+ return subscribe(dispatch).value;
93
+ });
94
+ });
95
+ /**
96
+ * @description
97
+ * - methods of this static property is lazily created;
98
+ * - remove signal and effect subscription of the named `ObjectSignal_instance`;
99
+ */
100
+ static remove = LazyFactory(() => ({
101
+ /**
102
+ * @static remove
103
+ * @description
104
+ * - remove subscriber from the named `ObjectSignal_instance`;
105
+ * @param {string} name
106
+ * @param {import('./Effect.mjs').Effect} effectInstance
107
+ * @returns {void}
108
+ * @example
109
+ * import { ObjectSignal } from 'vivth/neutral';
110
+ *
111
+ * ObjectSignal.remove.subscriber('yourObjectSignalName', myEffectInstance);
112
+ */
113
+ subscriber: (name, effectInstance) => {
114
+ /**
115
+ * this part is not needed, as the effect might need to react to other signals
116
+ // effectInstance.options.removeEffect();
117
+ */
118
+ ObjectSignal.get(name).then(({ remove }) => {
119
+ remove.subscriber(effectInstance);
120
+ });
121
+ },
122
+ /**
123
+ * @static remove
124
+ * @description
125
+ * - remove all subscribers from the named `ObjectSignal_instance`;
126
+ * @param {string} name
127
+ * @returns {void}
128
+ * @example
129
+ * import { ObjectSignal } from 'vivth/neutral';
130
+ *
131
+ * ObjectSignal.remove.allSubscribers('yourObjectSignalName');
132
+ */
133
+ allSubscribers: (name) => {
134
+ ObjectSignal.get(name).then(({ remove }) => {
135
+ remove.allSubscribers();
136
+ });
137
+ },
138
+ /**
139
+ * @static remove
140
+ * @description
141
+ * - remove reference of the `proxySignals` of the named `ObjectSignal_instance`;
142
+ * @param {string} name
143
+ * @returns {void}
144
+ * @example
145
+ * import { ObjectSignal } from 'vivth/neutral';
146
+ *
147
+ * ObjectSignal.remove.refs('yourObjectSignalName');
148
+ */
149
+ refs: (name) => {
150
+ ObjectSignal.get(name).then(({ remove }) => {
151
+ remove.ref();
152
+ });
153
+ },
154
+ }));
155
+ remove = LazyFactory(() => ({
156
+ /**
157
+ * @instance remove
158
+ * @description
159
+ * - remove subscriber from the `ObjectSignal_instance`;
160
+ * @param {import('./Effect.mjs').Effect} effectInstance
161
+ * @returns {void}
162
+ * @example
163
+ * import { ObjectSignal, Effect, Console } from 'vivth/neutral';
164
+ *
165
+ * const myObjectSignal = await ObjectSignal.get('dataEvent', false);
166
+ *
167
+ * const myEffectInstance = new Effect(({ subscribe })=>{
168
+ * const listenValue = subscribe(myObjectSignal.dispatch).value;
169
+ * Console.log({ listenValue });
170
+ * })
171
+ * myObjectSignal.dispatch.value = 'hey';
172
+ * objectSigObjectSignal_instance.remove.subscriber(myEffectInstance);
173
+ */
174
+ subscriber: (effectInstance) => {
175
+ /**
176
+ * this part is not needed, as the effect might need to react to other signals
177
+ // effectInstance.options.removeEffect();
178
+ */
179
+ this.dispatcher.remove.subscriber(effectInstance);
180
+ this.listener.remove.subscriber(effectInstance);
181
+ },
182
+ /**
183
+ * @instance remove
184
+ * @description
185
+ * - remove allSubscribers from the `ObjectSignal_instance`;
186
+ * @type {()=>void}
187
+ * @example
188
+ * import { ObjectSignal, Effect, Console } from 'vivth/neutral';
189
+ *
190
+ * const myObjectSignal = await ObjectSignal.get('dataEvent', false);
191
+ *
192
+ * const myEffectInstance = new Effect(({ subscribe })=>{
193
+ * const listenValue = subscribe(myObjectSignal.dispatch).value;
194
+ * Console.log({ listenValue });
195
+ * })
196
+ * myObjectSignal.dispatch.value = 'hey';
197
+ * objectSigObjectSignal_instance.remove.allSubscribers();
198
+ */
199
+ allSubscribers: () => {
200
+ this.dispatcher.remove.allSubscribers();
201
+ this.listener.remove.allSubscribers();
202
+ },
203
+ /**
204
+ * @instance remove
205
+ * @description
206
+ * - remove reference of the `proxySignals` of the `ObjectSignal_instance`;
207
+ * @type {()=>void}
208
+ * @example
209
+ * import { ObjectSignal, Effect, Console } from 'vivth/neutral';
210
+ *
211
+ * const myObjectSignal = await ObjectSignal.get('dataEvent', false);
212
+ *
213
+ * const myEffectInstance = new Effect(({ subscribe })=>{
214
+ * const listenValue = subscribe(myObjectSignal.dispatch).value;
215
+ * Console.log({ listenValue });
216
+ * });
217
+ *
218
+ * objectSigObjectSignal_instance.remove.ref();
219
+ */
220
+ ref: () => {
221
+ this.dispatcher.remove.ref();
222
+ this.listener.remove.ref();
223
+ },
224
+ }));
225
+ }