@hkdigital/lib-core 0.3.14 → 0.4.3

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 (324) hide show
  1. package/README.md +18 -9
  2. package/dist/auth/errors.d.ts +1 -0
  3. package/dist/auth/errors.js +1 -0
  4. package/dist/{states → browser/navigation}/navigation.svelte.js +1 -1
  5. package/dist/browser/navigation.d.ts +1 -0
  6. package/dist/browser/navigation.js +1 -0
  7. package/dist/config/README.md +5 -5
  8. package/dist/config/generators/imagetools.d.ts +2 -0
  9. package/dist/config/generators/imagetools.js +23 -10
  10. package/dist/config/generators/vite.js +1 -1
  11. package/dist/config/imagetools.d.ts +5 -5
  12. package/dist/config/typedef.d.ts +11 -0
  13. package/dist/config/typedef.js +17 -0
  14. package/dist/design/README.md +211 -66
  15. package/dist/design/config/{design-config.d.ts → design-tokens.d.ts} +23 -10
  16. package/dist/design/config/design-tokens.js +107 -0
  17. package/dist/design/generators/index.d.ts +51 -0
  18. package/dist/design/generators/index.js +124 -0
  19. package/dist/design/index.d.ts +3 -4
  20. package/dist/design/index.js +24 -41
  21. package/dist/design/plugins/skeleton.d.ts +4 -2
  22. package/dist/design/plugins/skeleton.js +3 -2
  23. package/dist/design/themes/hkdev/components/buttons/button-text.css +38 -25
  24. package/dist/design/themes/hkdev/theme-ext.js +1 -1
  25. package/dist/design/utils/clamp.js +1 -1
  26. package/dist/design/utils/root-vars.d.ts +50 -39
  27. package/dist/design/utils/root-vars.js +127 -29
  28. package/dist/{classes/data → generic/data/classes}/IterableTree.js +2 -2
  29. package/dist/{classes/data → generic/data/classes}/Selector.js +1 -1
  30. package/dist/generic/data/classes/typedef.d.ts +24 -0
  31. package/dist/generic/data/classes/typedef.js +14 -0
  32. package/dist/generic/data.d.ts +2 -0
  33. package/dist/generic/data.js +2 -0
  34. package/dist/generic/errors.d.ts +2 -0
  35. package/dist/generic/errors.js +2 -0
  36. package/dist/generic/events.d.ts +1 -0
  37. package/dist/generic/events.js +1 -0
  38. package/dist/{classes/promise → generic/promises/classes}/HkPromise.d.ts +17 -7
  39. package/dist/{classes/promise → generic/promises/classes}/HkPromise.js +20 -10
  40. package/dist/generic/promises.d.ts +1 -0
  41. package/dist/generic/promises.js +1 -0
  42. package/dist/{classes/streams → generic/streaming/classes}/ServerEventsStore.d.ts +1 -1
  43. package/dist/{classes/streams → generic/streaming/classes}/ServerEventsStore.js +2 -2
  44. package/dist/generic/streaming.d.ts +3 -0
  45. package/dist/generic/streaming.js +3 -0
  46. package/dist/generic/typedef.d.ts +1 -0
  47. package/dist/generic/typedef.js +1 -0
  48. package/dist/index.js +1 -0
  49. package/dist/logging/errors.d.ts +7 -0
  50. package/dist/logging/errors.js +11 -0
  51. package/dist/logging/index.d.ts +2 -3
  52. package/dist/logging/index.js +3 -4
  53. package/dist/logging/internal/adapters/console.d.ts +1 -16
  54. package/dist/logging/internal/adapters/console.js +322 -14
  55. package/dist/logging/internal/adapters/formatting.d.ts +69 -0
  56. package/dist/logging/internal/adapters/formatting.js +395 -0
  57. package/dist/logging/internal/adapters/pino.js +128 -27
  58. package/dist/logging/internal/adapters/typedef.d.ts +30 -0
  59. package/dist/logging/internal/adapters/typedef.js +11 -0
  60. package/dist/logging/internal/factories/client.js +1 -1
  61. package/dist/logging/internal/factories/server.js +12 -2
  62. package/dist/logging/internal/logger/Logger.d.ts +9 -7
  63. package/dist/logging/internal/logger/Logger.js +44 -9
  64. package/dist/logging/internal/test-errors.d.ts +35 -0
  65. package/dist/logging/internal/test-errors.js +137 -0
  66. package/dist/network/cache/IndexedDbCache.d.ts +1 -1
  67. package/dist/network/cache/MemoryResponseCache.d.ts +5 -0
  68. package/dist/network/cache/MemoryResponseCache.js +5 -2
  69. package/dist/network/errors.d.ts +2 -0
  70. package/dist/network/errors.js +2 -0
  71. package/dist/network/http/caching.js +1 -1
  72. package/dist/network/http/errors.d.ts +2 -2
  73. package/dist/network/http/errors.js +5 -13
  74. package/dist/network/http/http-request.js +1 -1
  75. package/dist/network/http/json-request.js +1 -1
  76. package/dist/network/http/response.js +1 -1
  77. package/dist/network/http/url.js +1 -1
  78. package/dist/network/loaders/README.md +14 -7
  79. package/dist/network/loaders/audio/AudioScene.svelte.js +3 -2
  80. package/dist/network/loaders/image/ImageLoader.svelte.d.ts +2 -2
  81. package/dist/network/loaders/image/ImageLoader.svelte.js +1 -1
  82. package/dist/network/loaders/image/ImageScene.svelte.d.ts +2 -2
  83. package/dist/network/loaders/image/ImageScene.svelte.js +9 -8
  84. package/dist/network/loaders/image/ImageVariantsLoader.svelte.d.ts +5 -5
  85. package/dist/network/loaders/image/ImageVariantsLoader.svelte.js +14 -13
  86. package/dist/network/loaders/image/utils/index.d.ts +2 -2
  87. package/dist/network/loaders/image/utils/index.js +9 -12
  88. package/dist/network/loaders/typedef.d.ts +0 -9
  89. package/dist/network/loaders/typedef.js +0 -12
  90. package/dist/network/states/NetworkLoader.svelte.d.ts +1 -1
  91. package/dist/network/states/NetworkLoader.svelte.js +3 -2
  92. package/dist/services/index.d.ts +0 -2
  93. package/dist/services/index.js +0 -3
  94. package/dist/services/service-base/ServiceBase.d.ts +2 -2
  95. package/dist/services/service-base/ServiceBase.js +15 -11
  96. package/dist/services/service-base/typedef.d.ts +2 -31
  97. package/dist/services/service-base/typedef.js +3 -2
  98. package/dist/services/service-manager/ServiceManager.d.ts +3 -3
  99. package/dist/services/service-manager/ServiceManager.js +2 -2
  100. package/dist/services/service-manager/typedef.d.ts +3 -3
  101. package/dist/services/service-manager/typedef.js +3 -3
  102. package/dist/services/typedef.d.ts +2 -0
  103. package/dist/services/typedef.js +2 -0
  104. package/dist/{classes/svelte → state/classes}/loading-state-machine/LoadingStateMachine.svelte.d.ts +1 -1
  105. package/dist/{classes/svelte → state/classes}/loading-state-machine/LoadingStateMachine.svelte.js +1 -1
  106. package/dist/state/classes/subscribers-count/index.d.ts +1 -0
  107. package/dist/state/classes/subscribers-count/index.js +1 -0
  108. package/dist/state/classes.d.ts +3 -0
  109. package/dist/state/classes.js +3 -0
  110. package/dist/{util/svelte/state-context/index.d.ts → state/context/state-context.d.ts} +1 -1
  111. package/dist/{util/svelte/state-context/index.js → state/context/state-context.js} +4 -4
  112. package/dist/state/context.d.ts +1 -0
  113. package/dist/state/context.js +1 -0
  114. package/dist/state/stores.d.ts +1 -0
  115. package/dist/state/stores.js +1 -0
  116. package/dist/ui/README.md +49 -0
  117. package/dist/ui/components/button-group/index.d.ts +1 -0
  118. package/dist/ui/components/button-group/index.js +1 -0
  119. package/dist/ui/{primitives → components}/drag-drop/DragDropContext.svelte +1 -1
  120. package/dist/ui/{primitives → components}/drag-drop/DragDropContext.svelte.d.ts +1 -1
  121. package/dist/ui/{primitives → components}/drag-drop/Draggable.svelte +2 -2
  122. package/dist/ui/{primitives → components}/drag-drop/Draggable.svelte.d.ts +1 -1
  123. package/dist/ui/{primitives → components}/drag-drop/DropZone.svelte +4 -4
  124. package/dist/ui/{primitives → components}/drag-drop/DropZone.svelte.d.ts +3 -3
  125. package/dist/ui/{primitives → components}/drag-drop/DropZoneArea.svelte +3 -3
  126. package/dist/ui/{primitives → components}/drag-drop/DropZoneArea.svelte.d.ts +4 -4
  127. package/dist/ui/{primitives → components}/drag-drop/DropZoneList.svelte +3 -3
  128. package/dist/ui/{primitives → components}/drag-drop/DropZoneList.svelte.d.ts +3 -3
  129. package/dist/ui/{primitives → components}/drag-drop/drag-state.svelte.d.ts +11 -11
  130. package/dist/ui/{primitives → components}/drag-drop/drag-state.svelte.js +5 -5
  131. package/dist/ui/components/drag-drop/typedef.d.ts +2 -0
  132. package/dist/ui/components/drag-drop/typedef.js +2 -0
  133. package/dist/ui/components/game-box/GameBox.svelte +1 -1
  134. package/dist/ui/components/game-box/index.d.ts +1 -0
  135. package/dist/ui/components/game-box/index.js +1 -0
  136. package/dist/ui/components/grid-layers/index.d.ts +1 -0
  137. package/dist/ui/components/grid-layers/index.js +1 -0
  138. package/dist/ui/{primitives/layout → components}/grid-layers/util.js +1 -1
  139. package/dist/ui/components/hk-app-layout/HkAppLayout.state.svelte.d.ts +3 -3
  140. package/dist/ui/components/hk-app-layout/HkAppLayout.state.svelte.js +3 -4
  141. package/dist/ui/components/hk-app-layout/index.d.ts +1 -0
  142. package/dist/ui/components/hk-app-layout/index.js +1 -0
  143. package/dist/ui/components/image-box/ImageBox.svelte +2 -2
  144. package/dist/ui/components/image-box/ImageBox.svelte.d.ts +3 -3
  145. package/dist/ui/components/image-box/index.d.ts +1 -1
  146. package/dist/ui/components/presenter/ImageSlide.svelte +1 -1
  147. package/dist/ui/components/presenter/ImageSlide.svelte.d.ts +2 -2
  148. package/dist/ui/components/presenter/Presenter.state.svelte.d.ts +3 -3
  149. package/dist/ui/components/presenter/Presenter.state.svelte.js +1 -1
  150. package/dist/ui/components/presenter/Presenter.svelte +1 -1
  151. package/dist/ui/components/presenter/Presenter.svelte.d.ts +1 -1
  152. package/dist/ui/{primitives → components}/rows/panel-grid-row/PanelGridRow.svelte.d.ts +1 -1
  153. package/dist/ui/{primitives → components}/rows/panel-row-2/PanelRow2.svelte.d.ts +1 -1
  154. package/dist/ui/{primitives → components}/tab-bar/HkTabBar.state.svelte.d.ts +3 -3
  155. package/dist/ui/{primitives → components}/tab-bar/HkTabBar.state.svelte.js +4 -2
  156. package/dist/ui/{primitives → components}/tab-bar/HkTabBar.svelte +2 -2
  157. package/dist/ui/{primitives → components}/tab-bar/HkTabBar.svelte.d.ts +2 -2
  158. package/dist/ui/components/tab-bar/HkTabBarSelector.state.svelte.d.ts +19 -0
  159. package/dist/ui/{primitives → components}/tab-bar/HkTabBarSelector.state.svelte.js +2 -2
  160. package/dist/ui/{primitives → components}/tab-bar/HkTabBarSelector.svelte +1 -1
  161. package/dist/ui/{primitives → components}/tab-bar/HkTabBarSelector.svelte.d.ts +2 -2
  162. package/dist/ui/{primitives → components}/tab-bar/typedef.d.ts +1 -1
  163. package/dist/ui/{primitives → components}/tab-bar/typedef.js +1 -1
  164. package/dist/ui/components/typedef.d.ts +5 -0
  165. package/dist/ui/components/typedef.js +5 -0
  166. package/dist/ui/components/virtual-viewport/index.d.ts +1 -0
  167. package/dist/ui/components/virtual-viewport/index.js +1 -0
  168. package/dist/ui/components.d.ts +11 -0
  169. package/dist/ui/components.js +11 -0
  170. package/dist/ui/{primitives/hkdev → dev}/blocks/TextBlock.svelte +1 -1
  171. package/dist/ui/{primitives/debug → dev}/debug-panel-design-scaling/DebugPanelDesignScaling.svelte +8 -8
  172. package/dist/ui/dev.d.ts +3 -0
  173. package/dist/ui/dev.js +3 -0
  174. package/dist/ui/primitives/buttons/button/Button.svelte.d.ts +1 -1
  175. package/dist/ui/primitives/buttons/button-text/TextButton.svelte +1 -1
  176. package/dist/ui/primitives/typedef.d.ts +1 -0
  177. package/dist/ui/primitives/typedef.js +1 -0
  178. package/dist/ui/primitives.d.ts +5 -0
  179. package/dist/ui/primitives.js +5 -0
  180. package/dist/ui/typedef.d.ts +2 -0
  181. package/dist/ui/typedef.js +2 -0
  182. package/dist/util/array/index.js +1 -1
  183. package/dist/util/bases/base58.d.ts +3 -3
  184. package/dist/util/bases/base58.js +3 -3
  185. package/dist/util/compare/index.d.ts +4 -5
  186. package/dist/util/compare/index.js +3 -4
  187. package/dist/util/exceptions/index.js +1 -1
  188. package/dist/util/expect/arrays.d.ts +11 -11
  189. package/dist/util/expect/arrays.js +14 -6
  190. package/dist/util/expect/index.js +2 -2
  191. package/dist/util/expect/primitives.d.ts +6 -5
  192. package/dist/util/expect/primitives.js +15 -5
  193. package/dist/util/expect/url.d.ts +6 -5
  194. package/dist/util/expect/url.js +15 -5
  195. package/dist/util/function/index.d.ts +1 -14
  196. package/dist/util/index.d.ts +5 -0
  197. package/dist/util/index.js +13 -0
  198. package/dist/util/is/index.d.ts +3 -2
  199. package/dist/util/is/index.js +2 -1
  200. package/dist/util/iterate/index.d.ts +6 -8
  201. package/dist/util/iterate/index.js +5 -5
  202. package/dist/util/object/index.d.ts +1 -2
  203. package/dist/util/object/index.js +2 -3
  204. package/dist/util/ssr/index.d.ts +16 -0
  205. package/dist/util/ssr/index.js +44 -0
  206. package/dist/util/svelte/index.d.ts +1 -1
  207. package/dist/util/svelte/index.js +1 -1
  208. package/dist/util/time/index.d.ts +2 -2
  209. package/dist/util/time/index.js +1 -1
  210. package/dist/valibot/index.d.ts +1 -1
  211. package/dist/valibot/index.js +27 -1
  212. package/package.json +4 -4
  213. package/dist/assets/autospuiten/car-paint-picker/army-green.jpg +0 -0
  214. package/dist/assets/autospuiten/car-paint-picker/electric-blue.jpg +0 -0
  215. package/dist/assets/autospuiten/car-paint-picker/lemon-yellow.jpg +0 -0
  216. package/dist/assets/autospuiten/car-paint-picker/opaque-purple.jpg +0 -0
  217. package/dist/assets/autospuiten/car-paint-picker/rusty.jpg +0 -0
  218. package/dist/assets/autospuiten/car-paint-picker/sunset-orange.jpg +0 -0
  219. package/dist/assets/autospuiten/car-paint-picker/tomato-red.jpg +0 -0
  220. package/dist/assets/autospuiten/car-paint-picker.d.ts +0 -17
  221. package/dist/assets/autospuiten/car-paint-picker.js +0 -41
  222. package/dist/assets/autospuiten/labels.d.ts +0 -7
  223. package/dist/assets/autospuiten/labels.js +0 -7
  224. package/dist/classes/data/index.d.ts +0 -2
  225. package/dist/classes/data/index.js +0 -2
  226. package/dist/classes/event-emitter/index.d.ts +0 -1
  227. package/dist/classes/event-emitter/index.js +0 -2
  228. package/dist/classes/index.d.ts +0 -4
  229. package/dist/classes/index.js +0 -4
  230. package/dist/classes/promise/index.d.ts +0 -1
  231. package/dist/classes/promise/index.js +0 -1
  232. package/dist/classes/stores/index.d.ts +0 -1
  233. package/dist/classes/stores/index.js +0 -1
  234. package/dist/classes/streams/index.d.ts +0 -3
  235. package/dist/classes/streams/index.js +0 -3
  236. package/dist/classes/svelte/index.d.ts +0 -1
  237. package/dist/classes/svelte/index.js +0 -1
  238. package/dist/design/config/design-config.js +0 -73
  239. package/dist/design/tailwind-theme-extend.d.ts +0 -23
  240. package/dist/design/tailwind-theme-extend.js +0 -158
  241. package/dist/errors/index.d.ts +0 -5
  242. package/dist/errors/index.js +0 -5
  243. package/dist/logging/internal/factories/universal.d.ts +0 -9
  244. package/dist/logging/internal/factories/universal.js +0 -22
  245. package/dist/services/service-base/index.d.ts +0 -3
  246. package/dist/services/service-base/index.js +0 -3
  247. package/dist/states/index.d.ts +0 -1
  248. package/dist/states/index.js +0 -1
  249. package/dist/stores/index.d.ts +0 -1
  250. package/dist/stores/index.js +0 -1
  251. package/dist/typedef/index.d.ts +0 -4
  252. package/dist/typedef/index.js +0 -4
  253. package/dist/ui/primitives/debug/index.d.ts +0 -1
  254. package/dist/ui/primitives/debug/index.js +0 -1
  255. package/dist/ui/primitives/index.d.ts +0 -0
  256. package/dist/ui/primitives/index.js +0 -2
  257. package/dist/ui/primitives/layout/grid-layers/GridLayers.svelte__heightFrom__ +0 -372
  258. package/dist/ui/primitives/layout/index.d.ts +0 -1
  259. package/dist/ui/primitives/layout/index.js +0 -1
  260. package/dist/ui/primitives/tab-bar/HkTabBarSelector.state.svelte.d.ts +0 -19
  261. /package/dist/{errors → auth/errors}/jwt.d.ts +0 -0
  262. /package/dist/{errors → auth/errors}/jwt.js +0 -0
  263. /package/dist/{states → browser/navigation}/navigation.svelte.d.ts +0 -0
  264. /package/dist/{classes/data → generic/data/classes}/IterableTree.d.ts +0 -0
  265. /package/dist/{classes/data → generic/data/classes}/Selector.d.ts +0 -0
  266. /package/dist/{classes → generic}/data/typedef.d.ts +0 -0
  267. /package/dist/{classes → generic}/data/typedef.js +0 -0
  268. /package/dist/{errors → generic/errors}/generic.d.ts +0 -0
  269. /package/dist/{errors → generic/errors}/generic.js +0 -0
  270. /package/dist/{errors → generic/errors}/promise.d.ts +0 -0
  271. /package/dist/{errors → generic/errors}/promise.js +0 -0
  272. /package/dist/{classes/event-emitter → generic/events/classes}/EventEmitter.d.ts +0 -0
  273. /package/dist/{classes/event-emitter → generic/events/classes}/EventEmitter.js +0 -0
  274. /package/dist/{classes/streams → generic/streaming/classes}/LogTransformStream.d.ts +0 -0
  275. /package/dist/{classes/streams → generic/streaming/classes}/LogTransformStream.js +0 -0
  276. /package/dist/{classes/streams → generic/streaming/classes}/TimeStampSource.d.ts +0 -0
  277. /package/dist/{classes/streams → generic/streaming/classes}/TimeStampSource.js +0 -0
  278. /package/dist/logging/{internal/constants.d.ts → constants.d.ts} +0 -0
  279. /package/dist/logging/{internal/constants.js → constants.js} +0 -0
  280. /package/dist/logging/{internal/typedef.d.ts → typedef.d.ts} +0 -0
  281. /package/dist/logging/{internal/typedef.js → typedef.js} +0 -0
  282. /package/dist/{errors → network/errors}/api.d.ts +0 -0
  283. /package/dist/{errors → network/errors}/api.js +0 -0
  284. /package/dist/{errors → network/errors}/http.d.ts +0 -0
  285. /package/dist/{errors → network/errors}/http.js +0 -0
  286. /package/dist/{classes/svelte → state/classes}/finite-state-machine/FiniteStateMachine.svelte.d.ts +0 -0
  287. /package/dist/{classes/svelte → state/classes}/finite-state-machine/FiniteStateMachine.svelte.js +0 -0
  288. /package/dist/{classes/svelte → state/classes}/finite-state-machine/index.d.ts +0 -0
  289. /package/dist/{classes/svelte → state/classes}/finite-state-machine/index.js +0 -0
  290. /package/dist/{classes/svelte → state/classes}/loading-state-machine/constants.d.ts +0 -0
  291. /package/dist/{classes/svelte → state/classes}/loading-state-machine/constants.js +0 -0
  292. /package/dist/{classes/svelte → state/classes}/loading-state-machine/index.d.ts +0 -0
  293. /package/dist/{classes/svelte → state/classes}/loading-state-machine/index.js +0 -0
  294. /package/dist/{classes/stores → state/classes/subscribers-count}/SubscribersCount.d.ts +0 -0
  295. /package/dist/{classes/stores → state/classes/subscribers-count}/SubscribersCount.js +0 -0
  296. /package/dist/{typedef/context.d.ts → state/context/typedef.d.ts} +0 -0
  297. /package/dist/{typedef/context.js → state/context/typedef.js} +0 -0
  298. /package/dist/{stores → state/stores}/theme.d.ts +0 -0
  299. /package/dist/{stores → state/stores}/theme.js +0 -0
  300. /package/dist/ui/{primitives → components}/drag-drop/DragController.d.ts +0 -0
  301. /package/dist/ui/{primitives → components}/drag-drop/DragController.js +0 -0
  302. /package/dist/ui/{primitives → components}/drag-drop/actions.d.ts +0 -0
  303. /package/dist/ui/{primitives → components}/drag-drop/actions.js +0 -0
  304. /package/dist/ui/{primitives → components}/drag-drop/index.d.ts +0 -0
  305. /package/dist/ui/{primitives → components}/drag-drop/index.js +0 -0
  306. /package/dist/{typedef → ui/components/drag-drop/typedef}/drag.d.ts +0 -0
  307. /package/dist/{typedef → ui/components/drag-drop/typedef}/drag.js +0 -0
  308. /package/dist/{typedef → ui/components/drag-drop/typedef}/drop.d.ts +0 -0
  309. /package/dist/{typedef → ui/components/drag-drop/typedef}/drop.js +0 -0
  310. /package/dist/ui/{primitives → components}/drag-drop/util.d.ts +0 -0
  311. /package/dist/ui/{primitives → components}/drag-drop/util.js +0 -0
  312. /package/dist/ui/{primitives/layout → components}/grid-layers/GridLayers.svelte +0 -0
  313. /package/dist/ui/{primitives/layout → components}/grid-layers/GridLayers.svelte.d.ts +0 -0
  314. /package/dist/ui/{primitives/layout → components}/grid-layers/util.d.ts +0 -0
  315. /package/dist/ui/{primitives → components}/rows/index.d.ts +0 -0
  316. /package/dist/ui/{primitives → components}/rows/index.js +0 -0
  317. /package/dist/ui/{primitives → components}/rows/panel-grid-row/PanelGridRow.svelte +0 -0
  318. /package/dist/ui/{primitives → components}/rows/panel-row-2/PanelRow2.svelte +0 -0
  319. /package/dist/ui/{primitives → components}/tab-bar/index.d.ts +0 -0
  320. /package/dist/ui/{primitives → components}/tab-bar/index.js +0 -0
  321. /package/dist/ui/{primitives/hkdev → dev}/blocks/TextBlock.svelte.d.ts +0 -0
  322. /package/dist/ui/{primitives/hkdev → dev}/buttons/CheckButton.svelte +0 -0
  323. /package/dist/ui/{primitives/hkdev → dev}/buttons/CheckButton.svelte.d.ts +0 -0
  324. /package/dist/ui/{primitives/debug → dev}/debug-panel-design-scaling/DebugPanelDesignScaling.svelte.d.ts +0 -0
@@ -1,10 +1,21 @@
1
+ /**
2
+ * @typedef {Object} ErrorSummaryMeta
3
+ * @property {string} category - Error category (rethrow, validation, http, promise, error)
4
+ * @property {string} method - Specific method (rethrow, expect, httpGet, hkpromise.timeout, etc)
5
+ * @property {string} [origin] - User function name where error originated
6
+ * @property {number} [relevantFrameIndex] - Index of most relevant stack frame to highlight
7
+ */
8
+
1
9
  /**
2
10
  * @typedef {Object} ErrorSummary
3
11
  * @property {string} name - The name of the exception/error
4
12
  * @property {string} message - The error message
13
+ * @property {ErrorSummaryMeta} [meta] - Error meta
5
14
  * @property {string} [stack] Stack trace (in debug mode for first exception)
6
15
  * @property {number} [status] - HTTP status code (for HttpError instances)
7
16
  * @property {*} [details] - Additional error details (for HttpError instances)
17
+ * @property {string} [errorType] - Formatted error type for display
18
+ * @property {string[]} [stackFrames] - Cleaned stack frames for terminal display
8
19
  */
9
20
 
10
21
  export default {};
@@ -1,6 +1,6 @@
1
1
  import { Logger } from '../logger/index.js';
2
2
  import { ConsoleAdapter } from '../adapters/console.js';
3
- import { INFO } from '../constants.js';
3
+ import { INFO } from '../../constants.js';
4
4
 
5
5
  /**
6
6
  * Create a client-side logger with console adapter
@@ -1,7 +1,7 @@
1
1
  import { Logger } from '../logger/index.js';
2
-
3
2
  import { PinoAdapter } from '../adapters/pino.js';
4
- import { INFO } from '../constants.js';
3
+ import { INFO } from '../../constants.js';
4
+ // import { expectNoSSRContext } from '../../../util/ssr/index.js';
5
5
 
6
6
  /**
7
7
  * Create a server-side logger with pino adapter
@@ -12,10 +12,20 @@ import { INFO } from '../constants.js';
12
12
  * @returns {Logger} Configured logger instance
13
13
  */
14
14
  export function createServerLogger(name, level = INFO, pinoOptions = {}) {
15
+ // Guard against SSR serialization issues
16
+ // expectNoSSRContext();
17
+
15
18
  const logger = new Logger(name, level);
16
19
  const adapter = new PinoAdapter(pinoOptions);
17
20
 
18
21
  // Connect adapter to logger events
22
+ //
23
+ // @note pino might fail if:
24
+ // pino tries to create a worker thread for pino-pretty before the
25
+ // development environment is fully ready, causing the transport target
26
+ // determination to fail
27
+ // -> Stop and start the dev server
28
+ //
19
29
  logger.on('log', (logEvent) => adapter.handleLog(logEvent));
20
30
 
21
31
  return logger;
@@ -33,6 +33,7 @@ export default class Logger extends EventEmitter {
33
33
  *
34
34
  * @param {string} message - Log message
35
35
  * @param {*} [details] - Additional details
36
+ *
36
37
  * @returns {boolean} True if the log was emitted
37
38
  */
38
39
  info(message: string, details?: any): boolean;
@@ -41,23 +42,24 @@ export default class Logger extends EventEmitter {
41
42
  *
42
43
  * @param {string} message - Log message
43
44
  * @param {*} [details] - Additional details
45
+ *
44
46
  * @returns {boolean} True if the log was emitted
45
47
  */
46
48
  warn(message: string, details?: any): boolean;
47
49
  /**
48
50
  * Log an error message
49
51
  *
50
- * @param {string} message - Log message
51
- * @param {*} [details] - Additional details
52
+ * @param {Error|string} originalErrorOrMessage
53
+ * @param {Error} [originalError]
54
+ *
52
55
  * @returns {boolean} True if the log was emitted
53
56
  */
54
- error(message: string, details?: any): boolean;
57
+ error(originalErrorOrMessage: Error | string, originalError?: Error, ...args: any[]): boolean;
55
58
  /**
56
59
  * Create a child logger with additional context
57
60
  *
58
61
  * @param {string} namespace
59
62
  * Namespace of the context (needed for chaining contexts)
60
- *
61
63
  * @param {Object} additionalContext - Additional context data
62
64
  *
63
65
  * @returns {Logger} New logger instance with merged context
@@ -70,9 +72,9 @@ export default class Logger extends EventEmitter {
70
72
  * forwarded to this logger.
71
73
  *
72
74
  * @param {string} eventName
73
- * @param {import('../typedef.js').LogEventData} eventData
75
+ * @param {import('../../typedef.js').LogEventData} eventData
74
76
  */
75
- logFromEvent(eventName: string, eventData: import("../typedef.js").LogEventData): boolean;
77
+ logFromEvent(eventName: string, eventData: import("../../typedef.js").LogEventData): boolean;
76
78
  #private;
77
79
  }
78
- import { EventEmitter } from '../../../classes/event-emitter';
80
+ import { EventEmitter } from '../../../generic/events.js';
@@ -32,7 +32,7 @@
32
32
  * logger.setLevel(DEBUG); // Now debug messages will also be logged
33
33
  */
34
34
 
35
- import { EventEmitter } from '../../../classes/event-emitter';
35
+ import { EventEmitter } from '../../../generic/events.js';
36
36
 
37
37
  import {
38
38
  DEBUG,
@@ -41,7 +41,12 @@ import {
41
41
  ERROR,
42
42
  LEVELS,
43
43
  LOG
44
- } from '../constants.js';
44
+ } from '../../constants.js';
45
+
46
+ import { DetailedError } from '../../../generic/errors.js';
47
+ import { LoggerError } from '../../errors.js';
48
+
49
+ import { toArray } from '../../../util/array/index.js';
45
50
 
46
51
  /**
47
52
  * Logger class for consistent logging
@@ -99,6 +104,7 @@ export default class Logger extends EventEmitter {
99
104
  *
100
105
  * @param {string} message - Log message
101
106
  * @param {*} [details] - Additional details
107
+ *
102
108
  * @returns {boolean} True if the log was emitted
103
109
  */
104
110
  info(message, details) {
@@ -110,6 +116,7 @@ export default class Logger extends EventEmitter {
110
116
  *
111
117
  * @param {string} message - Log message
112
118
  * @param {*} [details] - Additional details
119
+ *
113
120
  * @returns {boolean} True if the log was emitted
114
121
  */
115
122
  warn(message, details) {
@@ -119,12 +126,41 @@ export default class Logger extends EventEmitter {
119
126
  /**
120
127
  * Log an error message
121
128
  *
122
- * @param {string} message - Log message
123
- * @param {*} [details] - Additional details
129
+ * @param {Error|string} originalErrorOrMessage
130
+ * @param {Error} [originalError]
131
+ *
124
132
  * @returns {boolean} True if the log was emitted
125
133
  */
126
- error(message, details) {
127
- return this.#log(ERROR, message, details);
134
+ error(originalErrorOrMessage, originalError) {
135
+
136
+ if( originalErrorOrMessage instanceof Error )
137
+ {
138
+ // params: {error} originalErrorOrMessage
139
+ const loggerError = new LoggerError(originalErrorOrMessage);
140
+
141
+ const message = originalErrorOrMessage.message;
142
+
143
+ return this.#log(ERROR, message, loggerError);
144
+ }
145
+ else if( typeof originalErrorOrMessage === 'string' && originalError instanceof Error ) {
146
+ // params: {string} message, {error} originalError
147
+ const detailedError = new DetailedError(
148
+ originalErrorOrMessage,
149
+ null,
150
+ originalError
151
+ );
152
+
153
+ return this.#log(ERROR, detailedError.message, detailedError);
154
+ }
155
+ else {
156
+ // wrong params
157
+ const detailedError = new DetailedError(
158
+ 'Invalid parameters supplied to Logger.error',
159
+ toArray(arguments)
160
+ );
161
+
162
+ return this.#log(ERROR, detailedError.message, detailedError);
163
+ }
128
164
  }
129
165
 
130
166
  /**
@@ -132,7 +168,6 @@ export default class Logger extends EventEmitter {
132
168
  *
133
169
  * @param {string} namespace
134
170
  * Namespace of the context (needed for chaining contexts)
135
- *
136
171
  * @param {Object} additionalContext - Additional context data
137
172
  *
138
173
  * @returns {Logger} New logger instance with merged context
@@ -157,7 +192,7 @@ export default class Logger extends EventEmitter {
157
192
  * forwarded to this logger.
158
193
  *
159
194
  * @param {string} eventName
160
- * @param {import('../typedef.js').LogEventData} eventData
195
+ * @param {import('../../typedef.js').LogEventData} eventData
161
196
  */
162
197
  logFromEvent(eventName, eventData) {
163
198
  const level = eventData.level;
@@ -205,7 +240,7 @@ export default class Logger extends EventEmitter {
205
240
  /**
206
241
  * Internal event loggin method
207
242
  *
208
- * @param {import('../typedef.js').LogEvent} logEvent
243
+ * @param {import('../../typedef.js').LogEvent} logEvent
209
244
  */
210
245
  #logEvent(logEvent) {
211
246
  // Emit as both specific level event and generic 'log' event
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Test functions for generating various types of errors for logging demonstration
3
+ */
4
+ /**
5
+ * Simple error: division by zero (which creates NaN in JS, so we'll throw manually)
6
+ */
7
+ export function throwSimpleError(): number;
8
+ /**
9
+ * Simple error occurring in a sub function
10
+ */
11
+ export function throwErrorInSubFunction(): void;
12
+ /**
13
+ * Promise rejection in async function
14
+ */
15
+ export function throwPromiseRejection(): Promise<any>;
16
+ /**
17
+ * HkPromise timeout
18
+ */
19
+ export function throwHkPromiseTimeout(): Promise<any>;
20
+ /**
21
+ * HTTP request that fails
22
+ */
23
+ export function throwHttpException(): Promise<Response>;
24
+ /**
25
+ * Expect validation error
26
+ */
27
+ export function throwExpectError(): void;
28
+ /**
29
+ * Rethrow chain error
30
+ */
31
+ export function throwRethrowChainError(): void;
32
+ /**
33
+ * Raw valibot validation error (without expect wrapper)
34
+ */
35
+ export function throwRawValibotError(): any;
@@ -0,0 +1,137 @@
1
+ import { expect, rethrow } from '../../util/index.js';
2
+ import { HkPromise } from '../../generic/promises.js';
3
+ import { httpGet } from '../../network/http/index.js';
4
+ import { v } from '../../valibot/index.js';
5
+
6
+ /**
7
+ * Test functions for generating various types of errors for logging demonstration
8
+ */
9
+
10
+ /**
11
+ * Simple error: division by zero (which creates NaN in JS, so we'll throw manually)
12
+ */
13
+ export function throwSimpleError() {
14
+ const a = 10;
15
+ const b = 0;
16
+
17
+ if (b === 0) {
18
+ throw new Error('Division by zero is not allowed');
19
+ }
20
+
21
+ return a / b; // This won't be reached
22
+ }
23
+
24
+ /**
25
+ * Simple error occurring in a sub function
26
+ */
27
+ export function throwErrorInSubFunction() {
28
+ function deepFunction() {
29
+ function evenDeeperFunction() {
30
+ throw new Error('Error occurred in deeply nested function');
31
+ }
32
+
33
+ evenDeeperFunction();
34
+ }
35
+
36
+ function callDeepFunction() {
37
+ deepFunction();
38
+ }
39
+
40
+ callDeepFunction();
41
+ }
42
+
43
+ /**
44
+ * Promise rejection in async function
45
+ */
46
+ export async function throwPromiseRejection() {
47
+ // Create a promise that rejects after a short delay
48
+ const rejectedPromise = new Promise((resolve, reject) => {
49
+ setTimeout(() => {
50
+ reject(new Error('Promise was rejected after timeout'));
51
+ }, 100);
52
+ });
53
+
54
+ // Await the promise (will throw)
55
+ return await rejectedPromise;
56
+ }
57
+
58
+ /**
59
+ * HkPromise timeout
60
+ */
61
+ export async function throwHkPromiseTimeout() {
62
+ // Create an HkPromise that times out
63
+ const timeoutPromise = new HkPromise((resolve) => {
64
+ // Never resolve this promise to cause timeout
65
+ setTimeout(() => {
66
+ // This resolve will never be reached because timeout occurs first
67
+ resolve('This should not complete');
68
+ }, 2000);
69
+ });
70
+
71
+ // Set timeout of 500ms (will timeout before the 2000ms resolve)
72
+ timeoutPromise.setTimeout(500, 'HkPromise timeout after 500ms');
73
+
74
+ return await timeoutPromise;
75
+ }
76
+
77
+ /**
78
+ * HTTP request that fails
79
+ */
80
+ export async function throwHttpException() {
81
+ // Try to fetch with an invalid URL format
82
+ const response = await httpGet({
83
+ url: 'not-a-valid-url-format'
84
+ });
85
+ return response;
86
+ }
87
+
88
+ /**
89
+ * Expect validation error
90
+ */
91
+ export function throwExpectError() {
92
+ try {
93
+ // This will always fail and trigger an expect error
94
+ expect.string(123);
95
+ } catch (e) {
96
+ rethrow('throwExpectError failed', e);
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Rethrow chain error
102
+ */
103
+ export function throwRethrowChainError() {
104
+ function level1Function() {
105
+ try {
106
+ level2Function();
107
+ } catch (e) {
108
+ rethrow('Error in level1Function', e);
109
+ }
110
+ }
111
+
112
+ function level2Function() {
113
+ try {
114
+ level3Function();
115
+ } catch (e) {
116
+ rethrow('Error in level2Function', e);
117
+ }
118
+ }
119
+
120
+ function level3Function() {
121
+ throw new Error('Original error at deepest level');
122
+ }
123
+
124
+ level1Function();
125
+ }
126
+
127
+ /**
128
+ * Raw valibot validation error (without expect wrapper)
129
+ */
130
+ export function throwRawValibotError() {
131
+ // This calls valibot.parse directly, not through expect_*
132
+ const schema = v.string();
133
+ const invalidValue = 456;
134
+
135
+ // This will throw a ValiError directly from our valibotParser wrapper
136
+ return v.parse(schema, invalidValue);
137
+ }
@@ -50,7 +50,7 @@ export default class IndexedDbCache {
50
50
  * @private
51
51
  */
52
52
  private cleanupState;
53
- postponeCleanupTimer: number;
53
+ postponeCleanupTimer: NodeJS.Timeout;
54
54
  /**
55
55
  * Initialize the database connection
56
56
  *
@@ -28,6 +28,7 @@
28
28
  * @property {number|null} expires - Expiration timestamp (null if no expiration)
29
29
  * @property {string|null} etag - ETag header if present
30
30
  * @property {string|null} lastModified - Last-Modified header if present
31
+ * @property {string|null} cacheVersion - Cache version identifier
31
32
  */
32
33
  /**
33
34
  * In-memory response cache implementation
@@ -103,4 +104,8 @@ export type CacheEntry = {
103
104
  * - Last-Modified header if present
104
105
  */
105
106
  lastModified: string | null;
107
+ /**
108
+ * - Cache version identifier
109
+ */
110
+ cacheVersion: string | null;
106
111
  };
@@ -29,6 +29,7 @@
29
29
  * @property {number|null} expires - Expiration timestamp (null if no expiration)
30
30
  * @property {string|null} etag - ETag header if present
31
31
  * @property {string|null} lastModified - Last-Modified header if present
32
+ * @property {string|null} cacheVersion - Cache version identifier
32
33
  */
33
34
 
34
35
  /**
@@ -75,7 +76,8 @@ export default class MemoryResponseCache {
75
76
  timestamp: entry.timestamp,
76
77
  expires: entry.expires,
77
78
  etag: entry.etag,
78
- lastModified: entry.lastModified
79
+ lastModified: entry.lastModified,
80
+ cacheVersion: entry.cacheVersion
79
81
  };
80
82
  }
81
83
 
@@ -104,7 +106,8 @@ export default class MemoryResponseCache {
104
106
  lastAccessed: now,
105
107
  expires,
106
108
  etag: response.headers.get('ETag'),
107
- lastModified: response.headers.get('Last-Modified')
109
+ lastModified: response.headers.get('Last-Modified'),
110
+ cacheVersion: metadata.cacheVersion || null
108
111
  });
109
112
  }
110
113
 
@@ -0,0 +1,2 @@
1
+ export * from "./errors/api.js";
2
+ export * from "./errors/http.js";
@@ -0,0 +1,2 @@
1
+ export * from './errors/api.js';
2
+ export * from './errors/http.js';
@@ -135,7 +135,7 @@ export async function getCachedResponse(cacheKeyParams) {
135
135
  * @param {string} type Type of storage ('indexed-db', 'memory')
136
136
  * @param {Object} options Options for the storage adapter
137
137
  *
138
- * @returns {import('../../classes/cache').CacheStorage}
138
+ * @returns {import('../cache.js').CacheStorage}
139
139
  */
140
140
  function createCacheStorage(type = 'indexed-db', options = {}) {
141
141
  switch (type) {
@@ -13,6 +13,6 @@
13
13
  *
14
14
  * @param {object} response
15
15
  *
16
- * @returns {Error} error
16
+ * @returns {Promise<Error>} error
17
17
  */
18
- export function getErrorFromResponse(response: object): Error;
18
+ export function getErrorFromResponse(response: object): Promise<Error>;
@@ -1,4 +1,5 @@
1
1
  import * as expect from '../../util/expect/index.js';
2
+ import { DetailedError } from '../../generic/errors.js';
2
3
 
3
4
  import { CONTENT_TYPE } from '../../constants/http/index.js';
4
5
 
@@ -19,7 +20,7 @@ import { APPLICATION_JSON } from '../../constants/mime/index.js';
19
20
  *
20
21
  * @param {object} response
21
22
  *
22
- * @returns {Error} error
23
+ * @returns {Promise<Error>} error
23
24
  */
24
25
  export async function getErrorFromResponse(response) {
25
26
  expect.object(response);
@@ -77,21 +78,12 @@ export async function getErrorFromResponse(response) {
77
78
  }
78
79
  }
79
80
  } else {
80
- const tmp = await response.text();
81
-
82
- if (tmp.length) {
83
- message = tmp;
84
- } else {
85
- message = response.statusText;
86
- }
81
+ // For non-JSON responses, always use status text (avoid HTML pages)
82
+ message = response.statusText || `HTTP ${response.status}`;
87
83
  }
88
84
  // console.log( "message", message );
89
85
 
90
- const error = new Error(message);
91
-
92
- if (details) {
93
- error.details = details;
94
- }
86
+ const error = new DetailedError(message, details);
95
87
 
96
88
  return error;
97
89
  }
@@ -11,7 +11,7 @@ import {
11
11
  import { APPLICATION_JSON } from '../../constants/mime/application.js';
12
12
  import { CONTENT_TYPE } from '../../constants/http/headers.js';
13
13
 
14
- import { AbortError, TimeoutError } from '../../errors/api.js';
14
+ import { AbortError, TimeoutError } from '../errors/api.js';
15
15
 
16
16
  import * as expect from '../../util/expect/index.js';
17
17
 
@@ -2,7 +2,7 @@ import { METHOD_GET, METHOD_POST } from '../../constants/http/methods.js';
2
2
 
3
3
  import { APPLICATION_JSON } from '../../constants/mime/application.js';
4
4
  import { CONTENT_TYPE } from '../../constants/http/headers.js';
5
- import { ResponseError } from '../../errors/index.js';
5
+ import { ResponseError } from '../errors.js';
6
6
 
7
7
  import * as expect from '../../util/expect/index.js';
8
8
 
@@ -1,4 +1,4 @@
1
- import { ResponseError, HttpError } from '../../errors/index.js';
1
+ import { ResponseError, HttpError } from '../errors.js';
2
2
  import * as expect from '../../util/expect/index.js';
3
3
  import { toURL } from './url.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { TypeOrValueError } from '../../errors/index.js';
1
+ import { TypeOrValueError } from '../../generic/errors.js';
2
2
 
3
3
  /**
4
4
  * Returns an URL instance
@@ -44,22 +44,29 @@ Loads responsive image variants, automatically selecting the best size for conta
44
44
  ```javascript
45
45
  import { ImageVariantsLoader } from '$lib/network/loaders.js';
46
46
 
47
- const loader = new ImageVariantsLoader();
48
-
49
- // Load responsive variants
47
+ // Responsive image variants (array of ImageMeta)
50
48
  const imageSource = [
51
49
  { src: '/image-400.jpg', width: 400, height: 300 },
52
50
  { src: '/image-800.jpg', width: 800, height: 600 },
53
51
  { src: '/image-1200.jpg', width: 1200, height: 900 }
54
52
  ];
55
53
 
56
- await loader.load({
57
- imageSource,
54
+ const loader = new ImageVariantsLoader(imageSource, {
55
+ devicePixelRatio: window.devicePixelRatio
56
+ });
57
+
58
+ // Set optimal image variant for container
59
+ loader.setOptimalImageVariant({
58
60
  containerWidth: 600,
59
61
  containerHeight: 400,
60
- fit: 'cover', // or 'contain', 'fill'
61
- devicePixelRatio: window.devicePixelRatio
62
+ fit: 'cover' // or 'contain', 'fill'
62
63
  });
64
+
65
+ // Access the selected variant and loader
66
+ if (loader.loaded) {
67
+ const objectURL = loader.getObjectURL();
68
+ // Use objectURL in img src
69
+ }
63
70
  ```
64
71
 
65
72
  ### ImageScene
@@ -1,7 +1,8 @@
1
1
  import * as expect from '../../../util/expect/index.js';
2
2
 
3
+ import { LoadingStateMachine } from '../../../state/classes.js';
4
+
3
5
  import {
4
- LoadingStateMachine,
5
6
  STATE_INITIAL,
6
7
  STATE_LOADING,
7
8
  STATE_UNLOADING,
@@ -10,7 +11,7 @@ import {
10
11
  STATE_ERROR,
11
12
  LOAD,
12
13
  LOADED
13
- } from '../../../classes/svelte/loading-state-machine/index.js';
14
+ } from '../../../state/classes/loading-state-machine/constants.js';
14
15
 
15
16
  import AudioLoader from './AudioLoader.svelte.js';
16
17
 
@@ -5,9 +5,9 @@
5
5
  */
6
6
  export default class ImageLoader extends NetworkLoader {
7
7
  /**
8
- * @param {import('../typedef.js').ImageSource} imageSource
8
+ * @param {import('../../../config/typedef.js').ImageSource} imageSource
9
9
  */
10
- constructor(imageSource: import("../typedef.js").ImageSource);
10
+ constructor(imageSource: import("../../../config/typedef.js").ImageSource);
11
11
  get imageMeta(): import("./typedef.js").ImageMeta;
12
12
  get url(): string;
13
13
  #private;
@@ -16,7 +16,7 @@ export default class ImageLoader extends NetworkLoader {
16
16
  #imageMeta;
17
17
 
18
18
  /**
19
- * @param {import('../typedef.js').ImageSource} imageSource
19
+ * @param {import('../../../config/typedef.js').ImageSource} imageSource
20
20
  */
21
21
  constructor(imageSource) {
22
22
  const imageMeta = toSingleImageMeta(imageSource);
@@ -17,11 +17,11 @@ export default class ImageScene {
17
17
  *
18
18
  * @param {object} _
19
19
  * @param {string} _.label
20
- * @param {import('../typedef.js').ImageSource} _.imageSource
20
+ * @param {import('../../../config/typedef.js').ImageSource} _.imageSource
21
21
  */
22
22
  defineImage({ label, imageSource }: {
23
23
  label: string;
24
- imageSource: import("../typedef.js").ImageSource;
24
+ imageSource: import("../../../config/typedef.js").ImageSource;
25
25
  }): void;
26
26
  /**
27
27
  * Start loading all image sources