snice 4.29.0 → 4.30.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 (516) hide show
  1. package/README.md +3 -10
  2. package/adapters/react/SniceProvider.d.ts +71 -0
  3. package/adapters/react/SniceProvider.js +49 -0
  4. package/adapters/react/SniceProvider.js.map +1 -0
  5. package/adapters/react/SniceRouter.d.ts +44 -0
  6. package/adapters/react/SniceRouter.js +190 -0
  7. package/adapters/react/SniceRouter.js.map +1 -0
  8. package/adapters/react/components.d.ts +2 -0
  9. package/adapters/react/components.d.ts.map +1 -1
  10. package/adapters/react/components.js +1 -0
  11. package/adapters/react/components.js.map +1 -1
  12. package/adapters/react/components.ts +2 -0
  13. package/adapters/react/grid.d.ts +36 -0
  14. package/adapters/react/grid.d.ts.map +1 -0
  15. package/adapters/react/grid.js +24 -0
  16. package/adapters/react/grid.js.map +1 -0
  17. package/adapters/react/grid.tsx +44 -0
  18. package/adapters/react/index.d.ts +5 -0
  19. package/adapters/react/index.d.ts.map +1 -1
  20. package/adapters/react/index.js +3 -2
  21. package/adapters/react/index.js.map +1 -1
  22. package/adapters/react/index.ts +6 -3
  23. package/adapters/react/matchRoute.d.ts +16 -0
  24. package/adapters/react/matchRoute.js +32 -0
  25. package/adapters/react/matchRoute.js.map +1 -0
  26. package/adapters/react/types.d.ts +1 -15
  27. package/adapters/react/types.d.ts.map +1 -1
  28. package/adapters/react/types.ts +1 -15
  29. package/adapters/react/useRequestHandler.js +1 -1
  30. package/adapters/react/useRequestHandler.js.map +1 -1
  31. package/bin/snice.js +8 -13
  32. package/bin/templates/{pwa → default}/index.html +1 -1
  33. package/bin/templates/{pwa → default}/src/components/app-header.ts +36 -18
  34. package/bin/templates/{pwa → default}/src/components/notification-badge.ts +2 -21
  35. package/bin/templates/{pwa → default}/src/components/search-bar.ts +12 -12
  36. package/bin/templates/default/src/context.ts +17 -0
  37. package/bin/templates/{pwa → default}/src/controllers/notification-controller.ts +10 -15
  38. package/bin/templates/{pwa → default}/src/daemons/notifications.ts +0 -12
  39. package/bin/templates/{pwa → default}/src/main.ts +1 -7
  40. package/bin/templates/{pwa → default}/src/middleware/error.ts +1 -8
  41. package/bin/templates/{pwa → default}/src/pages/dashboard.ts +17 -18
  42. package/bin/templates/{pwa → default}/src/pages/data.ts +24 -24
  43. package/bin/templates/{pwa → default}/src/pages/login.ts +3 -6
  44. package/bin/templates/{pwa → default}/src/pages/notifications.ts +21 -19
  45. package/bin/templates/{pwa → default}/src/pages/profile.ts +10 -12
  46. package/bin/templates/{pwa → default}/src/pages/settings.ts +22 -22
  47. package/bin/templates/default/src/router.ts +13 -0
  48. package/bin/templates/default/src/styles/global.css +16 -0
  49. package/bin/templates/{pwa → default}/tsconfig.json +2 -1
  50. package/bin/templates/react/README.md +124 -0
  51. package/bin/templates/react/global.d.ts +10 -0
  52. package/bin/templates/react/index.html +15 -0
  53. package/bin/templates/react/package.json +31 -0
  54. package/bin/templates/react/src/App.tsx +112 -0
  55. package/bin/templates/react/src/components/AppHeader.tsx +85 -0
  56. package/bin/templates/react/src/components/AppLayout.tsx +11 -0
  57. package/bin/templates/react/src/components/NotificationBadge.tsx +13 -0
  58. package/bin/templates/react/src/components/SearchBar.tsx +63 -0
  59. package/bin/templates/react/src/daemons/notifications.ts +136 -0
  60. package/bin/templates/react/src/fetcher.ts +15 -0
  61. package/bin/templates/react/src/guards/auth.ts +6 -0
  62. package/bin/templates/react/src/main.tsx +27 -0
  63. package/bin/templates/react/src/middleware/auth.ts +16 -0
  64. package/bin/templates/react/src/middleware/error.ts +29 -0
  65. package/bin/templates/react/src/middleware/retry.ts +31 -0
  66. package/bin/templates/react/src/pages/DashboardPage.tsx +111 -0
  67. package/bin/templates/react/src/pages/DataPage.tsx +119 -0
  68. package/bin/templates/react/src/pages/LoginPage.tsx +46 -0
  69. package/bin/templates/react/src/pages/NotificationsPage.tsx +119 -0
  70. package/bin/templates/react/src/pages/ProfilePage.tsx +92 -0
  71. package/bin/templates/react/src/pages/SettingsPage.tsx +165 -0
  72. package/bin/templates/react/src/services/auth.ts +48 -0
  73. package/bin/templates/react/src/services/jwt.ts +35 -0
  74. package/bin/templates/react/src/services/storage.ts +24 -0
  75. package/bin/templates/react/src/styles/global.css +382 -0
  76. package/bin/templates/react/src/types/auth.ts +21 -0
  77. package/bin/templates/react/src/types/notifications.ts +9 -0
  78. package/bin/templates/react/tests/helpers/test-utils.ts +79 -0
  79. package/bin/templates/react/tests/middleware/auth.test.ts +67 -0
  80. package/bin/templates/react/tests/middleware/error.test.ts +105 -0
  81. package/bin/templates/react/tests/middleware/retry.test.ts +103 -0
  82. package/bin/templates/react/tests/services/auth.test.ts +89 -0
  83. package/bin/templates/react/tests/services/jwt.test.ts +76 -0
  84. package/bin/templates/react/tests/services/storage.test.ts +69 -0
  85. package/bin/templates/{base → react}/tsconfig.json +4 -6
  86. package/bin/templates/react/vite.config.ts +18 -0
  87. package/bin/templates/react/vitest.config.ts +18 -0
  88. package/dist/cdn/accordion/snice-accordion.js +1 -1
  89. package/dist/cdn/accordion/snice-accordion.min.js +1 -1
  90. package/dist/cdn/action-bar/snice-action-bar.js +1 -1
  91. package/dist/cdn/action-bar/snice-action-bar.min.js +1 -1
  92. package/dist/cdn/activity-feed/snice-activity-feed.js +1 -1
  93. package/dist/cdn/activity-feed/snice-activity-feed.min.js +1 -1
  94. package/dist/cdn/alert/snice-alert.js +1 -1
  95. package/dist/cdn/alert/snice-alert.min.js +1 -1
  96. package/dist/cdn/app-tiles/snice-app-tiles.js +1 -1
  97. package/dist/cdn/app-tiles/snice-app-tiles.min.js +1 -1
  98. package/dist/cdn/approval-flow/snice-approval-flow.js +1 -1
  99. package/dist/cdn/approval-flow/snice-approval-flow.min.js +1 -1
  100. package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
  101. package/dist/cdn/audio-recorder/snice-audio-recorder.min.js +1 -1
  102. package/dist/cdn/availability/snice-availability.js +1 -1
  103. package/dist/cdn/availability/snice-availability.min.js +1 -1
  104. package/dist/cdn/avatar/snice-avatar.js +1 -1
  105. package/dist/cdn/avatar/snice-avatar.min.js +1 -1
  106. package/dist/cdn/avatar-group/snice-avatar-group.js +1 -1
  107. package/dist/cdn/avatar-group/snice-avatar-group.min.js +1 -1
  108. package/dist/cdn/badge/snice-badge.js +1 -1
  109. package/dist/cdn/badge/snice-badge.min.js +1 -1
  110. package/dist/cdn/banner/snice-banner.js +1 -1
  111. package/dist/cdn/banner/snice-banner.min.js +1 -1
  112. package/dist/cdn/binpack/snice-binpack.js +1 -1
  113. package/dist/cdn/binpack/snice-binpack.min.js +1 -1
  114. package/dist/cdn/book/snice-book.js +1 -1
  115. package/dist/cdn/book/snice-book.min.js +1 -1
  116. package/dist/cdn/booking/snice-booking.js +1 -1
  117. package/dist/cdn/booking/snice-booking.min.js +1 -1
  118. package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +1 -1
  119. package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +1 -1
  120. package/dist/cdn/button/snice-button.js +1 -1
  121. package/dist/cdn/button/snice-button.min.js +1 -1
  122. package/dist/cdn/calendar/snice-calendar.js +1 -1
  123. package/dist/cdn/calendar/snice-calendar.min.js +1 -1
  124. package/dist/cdn/camera/snice-camera.js +1 -1
  125. package/dist/cdn/camera/snice-camera.min.js +1 -1
  126. package/dist/cdn/camera-annotate/snice-camera-annotate.js +1 -1
  127. package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +1 -1
  128. package/dist/cdn/candlestick/snice-candlestick.js +1 -1
  129. package/dist/cdn/candlestick/snice-candlestick.min.js +1 -1
  130. package/dist/cdn/card/snice-card.js +1 -1
  131. package/dist/cdn/card/snice-card.min.js +1 -1
  132. package/dist/cdn/carousel/snice-carousel.js +1 -1
  133. package/dist/cdn/carousel/snice-carousel.min.js +1 -1
  134. package/dist/cdn/cart/snice-cart.js +1 -1
  135. package/dist/cdn/cart/snice-cart.min.js +1 -1
  136. package/dist/cdn/chart/snice-chart.js +1 -1
  137. package/dist/cdn/chart/snice-chart.min.js +1 -1
  138. package/dist/cdn/chat/snice-chat.js +1 -1
  139. package/dist/cdn/chat/snice-chat.min.js +1 -1
  140. package/dist/cdn/checkbox/snice-checkbox.js +1 -1
  141. package/dist/cdn/checkbox/snice-checkbox.min.js +1 -1
  142. package/dist/cdn/chip/README.md +2 -2
  143. package/dist/cdn/chip/snice-chip.js +2 -2
  144. package/dist/cdn/chip/snice-chip.js.map +1 -1
  145. package/dist/cdn/chip/snice-chip.min.js +3 -3
  146. package/dist/cdn/chip/snice-chip.min.js.map +1 -1
  147. package/dist/cdn/code-block/snice-code-block.js +1 -1
  148. package/dist/cdn/code-block/snice-code-block.min.js +1 -1
  149. package/dist/cdn/color-display/snice-color-display.js +1 -1
  150. package/dist/cdn/color-display/snice-color-display.min.js +1 -1
  151. package/dist/cdn/color-picker/snice-color-picker.js +1 -1
  152. package/dist/cdn/color-picker/snice-color-picker.min.js +1 -1
  153. package/dist/cdn/command-palette/snice-command-palette.js +1 -1
  154. package/dist/cdn/command-palette/snice-command-palette.min.js +1 -1
  155. package/dist/cdn/comments/snice-comments.js +1 -1
  156. package/dist/cdn/comments/snice-comments.min.js +1 -1
  157. package/dist/cdn/countdown/snice-countdown.js +1 -1
  158. package/dist/cdn/countdown/snice-countdown.min.js +1 -1
  159. package/dist/cdn/cropper/snice-cropper.js +1 -1
  160. package/dist/cdn/cropper/snice-cropper.min.js +1 -1
  161. package/dist/cdn/data-card/snice-data-card.js +1 -1
  162. package/dist/cdn/data-card/snice-data-card.min.js +1 -1
  163. package/dist/cdn/date-picker/README.md +1 -1
  164. package/dist/cdn/date-picker/snice-date-picker.js +2 -2
  165. package/dist/cdn/date-picker/snice-date-picker.js.map +1 -1
  166. package/dist/cdn/date-picker/snice-date-picker.min.js +2 -2
  167. package/dist/cdn/date-picker/snice-date-picker.min.js.map +1 -1
  168. package/dist/cdn/date-range-picker/README.md +1 -1
  169. package/dist/cdn/date-range-picker/snice-date-range-picker.js +2 -2
  170. package/dist/cdn/date-range-picker/snice-date-range-picker.js.map +1 -1
  171. package/dist/cdn/date-range-picker/snice-date-range-picker.min.js +11 -11
  172. package/dist/cdn/date-range-picker/snice-date-range-picker.min.js.map +1 -1
  173. package/dist/cdn/date-time-picker/README.md +1 -1
  174. package/dist/cdn/date-time-picker/snice-date-time-picker.js +2 -2
  175. package/dist/cdn/date-time-picker/snice-date-time-picker.js.map +1 -1
  176. package/dist/cdn/date-time-picker/snice-date-time-picker.min.js +2 -2
  177. package/dist/cdn/date-time-picker/snice-date-time-picker.min.js.map +1 -1
  178. package/dist/cdn/diff/snice-diff.js +1 -1
  179. package/dist/cdn/diff/snice-diff.min.js +1 -1
  180. package/dist/cdn/divider/snice-divider.js +1 -1
  181. package/dist/cdn/divider/snice-divider.min.js +1 -1
  182. package/dist/cdn/doc/snice-doc.js +1 -1
  183. package/dist/cdn/doc/snice-doc.min.js +1 -1
  184. package/dist/cdn/draw/README.md +2 -2
  185. package/dist/cdn/draw/snice-draw.js +26 -4
  186. package/dist/cdn/draw/snice-draw.js.map +1 -1
  187. package/dist/cdn/draw/snice-draw.min.js +3 -3
  188. package/dist/cdn/draw/snice-draw.min.js.map +1 -1
  189. package/dist/cdn/drawer/snice-drawer.js +1 -1
  190. package/dist/cdn/drawer/snice-drawer.min.js +1 -1
  191. package/dist/cdn/empty-state/snice-empty-state.js +1 -1
  192. package/dist/cdn/empty-state/snice-empty-state.min.js +1 -1
  193. package/dist/cdn/estimate/snice-estimate.js +1 -1
  194. package/dist/cdn/estimate/snice-estimate.min.js +1 -1
  195. package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
  196. package/dist/cdn/file-gallery/snice-file-gallery.min.js +1 -1
  197. package/dist/cdn/file-upload/snice-file-upload.js +1 -1
  198. package/dist/cdn/file-upload/snice-file-upload.min.js +1 -1
  199. package/dist/cdn/flip-card/snice-flip-card.js +1 -1
  200. package/dist/cdn/flip-card/snice-flip-card.min.js +1 -1
  201. package/dist/cdn/flow/snice-flow.js +1 -1
  202. package/dist/cdn/flow/snice-flow.min.js +1 -1
  203. package/dist/cdn/form-layout/snice-form-layout.js +1 -1
  204. package/dist/cdn/form-layout/snice-form-layout.min.js +1 -1
  205. package/dist/cdn/funnel/snice-funnel.js +1 -1
  206. package/dist/cdn/funnel/snice-funnel.min.js +1 -1
  207. package/dist/cdn/gantt/snice-gantt.js +1 -1
  208. package/dist/cdn/gantt/snice-gantt.min.js +1 -1
  209. package/dist/cdn/gauge/snice-gauge.js +1 -1
  210. package/dist/cdn/gauge/snice-gauge.min.js +1 -1
  211. package/dist/cdn/grid/README.md +27 -0
  212. package/dist/cdn/grid/snice-grid.js +862 -0
  213. package/dist/cdn/grid/snice-grid.js.map +1 -0
  214. package/dist/cdn/grid/snice-grid.min.js +13 -0
  215. package/dist/cdn/grid/snice-grid.min.js.map +1 -0
  216. package/dist/cdn/heatmap/snice-heatmap.js +1 -1
  217. package/dist/cdn/heatmap/snice-heatmap.min.js +1 -1
  218. package/dist/cdn/image/snice-image.js +1 -1
  219. package/dist/cdn/image/snice-image.min.js +1 -1
  220. package/dist/cdn/input/snice-input.js +1 -1
  221. package/dist/cdn/input/snice-input.min.js +1 -1
  222. package/dist/cdn/invoice/snice-invoice.js +1 -1
  223. package/dist/cdn/invoice/snice-invoice.min.js +1 -1
  224. package/dist/cdn/kanban/snice-kanban.js +1 -1
  225. package/dist/cdn/kanban/snice-kanban.min.js +1 -1
  226. package/dist/cdn/key-value/snice-key-value.js +1 -1
  227. package/dist/cdn/key-value/snice-key-value.min.js +1 -1
  228. package/dist/cdn/kpi/snice-kpi.js +1 -1
  229. package/dist/cdn/kpi/snice-kpi.min.js +1 -1
  230. package/dist/cdn/layout/snice-layout.js +1 -1
  231. package/dist/cdn/layout/snice-layout.min.js +1 -1
  232. package/dist/cdn/leaderboard/snice-leaderboard.js +1 -1
  233. package/dist/cdn/leaderboard/snice-leaderboard.min.js +1 -1
  234. package/dist/cdn/link/snice-link.js +1 -1
  235. package/dist/cdn/link/snice-link.min.js +1 -1
  236. package/dist/cdn/link-preview/snice-link-preview.js +1 -1
  237. package/dist/cdn/link-preview/snice-link-preview.min.js +1 -1
  238. package/dist/cdn/list/snice-list.js +1 -1
  239. package/dist/cdn/list/snice-list.min.js +1 -1
  240. package/dist/cdn/location/snice-location.js +1 -1
  241. package/dist/cdn/location/snice-location.min.js +1 -1
  242. package/dist/cdn/login/snice-login.js +1 -1
  243. package/dist/cdn/login/snice-login.min.js +1 -1
  244. package/dist/cdn/map/snice-map.js +1 -1
  245. package/dist/cdn/map/snice-map.min.js +1 -1
  246. package/dist/cdn/markdown/snice-markdown.js +1 -1
  247. package/dist/cdn/markdown/snice-markdown.min.js +1 -1
  248. package/dist/cdn/masonry/snice-masonry.js +1 -1
  249. package/dist/cdn/masonry/snice-masonry.min.js +1 -1
  250. package/dist/cdn/menu/snice-menu.js +1 -1
  251. package/dist/cdn/menu/snice-menu.min.js +1 -1
  252. package/dist/cdn/message-strip/README.md +2 -2
  253. package/dist/cdn/message-strip/snice-message-strip.js +2 -2
  254. package/dist/cdn/message-strip/snice-message-strip.js.map +1 -1
  255. package/dist/cdn/message-strip/snice-message-strip.min.js +6 -6
  256. package/dist/cdn/message-strip/snice-message-strip.min.js.map +1 -1
  257. package/dist/cdn/metric-table/snice-metric-table.js +1 -1
  258. package/dist/cdn/metric-table/snice-metric-table.min.js +1 -1
  259. package/dist/cdn/modal/snice-modal.js +1 -1
  260. package/dist/cdn/modal/snice-modal.min.js +1 -1
  261. package/dist/cdn/music-player/snice-music-player.js +1 -1
  262. package/dist/cdn/music-player/snice-music-player.min.js +1 -1
  263. package/dist/cdn/nav/snice-nav.js +1 -1
  264. package/dist/cdn/nav/snice-nav.min.js +1 -1
  265. package/dist/cdn/network-graph/snice-network-graph.js +1 -1
  266. package/dist/cdn/network-graph/snice-network-graph.min.js +1 -1
  267. package/dist/cdn/notification-center/snice-notification-center.js +1 -1
  268. package/dist/cdn/notification-center/snice-notification-center.min.js +1 -1
  269. package/dist/cdn/order-tracker/snice-order-tracker.js +1 -1
  270. package/dist/cdn/order-tracker/snice-order-tracker.min.js +1 -1
  271. package/dist/cdn/org-chart/snice-org-chart.js +1 -1
  272. package/dist/cdn/org-chart/snice-org-chart.min.js +1 -1
  273. package/dist/cdn/pagination/snice-pagination.js +1 -1
  274. package/dist/cdn/pagination/snice-pagination.min.js +1 -1
  275. package/dist/cdn/paint/README.md +2 -2
  276. package/dist/cdn/paint/snice-paint.js +26 -3
  277. package/dist/cdn/paint/snice-paint.js.map +1 -1
  278. package/dist/cdn/paint/snice-paint.min.js +3 -3
  279. package/dist/cdn/paint/snice-paint.min.js.map +1 -1
  280. package/dist/cdn/pdf-viewer/snice-pdf-viewer.js +1 -1
  281. package/dist/cdn/pdf-viewer/snice-pdf-viewer.min.js +1 -1
  282. package/dist/cdn/permission-matrix/snice-permission-matrix.js +1 -1
  283. package/dist/cdn/permission-matrix/snice-permission-matrix.min.js +1 -1
  284. package/dist/cdn/podcast-player/snice-podcast-player.js +1 -1
  285. package/dist/cdn/podcast-player/snice-podcast-player.min.js +1 -1
  286. package/dist/cdn/pricing-table/snice-pricing-table.js +1 -1
  287. package/dist/cdn/pricing-table/snice-pricing-table.min.js +1 -1
  288. package/dist/cdn/product-card/README.md +1 -1
  289. package/dist/cdn/product-card/snice-product-card.js +1 -1
  290. package/dist/cdn/product-card/snice-product-card.min.js +1 -1
  291. package/dist/cdn/progress/snice-progress.js +1 -1
  292. package/dist/cdn/progress/snice-progress.min.js +1 -1
  293. package/dist/cdn/progress-ring/snice-progress-ring.js +1 -1
  294. package/dist/cdn/progress-ring/snice-progress-ring.min.js +1 -1
  295. package/dist/cdn/qr-code/snice-qr-code.js +1 -1
  296. package/dist/cdn/qr-code/snice-qr-code.min.js +1 -1
  297. package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
  298. package/dist/cdn/qr-reader/snice-qr-reader.min.js +1 -1
  299. package/dist/cdn/radio/snice-radio.js +1 -1
  300. package/dist/cdn/radio/snice-radio.min.js +1 -1
  301. package/dist/cdn/range-slider/snice-range-slider.js +1 -1
  302. package/dist/cdn/range-slider/snice-range-slider.min.js +1 -1
  303. package/dist/cdn/rating/snice-rating.js +1 -1
  304. package/dist/cdn/rating/snice-rating.min.js +1 -1
  305. package/dist/cdn/receipt/snice-receipt.js +1 -1
  306. package/dist/cdn/receipt/snice-receipt.min.js +1 -1
  307. package/dist/cdn/recipe/snice-recipe.js +1 -1
  308. package/dist/cdn/recipe/snice-recipe.min.js +1 -1
  309. package/dist/cdn/runtime/README.md +2 -2
  310. package/dist/cdn/runtime/snice-runtime.esm.js +40 -15
  311. package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
  312. package/dist/cdn/runtime/snice-runtime.esm.min.js +7 -7
  313. package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
  314. package/dist/cdn/runtime/snice-runtime.js +40 -15
  315. package/dist/cdn/runtime/snice-runtime.js.map +1 -1
  316. package/dist/cdn/runtime/snice-runtime.min.js +6 -6
  317. package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
  318. package/dist/cdn/sankey/snice-sankey.js +1 -1
  319. package/dist/cdn/sankey/snice-sankey.min.js +1 -1
  320. package/dist/cdn/segmented-control/snice-segmented-control.js +1 -1
  321. package/dist/cdn/segmented-control/snice-segmented-control.min.js +1 -1
  322. package/dist/cdn/select/snice-select.js +1 -1
  323. package/dist/cdn/select/snice-select.min.js +1 -1
  324. package/dist/cdn/skeleton/snice-skeleton.js +1 -1
  325. package/dist/cdn/skeleton/snice-skeleton.min.js +1 -1
  326. package/dist/cdn/slider/snice-slider.js +1 -1
  327. package/dist/cdn/slider/snice-slider.min.js +1 -1
  328. package/dist/cdn/sortable/snice-sortable.js +1 -1
  329. package/dist/cdn/sortable/snice-sortable.min.js +1 -1
  330. package/dist/cdn/sparkline/snice-sparkline.js +1 -1
  331. package/dist/cdn/sparkline/snice-sparkline.min.js +1 -1
  332. package/dist/cdn/spinner/snice-spinner.js +1 -1
  333. package/dist/cdn/spinner/snice-spinner.min.js +1 -1
  334. package/dist/cdn/split-button/snice-split-button.js +1 -1
  335. package/dist/cdn/split-button/snice-split-button.min.js +1 -1
  336. package/dist/cdn/split-pane/snice-split-pane.js +1 -1
  337. package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
  338. package/dist/cdn/spotlight/snice-spotlight.js +1 -1
  339. package/dist/cdn/spotlight/snice-spotlight.min.js +1 -1
  340. package/dist/cdn/spreadsheet/snice-spreadsheet.js +1 -1
  341. package/dist/cdn/spreadsheet/snice-spreadsheet.min.js +1 -1
  342. package/dist/cdn/stat-group/snice-stat-group.js +1 -1
  343. package/dist/cdn/stat-group/snice-stat-group.min.js +1 -1
  344. package/dist/cdn/step-input/snice-step-input.js +1 -1
  345. package/dist/cdn/step-input/snice-step-input.min.js +1 -1
  346. package/dist/cdn/stepper/snice-stepper.js +1 -1
  347. package/dist/cdn/stepper/snice-stepper.min.js +1 -1
  348. package/dist/cdn/switch/snice-switch.js +1 -1
  349. package/dist/cdn/switch/snice-switch.min.js +1 -1
  350. package/dist/cdn/table/snice-table.js +1 -1
  351. package/dist/cdn/table/snice-table.min.js +1 -1
  352. package/dist/cdn/tabs/snice-tabs.js +1 -1
  353. package/dist/cdn/tabs/snice-tabs.min.js +1 -1
  354. package/dist/cdn/tag/README.md +1 -1
  355. package/dist/cdn/tag/snice-tag.js +2 -2
  356. package/dist/cdn/tag/snice-tag.js.map +1 -1
  357. package/dist/cdn/tag/snice-tag.min.js +3 -3
  358. package/dist/cdn/tag/snice-tag.min.js.map +1 -1
  359. package/dist/cdn/tag-input/README.md +2 -2
  360. package/dist/cdn/tag-input/snice-tag-input.js +2 -2
  361. package/dist/cdn/tag-input/snice-tag-input.js.map +1 -1
  362. package/dist/cdn/tag-input/snice-tag-input.min.js +2 -2
  363. package/dist/cdn/tag-input/snice-tag-input.min.js.map +1 -1
  364. package/dist/cdn/terminal/snice-terminal.js +1 -1
  365. package/dist/cdn/terminal/snice-terminal.min.js +1 -1
  366. package/dist/cdn/testimonial/snice-testimonial.js +1 -1
  367. package/dist/cdn/testimonial/snice-testimonial.min.js +1 -1
  368. package/dist/cdn/textarea/snice-textarea.js +1 -1
  369. package/dist/cdn/textarea/snice-textarea.min.js +1 -1
  370. package/dist/cdn/time-picker/README.md +1 -1
  371. package/dist/cdn/time-picker/snice-time-picker.js +2 -2
  372. package/dist/cdn/time-picker/snice-time-picker.js.map +1 -1
  373. package/dist/cdn/time-picker/snice-time-picker.min.js +2 -2
  374. package/dist/cdn/time-picker/snice-time-picker.min.js.map +1 -1
  375. package/dist/cdn/time-range-picker/snice-time-range-picker.js +1 -1
  376. package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +1 -1
  377. package/dist/cdn/timeline/snice-timeline.js +1 -1
  378. package/dist/cdn/timeline/snice-timeline.min.js +1 -1
  379. package/dist/cdn/timer/snice-timer.js +1 -1
  380. package/dist/cdn/timer/snice-timer.min.js +1 -1
  381. package/dist/cdn/toast/README.md +1 -1
  382. package/dist/cdn/toast/snice-toast.js +7 -3
  383. package/dist/cdn/toast/snice-toast.js.map +1 -1
  384. package/dist/cdn/toast/snice-toast.min.js +6 -6
  385. package/dist/cdn/toast/snice-toast.min.js.map +1 -1
  386. package/dist/cdn/tooltip/snice-tooltip.js +1 -1
  387. package/dist/cdn/tooltip/snice-tooltip.min.js +1 -1
  388. package/dist/cdn/tree/snice-tree.js +1 -1
  389. package/dist/cdn/tree/snice-tree.min.js +1 -1
  390. package/dist/cdn/treemap/snice-treemap.js +1 -1
  391. package/dist/cdn/treemap/snice-treemap.min.js +1 -1
  392. package/dist/cdn/user-card/snice-user-card.js +1 -1
  393. package/dist/cdn/user-card/snice-user-card.min.js +1 -1
  394. package/dist/cdn/video-player/snice-video-player.js +1 -1
  395. package/dist/cdn/video-player/snice-video-player.min.js +1 -1
  396. package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +1 -1
  397. package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +1 -1
  398. package/dist/cdn/waterfall/README.md +1 -1
  399. package/dist/cdn/waterfall/snice-waterfall.js +1 -1
  400. package/dist/cdn/waterfall/snice-waterfall.min.js +1 -1
  401. package/dist/cdn/weather/snice-weather.js +1 -1
  402. package/dist/cdn/weather/snice-weather.min.js +1 -1
  403. package/dist/cdn/work-order/snice-work-order.js +1 -1
  404. package/dist/cdn/work-order/snice-work-order.min.js +1 -1
  405. package/dist/components/chip/snice-chip.js +1 -1
  406. package/dist/components/chip/snice-chip.js.map +1 -1
  407. package/dist/components/date-picker/snice-date-picker.js +1 -1
  408. package/dist/components/date-picker/snice-date-picker.js.map +1 -1
  409. package/dist/components/date-range-picker/snice-date-range-picker.js +1 -1
  410. package/dist/components/date-range-picker/snice-date-range-picker.js.map +1 -1
  411. package/dist/components/date-time-picker/snice-date-time-picker.js +1 -1
  412. package/dist/components/date-time-picker/snice-date-time-picker.js.map +1 -1
  413. package/dist/components/draw/snice-draw.d.ts +2 -0
  414. package/dist/components/draw/snice-draw.js +25 -3
  415. package/dist/components/draw/snice-draw.js.map +1 -1
  416. package/dist/components/grid/snice-grid.d.ts +73 -0
  417. package/dist/components/grid/snice-grid.js +795 -0
  418. package/dist/components/grid/snice-grid.js.map +1 -0
  419. package/dist/components/grid/snice-grid.types.d.ts +41 -0
  420. package/dist/components/message-strip/snice-message-strip.js +1 -1
  421. package/dist/components/message-strip/snice-message-strip.js.map +1 -1
  422. package/dist/components/paint/snice-paint.d.ts +2 -0
  423. package/dist/components/paint/snice-paint.js +25 -2
  424. package/dist/components/paint/snice-paint.js.map +1 -1
  425. package/dist/components/tag/snice-tag.js +1 -1
  426. package/dist/components/tag/snice-tag.js.map +1 -1
  427. package/dist/components/tag-input/snice-tag-input.js +1 -1
  428. package/dist/components/tag-input/snice-tag-input.js.map +1 -1
  429. package/dist/components/theme/theme.css +15 -0
  430. package/dist/components/time-picker/snice-time-picker.js +1 -1
  431. package/dist/components/time-picker/snice-time-picker.js.map +1 -1
  432. package/dist/components/toast/snice-toast-container.js +4 -0
  433. package/dist/components/toast/snice-toast-container.js.map +1 -1
  434. package/dist/components/toast/snice-toast.js +2 -2
  435. package/dist/index.cjs +37 -12
  436. package/dist/index.cjs.map +1 -1
  437. package/dist/index.esm.js +37 -12
  438. package/dist/index.esm.js.map +1 -1
  439. package/dist/index.iife.js +37 -12
  440. package/dist/index.iife.js.map +1 -1
  441. package/dist/react/SniceProvider.d.ts +71 -0
  442. package/dist/react/SniceProvider.js +49 -0
  443. package/dist/react/SniceProvider.js.map +1 -0
  444. package/dist/react/SniceRouter.d.ts +44 -0
  445. package/dist/react/SniceRouter.js +190 -0
  446. package/dist/react/SniceRouter.js.map +1 -0
  447. package/dist/react/index.d.ts +3 -0
  448. package/dist/react/index.js +14 -0
  449. package/dist/react/index.js.map +1 -0
  450. package/dist/react/matchRoute.d.ts +16 -0
  451. package/dist/react/matchRoute.js +32 -0
  452. package/dist/react/matchRoute.js.map +1 -0
  453. package/dist/react/useRequestHandler.js +1 -1
  454. package/dist/react/useRequestHandler.js.map +1 -1
  455. package/dist/symbols.cjs +1 -1
  456. package/dist/symbols.esm.js +1 -1
  457. package/dist/transitions.cjs +1 -1
  458. package/dist/transitions.esm.js +1 -1
  459. package/dist/types/guard.d.ts +4 -11
  460. package/docs/ai/README.md +7 -7
  461. package/docs/ai/components/grid.md +116 -0
  462. package/docs/ai/patterns.md +24 -0
  463. package/docs/ai/react-integration.md +97 -0
  464. package/docs/components/grid.md +249 -0
  465. package/docs/plans/2026-03-10-grid-component-design.md +138 -0
  466. package/docs/plans/2026-03-10-grid-component-plan.md +716 -0
  467. package/docs/plans/2026-03-10-react-integration-plan.md +1178 -0
  468. package/docs/react-integration.md +508 -0
  469. package/docs/request-response.md +7 -21
  470. package/package.json +1 -1
  471. package/bin/templates/base/README.md +0 -33
  472. package/bin/templates/base/global.d.ts +0 -14
  473. package/bin/templates/base/index.html +0 -13
  474. package/bin/templates/base/package.json +0 -21
  475. package/bin/templates/base/src/components/counter-button.ts +0 -88
  476. package/bin/templates/base/src/components/counter-button.types.ts +0 -7
  477. package/bin/templates/base/src/components/feature-card.ts +0 -59
  478. package/bin/templates/base/src/components/feature-card.types.ts +0 -5
  479. package/bin/templates/base/src/controllers/counter-controller.ts +0 -24
  480. package/bin/templates/base/src/main.ts +0 -24
  481. package/bin/templates/base/src/pages/about-page.ts +0 -68
  482. package/bin/templates/base/src/pages/home-page.ts +0 -105
  483. package/bin/templates/base/src/pages/not-found-page.ts +0 -55
  484. package/bin/templates/base/src/router.ts +0 -9
  485. package/bin/templates/base/src/styles/global.css +0 -27
  486. package/bin/templates/base/src/types/api-response.ts +0 -5
  487. package/bin/templates/base/src/types/status.ts +0 -1
  488. package/bin/templates/base/src/types/theme.ts +0 -1
  489. package/bin/templates/base/src/types/user.ts +0 -5
  490. package/bin/templates/base/vite.config.ts +0 -38
  491. package/bin/templates/pwa/public/vite.svg +0 -1
  492. package/bin/templates/pwa/src/router.ts +0 -20
  493. package/bin/templates/pwa/src/styles/global.css +0 -64
  494. /package/bin/templates/{pwa → default}/README.md +0 -0
  495. /package/bin/templates/{pwa → default}/global.d.ts +0 -0
  496. /package/bin/templates/{pwa → default}/package.json +0 -0
  497. /package/bin/templates/{pwa → default}/public/icons/.gitkeep +0 -0
  498. /package/bin/templates/{base → default}/public/vite.svg +0 -0
  499. /package/bin/templates/{pwa → default}/src/fetcher.ts +0 -0
  500. /package/bin/templates/{pwa → default}/src/guards/auth.ts +0 -0
  501. /package/bin/templates/{pwa → default}/src/middleware/auth.ts +0 -0
  502. /package/bin/templates/{pwa → default}/src/middleware/retry.ts +0 -0
  503. /package/bin/templates/{pwa → default}/src/services/auth.ts +0 -0
  504. /package/bin/templates/{pwa → default}/src/services/jwt.ts +0 -0
  505. /package/bin/templates/{pwa → default}/src/services/storage.ts +0 -0
  506. /package/bin/templates/{pwa → default}/src/types/auth.ts +0 -0
  507. /package/bin/templates/{pwa → default}/src/types/notifications.ts +0 -0
  508. /package/bin/templates/{pwa → default}/tests/helpers/test-utils.ts +0 -0
  509. /package/bin/templates/{pwa → default}/tests/middleware/auth.test.ts +0 -0
  510. /package/bin/templates/{pwa → default}/tests/middleware/error.test.ts +0 -0
  511. /package/bin/templates/{pwa → default}/tests/middleware/retry.test.ts +0 -0
  512. /package/bin/templates/{pwa → default}/tests/services/auth.test.ts +0 -0
  513. /package/bin/templates/{pwa → default}/tests/services/jwt.test.ts +0 -0
  514. /package/bin/templates/{pwa → default}/tests/services/storage.test.ts +0 -0
  515. /package/bin/templates/{pwa → default}/vite.config.ts +0 -0
  516. /package/bin/templates/{pwa → default}/vitest.config.ts +0 -0
@@ -0,0 +1,48 @@
1
+ import type { LoginCredentials, LoginResponse, User } from '../types/auth';
2
+ import { setToken, setUser, clearToken, getToken } from './storage';
3
+ import { isTokenExpired } from './jwt';
4
+
5
+ // Mock API - replace with real API calls
6
+ const MOCK_USER: User = {
7
+ id: '1',
8
+ email: 'demo@example.com',
9
+ name: 'Demo User',
10
+ avatar: 'https://i.pravatar.cc/150?img=1'
11
+ };
12
+
13
+ const MOCK_TOKEN = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxIiwiZW1haWwiOiJkZW1vQGV4YW1wbGUuY29tIiwiaWF0IjoxNjE2MjM5MDIyLCJleHAiOjk5OTk5OTk5OTl9.mock';
14
+
15
+ export async function login(credentials: LoginCredentials): Promise<LoginResponse> {
16
+ // Simulate API call
17
+ await new Promise(resolve => setTimeout(resolve, 500));
18
+
19
+ // Mock validation
20
+ if (credentials.email === 'demo@example.com' && credentials.password === 'demo') {
21
+ setToken(MOCK_TOKEN);
22
+ setUser(MOCK_USER);
23
+
24
+ return {
25
+ token: MOCK_TOKEN,
26
+ user: MOCK_USER
27
+ };
28
+ }
29
+
30
+ throw new Error('Invalid credentials');
31
+ }
32
+
33
+ export async function logout(): Promise<void> {
34
+ clearToken();
35
+ }
36
+
37
+ export function isAuthenticated(): boolean {
38
+ const token = getToken();
39
+ if (!token) return false;
40
+ return !isTokenExpired(token);
41
+ }
42
+
43
+ export async function refreshToken(): Promise<string> {
44
+ // Mock refresh - in real app, call refresh endpoint
45
+ await new Promise(resolve => setTimeout(resolve, 300));
46
+ setToken(MOCK_TOKEN);
47
+ return MOCK_TOKEN;
48
+ }
@@ -0,0 +1,35 @@
1
+ interface JWTPayload {
2
+ exp?: number;
3
+ iat?: number;
4
+ sub?: string;
5
+ [key: string]: any;
6
+ }
7
+
8
+ export function decodeJWT(token: string): JWTPayload | null {
9
+ try {
10
+ const parts = token.split('.');
11
+ if (parts.length !== 3) return null;
12
+
13
+ const payload = parts[1];
14
+ const decoded = atob(payload.replace(/-/g, '+').replace(/_/g, '/'));
15
+ return JSON.parse(decoded);
16
+ } catch (err) {
17
+ console.error('Failed to decode JWT:', err);
18
+ return null;
19
+ }
20
+ }
21
+
22
+ export function isTokenExpired(token: string): boolean {
23
+ const payload = decodeJWT(token);
24
+ if (!payload || !payload.exp) return true;
25
+
26
+ const now = Math.floor(Date.now() / 1000);
27
+ return payload.exp < now;
28
+ }
29
+
30
+ export function getTokenExpiration(token: string): Date | null {
31
+ const payload = decodeJWT(token);
32
+ if (!payload || !payload.exp) return null;
33
+
34
+ return new Date(payload.exp * 1000);
35
+ }
@@ -0,0 +1,24 @@
1
+ const TOKEN_KEY = 'auth_token';
2
+ const USER_KEY = 'auth_user';
3
+
4
+ export function getToken(): string | null {
5
+ return localStorage.getItem(TOKEN_KEY);
6
+ }
7
+
8
+ export function setToken(token: string): void {
9
+ localStorage.setItem(TOKEN_KEY, token);
10
+ }
11
+
12
+ export function clearToken(): void {
13
+ localStorage.removeItem(TOKEN_KEY);
14
+ localStorage.removeItem(USER_KEY);
15
+ }
16
+
17
+ export function getUser<T>(): T | null {
18
+ const user = localStorage.getItem(USER_KEY);
19
+ return user ? JSON.parse(user) : null;
20
+ }
21
+
22
+ export function setUser<T>(user: T): void {
23
+ localStorage.setItem(USER_KEY, JSON.stringify(user));
24
+ }
@@ -0,0 +1,382 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ }
4
+
5
+ body {
6
+ margin: 0;
7
+ padding: 0;
8
+ font-family: var(--snice-font-family);
9
+ background: var(--snice-color-background-secondary);
10
+ color: var(--snice-color-text);
11
+ line-height: var(--snice-line-height-normal);
12
+ }
13
+
14
+ #root {
15
+ min-height: 100vh;
16
+ }
17
+
18
+ /* App Header */
19
+ .app-header {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: space-between;
23
+ padding: 0 1.5rem;
24
+ height: 60px;
25
+ background: var(--snice-color-background);
26
+ border-bottom: 1px solid var(--snice-color-border);
27
+ }
28
+
29
+ .app-header .brand a {
30
+ font-size: 1.25rem;
31
+ font-weight: 700;
32
+ color: var(--snice-color-primary);
33
+ text-decoration: none;
34
+ }
35
+
36
+ .app-header .nav-links {
37
+ display: flex;
38
+ gap: 1.5rem;
39
+ align-items: center;
40
+ }
41
+
42
+ .app-header .nav-links a {
43
+ color: var(--snice-color-text-secondary);
44
+ text-decoration: none;
45
+ font-size: 0.875rem;
46
+ font-weight: 500;
47
+ display: flex;
48
+ align-items: center;
49
+ gap: 0.375rem;
50
+ }
51
+
52
+ .app-header .nav-links a:hover {
53
+ color: var(--snice-color-primary);
54
+ }
55
+
56
+ .user-section {
57
+ position: relative;
58
+ }
59
+
60
+ .user-btn {
61
+ display: flex;
62
+ align-items: center;
63
+ gap: 0.5rem;
64
+ background: none;
65
+ border: none;
66
+ cursor: pointer;
67
+ padding: 0.375rem 0.5rem;
68
+ border-radius: var(--snice-border-radius-lg);
69
+ color: var(--snice-color-text);
70
+ }
71
+
72
+ .user-btn:hover {
73
+ background: var(--snice-color-background-secondary);
74
+ }
75
+
76
+ .user-name {
77
+ font-size: 0.875rem;
78
+ font-weight: 500;
79
+ }
80
+
81
+ .user-menu {
82
+ position: absolute;
83
+ right: 0;
84
+ top: 100%;
85
+ margin-top: 0.5rem;
86
+ min-width: 180px;
87
+ background: var(--snice-color-background);
88
+ border: 1px solid var(--snice-color-border);
89
+ border-radius: var(--snice-border-radius-lg);
90
+ box-shadow: var(--snice-shadow-lg);
91
+ padding: 0.5rem 0;
92
+ z-index: 100;
93
+ }
94
+
95
+ .user-menu a,
96
+ .user-menu button {
97
+ display: block;
98
+ width: 100%;
99
+ padding: 0.5rem 1rem;
100
+ color: var(--snice-color-text);
101
+ text-decoration: none;
102
+ background: none;
103
+ border: none;
104
+ cursor: pointer;
105
+ text-align: left;
106
+ font-size: 0.875rem;
107
+ }
108
+
109
+ .user-menu a:hover,
110
+ .user-menu button:hover {
111
+ background: var(--snice-color-background-secondary);
112
+ color: var(--snice-color-primary);
113
+ }
114
+
115
+ .login-link {
116
+ color: var(--snice-color-primary);
117
+ text-decoration: none;
118
+ font-weight: 500;
119
+ }
120
+
121
+ /* Notification Badge */
122
+ .notification-badge {
123
+ display: inline-flex;
124
+ align-items: center;
125
+ justify-content: center;
126
+ min-width: 18px;
127
+ height: 18px;
128
+ padding: 0 4px;
129
+ background: var(--snice-color-danger);
130
+ color: white;
131
+ font-size: 0.6875rem;
132
+ font-weight: 600;
133
+ border-radius: 9px;
134
+ line-height: 1;
135
+ }
136
+
137
+ /* Search Bar */
138
+ .search-bar {
139
+ display: flex;
140
+ align-items: center;
141
+ gap: 0.5rem;
142
+ padding: 0.5rem 0.75rem;
143
+ background: var(--snice-color-background);
144
+ border: 1px solid var(--snice-color-border);
145
+ border-radius: var(--snice-border-radius-lg);
146
+ width: 100%;
147
+ }
148
+
149
+ .search-bar:focus-within {
150
+ border-color: var(--snice-color-primary);
151
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--snice-color-primary) 15%, transparent);
152
+ }
153
+
154
+ .search-bar .search-icon {
155
+ color: var(--snice-color-text-secondary);
156
+ font-size: 0.875rem;
157
+ }
158
+
159
+ .search-bar input {
160
+ flex: 1;
161
+ border: none;
162
+ outline: none;
163
+ background: transparent;
164
+ font-size: 0.875rem;
165
+ color: var(--snice-color-text);
166
+ }
167
+
168
+ .search-bar input::placeholder {
169
+ color: var(--snice-color-text-secondary);
170
+ }
171
+
172
+ .search-bar .clear-btn {
173
+ background: none;
174
+ border: none;
175
+ cursor: pointer;
176
+ color: var(--snice-color-text-secondary);
177
+ font-size: 0.75rem;
178
+ padding: 0.125rem 0.25rem;
179
+ border-radius: var(--snice-border-radius-md);
180
+ }
181
+
182
+ .search-bar .clear-btn:hover {
183
+ background: var(--snice-color-background-secondary);
184
+ color: var(--snice-color-text);
185
+ }
186
+
187
+ /* Page Containers */
188
+ .page-container {
189
+ padding: 2rem;
190
+ max-width: 1200px;
191
+ margin: 0 auto;
192
+ }
193
+
194
+ .page-container-narrow {
195
+ padding: 2rem;
196
+ max-width: 800px;
197
+ margin: 0 auto;
198
+ }
199
+
200
+ .page-container-medium {
201
+ padding: 2rem;
202
+ max-width: 1000px;
203
+ margin: 0 auto;
204
+ }
205
+
206
+ /* Filter Buttons */
207
+ .filter-btn {
208
+ padding: 0.375rem 0.75rem;
209
+ border: 1px solid var(--snice-color-border);
210
+ border-radius: var(--snice-border-radius-md);
211
+ background: var(--snice-color-background);
212
+ color: var(--snice-color-text-secondary);
213
+ font-size: 0.8125rem;
214
+ cursor: pointer;
215
+ transition: all 0.15s;
216
+ }
217
+
218
+ .filter-btn:hover {
219
+ border-color: var(--snice-color-primary);
220
+ color: var(--snice-color-primary);
221
+ }
222
+
223
+ .filter-btn.active {
224
+ background: var(--snice-color-primary);
225
+ border-color: var(--snice-color-primary);
226
+ color: white;
227
+ }
228
+
229
+ /* Theme Buttons */
230
+ .theme-btn {
231
+ flex: 1;
232
+ display: flex;
233
+ flex-direction: column;
234
+ align-items: center;
235
+ gap: 0.5rem;
236
+ padding: 1rem;
237
+ background: var(--snice-color-background-secondary);
238
+ border: 2px solid var(--snice-color-border);
239
+ border-radius: var(--snice-border-radius-lg);
240
+ cursor: pointer;
241
+ color: var(--snice-color-text);
242
+ font-size: 0.875rem;
243
+ transition: border-color 0.2s;
244
+ }
245
+
246
+ .theme-btn:hover {
247
+ border-color: var(--snice-color-primary);
248
+ }
249
+
250
+ .theme-btn.active {
251
+ border-color: var(--snice-color-primary);
252
+ background: color-mix(in srgb, var(--snice-color-primary) 10%, transparent);
253
+ }
254
+
255
+ .theme-icon {
256
+ font-size: 1.5rem;
257
+ }
258
+
259
+ /* Data Table */
260
+ .data-table {
261
+ border: 1px solid var(--snice-color-border);
262
+ border-radius: var(--snice-border-radius-lg);
263
+ overflow: hidden;
264
+ }
265
+
266
+ .table-header {
267
+ display: grid;
268
+ grid-template-columns: 1fr 120px 100px;
269
+ padding: 0.75rem 1rem;
270
+ background: var(--snice-color-background-secondary);
271
+ font-size: 0.75rem;
272
+ font-weight: 600;
273
+ text-transform: uppercase;
274
+ letter-spacing: 0.05em;
275
+ color: var(--snice-color-text-secondary);
276
+ }
277
+
278
+ .table-row {
279
+ display: grid;
280
+ grid-template-columns: 1fr 120px 100px;
281
+ padding: 1rem;
282
+ border-top: 1px solid var(--snice-color-border);
283
+ align-items: center;
284
+ transition: background 0.15s;
285
+ }
286
+
287
+ .table-row:hover {
288
+ background: var(--snice-color-background-secondary);
289
+ }
290
+
291
+ .col-title strong {
292
+ display: block;
293
+ color: var(--snice-color-text);
294
+ font-size: 0.9375rem;
295
+ }
296
+
297
+ .col-title .description {
298
+ display: block;
299
+ font-size: 0.8125rem;
300
+ color: var(--snice-color-text-secondary);
301
+ margin-top: 0.125rem;
302
+ }
303
+
304
+ .col-status {
305
+ display: flex;
306
+ align-items: center;
307
+ gap: 0.375rem;
308
+ font-size: 0.8125rem;
309
+ color: var(--snice-color-text);
310
+ text-transform: capitalize;
311
+ }
312
+
313
+ .status-dot {
314
+ width: 8px;
315
+ height: 8px;
316
+ border-radius: 50%;
317
+ flex-shrink: 0;
318
+ }
319
+
320
+ .col-date {
321
+ font-size: 0.8125rem;
322
+ color: var(--snice-color-text-secondary);
323
+ }
324
+
325
+ /* Login Page */
326
+ .login-page {
327
+ display: flex;
328
+ align-items: center;
329
+ justify-content: center;
330
+ height: 100vh;
331
+ overflow: hidden;
332
+ background: linear-gradient(135deg, var(--snice-color-primary) 0%, var(--snice-color-primary-hover) 100%);
333
+ padding: 2rem;
334
+ box-sizing: border-box;
335
+ }
336
+
337
+ .login-page snice-login {
338
+ width: 100%;
339
+ max-width: 400px;
340
+ }
341
+
342
+ .login-page .hint {
343
+ margin: 0.25rem 0;
344
+ font-size: 0.875rem;
345
+ color: var(--snice-color-text-secondary);
346
+ text-align: center;
347
+ }
348
+
349
+ /* Animations */
350
+ @keyframes slideIn {
351
+ from {
352
+ opacity: 0;
353
+ transform: translateX(-20px);
354
+ }
355
+ to {
356
+ opacity: 1;
357
+ transform: translateX(0);
358
+ }
359
+ }
360
+
361
+ .notification-slide-in {
362
+ animation: slideIn 0.3s ease-out;
363
+ }
364
+
365
+ /* Responsive */
366
+ @media (max-width: 640px) {
367
+ .app-header .nav-links {
368
+ display: none;
369
+ }
370
+ .user-name {
371
+ display: none;
372
+ }
373
+ .stats-grid {
374
+ grid-template-columns: 1fr;
375
+ }
376
+ .theme-options {
377
+ flex-direction: column;
378
+ }
379
+ .filters {
380
+ flex-wrap: wrap;
381
+ }
382
+ }
@@ -0,0 +1,21 @@
1
+ export interface User {
2
+ id: string;
3
+ email: string;
4
+ name: string;
5
+ avatar?: string;
6
+ }
7
+
8
+ export interface LoginCredentials {
9
+ email: string;
10
+ password: string;
11
+ }
12
+
13
+ export interface LoginResponse {
14
+ token: string;
15
+ user: User;
16
+ }
17
+
18
+ export interface Principal {
19
+ user: User | null;
20
+ isAuthenticated: boolean;
21
+ }
@@ -0,0 +1,9 @@
1
+ export type NotificationType = 'info' | 'success' | 'warning' | 'error';
2
+
3
+ export interface Notification {
4
+ id: string;
5
+ title: string;
6
+ message: string;
7
+ type: NotificationType;
8
+ timestamp: string;
9
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Wait for a specified number of milliseconds
3
+ */
4
+ export async function waitFor(ms: number): Promise<void> {
5
+ return new Promise(resolve => setTimeout(resolve, ms));
6
+ }
7
+
8
+ /**
9
+ * Wait for a condition to become true
10
+ */
11
+ export async function waitUntil(
12
+ condition: () => boolean,
13
+ timeout = 1000,
14
+ interval = 10
15
+ ): Promise<void> {
16
+ const start = Date.now();
17
+ while (!condition()) {
18
+ if (Date.now() - start > timeout) {
19
+ throw new Error('Timeout waiting for condition');
20
+ }
21
+ await waitFor(interval);
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Create a container div and append it to document.body
27
+ */
28
+ export function createContainer(id = 'app'): HTMLDivElement {
29
+ const container = document.createElement('div');
30
+ container.id = id;
31
+ document.body.appendChild(container);
32
+ return container;
33
+ }
34
+
35
+ /**
36
+ * Clean up the document body
37
+ */
38
+ export function cleanup(): void {
39
+ document.body.innerHTML = '';
40
+ }
41
+
42
+ /**
43
+ * Mock localStorage for tests
44
+ */
45
+ export function mockLocalStorage() {
46
+ const store: Record<string, string> = {};
47
+
48
+ return {
49
+ getItem: vi.fn((key: string) => store[key] || null),
50
+ setItem: vi.fn((key: string, value: string) => {
51
+ store[key] = value;
52
+ }),
53
+ removeItem: vi.fn((key: string) => {
54
+ delete store[key];
55
+ }),
56
+ clear: vi.fn(() => {
57
+ Object.keys(store).forEach(key => delete store[key]);
58
+ }),
59
+ };
60
+ }
61
+
62
+ /**
63
+ * Mock fetch for tests
64
+ */
65
+ export function mockFetch(
66
+ response: unknown = {},
67
+ status = 200,
68
+ ok = true
69
+ ) {
70
+ return vi.fn(() =>
71
+ Promise.resolve({
72
+ ok,
73
+ status,
74
+ json: () => Promise.resolve(response),
75
+ text: () => Promise.resolve(JSON.stringify(response)),
76
+ headers: new Headers(),
77
+ } as Response)
78
+ );
79
+ }
@@ -0,0 +1,67 @@
1
+ import { describe, it, expect, beforeEach, vi } from 'vitest';
2
+ import { Context } from 'snice';
3
+ import { authMiddleware } from '../../src/middleware/auth';
4
+ import * as storage from '../../src/services/storage';
5
+
6
+ describe('Auth Middleware', () => {
7
+ let mockContext: Context;
8
+ let mockRequest: Request;
9
+ let mockNext: any;
10
+
11
+ beforeEach(() => {
12
+ localStorage.clear();
13
+ vi.clearAllMocks();
14
+
15
+ // Create mock context
16
+ mockContext = {
17
+ application: {
18
+ principal: {
19
+ user: null,
20
+ isAuthenticated: false,
21
+ },
22
+ },
23
+ navigation: {
24
+ route: '/',
25
+ params: {},
26
+ },
27
+ update: vi.fn(),
28
+ } as unknown as Context;
29
+
30
+ // Create mock request
31
+ mockRequest = new Request('https://api.example.com/data', {
32
+ headers: new Headers(),
33
+ });
34
+
35
+ // Create mock next function
36
+ const mockResponse = new Response('{}', { status: 200 });
37
+ mockNext = vi.fn(() => Promise.resolve(mockResponse));
38
+ });
39
+
40
+ it('should add Authorization header when token exists', async () => {
41
+ const token = 'test-token-123';
42
+ storage.setToken(token);
43
+
44
+ await authMiddleware.call(mockContext, mockRequest, mockNext);
45
+
46
+ expect(mockRequest.headers.get('Authorization')).toBe(`Bearer ${token}`);
47
+ expect(mockNext).toHaveBeenCalled();
48
+ });
49
+
50
+ it('should not add Authorization header when no token exists', async () => {
51
+ await authMiddleware.call(mockContext, mockRequest, mockNext);
52
+
53
+ expect(mockRequest.headers.get('Authorization')).toBeNull();
54
+ expect(mockNext).toHaveBeenCalled();
55
+ });
56
+
57
+ it('should call next() and return response', async () => {
58
+ const token = 'test-token-123';
59
+ storage.setToken(token);
60
+
61
+ const response = await authMiddleware.call(mockContext, mockRequest, mockNext);
62
+
63
+ expect(mockNext).toHaveBeenCalledTimes(1);
64
+ expect(response).toBeInstanceOf(Response);
65
+ expect(response.status).toBe(200);
66
+ });
67
+ });