snice 5.1.0 → 5.2.1

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 (323) hide show
  1. package/adapters/react/SniceProvider.js +1 -1
  2. package/adapters/react/SniceRouter.js +1 -1
  3. package/adapters/react/matchRoute.js +1 -1
  4. package/adapters/react/useRequestHandler.js +1 -1
  5. package/dist/cdn/accordion/snice-accordion.js +1 -1
  6. package/dist/cdn/accordion/snice-accordion.min.js +1 -1
  7. package/dist/cdn/action-bar/snice-action-bar.js +1 -1
  8. package/dist/cdn/action-bar/snice-action-bar.min.js +1 -1
  9. package/dist/cdn/activity-feed/snice-activity-feed.js +1 -1
  10. package/dist/cdn/activity-feed/snice-activity-feed.min.js +1 -1
  11. package/dist/cdn/alert/snice-alert.js +1 -1
  12. package/dist/cdn/alert/snice-alert.min.js +1 -1
  13. package/dist/cdn/app-tiles/snice-app-tiles.js +1 -1
  14. package/dist/cdn/app-tiles/snice-app-tiles.min.js +1 -1
  15. package/dist/cdn/approval-flow/snice-approval-flow.js +1 -1
  16. package/dist/cdn/approval-flow/snice-approval-flow.min.js +1 -1
  17. package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
  18. package/dist/cdn/audio-recorder/snice-audio-recorder.min.js +1 -1
  19. package/dist/cdn/availability/snice-availability.js +1 -1
  20. package/dist/cdn/availability/snice-availability.min.js +1 -1
  21. package/dist/cdn/avatar/snice-avatar.js +1 -1
  22. package/dist/cdn/avatar/snice-avatar.min.js +1 -1
  23. package/dist/cdn/avatar-group/snice-avatar-group.js +1 -1
  24. package/dist/cdn/avatar-group/snice-avatar-group.min.js +1 -1
  25. package/dist/cdn/badge/snice-badge.js +1 -1
  26. package/dist/cdn/badge/snice-badge.min.js +1 -1
  27. package/dist/cdn/banner/snice-banner.js +1 -1
  28. package/dist/cdn/banner/snice-banner.min.js +1 -1
  29. package/dist/cdn/binpack/snice-binpack.js +1 -1
  30. package/dist/cdn/binpack/snice-binpack.min.js +1 -1
  31. package/dist/cdn/book/snice-book.js +1 -1
  32. package/dist/cdn/book/snice-book.min.js +1 -1
  33. package/dist/cdn/booking/snice-booking.js +1 -1
  34. package/dist/cdn/booking/snice-booking.min.js +1 -1
  35. package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +1 -1
  36. package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +1 -1
  37. package/dist/cdn/button/snice-button.js +1 -1
  38. package/dist/cdn/button/snice-button.min.js +1 -1
  39. package/dist/cdn/calendar/snice-calendar.js +1 -1
  40. package/dist/cdn/calendar/snice-calendar.min.js +1 -1
  41. package/dist/cdn/camera/snice-camera.js +1 -1
  42. package/dist/cdn/camera/snice-camera.min.js +1 -1
  43. package/dist/cdn/camera-annotate/snice-camera-annotate.js +1 -1
  44. package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +1 -1
  45. package/dist/cdn/candlestick/snice-candlestick.js +1 -1
  46. package/dist/cdn/candlestick/snice-candlestick.min.js +1 -1
  47. package/dist/cdn/card/snice-card.js +1 -1
  48. package/dist/cdn/card/snice-card.min.js +1 -1
  49. package/dist/cdn/carousel/snice-carousel.js +1 -1
  50. package/dist/cdn/carousel/snice-carousel.min.js +1 -1
  51. package/dist/cdn/cart/snice-cart.js +1 -1
  52. package/dist/cdn/cart/snice-cart.min.js +1 -1
  53. package/dist/cdn/chart/snice-chart.js +1 -1
  54. package/dist/cdn/chart/snice-chart.min.js +1 -1
  55. package/dist/cdn/chat/README.md +1 -1
  56. package/dist/cdn/chat/snice-chat.js +3 -3
  57. package/dist/cdn/chat/snice-chat.js.map +1 -1
  58. package/dist/cdn/chat/snice-chat.min.js +3 -3
  59. package/dist/cdn/chat/snice-chat.min.js.map +1 -1
  60. package/dist/cdn/checkbox/snice-checkbox.js +1 -1
  61. package/dist/cdn/checkbox/snice-checkbox.min.js +1 -1
  62. package/dist/cdn/chip/snice-chip.js +1 -1
  63. package/dist/cdn/chip/snice-chip.min.js +1 -1
  64. package/dist/cdn/code-block/snice-code-block.js +1 -1
  65. package/dist/cdn/code-block/snice-code-block.min.js +1 -1
  66. package/dist/cdn/color-display/snice-color-display.js +1 -1
  67. package/dist/cdn/color-display/snice-color-display.min.js +1 -1
  68. package/dist/cdn/color-picker/snice-color-picker.js +1 -1
  69. package/dist/cdn/color-picker/snice-color-picker.min.js +1 -1
  70. package/dist/cdn/command-palette/snice-command-palette.js +1 -1
  71. package/dist/cdn/command-palette/snice-command-palette.min.js +1 -1
  72. package/dist/cdn/comments/snice-comments.js +1 -1
  73. package/dist/cdn/comments/snice-comments.min.js +1 -1
  74. package/dist/cdn/countdown/snice-countdown.js +1 -1
  75. package/dist/cdn/countdown/snice-countdown.min.js +1 -1
  76. package/dist/cdn/cropper/snice-cropper.js +1 -1
  77. package/dist/cdn/cropper/snice-cropper.min.js +1 -1
  78. package/dist/cdn/data-card/snice-data-card.js +1 -1
  79. package/dist/cdn/data-card/snice-data-card.min.js +1 -1
  80. package/dist/cdn/date-picker/snice-date-picker.js +1 -1
  81. package/dist/cdn/date-picker/snice-date-picker.min.js +1 -1
  82. package/dist/cdn/date-range-picker/snice-date-range-picker.js +1 -1
  83. package/dist/cdn/date-range-picker/snice-date-range-picker.min.js +1 -1
  84. package/dist/cdn/date-time-picker/snice-date-time-picker.js +1 -1
  85. package/dist/cdn/date-time-picker/snice-date-time-picker.min.js +1 -1
  86. package/dist/cdn/diff/snice-diff.js +1 -1
  87. package/dist/cdn/diff/snice-diff.min.js +1 -1
  88. package/dist/cdn/divider/snice-divider.js +1 -1
  89. package/dist/cdn/divider/snice-divider.min.js +1 -1
  90. package/dist/cdn/doc/snice-doc.js +1 -1
  91. package/dist/cdn/doc/snice-doc.min.js +1 -1
  92. package/dist/cdn/draw/snice-draw.js +1 -1
  93. package/dist/cdn/draw/snice-draw.min.js +1 -1
  94. package/dist/cdn/drawer/snice-drawer.js +1 -1
  95. package/dist/cdn/drawer/snice-drawer.min.js +1 -1
  96. package/dist/cdn/empty-state/README.md +1 -1
  97. package/dist/cdn/empty-state/snice-empty-state.js +3 -3
  98. package/dist/cdn/empty-state/snice-empty-state.js.map +1 -1
  99. package/dist/cdn/empty-state/snice-empty-state.min.js +4 -4
  100. package/dist/cdn/empty-state/snice-empty-state.min.js.map +1 -1
  101. package/dist/cdn/estimate/snice-estimate.js +1 -1
  102. package/dist/cdn/estimate/snice-estimate.min.js +1 -1
  103. package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
  104. package/dist/cdn/file-gallery/snice-file-gallery.min.js +1 -1
  105. package/dist/cdn/file-upload/snice-file-upload.js +1 -1
  106. package/dist/cdn/file-upload/snice-file-upload.min.js +1 -1
  107. package/dist/cdn/flip-card/snice-flip-card.js +1 -1
  108. package/dist/cdn/flip-card/snice-flip-card.min.js +1 -1
  109. package/dist/cdn/flow/snice-flow.js +1 -1
  110. package/dist/cdn/flow/snice-flow.min.js +1 -1
  111. package/dist/cdn/form-layout/snice-form-layout.js +1 -1
  112. package/dist/cdn/form-layout/snice-form-layout.min.js +1 -1
  113. package/dist/cdn/funnel/snice-funnel.js +1 -1
  114. package/dist/cdn/funnel/snice-funnel.min.js +1 -1
  115. package/dist/cdn/gantt/snice-gantt.js +1 -1
  116. package/dist/cdn/gantt/snice-gantt.min.js +1 -1
  117. package/dist/cdn/gauge/snice-gauge.js +1 -1
  118. package/dist/cdn/gauge/snice-gauge.min.js +1 -1
  119. package/dist/cdn/grid/snice-grid.js +1 -1
  120. package/dist/cdn/grid/snice-grid.min.js +1 -1
  121. package/dist/cdn/heatmap/snice-heatmap.js +1 -1
  122. package/dist/cdn/heatmap/snice-heatmap.min.js +1 -1
  123. package/dist/cdn/image/snice-image.js +1 -1
  124. package/dist/cdn/image/snice-image.min.js +1 -1
  125. package/dist/cdn/input/snice-input.js +1 -1
  126. package/dist/cdn/input/snice-input.min.js +1 -1
  127. package/dist/cdn/invoice/snice-invoice.js +1 -1
  128. package/dist/cdn/invoice/snice-invoice.min.js +1 -1
  129. package/dist/cdn/kanban/snice-kanban.js +1 -1
  130. package/dist/cdn/kanban/snice-kanban.min.js +1 -1
  131. package/dist/cdn/key-value/snice-key-value.js +1 -1
  132. package/dist/cdn/key-value/snice-key-value.min.js +1 -1
  133. package/dist/cdn/kpi/snice-kpi.js +1 -1
  134. package/dist/cdn/kpi/snice-kpi.min.js +1 -1
  135. package/dist/cdn/layout/snice-layout.js +1 -1
  136. package/dist/cdn/layout/snice-layout.min.js +1 -1
  137. package/dist/cdn/leaderboard/snice-leaderboard.js +1 -1
  138. package/dist/cdn/leaderboard/snice-leaderboard.min.js +1 -1
  139. package/dist/cdn/link/snice-link.js +1 -1
  140. package/dist/cdn/link/snice-link.min.js +1 -1
  141. package/dist/cdn/link-preview/snice-link-preview.js +1 -1
  142. package/dist/cdn/link-preview/snice-link-preview.min.js +1 -1
  143. package/dist/cdn/list/README.md +1 -1
  144. package/dist/cdn/list/snice-list.js +3 -3
  145. package/dist/cdn/list/snice-list.js.map +1 -1
  146. package/dist/cdn/list/snice-list.min.js +7 -7
  147. package/dist/cdn/list/snice-list.min.js.map +1 -1
  148. package/dist/cdn/location/snice-location.js +1 -1
  149. package/dist/cdn/location/snice-location.min.js +1 -1
  150. package/dist/cdn/login/snice-login.js +1 -1
  151. package/dist/cdn/login/snice-login.min.js +1 -1
  152. package/dist/cdn/map/snice-map.js +1 -1
  153. package/dist/cdn/map/snice-map.min.js +1 -1
  154. package/dist/cdn/markdown/snice-markdown.js +1 -1
  155. package/dist/cdn/markdown/snice-markdown.min.js +1 -1
  156. package/dist/cdn/masonry/snice-masonry.js +1 -1
  157. package/dist/cdn/masonry/snice-masonry.min.js +1 -1
  158. package/dist/cdn/menu/snice-menu.js +1 -1
  159. package/dist/cdn/menu/snice-menu.min.js +1 -1
  160. package/dist/cdn/message-strip/snice-message-strip.js +1 -1
  161. package/dist/cdn/message-strip/snice-message-strip.min.js +1 -1
  162. package/dist/cdn/metric-table/snice-metric-table.js +1 -1
  163. package/dist/cdn/metric-table/snice-metric-table.min.js +1 -1
  164. package/dist/cdn/modal/snice-modal.js +1 -1
  165. package/dist/cdn/modal/snice-modal.min.js +1 -1
  166. package/dist/cdn/music-player/snice-music-player.js +1 -1
  167. package/dist/cdn/music-player/snice-music-player.min.js +1 -1
  168. package/dist/cdn/nav/snice-nav.js +1 -1
  169. package/dist/cdn/nav/snice-nav.min.js +1 -1
  170. package/dist/cdn/network-graph/snice-network-graph.js +1 -1
  171. package/dist/cdn/network-graph/snice-network-graph.min.js +1 -1
  172. package/dist/cdn/notification-center/README.md +1 -1
  173. package/dist/cdn/notification-center/snice-notification-center.js +3 -3
  174. package/dist/cdn/notification-center/snice-notification-center.js.map +1 -1
  175. package/dist/cdn/notification-center/snice-notification-center.min.js +3 -3
  176. package/dist/cdn/notification-center/snice-notification-center.min.js.map +1 -1
  177. package/dist/cdn/order-tracker/snice-order-tracker.js +1 -1
  178. package/dist/cdn/order-tracker/snice-order-tracker.min.js +1 -1
  179. package/dist/cdn/org-chart/snice-org-chart.js +1 -1
  180. package/dist/cdn/org-chart/snice-org-chart.min.js +1 -1
  181. package/dist/cdn/pagination/snice-pagination.js +1 -1
  182. package/dist/cdn/pagination/snice-pagination.min.js +1 -1
  183. package/dist/cdn/paint/snice-paint.js +1 -1
  184. package/dist/cdn/paint/snice-paint.min.js +1 -1
  185. package/dist/cdn/pdf-viewer/snice-pdf-viewer.js +1 -1
  186. package/dist/cdn/pdf-viewer/snice-pdf-viewer.min.js +1 -1
  187. package/dist/cdn/permission-matrix/snice-permission-matrix.js +1 -1
  188. package/dist/cdn/permission-matrix/snice-permission-matrix.min.js +1 -1
  189. package/dist/cdn/podcast-player/snice-podcast-player.js +1 -1
  190. package/dist/cdn/podcast-player/snice-podcast-player.min.js +1 -1
  191. package/dist/cdn/popover/snice-popover.js +1 -1
  192. package/dist/cdn/popover/snice-popover.min.js +1 -1
  193. package/dist/cdn/pricing-table/snice-pricing-table.js +1 -1
  194. package/dist/cdn/pricing-table/snice-pricing-table.min.js +1 -1
  195. package/dist/cdn/product-card/snice-product-card.js +1 -1
  196. package/dist/cdn/product-card/snice-product-card.min.js +1 -1
  197. package/dist/cdn/progress/snice-progress.js +1 -1
  198. package/dist/cdn/progress/snice-progress.min.js +1 -1
  199. package/dist/cdn/progress-ring/snice-progress-ring.js +1 -1
  200. package/dist/cdn/progress-ring/snice-progress-ring.min.js +1 -1
  201. package/dist/cdn/qr-code/snice-qr-code.js +1 -1
  202. package/dist/cdn/qr-code/snice-qr-code.min.js +1 -1
  203. package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
  204. package/dist/cdn/qr-reader/snice-qr-reader.min.js +1 -1
  205. package/dist/cdn/radio/snice-radio.js +1 -1
  206. package/dist/cdn/radio/snice-radio.min.js +1 -1
  207. package/dist/cdn/range-slider/snice-range-slider.js +1 -1
  208. package/dist/cdn/range-slider/snice-range-slider.min.js +1 -1
  209. package/dist/cdn/rating/snice-rating.js +1 -1
  210. package/dist/cdn/rating/snice-rating.min.js +1 -1
  211. package/dist/cdn/receipt/snice-receipt.js +1 -1
  212. package/dist/cdn/receipt/snice-receipt.min.js +1 -1
  213. package/dist/cdn/recipe/snice-recipe.js +1 -1
  214. package/dist/cdn/recipe/snice-recipe.min.js +1 -1
  215. package/dist/cdn/runtime/snice-runtime.esm.js +220 -205
  216. package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
  217. package/dist/cdn/runtime/snice-runtime.esm.min.js +8 -8
  218. package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
  219. package/dist/cdn/runtime/snice-runtime.js +220 -205
  220. package/dist/cdn/runtime/snice-runtime.js.map +1 -1
  221. package/dist/cdn/runtime/snice-runtime.min.js +8 -8
  222. package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
  223. package/dist/cdn/sankey/snice-sankey.js +1 -1
  224. package/dist/cdn/sankey/snice-sankey.min.js +1 -1
  225. package/dist/cdn/segmented-control/snice-segmented-control.js +1 -1
  226. package/dist/cdn/segmented-control/snice-segmented-control.min.js +1 -1
  227. package/dist/cdn/select/snice-select.js +1 -1
  228. package/dist/cdn/select/snice-select.min.js +1 -1
  229. package/dist/cdn/skeleton/snice-skeleton.js +1 -1
  230. package/dist/cdn/skeleton/snice-skeleton.min.js +1 -1
  231. package/dist/cdn/slider/snice-slider.js +1 -1
  232. package/dist/cdn/slider/snice-slider.min.js +1 -1
  233. package/dist/cdn/sortable/snice-sortable.js +1 -1
  234. package/dist/cdn/sortable/snice-sortable.min.js +1 -1
  235. package/dist/cdn/sparkline/snice-sparkline.js +1 -1
  236. package/dist/cdn/sparkline/snice-sparkline.min.js +1 -1
  237. package/dist/cdn/spinner/snice-spinner.js +1 -1
  238. package/dist/cdn/spinner/snice-spinner.min.js +1 -1
  239. package/dist/cdn/split-button/snice-split-button.js +1 -1
  240. package/dist/cdn/split-button/snice-split-button.min.js +1 -1
  241. package/dist/cdn/split-pane/snice-split-pane.js +1 -1
  242. package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
  243. package/dist/cdn/spotlight/snice-spotlight.js +1 -1
  244. package/dist/cdn/spotlight/snice-spotlight.min.js +1 -1
  245. package/dist/cdn/stat-group/snice-stat-group.js +1 -1
  246. package/dist/cdn/stat-group/snice-stat-group.min.js +1 -1
  247. package/dist/cdn/step-input/snice-step-input.js +1 -1
  248. package/dist/cdn/step-input/snice-step-input.min.js +1 -1
  249. package/dist/cdn/stepper/snice-stepper.js +1 -1
  250. package/dist/cdn/stepper/snice-stepper.min.js +1 -1
  251. package/dist/cdn/switch/snice-switch.js +1 -1
  252. package/dist/cdn/switch/snice-switch.min.js +1 -1
  253. package/dist/cdn/table/README.md +1 -1
  254. package/dist/cdn/table/snice-table.js +3 -3
  255. package/dist/cdn/table/snice-table.js.map +1 -1
  256. package/dist/cdn/table/snice-table.min.js +24 -24
  257. package/dist/cdn/table/snice-table.min.js.map +1 -1
  258. package/dist/cdn/tabs/snice-tabs.js +1 -1
  259. package/dist/cdn/tabs/snice-tabs.min.js +1 -1
  260. package/dist/cdn/tag/snice-tag.js +1 -1
  261. package/dist/cdn/tag/snice-tag.min.js +1 -1
  262. package/dist/cdn/tag-input/snice-tag-input.js +1 -1
  263. package/dist/cdn/tag-input/snice-tag-input.min.js +1 -1
  264. package/dist/cdn/terminal/snice-terminal.js +1 -1
  265. package/dist/cdn/terminal/snice-terminal.min.js +1 -1
  266. package/dist/cdn/testimonial/snice-testimonial.js +1 -1
  267. package/dist/cdn/testimonial/snice-testimonial.min.js +1 -1
  268. package/dist/cdn/textarea/snice-textarea.js +1 -1
  269. package/dist/cdn/textarea/snice-textarea.min.js +1 -1
  270. package/dist/cdn/time-picker/snice-time-picker.js +1 -1
  271. package/dist/cdn/time-picker/snice-time-picker.min.js +1 -1
  272. package/dist/cdn/time-range-picker/snice-time-range-picker.js +1 -1
  273. package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +1 -1
  274. package/dist/cdn/timeline/snice-timeline.js +1 -1
  275. package/dist/cdn/timeline/snice-timeline.min.js +1 -1
  276. package/dist/cdn/timer/snice-timer.js +1 -1
  277. package/dist/cdn/timer/snice-timer.min.js +1 -1
  278. package/dist/cdn/toast/snice-toast.js +1 -1
  279. package/dist/cdn/toast/snice-toast.min.js +1 -1
  280. package/dist/cdn/tooltip/snice-tooltip.js +1 -1
  281. package/dist/cdn/tooltip/snice-tooltip.min.js +1 -1
  282. package/dist/cdn/tree/snice-tree.js +1 -1
  283. package/dist/cdn/tree/snice-tree.min.js +1 -1
  284. package/dist/cdn/treemap/snice-treemap.js +1 -1
  285. package/dist/cdn/treemap/snice-treemap.min.js +1 -1
  286. package/dist/cdn/user-card/snice-user-card.js +1 -1
  287. package/dist/cdn/user-card/snice-user-card.min.js +1 -1
  288. package/dist/cdn/video-player/snice-video-player.js +1 -1
  289. package/dist/cdn/video-player/snice-video-player.min.js +1 -1
  290. package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +1 -1
  291. package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +1 -1
  292. package/dist/cdn/waterfall/snice-waterfall.js +1 -1
  293. package/dist/cdn/waterfall/snice-waterfall.min.js +1 -1
  294. package/dist/cdn/weather/snice-weather.js +1 -1
  295. package/dist/cdn/weather/snice-weather.min.js +1 -1
  296. package/dist/cdn/work-order/snice-work-order.js +1 -1
  297. package/dist/cdn/work-order/snice-work-order.min.js +1 -1
  298. package/dist/components/empty-state/snice-empty-state.js +2 -2
  299. package/dist/components/empty-state/snice-empty-state.js.map +1 -1
  300. package/dist/context.d.ts +2 -2
  301. package/dist/index.cjs +217 -202
  302. package/dist/index.cjs.map +1 -1
  303. package/dist/index.esm.js +217 -202
  304. package/dist/index.esm.js.map +1 -1
  305. package/dist/index.iife.js +217 -202
  306. package/dist/index.iife.js.map +1 -1
  307. package/dist/react/SniceProvider.js +1 -1
  308. package/dist/react/SniceRouter.js +1 -1
  309. package/dist/react/index.js +1 -1
  310. package/dist/react/matchRoute.js +1 -1
  311. package/dist/react/useRequestHandler.js +1 -1
  312. package/dist/symbols.cjs +1 -1
  313. package/dist/symbols.esm.js +1 -1
  314. package/dist/transitions.cjs +1 -1
  315. package/dist/transitions.esm.js +1 -1
  316. package/docs/STORYBOOK.md +1 -1
  317. package/docs/ai/api.md +4 -5
  318. package/docs/ai/decorators.md +2 -2
  319. package/docs/components/drawer.md +1 -1
  320. package/docs/controllers.md +41 -0
  321. package/docs/elements.md +1 -1
  322. package/docs/routing.md +1 -1
  323. package/package.json +2 -2
package/dist/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * snice v5.0.0
2
+ * snice v5.2.0
3
3
  * A decorator-driven web component library with differential rendering, routing, controllers, and 130+ ready-made UI components. Use as much or as little as you want. Zero dependencies, works anywhere.
4
4
  * (c) 2024
5
5
  * Released under the MIT License.
@@ -2679,6 +2679,208 @@ function cleanupEventHandlers(instance) {
2679
2679
  instance[CLEANUP].events = [];
2680
2680
  }
2681
2681
 
2682
+ /**
2683
+ * @context decorator for receiving router context updates
2684
+ */
2685
+ const CONTEXT_HANDLERS = getSymbol('context-handlers');
2686
+ /**
2687
+ * @context decorator for receiving router context updates
2688
+ *
2689
+ * Works on both methods and fields:
2690
+ *
2691
+ * - **Method form**: the method is invoked with the current Context on every
2692
+ * update (and once at register time so the first render sees the context).
2693
+ * - **Field form**: the field is overwritten with the current Context on
2694
+ * every update (and once at register time). Pair with `@property` if you
2695
+ * want assignment to also schedule a re-render.
2696
+ *
2697
+ * @example
2698
+ * ```typescript
2699
+ * @element('my-layout')
2700
+ * class MyLayout extends HTMLElement {
2701
+ * // Method form
2702
+ * @context()
2703
+ * handleContext(ctx: Context) {
2704
+ * this.renderNav(ctx.navigation.placards, ctx.navigation.route);
2705
+ * }
2706
+ *
2707
+ * // Field form — the field is populated before first render
2708
+ * @context() ctx!: Context;
2709
+ *
2710
+ * // Field + @property — assignment also triggers re-render
2711
+ * @property({ attribute: false }) @context() reactiveCtx!: Context;
2712
+ * }
2713
+ * ```
2714
+ */
2715
+ function context$1(options = {}) {
2716
+ return function (value, decoratorContext) {
2717
+ const name = decoratorContext.name;
2718
+ const kind = decoratorContext.kind;
2719
+ const registerHandler = function () {
2720
+ const constructor = this.constructor;
2721
+ // De-dupe: methods identify by reference, fields identify by name.
2722
+ if (!Object.prototype.hasOwnProperty.call(constructor, CONTEXT_METHODS)) {
2723
+ constructor[CONTEXT_METHODS] = new Set();
2724
+ }
2725
+ const dedupeKey = kind === 'method' ? value : `field:${name}`;
2726
+ if (constructor[CONTEXT_METHODS].has(dedupeKey))
2727
+ return;
2728
+ constructor[CONTEXT_METHODS].add(dedupeKey);
2729
+ if (!Object.prototype.hasOwnProperty.call(constructor, CONTEXT_HANDLERS)) {
2730
+ const inherited = constructor[CONTEXT_HANDLERS];
2731
+ constructor[CONTEXT_HANDLERS] = inherited ? [...inherited] : [];
2732
+ }
2733
+ if (kind === 'method') {
2734
+ constructor[CONTEXT_HANDLERS].push({
2735
+ kind: 'method',
2736
+ methodName: name,
2737
+ method: value,
2738
+ options,
2739
+ });
2740
+ }
2741
+ else if (kind === 'field' || kind === 'accessor') {
2742
+ constructor[CONTEXT_HANDLERS].push({
2743
+ kind: 'field',
2744
+ fieldName: name,
2745
+ options,
2746
+ });
2747
+ }
2748
+ };
2749
+ if (kind === 'method') {
2750
+ decoratorContext.addInitializer(registerHandler);
2751
+ return value;
2752
+ }
2753
+ // Field decorators: do registration via the init function (fires per
2754
+ // instance during construction, with `this` bound). Returning the init
2755
+ // function is the canonical Stage 3 way for field decorators —
2756
+ // `addInitializer` for fields can be late or unreliable across runtimes.
2757
+ return function (initialValue) {
2758
+ registerHandler.call(this);
2759
+ return initialValue;
2760
+ };
2761
+ };
2762
+ }
2763
+ /**
2764
+ * Setup context handler for an element instance
2765
+ * Called automatically during element connection
2766
+ */
2767
+ // Accepts an HTMLElement OR a controller instance — both are plain objects
2768
+ // that may carry CONTEXT_HANDLER and a constructor with CONTEXT_HANDLERS.
2769
+ function setupContextHandler(element) {
2770
+ const handlers = element.constructor[CONTEXT_HANDLERS];
2771
+ if (!handlers || !Array.isArray(handlers) || handlers.length === 0) {
2772
+ return;
2773
+ }
2774
+ // Get the Context instance from the router
2775
+ const ctx = element[CONTEXT_HANDLER];
2776
+ if (!ctx) {
2777
+ return;
2778
+ }
2779
+ // Store the Context instance for cleanup
2780
+ element[NAVIGATION_CONTEXT_INSTANCE] = ctx;
2781
+ // Per-element Map of handler-name → wrapped function. Symbol-keyed so it
2782
+ // doesn't pollute the element's public surface.
2783
+ let wrapped = element[WRAPPED_CONTEXT_HANDLERS];
2784
+ if (!wrapped) {
2785
+ wrapped = new Map();
2786
+ element[WRAPPED_CONTEXT_HANDLERS] = wrapped;
2787
+ }
2788
+ // Register each handler with the Context
2789
+ for (const handler of handlers) {
2790
+ const { kind, options } = handler;
2791
+ const handlerName = kind === 'field' ? handler.fieldName : handler.methodName;
2792
+ // Create wrapped method with timing controls
2793
+ const wrappedFn = function (context) {
2794
+ // Skip if already called once
2795
+ if (options.once && element[CONTEXT_CALLED]) {
2796
+ return;
2797
+ }
2798
+ const callMethod = () => {
2799
+ if (kind === 'field') {
2800
+ element[handler.fieldName] = context;
2801
+ }
2802
+ else {
2803
+ handler.method.call(element, context);
2804
+ }
2805
+ // Handle once option
2806
+ if (options.once) {
2807
+ element[CONTEXT_CALLED] = true;
2808
+ // Unregister after first call
2809
+ const ctx = element[NAVIGATION_CONTEXT_INSTANCE];
2810
+ if (ctx && typeof ctx[CONTEXT_UNREGISTER] === 'function') {
2811
+ ctx[CONTEXT_UNREGISTER](element);
2812
+ }
2813
+ }
2814
+ };
2815
+ // Per-handler timer slot to avoid debounce/throttle handlers on the same
2816
+ // element overwriting each other's state.
2817
+ const timerSlot = element[CONTEXT_TIMER] ||
2818
+ (element[CONTEXT_TIMER] = {});
2819
+ const timerKey = handlerName;
2820
+ if (options.debounce) {
2821
+ clearTimeout(timerSlot[timerKey]?.timeout);
2822
+ timerSlot[timerKey] = {
2823
+ timeout: setTimeout(callMethod, options.debounce),
2824
+ };
2825
+ return;
2826
+ }
2827
+ if (options.throttle) {
2828
+ const now = Date.now();
2829
+ const lastCall = timerSlot[timerKey]?.lastCall || 0;
2830
+ if (now - lastCall >= options.throttle) {
2831
+ timerSlot[timerKey] = { lastCall: now };
2832
+ callMethod();
2833
+ }
2834
+ return;
2835
+ }
2836
+ callMethod();
2837
+ };
2838
+ wrapped.set(handlerName, wrappedFn);
2839
+ // Register with the Context using the handler name (lookup goes through
2840
+ // the WRAPPED_CONTEXT_HANDLERS Map on the element).
2841
+ if (typeof ctx[CONTEXT_REGISTER] === 'function') {
2842
+ ctx[CONTEXT_REGISTER](element, handlerName);
2843
+ }
2844
+ // Synchronously emit current context to the just-registered handler so
2845
+ // field/method values are populated BEFORE the first render microtask
2846
+ // flushes — eliminates the cold-render flicker where ctx is undefined.
2847
+ try {
2848
+ wrappedFn(ctx);
2849
+ }
2850
+ catch (error) {
2851
+ console.error(`Error invoking @context handler at registration:`, error);
2852
+ }
2853
+ }
2854
+ }
2855
+ /**
2856
+ * Cleanup context handler for an element instance
2857
+ * Called automatically during element disconnection
2858
+ */
2859
+ function cleanupContextHandler(element) {
2860
+ const handlers = element.constructor[CONTEXT_HANDLERS];
2861
+ if (!handlers || !Array.isArray(handlers) || handlers.length === 0) {
2862
+ return;
2863
+ }
2864
+ // Clear any pending debounce timers (per-handler slots)
2865
+ const timerSlot = element[CONTEXT_TIMER];
2866
+ if (timerSlot && typeof timerSlot === 'object') {
2867
+ for (const key of Object.keys(timerSlot)) {
2868
+ if (timerSlot[key]?.timeout)
2869
+ clearTimeout(timerSlot[key].timeout);
2870
+ }
2871
+ delete element[CONTEXT_TIMER];
2872
+ }
2873
+ // Drop the per-element wrapped-handlers Map.
2874
+ delete element[WRAPPED_CONTEXT_HANDLERS];
2875
+ // Unregister from Context if available
2876
+ const ctx = element[NAVIGATION_CONTEXT_INSTANCE];
2877
+ if (ctx && typeof ctx[CONTEXT_UNREGISTER] === 'function') {
2878
+ ctx[CONTEXT_UNREGISTER](element);
2879
+ }
2880
+ delete element[NAVIGATION_CONTEXT_INSTANCE];
2881
+ delete element[CONTEXT_CALLED];
2882
+ }
2883
+
2682
2884
  // Controller-scoped cleanup registry
2683
2885
  class ControllerScope {
2684
2886
  constructor() {
@@ -2784,6 +2986,14 @@ async function attachController(element, controllerName) {
2784
2986
  if (routerContext !== undefined) {
2785
2987
  controllerInstance[ROUTER_CONTEXT] = routerContext;
2786
2988
  }
2989
+ // Mirror the element's CONTEXT_HANDLER onto the controller so
2990
+ // setupContextHandler can wire @context() handlers declared on the
2991
+ // controller class. This makes @context() work identically on elements
2992
+ // and controllers.
2993
+ const ctxHandler = element[CONTEXT_HANDLER];
2994
+ if (ctxHandler !== undefined) {
2995
+ controllerInstance[CONTEXT_HANDLER] = ctxHandler;
2996
+ }
2787
2997
  // Store references
2788
2998
  element[CONTROLLER_KEY] = controllerInstance;
2789
2999
  element[CONTROLLER_NAME_KEY] = controllerName;
@@ -2822,6 +3032,8 @@ async function attachController(element, controllerName) {
2822
3032
  setupResponseHandlers(controllerInstance, element);
2823
3033
  // Setup @on event handlers for controller
2824
3034
  setupEventHandlers(controllerInstance, element);
3035
+ // Setup @context() handlers for controller (fires sync emit at register)
3036
+ setupContextHandler(controllerInstance);
2825
3037
  element.dispatchEvent(new CustomEvent('controller-attached', {
2826
3038
  detail: { name: controllerName, controller: controllerInstance }
2827
3039
  }));
@@ -2858,12 +3070,15 @@ async function detachController(element) {
2858
3070
  cleanupResponseHandlers(controllerInstance);
2859
3071
  // Cleanup @on event handlers for controller
2860
3072
  cleanupEventHandlers(controllerInstance);
3073
+ // Cleanup @context() handlers for controller
3074
+ cleanupContextHandler(controllerInstance);
2861
3075
  // Cleanup the controller scope
2862
3076
  if (scope) {
2863
3077
  await scope.cleanup();
2864
3078
  }
2865
- // Clean up router context reference
3079
+ // Clean up router/context references
2866
3080
  delete controllerInstance[ROUTER_CONTEXT];
3081
+ delete controllerInstance[CONTEXT_HANDLER];
2867
3082
  delete element[CONTROLLER_KEY];
2868
3083
  delete element[CONTROLLER_NAME_KEY];
2869
3084
  delete element[CONTROLLER_OPERATIONS];
@@ -2958,206 +3173,6 @@ function useNativeElementControllers() {
2958
3173
  globalThis.sniceNativeControllerObserver = observer;
2959
3174
  }
2960
3175
 
2961
- /**
2962
- * @context decorator for receiving router context updates
2963
- */
2964
- const CONTEXT_HANDLERS = getSymbol('context-handlers');
2965
- /**
2966
- * @context decorator for receiving router context updates
2967
- *
2968
- * Works on both methods and fields:
2969
- *
2970
- * - **Method form**: the method is invoked with the current Context on every
2971
- * update (and once at register time so the first render sees the context).
2972
- * - **Field form**: the field is overwritten with the current Context on
2973
- * every update (and once at register time). Pair with `@property` if you
2974
- * want assignment to also schedule a re-render.
2975
- *
2976
- * @example
2977
- * ```typescript
2978
- * @element('my-layout')
2979
- * class MyLayout extends HTMLElement {
2980
- * // Method form
2981
- * @context()
2982
- * handleContext(ctx: Context) {
2983
- * this.renderNav(ctx.navigation.placards, ctx.navigation.route);
2984
- * }
2985
- *
2986
- * // Field form — the field is populated before first render
2987
- * @context() ctx!: Context;
2988
- *
2989
- * // Field + @property — assignment also triggers re-render
2990
- * @property({ attribute: false }) @context() reactiveCtx!: Context;
2991
- * }
2992
- * ```
2993
- */
2994
- function context$1(options = {}) {
2995
- return function (value, decoratorContext) {
2996
- const name = decoratorContext.name;
2997
- const kind = decoratorContext.kind;
2998
- const registerHandler = function () {
2999
- const constructor = this.constructor;
3000
- // De-dupe: methods identify by reference, fields identify by name.
3001
- if (!Object.prototype.hasOwnProperty.call(constructor, CONTEXT_METHODS)) {
3002
- constructor[CONTEXT_METHODS] = new Set();
3003
- }
3004
- const dedupeKey = kind === 'method' ? value : `field:${name}`;
3005
- if (constructor[CONTEXT_METHODS].has(dedupeKey))
3006
- return;
3007
- constructor[CONTEXT_METHODS].add(dedupeKey);
3008
- if (!Object.prototype.hasOwnProperty.call(constructor, CONTEXT_HANDLERS)) {
3009
- const inherited = constructor[CONTEXT_HANDLERS];
3010
- constructor[CONTEXT_HANDLERS] = inherited ? [...inherited] : [];
3011
- }
3012
- if (kind === 'method') {
3013
- constructor[CONTEXT_HANDLERS].push({
3014
- kind: 'method',
3015
- methodName: name,
3016
- method: value,
3017
- options,
3018
- });
3019
- }
3020
- else if (kind === 'field' || kind === 'accessor') {
3021
- constructor[CONTEXT_HANDLERS].push({
3022
- kind: 'field',
3023
- fieldName: name,
3024
- options,
3025
- });
3026
- }
3027
- };
3028
- if (kind === 'method') {
3029
- decoratorContext.addInitializer(registerHandler);
3030
- return value;
3031
- }
3032
- // Field decorators: do registration via the init function (fires per
3033
- // instance during construction, with `this` bound). Returning the init
3034
- // function is the canonical Stage 3 way for field decorators —
3035
- // `addInitializer` for fields can be late or unreliable across runtimes.
3036
- return function (initialValue) {
3037
- registerHandler.call(this);
3038
- return initialValue;
3039
- };
3040
- };
3041
- }
3042
- /**
3043
- * Setup context handler for an element instance
3044
- * Called automatically during element connection
3045
- */
3046
- function setupContextHandler(element) {
3047
- const handlers = element.constructor[CONTEXT_HANDLERS];
3048
- if (!handlers || !Array.isArray(handlers) || handlers.length === 0) {
3049
- return;
3050
- }
3051
- // Get the Context instance from the router
3052
- const ctx = element[CONTEXT_HANDLER];
3053
- if (!ctx) {
3054
- return;
3055
- }
3056
- // Store the Context instance for cleanup
3057
- element[NAVIGATION_CONTEXT_INSTANCE] = ctx;
3058
- // Per-element Map of handler-name → wrapped function. Symbol-keyed so it
3059
- // doesn't pollute the element's public surface.
3060
- let wrapped = element[WRAPPED_CONTEXT_HANDLERS];
3061
- if (!wrapped) {
3062
- wrapped = new Map();
3063
- element[WRAPPED_CONTEXT_HANDLERS] = wrapped;
3064
- }
3065
- // Register each handler with the Context
3066
- for (const handler of handlers) {
3067
- const { kind, options } = handler;
3068
- const handlerName = kind === 'field' ? handler.fieldName : handler.methodName;
3069
- // Create wrapped method with timing controls
3070
- const wrappedFn = function (context) {
3071
- // Skip if already called once
3072
- if (options.once && element[CONTEXT_CALLED]) {
3073
- return;
3074
- }
3075
- const callMethod = () => {
3076
- if (kind === 'field') {
3077
- element[handler.fieldName] = context;
3078
- }
3079
- else {
3080
- handler.method.call(element, context);
3081
- }
3082
- // Handle once option
3083
- if (options.once) {
3084
- element[CONTEXT_CALLED] = true;
3085
- // Unregister after first call
3086
- const ctx = element[NAVIGATION_CONTEXT_INSTANCE];
3087
- if (ctx && typeof ctx[CONTEXT_UNREGISTER] === 'function') {
3088
- ctx[CONTEXT_UNREGISTER](element);
3089
- }
3090
- }
3091
- };
3092
- // Per-handler timer slot to avoid debounce/throttle handlers on the same
3093
- // element overwriting each other's state.
3094
- const timerSlot = element[CONTEXT_TIMER] ||
3095
- (element[CONTEXT_TIMER] = {});
3096
- const timerKey = handlerName;
3097
- if (options.debounce) {
3098
- clearTimeout(timerSlot[timerKey]?.timeout);
3099
- timerSlot[timerKey] = {
3100
- timeout: setTimeout(callMethod, options.debounce),
3101
- };
3102
- return;
3103
- }
3104
- if (options.throttle) {
3105
- const now = Date.now();
3106
- const lastCall = timerSlot[timerKey]?.lastCall || 0;
3107
- if (now - lastCall >= options.throttle) {
3108
- timerSlot[timerKey] = { lastCall: now };
3109
- callMethod();
3110
- }
3111
- return;
3112
- }
3113
- callMethod();
3114
- };
3115
- wrapped.set(handlerName, wrappedFn);
3116
- // Register with the Context using the handler name (lookup goes through
3117
- // the WRAPPED_CONTEXT_HANDLERS Map on the element).
3118
- if (typeof ctx[CONTEXT_REGISTER] === 'function') {
3119
- ctx[CONTEXT_REGISTER](element, handlerName);
3120
- }
3121
- // Synchronously emit current context to the just-registered handler so
3122
- // field/method values are populated BEFORE the first render microtask
3123
- // flushes — eliminates the cold-render flicker where ctx is undefined.
3124
- try {
3125
- wrappedFn(ctx);
3126
- }
3127
- catch (error) {
3128
- console.error(`Error invoking @context handler at registration:`, error);
3129
- }
3130
- }
3131
- }
3132
- /**
3133
- * Cleanup context handler for an element instance
3134
- * Called automatically during element disconnection
3135
- */
3136
- function cleanupContextHandler(element) {
3137
- const handlers = element.constructor[CONTEXT_HANDLERS];
3138
- if (!handlers || !Array.isArray(handlers) || handlers.length === 0) {
3139
- return;
3140
- }
3141
- // Clear any pending debounce timers (per-handler slots)
3142
- const timerSlot = element[CONTEXT_TIMER];
3143
- if (timerSlot && typeof timerSlot === 'object') {
3144
- for (const key of Object.keys(timerSlot)) {
3145
- if (timerSlot[key]?.timeout)
3146
- clearTimeout(timerSlot[key].timeout);
3147
- }
3148
- delete element[CONTEXT_TIMER];
3149
- }
3150
- // Drop the per-element wrapped-handlers Map.
3151
- delete element[WRAPPED_CONTEXT_HANDLERS];
3152
- // Unregister from Context if available
3153
- const ctx = element[NAVIGATION_CONTEXT_INSTANCE];
3154
- if (ctx && typeof ctx[CONTEXT_UNREGISTER] === 'function') {
3155
- ctx[CONTEXT_UNREGISTER](element);
3156
- }
3157
- delete element[NAVIGATION_CONTEXT_INSTANCE];
3158
- delete element[CONTEXT_CALLED];
3159
- }
3160
-
3161
3176
  /**
3162
3177
  * @render and @styles decorators for Snice v3.0.0
3163
3178
  * Provides automatic differential rendering on property changes