@omerdlw/base-framework 1.0.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 (383) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/dist/atoms/button.d.ts +11 -0
  4. package/dist/atoms/button.d.ts.map +1 -0
  5. package/dist/atoms/icon.d.ts +15 -0
  6. package/dist/atoms/icon.d.ts.map +1 -0
  7. package/dist/atoms/index.d.ts +6 -0
  8. package/dist/atoms/index.d.ts.map +1 -0
  9. package/dist/atoms/index.js +169 -0
  10. package/dist/atoms/index.js.map +1 -0
  11. package/dist/atoms/spinner.d.ts +9 -0
  12. package/dist/atoms/spinner.d.ts.map +1 -0
  13. package/dist/atoms/tooltip.d.ts +18 -0
  14. package/dist/atoms/tooltip.d.ts.map +1 -0
  15. package/dist/error/boundary.d.ts +14 -0
  16. package/dist/error/boundary.d.ts.map +1 -0
  17. package/dist/error/constants.d.ts +18 -0
  18. package/dist/error/constants.d.ts.map +1 -0
  19. package/dist/error/index.d.ts +9 -0
  20. package/dist/error/index.d.ts.map +1 -0
  21. package/dist/error/index.js +688 -0
  22. package/dist/error/index.js.map +1 -0
  23. package/dist/error/listener.d.ts +2 -0
  24. package/dist/error/listener.d.ts.map +1 -0
  25. package/dist/error/reporter.d.ts +32 -0
  26. package/dist/error/reporter.d.ts.map +1 -0
  27. package/dist/error/theme.d.ts +3 -0
  28. package/dist/error/theme.d.ts.map +1 -0
  29. package/dist/error/types.d.ts +91 -0
  30. package/dist/error/types.d.ts.map +1 -0
  31. package/dist/error/utils.d.ts +21 -0
  32. package/dist/error/utils.d.ts.map +1 -0
  33. package/dist/events.d.ts +51 -0
  34. package/dist/events.d.ts.map +1 -0
  35. package/dist/events.js +88 -0
  36. package/dist/events.js.map +1 -0
  37. package/dist/hooks/index.d.ts +17 -0
  38. package/dist/hooks/index.d.ts.map +1 -0
  39. package/dist/hooks/index.js +804 -0
  40. package/dist/hooks/index.js.map +1 -0
  41. package/dist/hooks/types.d.ts +58 -0
  42. package/dist/hooks/types.d.ts.map +1 -0
  43. package/dist/hooks/use-async-action.d.ts +3 -0
  44. package/dist/hooks/use-async-action.d.ts.map +1 -0
  45. package/dist/hooks/use-click-outside.d.ts +3 -0
  46. package/dist/hooks/use-click-outside.d.ts.map +1 -0
  47. package/dist/hooks/use-controllable-state.d.ts +3 -0
  48. package/dist/hooks/use-controllable-state.d.ts.map +1 -0
  49. package/dist/hooks/use-debounce.d.ts +2 -0
  50. package/dist/hooks/use-debounce.d.ts.map +1 -0
  51. package/dist/hooks/use-fullscreen-state.d.ts +4 -0
  52. package/dist/hooks/use-fullscreen-state.d.ts.map +1 -0
  53. package/dist/hooks/use-global-event.d.ts +7 -0
  54. package/dist/hooks/use-global-event.d.ts.map +1 -0
  55. package/dist/hooks/use-hotkey.d.ts +4 -0
  56. package/dist/hooks/use-hotkey.d.ts.map +1 -0
  57. package/dist/hooks/use-intersection-observer.d.ts +4 -0
  58. package/dist/hooks/use-intersection-observer.d.ts.map +1 -0
  59. package/dist/hooks/use-isomorphic-layout-effect.d.ts +3 -0
  60. package/dist/hooks/use-isomorphic-layout-effect.d.ts.map +1 -0
  61. package/dist/hooks/use-media-query.d.ts +2 -0
  62. package/dist/hooks/use-media-query.d.ts.map +1 -0
  63. package/dist/hooks/use-mounted.d.ts +2 -0
  64. package/dist/hooks/use-mounted.d.ts.map +1 -0
  65. package/dist/hooks/use-required-context.d.ts +3 -0
  66. package/dist/hooks/use-required-context.d.ts.map +1 -0
  67. package/dist/hooks/use-server-action.d.ts +4 -0
  68. package/dist/hooks/use-server-action.d.ts.map +1 -0
  69. package/dist/hooks/use-storage-state.d.ts +5 -0
  70. package/dist/hooks/use-storage-state.d.ts.map +1 -0
  71. package/dist/hooks/use-store.d.ts +3 -0
  72. package/dist/hooks/use-store.d.ts.map +1 -0
  73. package/dist/index.d.ts +12 -0
  74. package/dist/index.d.ts.map +1 -0
  75. package/dist/index.js +20415 -0
  76. package/dist/index.js.map +1 -0
  77. package/dist/kernel/adapters.d.ts +5 -0
  78. package/dist/kernel/adapters.d.ts.map +1 -0
  79. package/dist/kernel/compose.d.ts +15 -0
  80. package/dist/kernel/compose.d.ts.map +1 -0
  81. package/dist/kernel/constants.d.ts +12 -0
  82. package/dist/kernel/constants.d.ts.map +1 -0
  83. package/dist/kernel/context-registry.d.ts +3 -0
  84. package/dist/kernel/context-registry.d.ts.map +1 -0
  85. package/dist/kernel/handlers.d.ts +3 -0
  86. package/dist/kernel/handlers.d.ts.map +1 -0
  87. package/dist/kernel/hooks.d.ts +7 -0
  88. package/dist/kernel/hooks.d.ts.map +1 -0
  89. package/dist/kernel/index.d.ts +14 -0
  90. package/dist/kernel/index.d.ts.map +1 -0
  91. package/dist/kernel/index.js +2109 -0
  92. package/dist/kernel/index.js.map +1 -0
  93. package/dist/kernel/installed.d.ts +21 -0
  94. package/dist/kernel/installed.d.ts.map +1 -0
  95. package/dist/kernel/module.d.ts +32 -0
  96. package/dist/kernel/module.d.ts.map +1 -0
  97. package/dist/kernel/operations.d.ts +21 -0
  98. package/dist/kernel/operations.d.ts.map +1 -0
  99. package/dist/kernel/page-controller.d.ts +8 -0
  100. package/dist/kernel/page-controller.d.ts.map +1 -0
  101. package/dist/kernel/provider.d.ts +18 -0
  102. package/dist/kernel/provider.d.ts.map +1 -0
  103. package/dist/kernel/runtime.d.ts +30 -0
  104. package/dist/kernel/runtime.d.ts.map +1 -0
  105. package/dist/kernel/schema.d.ts +13 -0
  106. package/dist/kernel/schema.d.ts.map +1 -0
  107. package/dist/kernel/store.d.ts +4 -0
  108. package/dist/kernel/store.d.ts.map +1 -0
  109. package/dist/kernel/types.d.ts +233 -0
  110. package/dist/kernel/types.d.ts.map +1 -0
  111. package/dist/kernel/utils.d.ts +20 -0
  112. package/dist/kernel/utils.d.ts.map +1 -0
  113. package/dist/modules/ambient/constants.d.ts +23 -0
  114. package/dist/modules/ambient/constants.d.ts.map +1 -0
  115. package/dist/modules/ambient/context.d.ts +10 -0
  116. package/dist/modules/ambient/context.d.ts.map +1 -0
  117. package/dist/modules/ambient/index.d.ts +6 -0
  118. package/dist/modules/ambient/index.d.ts.map +1 -0
  119. package/dist/modules/ambient/index.js +896 -0
  120. package/dist/modules/ambient/index.js.map +1 -0
  121. package/dist/modules/ambient/module.d.ts +12 -0
  122. package/dist/modules/ambient/module.d.ts.map +1 -0
  123. package/dist/modules/ambient/types.d.ts +84 -0
  124. package/dist/modules/ambient/types.d.ts.map +1 -0
  125. package/dist/modules/ambient/utils.d.ts +18 -0
  126. package/dist/modules/ambient/utils.d.ts.map +1 -0
  127. package/dist/modules/background/constants.d.ts +12 -0
  128. package/dist/modules/background/constants.d.ts.map +1 -0
  129. package/dist/modules/background/context.d.ts +13 -0
  130. package/dist/modules/background/context.d.ts.map +1 -0
  131. package/dist/modules/background/hooks.d.ts +119 -0
  132. package/dist/modules/background/hooks.d.ts.map +1 -0
  133. package/dist/modules/background/index.d.ts +7 -0
  134. package/dist/modules/background/index.d.ts.map +1 -0
  135. package/dist/modules/background/index.js +3195 -0
  136. package/dist/modules/background/index.js.map +1 -0
  137. package/dist/modules/background/module.d.ts +14 -0
  138. package/dist/modules/background/module.d.ts.map +1 -0
  139. package/dist/modules/background/motion.d.ts +13 -0
  140. package/dist/modules/background/motion.d.ts.map +1 -0
  141. package/dist/modules/background/overlay.d.ts +49 -0
  142. package/dist/modules/background/overlay.d.ts.map +1 -0
  143. package/dist/modules/background/types.d.ts +153 -0
  144. package/dist/modules/background/types.d.ts.map +1 -0
  145. package/dist/modules/background/utils.d.ts +56 -0
  146. package/dist/modules/background/utils.d.ts.map +1 -0
  147. package/dist/modules/background/youtube/iframe.d.ts +52 -0
  148. package/dist/modules/background/youtube/iframe.d.ts.map +1 -0
  149. package/dist/modules/background/youtube/parse.d.ts +17 -0
  150. package/dist/modules/background/youtube/parse.d.ts.map +1 -0
  151. package/dist/modules/context-menu/constants.d.ts +8 -0
  152. package/dist/modules/context-menu/constants.d.ts.map +1 -0
  153. package/dist/modules/context-menu/context.d.ts +16 -0
  154. package/dist/modules/context-menu/context.d.ts.map +1 -0
  155. package/dist/modules/context-menu/hooks.d.ts +31 -0
  156. package/dist/modules/context-menu/hooks.d.ts.map +1 -0
  157. package/dist/modules/context-menu/index.d.ts +6 -0
  158. package/dist/modules/context-menu/index.d.ts.map +1 -0
  159. package/dist/modules/context-menu/index.js +2008 -0
  160. package/dist/modules/context-menu/index.js.map +1 -0
  161. package/dist/modules/context-menu/module.d.ts +12 -0
  162. package/dist/modules/context-menu/module.d.ts.map +1 -0
  163. package/dist/modules/context-menu/motion.d.ts +9 -0
  164. package/dist/modules/context-menu/motion.d.ts.map +1 -0
  165. package/dist/modules/context-menu/overlay.d.ts +15 -0
  166. package/dist/modules/context-menu/overlay.d.ts.map +1 -0
  167. package/dist/modules/context-menu/resolver.d.ts +7 -0
  168. package/dist/modules/context-menu/resolver.d.ts.map +1 -0
  169. package/dist/modules/context-menu/state.d.ts +4 -0
  170. package/dist/modules/context-menu/state.d.ts.map +1 -0
  171. package/dist/modules/context-menu/types.d.ts +171 -0
  172. package/dist/modules/context-menu/types.d.ts.map +1 -0
  173. package/dist/modules/context-menu/utils.d.ts +16 -0
  174. package/dist/modules/context-menu/utils.d.ts.map +1 -0
  175. package/dist/modules/controls/constants.d.ts +7 -0
  176. package/dist/modules/controls/constants.d.ts.map +1 -0
  177. package/dist/modules/controls/hooks.d.ts +15 -0
  178. package/dist/modules/controls/hooks.d.ts.map +1 -0
  179. package/dist/modules/controls/index.d.ts +6 -0
  180. package/dist/modules/controls/index.d.ts.map +1 -0
  181. package/dist/modules/controls/index.js +1242 -0
  182. package/dist/modules/controls/index.js.map +1 -0
  183. package/dist/modules/controls/module.d.ts +12 -0
  184. package/dist/modules/controls/module.d.ts.map +1 -0
  185. package/dist/modules/controls/overlay.d.ts +2 -0
  186. package/dist/modules/controls/overlay.d.ts.map +1 -0
  187. package/dist/modules/controls/types.d.ts +86 -0
  188. package/dist/modules/controls/types.d.ts.map +1 -0
  189. package/dist/modules/controls/utils.d.ts +9 -0
  190. package/dist/modules/controls/utils.d.ts.map +1 -0
  191. package/dist/modules/dock/cards.d.ts +1035 -0
  192. package/dist/modules/dock/cards.d.ts.map +1 -0
  193. package/dist/modules/dock/constants.d.ts +157 -0
  194. package/dist/modules/dock/constants.d.ts.map +1 -0
  195. package/dist/modules/dock/context.d.ts +26 -0
  196. package/dist/modules/dock/context.d.ts.map +1 -0
  197. package/dist/modules/dock/hooks.d.ts +957 -0
  198. package/dist/modules/dock/hooks.d.ts.map +1 -0
  199. package/dist/modules/dock/hud.d.ts +43 -0
  200. package/dist/modules/dock/hud.d.ts.map +1 -0
  201. package/dist/modules/dock/index.d.ts +27 -0
  202. package/dist/modules/dock/index.d.ts.map +1 -0
  203. package/dist/modules/dock/index.js +12111 -0
  204. package/dist/modules/dock/index.js.map +1 -0
  205. package/dist/modules/dock/module.d.ts +71 -0
  206. package/dist/modules/dock/module.d.ts.map +1 -0
  207. package/dist/modules/dock/motion.d.ts +986 -0
  208. package/dist/modules/dock/motion.d.ts.map +1 -0
  209. package/dist/modules/dock/overlay.d.ts +79 -0
  210. package/dist/modules/dock/overlay.d.ts.map +1 -0
  211. package/dist/modules/dock/provider.d.ts +3 -0
  212. package/dist/modules/dock/provider.d.ts.map +1 -0
  213. package/dist/modules/dock/routing/breadcrumbs.d.ts +43 -0
  214. package/dist/modules/dock/routing/breadcrumbs.d.ts.map +1 -0
  215. package/dist/modules/dock/routing/continuity.d.ts +19 -0
  216. package/dist/modules/dock/routing/continuity.d.ts.map +1 -0
  217. package/dist/modules/dock/routing/guards.d.ts +21 -0
  218. package/dist/modules/dock/routing/guards.d.ts.map +1 -0
  219. package/dist/modules/dock/routing/navigation.d.ts +37 -0
  220. package/dist/modules/dock/routing/navigation.d.ts.map +1 -0
  221. package/dist/modules/dock/routing/transactions.d.ts +21 -0
  222. package/dist/modules/dock/routing/transactions.d.ts.map +1 -0
  223. package/dist/modules/dock/runtime/commands.d.ts +18 -0
  224. package/dist/modules/dock/runtime/commands.d.ts.map +1 -0
  225. package/dist/modules/dock/runtime/display.d.ts +36 -0
  226. package/dist/modules/dock/runtime/display.d.ts.map +1 -0
  227. package/dist/modules/dock/runtime/dock.d.ts +123 -0
  228. package/dist/modules/dock/runtime/dock.d.ts.map +1 -0
  229. package/dist/modules/dock/state.d.ts +22 -0
  230. package/dist/modules/dock/state.d.ts.map +1 -0
  231. package/dist/modules/dock/status/events.d.ts +37 -0
  232. package/dist/modules/dock/status/events.d.ts.map +1 -0
  233. package/dist/modules/dock/status/hooks.d.ts +6 -0
  234. package/dist/modules/dock/status/hooks.d.ts.map +1 -0
  235. package/dist/modules/dock/status/model.d.ts +65 -0
  236. package/dist/modules/dock/status/model.d.ts.map +1 -0
  237. package/dist/modules/dock/surface/context.d.ts +43 -0
  238. package/dist/modules/dock/surface/context.d.ts.map +1 -0
  239. package/dist/modules/dock/surface/definition.d.ts +38 -0
  240. package/dist/modules/dock/surface/definition.d.ts.map +1 -0
  241. package/dist/modules/dock/surface/hooks.d.ts +123 -0
  242. package/dist/modules/dock/surface/hooks.d.ts.map +1 -0
  243. package/dist/modules/dock/surface/machine.d.ts +75 -0
  244. package/dist/modules/dock/surface/machine.d.ts.map +1 -0
  245. package/dist/modules/dock/surface/stack.d.ts +38 -0
  246. package/dist/modules/dock/surface/stack.d.ts.map +1 -0
  247. package/dist/modules/dock/surface/view-model.d.ts +3 -0
  248. package/dist/modules/dock/surface/view-model.d.ts.map +1 -0
  249. package/dist/modules/dock/types.d.ts +1158 -0
  250. package/dist/modules/dock/types.d.ts.map +1 -0
  251. package/dist/modules/dock/utils.d.ts +93 -0
  252. package/dist/modules/dock/utils.d.ts.map +1 -0
  253. package/dist/modules/index.d.ts +12 -0
  254. package/dist/modules/index.d.ts.map +1 -0
  255. package/dist/modules/index.js +18020 -0
  256. package/dist/modules/index.js.map +1 -0
  257. package/dist/modules/loading/constants.d.ts +5 -0
  258. package/dist/modules/loading/constants.d.ts.map +1 -0
  259. package/dist/modules/loading/context.d.ts +13 -0
  260. package/dist/modules/loading/context.d.ts.map +1 -0
  261. package/dist/modules/loading/hooks.d.ts +6 -0
  262. package/dist/modules/loading/hooks.d.ts.map +1 -0
  263. package/dist/modules/loading/index.d.ts +7 -0
  264. package/dist/modules/loading/index.d.ts.map +1 -0
  265. package/dist/modules/loading/index.js +1256 -0
  266. package/dist/modules/loading/index.js.map +1 -0
  267. package/dist/modules/loading/module.d.ts +14 -0
  268. package/dist/modules/loading/module.d.ts.map +1 -0
  269. package/dist/modules/loading/overlay.d.ts +2 -0
  270. package/dist/modules/loading/overlay.d.ts.map +1 -0
  271. package/dist/modules/loading/types.d.ts +47 -0
  272. package/dist/modules/loading/types.d.ts.map +1 -0
  273. package/dist/modules/loading/utils.d.ts +4 -0
  274. package/dist/modules/loading/utils.d.ts.map +1 -0
  275. package/dist/modules/media/constants.d.ts +7 -0
  276. package/dist/modules/media/constants.d.ts.map +1 -0
  277. package/dist/modules/media/context.d.ts +6 -0
  278. package/dist/modules/media/context.d.ts.map +1 -0
  279. package/dist/modules/media/hooks.d.ts +3 -0
  280. package/dist/modules/media/hooks.d.ts.map +1 -0
  281. package/dist/modules/media/index.d.ts +8 -0
  282. package/dist/modules/media/index.d.ts.map +1 -0
  283. package/dist/modules/media/index.js +728 -0
  284. package/dist/modules/media/index.js.map +1 -0
  285. package/dist/modules/media/module.d.ts +11 -0
  286. package/dist/modules/media/module.d.ts.map +1 -0
  287. package/dist/modules/media/overlay.d.ts +9 -0
  288. package/dist/modules/media/overlay.d.ts.map +1 -0
  289. package/dist/modules/media/types.d.ts +77 -0
  290. package/dist/modules/media/types.d.ts.map +1 -0
  291. package/dist/modules/media/utils.d.ts +17 -0
  292. package/dist/modules/media/utils.d.ts.map +1 -0
  293. package/dist/modules/modal/constants.d.ts +20 -0
  294. package/dist/modules/modal/constants.d.ts.map +1 -0
  295. package/dist/modules/modal/context.d.ts +20 -0
  296. package/dist/modules/modal/context.d.ts.map +1 -0
  297. package/dist/modules/modal/hooks.d.ts +41 -0
  298. package/dist/modules/modal/hooks.d.ts.map +1 -0
  299. package/dist/modules/modal/index.d.ts +7 -0
  300. package/dist/modules/modal/index.d.ts.map +1 -0
  301. package/dist/modules/modal/index.js +2672 -0
  302. package/dist/modules/modal/index.js.map +1 -0
  303. package/dist/modules/modal/module.d.ts +12 -0
  304. package/dist/modules/modal/module.d.ts.map +1 -0
  305. package/dist/modules/modal/motion.d.ts +16 -0
  306. package/dist/modules/modal/motion.d.ts.map +1 -0
  307. package/dist/modules/modal/overlay.d.ts +4 -0
  308. package/dist/modules/modal/overlay.d.ts.map +1 -0
  309. package/dist/modules/modal/state.d.ts +4 -0
  310. package/dist/modules/modal/state.d.ts.map +1 -0
  311. package/dist/modules/modal/types.d.ts +109 -0
  312. package/dist/modules/modal/types.d.ts.map +1 -0
  313. package/dist/modules/modal/utils.d.ts +31 -0
  314. package/dist/modules/modal/utils.d.ts.map +1 -0
  315. package/dist/modules/notification/constants.d.ts +9 -0
  316. package/dist/modules/notification/constants.d.ts.map +1 -0
  317. package/dist/modules/notification/context.d.ts +7 -0
  318. package/dist/modules/notification/context.d.ts.map +1 -0
  319. package/dist/modules/notification/hooks.d.ts +10 -0
  320. package/dist/modules/notification/hooks.d.ts.map +1 -0
  321. package/dist/modules/notification/index.d.ts +7 -0
  322. package/dist/modules/notification/index.d.ts.map +1 -0
  323. package/dist/modules/notification/index.js +905 -0
  324. package/dist/modules/notification/index.js.map +1 -0
  325. package/dist/modules/notification/module.d.ts +11 -0
  326. package/dist/modules/notification/module.d.ts.map +1 -0
  327. package/dist/modules/notification/motion.d.ts +15 -0
  328. package/dist/modules/notification/motion.d.ts.map +1 -0
  329. package/dist/modules/notification/overlay.d.ts +3 -0
  330. package/dist/modules/notification/overlay.d.ts.map +1 -0
  331. package/dist/modules/notification/types.d.ts +57 -0
  332. package/dist/modules/notification/types.d.ts.map +1 -0
  333. package/dist/modules/notification/utils.d.ts +9 -0
  334. package/dist/modules/notification/utils.d.ts.map +1 -0
  335. package/dist/modules/theme.d.ts +3 -0
  336. package/dist/modules/theme.d.ts.map +1 -0
  337. package/dist/provider.d.ts +23 -0
  338. package/dist/provider.d.ts.map +1 -0
  339. package/dist/provider.js +1973 -0
  340. package/dist/provider.js.map +1 -0
  341. package/dist/result.d.ts +50 -0
  342. package/dist/result.d.ts.map +1 -0
  343. package/dist/result.js +163 -0
  344. package/dist/result.js.map +1 -0
  345. package/dist/theme.d.ts +25 -0
  346. package/dist/theme.d.ts.map +1 -0
  347. package/dist/theme.js +44 -0
  348. package/dist/theme.js.map +1 -0
  349. package/dist/tokens/index.d.ts +3 -0
  350. package/dist/tokens/index.d.ts.map +1 -0
  351. package/dist/tokens/index.js +325 -0
  352. package/dist/tokens/index.js.map +1 -0
  353. package/dist/tokens/motion.d.ts +315 -0
  354. package/dist/tokens/motion.d.ts.map +1 -0
  355. package/dist/tokens/tokens.d.ts +34 -0
  356. package/dist/tokens/tokens.d.ts.map +1 -0
  357. package/dist/utils/cn.d.ts +3 -0
  358. package/dist/utils/cn.d.ts.map +1 -0
  359. package/dist/utils/dom.d.ts +5 -0
  360. package/dist/utils/dom.d.ts.map +1 -0
  361. package/dist/utils/index.d.ts +16 -0
  362. package/dist/utils/index.d.ts.map +1 -0
  363. package/dist/utils/index.js +485 -0
  364. package/dist/utils/index.js.map +1 -0
  365. package/dist/utils/json.d.ts +3 -0
  366. package/dist/utils/json.d.ts.map +1 -0
  367. package/dist/utils/number.d.ts +4 -0
  368. package/dist/utils/number.d.ts.map +1 -0
  369. package/dist/utils/object.d.ts +7 -0
  370. package/dist/utils/object.d.ts.map +1 -0
  371. package/dist/utils/report.d.ts +5 -0
  372. package/dist/utils/report.d.ts.map +1 -0
  373. package/dist/utils/scheduler.d.ts +34 -0
  374. package/dist/utils/scheduler.d.ts.map +1 -0
  375. package/dist/utils/store.d.ts +11 -0
  376. package/dist/utils/store.d.ts.map +1 -0
  377. package/dist/utils/string.d.ts +8 -0
  378. package/dist/utils/string.d.ts.map +1 -0
  379. package/dist/utils/timing.d.ts +8 -0
  380. package/dist/utils/timing.d.ts.map +1 -0
  381. package/dist/utils/user-message.d.ts +20 -0
  382. package/dist/utils/user-message.d.ts.map +1 -0
  383. package/package.json +113 -0
@@ -0,0 +1,905 @@
1
+ "use client";
2
+ import { clsx } from 'clsx';
3
+ import { twMerge } from 'tailwind-merge';
4
+ import { createContext, useState, useRef, useCallback, useEffect, useMemo, use, useSyncExternalStore, useLayoutEffect, useContext } from 'react';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+ import 'next/navigation';
7
+ import { createPortal } from 'react-dom';
8
+ import { AnimatePresence, motion } from 'motion/react';
9
+
10
+ function cn(...inputs) {
11
+ return twMerge(clsx(inputs));
12
+ }
13
+
14
+ // src/utils/dom.ts
15
+ var isBrowser = typeof window !== "undefined";
16
+
17
+ // src/utils/object.ts
18
+ function isObject(value) {
19
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
20
+ }
21
+ function report(scope, error, level = "error") {
22
+ if (process.env.NODE_ENV === "production" && typeof window !== "undefined") {
23
+ return;
24
+ }
25
+ console[level](`[${scope}]`, error);
26
+ }
27
+
28
+ // src/utils/user-message.ts
29
+ var USER_MESSAGES = Object.freeze({
30
+ generic: "Something went wrong. Please try again",
31
+ network: "You appear to be offline. Check your connection and try again",
32
+ timeout: "That took too long. Please try again",
33
+ unauthorized: "Your session has expired. Please sign in again",
34
+ forbidden: "You don't have permission to do that",
35
+ notFound: "We couldn't find what you were looking for",
36
+ rateLimited: "Too many attempts. Please wait a moment and try again",
37
+ server: "We're having trouble on our end. Please try again in a moment"
38
+ });
39
+ var UserError = class extends Error {
40
+ status;
41
+ constructor(message, status) {
42
+ super(message);
43
+ this.name = "UserError";
44
+ this.status = status;
45
+ }
46
+ };
47
+ var NETWORK_FAILURE = /failed to fetch|network|load failed|fetch failed/i;
48
+ function readField(source, field, type) {
49
+ const value = source?.[field];
50
+ return typeof value === type ? value : void 0;
51
+ }
52
+ function readPayloadMessage(error) {
53
+ const payload = error?.payload;
54
+ const message = readField(payload, "error", "string")?.trim();
55
+ return message || void 0;
56
+ }
57
+ function toUserMessage(error, { codes, fallback = USER_MESSAGES.generic } = {}) {
58
+ if (typeof error === "string") return error.trim() || fallback;
59
+ if (!error || typeof error !== "object") return fallback;
60
+ if (error instanceof UserError) {
61
+ if (error.status === 401) return USER_MESSAGES.unauthorized;
62
+ return error.message || fallback;
63
+ }
64
+ if (error.name === "AbortError") return fallback;
65
+ const code = readField(error, "code", "string");
66
+ if (code && codes?.[code]) return codes[code];
67
+ const status = readField(error, "status", "number");
68
+ if (status === 401) return USER_MESSAGES.unauthorized;
69
+ if (status === 429) return USER_MESSAGES.rateLimited;
70
+ if (status === 408 || status === 504) return USER_MESSAGES.timeout;
71
+ if (status !== void 0 && status >= 500) return USER_MESSAGES.server;
72
+ if (status !== void 0 && status >= 400) {
73
+ const authored = readPayloadMessage(error);
74
+ if (authored) return authored;
75
+ if (status === 403) return USER_MESSAGES.forbidden;
76
+ if (status === 404) return USER_MESSAGES.notFound;
77
+ return fallback;
78
+ }
79
+ const isOffline = typeof navigator !== "undefined" && navigator.onLine === false;
80
+ if (isOffline || NETWORK_FAILURE.test(error.message ?? "") && (error instanceof TypeError || /fetch/i.test(error.name))) {
81
+ return USER_MESSAGES.network;
82
+ }
83
+ return fallback;
84
+ }
85
+
86
+ // src/utils/store.ts
87
+ function freezeStoreSnapshot(state) {
88
+ if (process.env.NODE_ENV === "production" || !state || typeof state !== "object") {
89
+ return state;
90
+ }
91
+ const seen = /* @__PURE__ */ new WeakSet();
92
+ const freeze = (value) => {
93
+ if (seen.has(value) || Object.isFrozen(value)) return;
94
+ seen.add(value);
95
+ const prototype = Object.getPrototypeOf(value);
96
+ if (Array.isArray(value) || prototype === Object.prototype || prototype === null) {
97
+ for (const key of Reflect.ownKeys(value)) {
98
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
99
+ if (descriptor && "value" in descriptor && descriptor.value !== null) {
100
+ if (typeof descriptor.value === "object") freeze(descriptor.value);
101
+ }
102
+ }
103
+ }
104
+ Object.freeze(value);
105
+ };
106
+ freeze(state);
107
+ return state;
108
+ }
109
+ function createStore(initialState, { freezeSnapshots = true } = {}) {
110
+ const listeners = /* @__PURE__ */ new Set();
111
+ const prepare = freezeSnapshots ? freezeStoreSnapshot : (state) => state;
112
+ let snapshot = prepare(initialState);
113
+ const publish = (nextStateOrUpdater) => {
114
+ const nextState = typeof nextStateOrUpdater === "function" ? nextStateOrUpdater(snapshot) : nextStateOrUpdater;
115
+ if (Object.is(snapshot, nextState)) return false;
116
+ snapshot = prepare(nextState);
117
+ for (const listener of listeners) {
118
+ try {
119
+ listener();
120
+ } catch (error) {
121
+ report("CoreStore subscriber", error, "warn");
122
+ }
123
+ }
124
+ return true;
125
+ };
126
+ const setState = (updater) => {
127
+ if (typeof updater === "function") {
128
+ return publish(updater);
129
+ }
130
+ if (snapshot && typeof snapshot === "object" && updater && typeof updater === "object") {
131
+ return publish({ ...snapshot, ...updater });
132
+ }
133
+ return publish(updater);
134
+ };
135
+ return Object.freeze({
136
+ getSnapshot() {
137
+ return snapshot;
138
+ },
139
+ publish,
140
+ setState,
141
+ subscribe(listener) {
142
+ if (typeof listener !== "function") return () => {
143
+ };
144
+ listeners.add(listener);
145
+ return () => listeners.delete(listener);
146
+ }
147
+ });
148
+ }
149
+ function getOrCreateGlobalContext(name, defaultValue) {
150
+ const sym = /* @__PURE__ */ Symbol.for(`@omerdlw/base-framework/context/${name}`);
151
+ const store = globalThis;
152
+ if (!store[sym]) {
153
+ store[sym] = createContext(defaultValue);
154
+ }
155
+ return store[sym];
156
+ }
157
+
158
+ // src/theme.tsx
159
+ function defineThemeSpec(id) {
160
+ return Object.freeze({ id });
161
+ }
162
+ var EMPTY = /* @__PURE__ */ new Map();
163
+ var ThemeContext = getOrCreateGlobalContext("ThemeContext", EMPTY);
164
+ function useTheme(spec) {
165
+ const config = useContext(ThemeContext).get(spec.id);
166
+ if (!config) {
167
+ throw new Error(
168
+ `Theme "${spec.id}" is missing. Add its theme file to src/config/ and list it in src/config/index.ts.`
169
+ );
170
+ }
171
+ return {
172
+ slots: config.slots,
173
+ styles: config.styles ?? {}
174
+ };
175
+ }
176
+
177
+ // src/modules/notification/constants.ts
178
+ var TOAST_DURATIONS = Object.freeze({
179
+ DEFAULT: 2e3,
180
+ SHORT: 1500
181
+ });
182
+ var SESSION_EXPIRED_MESSAGE = USER_MESSAGES.unauthorized;
183
+ var DOCK_STACK_ELEMENT_ID = "dock-card-stack";
184
+ var notificationTheme = defineThemeSpec("notification");
185
+ function useRequiredContext(context, hookName, providerName) {
186
+ const value = use(context);
187
+ if (value === null) {
188
+ throw new Error(`${hookName} must be used within ${providerName}`);
189
+ }
190
+ return value;
191
+ }
192
+ function useStore(store, selector = (state) => state, isEqual = Object.is) {
193
+ const cacheRef = useRef({
194
+ isEqual: null,
195
+ selected: void 0,
196
+ selector: null,
197
+ snapshot: null
198
+ });
199
+ const getSelectedSnapshot = useCallback(() => {
200
+ const snapshot = store.getSnapshot();
201
+ const cache = cacheRef.current;
202
+ if (cache.snapshot === snapshot && cache.selector === selector && cache.isEqual === isEqual) {
203
+ return cache.selected;
204
+ }
205
+ const selected = selector(snapshot);
206
+ if (cache.snapshot !== null && cache.isEqual === isEqual && isEqual(cache.selected, selected)) {
207
+ cache.snapshot = snapshot;
208
+ cache.selector = selector;
209
+ return cache.selected;
210
+ }
211
+ cacheRef.current = {
212
+ isEqual,
213
+ selected,
214
+ selector,
215
+ snapshot
216
+ };
217
+ return selected;
218
+ }, [isEqual, selector, store]);
219
+ return useSyncExternalStore(
220
+ store.subscribe,
221
+ getSelectedSnapshot,
222
+ getSelectedSnapshot
223
+ );
224
+ }
225
+ var useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;
226
+
227
+ // src/events.ts
228
+ var EVENT_TYPES = Object.freeze({
229
+ API_UNAUTHORIZED: "API_UNAUTHORIZED",
230
+ STATE_CHANGE: "STATE_CHANGE",
231
+ API_ERROR: "API_ERROR",
232
+ APP_ERROR: "APP_ERROR"
233
+ });
234
+ var EventEmitter = class {
235
+ events = /* @__PURE__ */ new Map();
236
+ debounceTimers = /* @__PURE__ */ new Map();
237
+ subscribe(event, callback) {
238
+ if (typeof event !== "string" || !event || typeof callback !== "function") {
239
+ return () => {
240
+ };
241
+ }
242
+ const listeners = this.events.get(event) || /* @__PURE__ */ new Set();
243
+ listeners.add(callback);
244
+ this.events.set(event, listeners);
245
+ return () => {
246
+ listeners.delete(callback);
247
+ if (listeners.size === 0) this.events.delete(event);
248
+ };
249
+ }
250
+ emit(event, payload) {
251
+ const listeners = this.events.get(event);
252
+ if (!listeners || listeners.size === 0) return;
253
+ const snapshot = Array.from(listeners);
254
+ for (const callback of snapshot) {
255
+ try {
256
+ callback(payload);
257
+ } catch (error) {
258
+ report(`Event listener (${String(event)})`, error);
259
+ }
260
+ }
261
+ }
262
+ emitDebounced(event, payload, waitMs = 100) {
263
+ const existing = this.debounceTimers.get(event);
264
+ if (existing) clearTimeout(existing);
265
+ const timer = setTimeout(() => {
266
+ this.debounceTimers.delete(event);
267
+ this.emit(event, payload);
268
+ }, waitMs);
269
+ this.debounceTimers.set(event, timer);
270
+ }
271
+ cancelDebounced(event) {
272
+ if (event) {
273
+ const timer = this.debounceTimers.get(event);
274
+ if (timer) {
275
+ clearTimeout(timer);
276
+ this.debounceTimers.delete(event);
277
+ }
278
+ } else {
279
+ for (const timer of this.debounceTimers.values()) {
280
+ clearTimeout(timer);
281
+ }
282
+ this.debounceTimers.clear();
283
+ }
284
+ }
285
+ unsubscribeAll(event) {
286
+ this.cancelDebounced(event);
287
+ if (event) this.events.delete(event);
288
+ else this.events.clear();
289
+ }
290
+ hasListeners(event) {
291
+ return Boolean(this.events.get(event)?.size);
292
+ }
293
+ getListenerCount(event) {
294
+ return this.events.get(event)?.size || 0;
295
+ }
296
+ getAllEvents() {
297
+ return [...this.events.keys()];
298
+ }
299
+ };
300
+ var GLOBAL_EVENTS_KEY = /* @__PURE__ */ Symbol.for("__base_framework_global_events__");
301
+ var _global = globalThis;
302
+ var globalEvents = _global[GLOBAL_EVENTS_KEY] ?? (_global[GLOBAL_EVENTS_KEY] = new EventEmitter());
303
+
304
+ // src/hooks/use-global-event.ts
305
+ function useGlobalEvent(event, callback, options) {
306
+ const callbackRef = useRef(callback);
307
+ const debounceTimerRef = useRef(null);
308
+ useRef(0);
309
+ const throttleTimerRef = useRef(null);
310
+ useIsomorphicLayoutEffect(() => {
311
+ callbackRef.current = callback;
312
+ });
313
+ const debounceMs = options?.debounceMs;
314
+ const throttleMs = options?.throttleMs;
315
+ useEffect(() => {
316
+ if (!event) return;
317
+ const events = Array.isArray(event) ? event.filter(Boolean) : [event];
318
+ if (events.length === 0) return;
319
+ const handler = (payload) => {
320
+ callbackRef.current?.(payload);
321
+ };
322
+ const unsubs = events.map((ev) => globalEvents.subscribe(ev, handler));
323
+ return () => {
324
+ unsubs.forEach((unsub) => unsub());
325
+ if (debounceTimerRef.current !== null) {
326
+ clearTimeout(debounceTimerRef.current);
327
+ debounceTimerRef.current = null;
328
+ }
329
+ if (throttleTimerRef.current !== null) {
330
+ clearTimeout(throttleTimerRef.current);
331
+ throttleTimerRef.current = null;
332
+ }
333
+ };
334
+ }, [event, debounceMs, throttleMs]);
335
+ }
336
+
337
+ // src/result.ts
338
+ function isResult(value) {
339
+ return typeof value === "object" && value !== null && "success" in value && typeof value.success === "boolean" && ("data" in value && value.success === true || "error" in value && value.success === false);
340
+ }
341
+
342
+ // src/modules/notification/utils.ts
343
+ function normalizeFeedbackText(value) {
344
+ if (typeof value !== "string") return value;
345
+ return value.trim().replace(/[.\s]+$/, "");
346
+ }
347
+ function getActiveNotification(notifications) {
348
+ let active = null;
349
+ for (const entry of Object.values(notifications)) {
350
+ if (!active || entry.timestamp >= active.timestamp) active = entry;
351
+ }
352
+ return active;
353
+ }
354
+ function normalizeToastOptions(options) {
355
+ return typeof options === "number" ? { duration: options } : options || {};
356
+ }
357
+ function withDefaultDuration(duration, options) {
358
+ const normalized = normalizeToastOptions(options);
359
+ return {
360
+ ...normalized,
361
+ duration: normalized.duration !== void 0 ? normalized.duration : duration
362
+ };
363
+ }
364
+ function isNotificationDataObject(value) {
365
+ return isObject(value) && "message" in value;
366
+ }
367
+ var NotificationContext = getOrCreateGlobalContext(
368
+ "NotificationContext",
369
+ null
370
+ );
371
+ var notificationIdCounter = 0;
372
+ var INITIAL_NOTIFICATION_STATE = { notifications: {} };
373
+ function normalizeDuration(value) {
374
+ if (value === null) return null;
375
+ if (value === void 0) return TOAST_DURATIONS.DEFAULT;
376
+ const duration = Number(value);
377
+ return Number.isFinite(duration) && duration > 0 ? duration : null;
378
+ }
379
+ var NotificationProvider = ({
380
+ children
381
+ }) => {
382
+ const [store] = useState(
383
+ () => createStore(INITIAL_NOTIFICATION_STATE, {
384
+ freezeSnapshots: false
385
+ })
386
+ );
387
+ const timersRef = useRef(
388
+ /* @__PURE__ */ new Map()
389
+ );
390
+ const clearTimers = useCallback(() => {
391
+ timersRef.current.forEach(clearTimeout);
392
+ timersRef.current.clear();
393
+ }, []);
394
+ useEffect(() => clearTimers, [clearTimers]);
395
+ const dismissNotification = useCallback(
396
+ (id) => {
397
+ clearTimeout(timersRef.current.get(id));
398
+ timersRef.current.delete(id);
399
+ store.publish((prev) => {
400
+ if (!Object.hasOwn(prev.notifications, id)) return prev;
401
+ const notifications = { ...prev.notifications };
402
+ delete notifications[id];
403
+ return { notifications };
404
+ });
405
+ },
406
+ [store]
407
+ );
408
+ const dismissAllNotifications = useCallback(() => {
409
+ clearTimers();
410
+ store.publish(
411
+ (prev) => Object.keys(prev.notifications).length === 0 ? prev : { notifications: {} }
412
+ );
413
+ }, [clearTimers, store]);
414
+ const showNotification = useCallback(
415
+ (messageOrData, options) => {
416
+ const normalizedOptions = normalizeToastOptions(options);
417
+ const payload = isNotificationDataObject(messageOrData) ? { ...normalizedOptions, ...messageOrData } : { ...normalizedOptions, message: messageOrData };
418
+ const normalizedMessage = normalizeFeedbackText(payload.message);
419
+ if (normalizedMessage === null || normalizedMessage === void 0 || normalizedMessage === "") {
420
+ return null;
421
+ }
422
+ const id = payload.dedupeKey || payload.id || (typeof normalizedMessage === "string" ? normalizedMessage.slice(0, 64) : `notification-${++notificationIdCounter}`);
423
+ clearTimers();
424
+ const entry = {
425
+ dedupeKey: payload.dedupeKey,
426
+ duration: payload.duration,
427
+ id,
428
+ message: normalizedMessage,
429
+ timestamp: Date.now()
430
+ };
431
+ store.publish({ notifications: { [id]: entry } });
432
+ const duration = normalizeDuration(payload.duration);
433
+ if (duration) {
434
+ timersRef.current.set(
435
+ id,
436
+ setTimeout(() => dismissNotification(id), duration)
437
+ );
438
+ }
439
+ return id;
440
+ },
441
+ [clearTimers, dismissNotification, store]
442
+ );
443
+ const actions = useMemo(
444
+ () => ({
445
+ dismissAllNotifications,
446
+ dismissNotification,
447
+ showNotification
448
+ }),
449
+ [dismissAllNotifications, dismissNotification, showNotification]
450
+ );
451
+ const value = useMemo(
452
+ () => ({ actions, store }),
453
+ [actions, store]
454
+ );
455
+ return /* @__PURE__ */ jsx(NotificationContext, { value, children });
456
+ };
457
+ function useNotificationActions() {
458
+ return useRequiredContext(
459
+ NotificationContext,
460
+ "useNotificationActions",
461
+ "NotificationProvider"
462
+ ).actions;
463
+ }
464
+ function useNotificationState() {
465
+ const { store } = useRequiredContext(
466
+ NotificationContext,
467
+ "useNotificationState",
468
+ "NotificationProvider"
469
+ );
470
+ return useStore(store);
471
+ }
472
+ function useNotification() {
473
+ const actions = useNotificationActions();
474
+ const state = useNotificationState();
475
+ return useMemo(() => ({ ...actions, ...state }), [actions, state]);
476
+ }
477
+ var toastPromiseIdCounter = 0;
478
+ function resolveMessage(message, arg) {
479
+ return typeof message === "function" ? message(arg) : message;
480
+ }
481
+ function getOutcomeMessage(value, messages) {
482
+ if (!isResult(value)) return resolveMessage(messages.success, value);
483
+ return value.success ? resolveMessage(messages.success, value.data) : resolveMessage(messages.error, value.error) || toUserMessage(value.error);
484
+ }
485
+ function useToast(defaultDuration) {
486
+ const { dismissAllNotifications, dismissNotification, showNotification } = useNotificationActions();
487
+ const resolvedDefaultDuration = defaultDuration ?? TOAST_DURATIONS.DEFAULT;
488
+ const triggerToast = useCallback(
489
+ (message, options) => showNotification(
490
+ message,
491
+ withDefaultDuration(resolvedDefaultDuration, options)
492
+ ),
493
+ [resolvedDefaultDuration, showNotification]
494
+ );
495
+ const dismiss = useCallback(
496
+ (id) => {
497
+ if (id) dismissNotification(id);
498
+ else dismissAllNotifications();
499
+ },
500
+ [dismissAllNotifications, dismissNotification]
501
+ );
502
+ const fromResult = useCallback(
503
+ (result, messages = {}, options) => {
504
+ if (isResult(result)) {
505
+ const message = getOutcomeMessage(result, messages);
506
+ if (message) triggerToast(message, options);
507
+ }
508
+ return result;
509
+ },
510
+ [triggerToast]
511
+ );
512
+ const promise = useCallback(
513
+ async (promiseOrFn, messages = {}, options) => {
514
+ const normalized = normalizeToastOptions(options);
515
+ const id = normalized.id || normalized.dedupeKey || `toast-promise-${++toastPromiseIdCounter}`;
516
+ const sharedOptions = { ...normalized, id };
517
+ if (messages.loading) {
518
+ showNotification(messages.loading, {
519
+ ...sharedOptions,
520
+ duration: null
521
+ });
522
+ }
523
+ try {
524
+ const resolved = await (typeof promiseOrFn === "function" ? promiseOrFn() : promiseOrFn);
525
+ const message = getOutcomeMessage(resolved, messages);
526
+ if (message) triggerToast(message, sharedOptions);
527
+ else if (messages.loading) dismiss(id);
528
+ return resolved;
529
+ } catch (error) {
530
+ triggerToast(
531
+ resolveMessage(messages.error, error) || toUserMessage(error),
532
+ sharedOptions
533
+ );
534
+ throw error;
535
+ }
536
+ },
537
+ [dismiss, showNotification, triggerToast]
538
+ );
539
+ return useMemo(
540
+ () => Object.assign(
541
+ (message, options) => triggerToast(message, options),
542
+ { dismiss, dismissAll: dismissAllNotifications, fromResult, promise }
543
+ ),
544
+ [dismiss, dismissAllNotifications, fromResult, promise, triggerToast]
545
+ );
546
+ }
547
+ var emptySubscribe = () => () => {
548
+ };
549
+ function NotificationListener() {
550
+ const { showNotification } = useNotificationActions();
551
+ useGlobalEvent(EVENT_TYPES.API_UNAUTHORIZED, (data) => {
552
+ if (data?.source && data.source !== "app") return;
553
+ showNotification(SESSION_EXPIRED_MESSAGE);
554
+ });
555
+ useGlobalEvent(
556
+ EVENT_TYPES.APP_ERROR,
557
+ (data) => {
558
+ if (!data?.notify || !data.message) return;
559
+ showNotification(data.message);
560
+ }
561
+ );
562
+ useGlobalEvent(
563
+ EVENT_TYPES.STATE_CHANGE,
564
+ (data) => {
565
+ if (!data?.notify || !data.message) return;
566
+ showNotification(data.message);
567
+ }
568
+ );
569
+ return null;
570
+ }
571
+ function useNotificationContainerModel() {
572
+ const { notifications } = useNotificationState();
573
+ const { dismissNotification } = useNotificationActions();
574
+ const isHydrated = useSyncExternalStore(
575
+ emptySubscribe,
576
+ () => true,
577
+ () => false
578
+ );
579
+ const activeEntry = useMemo(
580
+ () => getActiveNotification(notifications),
581
+ [notifications]
582
+ );
583
+ const theme = useTheme(notificationTheme);
584
+ return { dismissNotification, isHydrated, activeEntry, theme };
585
+ }
586
+
587
+ // src/kernel/constants.ts
588
+ var REGISTRY_SOURCES = Object.freeze({
589
+ STATIC: "static",
590
+ DYNAMIC: "dynamic",
591
+ USER: "user"
592
+ });
593
+ var REGISTRY_LIFECYCLES = Object.freeze({
594
+ IMMEDIATE: "immediate",
595
+ GRACEFUL: "graceful",
596
+ PERSISTENT: "persistent",
597
+ ROUTE: "route"
598
+ });
599
+ var REGISTRY_METADATA_KEYS = Object.freeze([
600
+ "cleanup",
601
+ "cleanupDelayMs",
602
+ "instanceId",
603
+ "lifecycle",
604
+ "priority",
605
+ "source",
606
+ "scope",
607
+ "validation"
608
+ ]);
609
+ Object.freeze({
610
+ [REGISTRY_SOURCES.STATIC]: 100,
611
+ [REGISTRY_SOURCES.DYNAMIC]: 200,
612
+ [REGISTRY_SOURCES.USER]: 300
613
+ });
614
+ Object.freeze({
615
+ [REGISTRY_SOURCES.STATIC]: 10,
616
+ [REGISTRY_SOURCES.DYNAMIC]: 20,
617
+ [REGISTRY_SOURCES.USER]: 30
618
+ });
619
+ new Set(
620
+ Object.values(REGISTRY_LIFECYCLES)
621
+ );
622
+ new Set(
623
+ REGISTRY_METADATA_KEYS
624
+ );
625
+ var REGISTRY_SCOPE_KINDS = Object.freeze({
626
+ APP: "app",
627
+ SESSION: "session",
628
+ ROUTE: "route",
629
+ INSTANCE: "instance",
630
+ WORKSPACE: "workspace"
631
+ });
632
+ REGISTRY_SCOPE_KINDS.APP;
633
+ function createNoopHandle(status = "rejected", reason = "unknown") {
634
+ const handle = Object.assign(() => false, {
635
+ active: false,
636
+ dispose: () => false,
637
+ instanceId: null,
638
+ key: "",
639
+ priority: 0,
640
+ reason,
641
+ source: "",
642
+ status,
643
+ type: "",
644
+ update: () => handle,
645
+ updatedAt: 0,
646
+ validation: "warn"
647
+ });
648
+ return handle;
649
+ }
650
+ createNoopHandle();
651
+ getOrCreateGlobalContext(
652
+ "RegistryContext",
653
+ null
654
+ );
655
+ getOrCreateGlobalContext("ModuleHostContext", null);
656
+ function createPageControllerStore() {
657
+ const listeners = /* @__PURE__ */ new Set();
658
+ let stack = [];
659
+ const notify = () => {
660
+ listeners.forEach((listener) => {
661
+ try {
662
+ listener();
663
+ } catch (error) {
664
+ report("Page controller listener", error);
665
+ }
666
+ });
667
+ };
668
+ return {
669
+ getSnapshot() {
670
+ const top = stack[stack.length - 1];
671
+ return top?.controllerRef?.current || null;
672
+ },
673
+ notify,
674
+ register(id, controllerRef) {
675
+ stack = stack.filter((item) => item.id !== id);
676
+ stack.push({ controllerRef, id });
677
+ notify();
678
+ },
679
+ subscribe(listener) {
680
+ listeners.add(listener);
681
+ return () => {
682
+ listeners.delete(listener);
683
+ };
684
+ },
685
+ unregister(id) {
686
+ stack = stack.filter((item) => item.id !== id);
687
+ notify();
688
+ }
689
+ };
690
+ }
691
+ var fallbackStandaloneStore = createPageControllerStore();
692
+ getOrCreateGlobalContext(
693
+ "PageControllerContext",
694
+ null
695
+ );
696
+ getOrCreateGlobalContext(
697
+ "PageControllerStoreContext",
698
+ fallbackStandaloneStore
699
+ );
700
+ function defineModule(coreModule) {
701
+ return Object.freeze({ ...coreModule });
702
+ }
703
+ createStore(void 0);
704
+
705
+ // src/tokens/motion.ts
706
+ var DURATION_TOKENS = Object.freeze({
707
+ INSTANT: 0.08,
708
+ MICRO: 0.18,
709
+ FAST: 0.28,
710
+ BASE: 0.36,
711
+ MODERATE: 0.44,
712
+ SLOW: 0.58,
713
+ CINEMATIC: 0.86
714
+ });
715
+ var EASING_CURVES = Object.freeze({
716
+ OUT_EXPO: [0.16, 1, 0.3, 1],
717
+ OUT_QUART: [0.25, 1, 0.5, 1],
718
+ OUT_QUINT: [0.22, 1, 0.36, 1],
719
+ IN_OUT_CUBIC: [0.65, 0, 0.35, 1],
720
+ IN_CUBIC: [0.5, 0, 1, 1],
721
+ OUT_BACK: [0.34, 1.56, 0.64, 1]
722
+ });
723
+ var MOTION_EASINGS = Object.freeze({
724
+ ENTER: EASING_CURVES.OUT_QUART,
725
+ ENTER_EMPHASIZED: EASING_CURVES.OUT_EXPO,
726
+ EXIT: EASING_CURVES.IN_CUBIC
727
+ });
728
+ Object.freeze({
729
+ MICRO: Object.freeze({
730
+ distance: 4,
731
+ duration: DURATION_TOKENS.MICRO,
732
+ ease: MOTION_EASINGS.ENTER_EMPHASIZED,
733
+ scaleDelta: 8e-3
734
+ }),
735
+ FAST: Object.freeze({
736
+ distance: 9,
737
+ duration: DURATION_TOKENS.FAST,
738
+ ease: MOTION_EASINGS.ENTER_EMPHASIZED,
739
+ scaleDelta: 0.012
740
+ }),
741
+ STANDARD: Object.freeze({
742
+ distance: 18,
743
+ duration: DURATION_TOKENS.MODERATE,
744
+ ease: MOTION_EASINGS.ENTER,
745
+ scaleDelta: 0.018
746
+ }),
747
+ SURFACE: Object.freeze({
748
+ distance: 28,
749
+ duration: DURATION_TOKENS.SLOW,
750
+ ease: MOTION_EASINGS.ENTER_EMPHASIZED,
751
+ scaleDelta: 0.024
752
+ })
753
+ });
754
+ Object.freeze({
755
+ duration: DURATION_TOKENS.INSTANT,
756
+ ease: "linear"
757
+ });
758
+
759
+ // src/modules/notification/motion.ts
760
+ function toGpuTransform(y = 0, scale = 1) {
761
+ return `translate3d(0, ${Math.round(y)}px, 0) scale(${Math.round(scale * 1e3) / 1e3})`;
762
+ }
763
+ var NOTIFICATION_COMPOSITOR_STYLE = Object.freeze({
764
+ WebkitBackfaceVisibility: "hidden",
765
+ WebkitFontSmoothing: "antialiased",
766
+ backfaceVisibility: "hidden",
767
+ transform: "translateZ(0)",
768
+ willChange: "transform, opacity, filter"
769
+ });
770
+ var NOTIFICATION_TRANSITION = Object.freeze({
771
+ duration: DURATION_TOKENS.MODERATE,
772
+ ease: EASING_CURVES.OUT_EXPO,
773
+ type: "tween"
774
+ });
775
+ var NOTIFICATION_EXIT_TRANSITION = Object.freeze({
776
+ duration: DURATION_TOKENS.FAST,
777
+ ease: EASING_CURVES.IN_CUBIC,
778
+ type: "tween"
779
+ });
780
+ var toastVariants = Object.freeze({
781
+ exit: {
782
+ opacity: 0,
783
+ transform: toGpuTransform(-6, 0.98),
784
+ transition: NOTIFICATION_EXIT_TRANSITION
785
+ },
786
+ hidden: {
787
+ opacity: 0,
788
+ transform: toGpuTransform(-10, 0.96)
789
+ },
790
+ visible: {
791
+ opacity: 1,
792
+ transform: toGpuTransform(0, 1),
793
+ transition: NOTIFICATION_TRANSITION
794
+ }
795
+ });
796
+ function Toast({
797
+ className,
798
+ entry,
799
+ messageClassName,
800
+ onDismiss,
801
+ polite,
802
+ style
803
+ }) {
804
+ return /* @__PURE__ */ jsx(
805
+ motion.div,
806
+ {
807
+ role: "alert",
808
+ "aria-atomic": "true",
809
+ "aria-live": polite ? "polite" : void 0,
810
+ "aria-keyshortcuts": "Escape",
811
+ tabIndex: 0,
812
+ variants: toastVariants,
813
+ initial: "hidden",
814
+ animate: "visible",
815
+ exit: "exit",
816
+ transition: NOTIFICATION_TRANSITION,
817
+ style: { ...NOTIFICATION_COMPOSITOR_STYLE, ...style },
818
+ className,
819
+ onClick: (event) => {
820
+ event.stopPropagation();
821
+ onDismiss();
822
+ },
823
+ onKeyDown: (event) => {
824
+ if (event.key !== "Escape") return;
825
+ event.preventDefault();
826
+ event.stopPropagation();
827
+ onDismiss();
828
+ },
829
+ children: /* @__PURE__ */ jsx("div", { className: messageClassName, children: entry.message })
830
+ }
831
+ );
832
+ }
833
+ function NotificationContainer() {
834
+ const { dismissNotification, isHydrated, activeEntry, theme } = useNotificationContainerModel();
835
+ if (!isHydrated) return null;
836
+ const dockElement = document.getElementById(DOCK_STACK_ELEMENT_ID);
837
+ const toast = (className, polite) => /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: activeEntry && /* @__PURE__ */ jsx(
838
+ Toast,
839
+ {
840
+ className,
841
+ entry: activeEntry,
842
+ messageClassName: theme.slots.toastMessage,
843
+ polite,
844
+ style: theme.styles.toast,
845
+ onDismiss: () => dismissNotification(activeEntry.id)
846
+ },
847
+ activeEntry.id
848
+ ) });
849
+ if (dockElement) {
850
+ return createPortal(
851
+ toast(cn(theme.slots.toast, theme.slots.toastDocked), true),
852
+ dockElement
853
+ );
854
+ }
855
+ return createPortal(
856
+ /* @__PURE__ */ jsx(
857
+ "div",
858
+ {
859
+ "aria-atomic": "true",
860
+ "aria-live": "polite",
861
+ className: theme.slots.layer,
862
+ style: theme.styles.layer,
863
+ children: toast(theme.slots.toast)
864
+ }
865
+ ),
866
+ document.body
867
+ );
868
+ }
869
+ function NotificationLayer() {
870
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
871
+ /* @__PURE__ */ jsx(NotificationListener, {}),
872
+ /* @__PURE__ */ jsx(NotificationContainer, {})
873
+ ] });
874
+ }
875
+
876
+ // src/modules/notification/module.ts
877
+ function selectToastDuration(config) {
878
+ const notification = config.notification;
879
+ if (typeof notification === "number") return notification;
880
+ return notification?.duration ?? null;
881
+ }
882
+ function useNotificationPage(duration, page) {
883
+ const toast = useToast(duration);
884
+ return useMemo(
885
+ () => ({
886
+ set: (notification) => page.set({ notification }),
887
+ toast
888
+ }),
889
+ [page, toast]
890
+ );
891
+ }
892
+ var notificationModule = defineModule({
893
+ id: "notification",
894
+ context: NotificationContext,
895
+ Provider: NotificationProvider,
896
+ Overlay: NotificationLayer,
897
+ page: {
898
+ select: selectToastDuration,
899
+ use: useNotificationPage
900
+ }
901
+ });
902
+
903
+ export { NotificationContext, NotificationProvider, TOAST_DURATIONS, notificationModule, notificationTheme, useNotification, useNotificationActions, useNotificationState, useToast };
904
+ //# sourceMappingURL=index.js.map
905
+ //# sourceMappingURL=index.js.map