tekivex-ui 2.5.14 → 2.5.16

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 (392) hide show
  1. package/dist/charts.cjs +1 -1
  2. package/dist/charts.js +22 -553
  3. package/dist/chunk-B3ph66Zb.js +1 -0
  4. package/dist/chunk-Bc16rJT-.js +1 -0
  5. package/dist/chunk-BiHAhNbu.js +3 -0
  6. package/dist/chunk-CVRuGUFA.js +1 -0
  7. package/dist/chunk-Dc4_ud5s.js +1 -0
  8. package/dist/chunk-Dj40UFcz.js +1 -0
  9. package/dist/chunk-DjxOP8W4.js +1 -0
  10. package/dist/chunk-DmRB1Blb.js +1 -0
  11. package/dist/chunk-PJ50l0JC.js +1 -0
  12. package/dist/headless.cjs +1 -1
  13. package/dist/headless.js +1 -442
  14. package/dist/i18n.cjs +1 -1
  15. package/dist/i18n.js +1 -733
  16. package/dist/index.cjs +1 -147
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +419 -16193
  19. package/dist/quantum.cjs +1 -89
  20. package/dist/quantum.js +74 -2551
  21. package/dist/realtime.cjs +1 -23
  22. package/dist/realtime.js +1 -804
  23. package/dist/src/a11y/index.d.ts +0 -1
  24. package/dist/src/charts/TkxAreaChart.d.ts +0 -5
  25. package/dist/src/charts/TkxBarChart.d.ts +0 -3
  26. package/dist/src/charts/TkxDonutChart.d.ts +0 -5
  27. package/dist/src/charts/TkxLineChart.d.ts +0 -1
  28. package/dist/src/charts/TkxPieChart.d.ts +0 -3
  29. package/dist/src/charts/TkxRadarChart.d.ts +0 -3
  30. package/dist/src/charts/TkxScatterChart.d.ts +0 -2
  31. package/dist/src/charts/index.d.ts +0 -1
  32. package/dist/src/charts/shared.d.ts +0 -3
  33. package/dist/src/components/TkxAIChatBubble.d.ts +0 -9
  34. package/dist/src/components/TkxAIConfidenceBar.d.ts +0 -6
  35. package/dist/src/components/TkxAIThinking.d.ts +0 -6
  36. package/dist/src/components/TkxAccordion.d.ts +0 -1
  37. package/dist/src/components/TkxAffix.d.ts +0 -1
  38. package/dist/src/components/TkxAlert.d.ts +0 -1
  39. package/dist/src/components/TkxAnchor.d.ts +0 -1
  40. package/dist/src/components/TkxAppBar.d.ts +0 -1
  41. package/dist/src/components/TkxAutocomplete.d.ts +0 -1
  42. package/dist/src/components/TkxAvatar.d.ts +0 -1
  43. package/dist/src/components/TkxBadge.d.ts +0 -1
  44. package/dist/src/components/TkxBottomNav.d.ts +0 -1
  45. package/dist/src/components/TkxBreadcrumb.d.ts +0 -1
  46. package/dist/src/components/TkxButton.d.ts +0 -1
  47. package/dist/src/components/TkxCard.d.ts +0 -1
  48. package/dist/src/components/TkxCarousel.d.ts +0 -1
  49. package/dist/src/components/TkxCascader.d.ts +0 -1
  50. package/dist/src/components/TkxChat.d.ts +0 -1
  51. package/dist/src/components/TkxCheckbox.d.ts +0 -1
  52. package/dist/src/components/TkxClock.d.ts +0 -1
  53. package/dist/src/components/TkxColorPicker.d.ts +0 -1
  54. package/dist/src/components/TkxCommand.d.ts +0 -1
  55. package/dist/src/components/TkxConfigProvider.d.ts +0 -30
  56. package/dist/src/components/TkxDataGrid.d.ts +0 -15
  57. package/dist/src/components/TkxDatePicker.d.ts +0 -1
  58. package/dist/src/components/TkxDivider.d.ts +0 -1
  59. package/dist/src/components/TkxDrawer.d.ts +0 -1
  60. package/dist/src/components/TkxDropdown.d.ts +0 -1
  61. package/dist/src/components/TkxEmpty.d.ts +0 -1
  62. package/dist/src/components/TkxFileUpload.d.ts +0 -1
  63. package/dist/src/components/TkxForm.d.ts +0 -35
  64. package/dist/src/components/TkxIcon.d.ts +0 -1
  65. package/dist/src/components/TkxImage.d.ts +0 -1
  66. package/dist/src/components/TkxInput.d.ts +0 -1
  67. package/dist/src/components/TkxLayout.d.ts +0 -22
  68. package/dist/src/components/TkxList.d.ts +0 -1
  69. package/dist/src/components/TkxLiveFeed.d.ts +0 -1
  70. package/dist/src/components/TkxLiveLog.d.ts +0 -1
  71. package/dist/src/components/TkxLiveMetrics.d.ts +0 -1
  72. package/dist/src/components/TkxLogo.d.ts +0 -1
  73. package/dist/src/components/TkxMarkdown.d.ts +19 -0
  74. package/dist/src/components/TkxMasonry.d.ts +0 -1
  75. package/dist/src/components/TkxMentions.d.ts +0 -1
  76. package/dist/src/components/TkxMenu.d.ts +0 -1
  77. package/dist/src/components/TkxModal.d.ts +0 -1
  78. package/dist/src/components/TkxNumberInput.d.ts +0 -1
  79. package/dist/src/components/TkxOTP.d.ts +0 -1
  80. package/dist/src/components/TkxPagination.d.ts +0 -1
  81. package/dist/src/components/TkxPlayground.d.ts +0 -13
  82. package/dist/src/components/TkxPopover.d.ts +0 -1
  83. package/dist/src/components/TkxProgress.d.ts +0 -1
  84. package/dist/src/components/TkxQRCode.d.ts +0 -1
  85. package/dist/src/components/TkxQuantumForm.d.ts +0 -1
  86. package/dist/src/components/TkxRadio.d.ts +0 -1
  87. package/dist/src/components/TkxRating.d.ts +0 -1
  88. package/dist/src/components/TkxRealTimeChart.d.ts +0 -1
  89. package/dist/src/components/TkxResult.d.ts +0 -1
  90. package/dist/src/components/TkxRichTextDisplay.d.ts +0 -1
  91. package/dist/src/components/TkxSegmented.d.ts +0 -1
  92. package/dist/src/components/TkxSelect.d.ts +0 -3
  93. package/dist/src/components/TkxSkeleton.d.ts +0 -1
  94. package/dist/src/components/TkxSlider.d.ts +0 -1
  95. package/dist/src/components/TkxSnackbar.d.ts +0 -1
  96. package/dist/src/components/TkxSpeedDial.d.ts +0 -1
  97. package/dist/src/components/TkxSpin.d.ts +0 -1
  98. package/dist/src/components/TkxStatistic.d.ts +0 -1
  99. package/dist/src/components/TkxStepper.d.ts +0 -1
  100. package/dist/src/components/TkxTable.d.ts +0 -1
  101. package/dist/src/components/TkxTabs.d.ts +0 -1
  102. package/dist/src/components/TkxTag.d.ts +0 -1
  103. package/dist/src/components/TkxThemeBuilder.d.ts +0 -1
  104. package/dist/src/components/TkxTimeline.d.ts +0 -1
  105. package/dist/src/components/TkxToast.d.ts +0 -1
  106. package/dist/src/components/TkxToggle.d.ts +0 -1
  107. package/dist/src/components/TkxToolbar.d.ts +0 -1
  108. package/dist/src/components/TkxTooltip.d.ts +0 -1
  109. package/dist/src/components/TkxTour.d.ts +0 -1
  110. package/dist/src/components/TkxTransferList.d.ts +0 -1
  111. package/dist/src/components/TkxTreeView.d.ts +0 -1
  112. package/dist/src/components/TkxTypography.d.ts +0 -1
  113. package/dist/src/components/TkxVideoPlayer.d.ts +0 -1
  114. package/dist/src/components/TkxWatermark.d.ts +0 -1
  115. package/dist/src/components/index.d.ts +1 -1
  116. package/dist/src/engine/css.d.ts +0 -1
  117. package/dist/src/engine/index.d.ts +0 -1
  118. package/dist/src/engine/quantum-ai.d.ts +0 -73
  119. package/dist/src/engine/quantum.d.ts +0 -1
  120. package/dist/src/engine/security.d.ts +0 -9
  121. package/dist/src/engine/tkx.d.ts +0 -53
  122. package/dist/src/engine/wcag.d.ts +0 -1
  123. package/dist/src/headless/index.d.ts +0 -1
  124. package/dist/src/headless/useControllable.d.ts +0 -15
  125. package/dist/src/headless/useDebounce.d.ts +0 -12
  126. package/dist/src/headless/useDisclosure.d.ts +0 -13
  127. package/dist/src/headless/useFormState.d.ts +0 -13
  128. package/dist/src/headless/useInfiniteQuery.d.ts +0 -11
  129. package/dist/src/headless/useIntersectionObserver.d.ts +0 -10
  130. package/dist/src/headless/useListSelection.d.ts +0 -9
  131. package/dist/src/headless/useLocalStorage.d.ts +0 -8
  132. package/dist/src/headless/useMediaQuery.d.ts +0 -10
  133. package/dist/src/headless/useRovingTabIndex.d.ts +0 -15
  134. package/dist/src/headless/useSSE.d.ts +0 -9
  135. package/dist/src/headless/useThrottle.d.ts +0 -7
  136. package/dist/src/headless/useWebSocket.d.ts +0 -9
  137. package/dist/src/hooks/index.d.ts +0 -1
  138. package/dist/src/i18n/I18nProvider.d.ts +0 -1
  139. package/dist/src/i18n/index.d.ts +0 -1
  140. package/dist/src/quantum/index.d.ts +0 -1
  141. package/dist/src/realtime/index.d.ts +0 -1
  142. package/dist/src/themes/index.d.ts +0 -1
  143. package/package.json +5 -3
  144. package/dist/TkxForm-BaO4wvXt.js +0 -320
  145. package/dist/TkxForm-M6ttomry.cjs +0 -12
  146. package/dist/chunk-Bmb41Sf3.cjs +0 -1
  147. package/dist/hooks-6pRsPOyG.js +0 -58
  148. package/dist/hooks-mivgRljH.cjs +0 -1
  149. package/dist/index.d.ts.map +0 -1
  150. package/dist/src/a11y/index.d.ts.map +0 -1
  151. package/dist/src/charts/TkxAreaChart.d.ts.map +0 -1
  152. package/dist/src/charts/TkxBarChart.d.ts.map +0 -1
  153. package/dist/src/charts/TkxDonutChart.d.ts.map +0 -1
  154. package/dist/src/charts/TkxLineChart.d.ts.map +0 -1
  155. package/dist/src/charts/TkxPieChart.d.ts.map +0 -1
  156. package/dist/src/charts/TkxRadarChart.d.ts.map +0 -1
  157. package/dist/src/charts/TkxScatterChart.d.ts.map +0 -1
  158. package/dist/src/charts/index.d.ts.map +0 -1
  159. package/dist/src/charts/shared.d.ts.map +0 -1
  160. package/dist/src/components/TkxAIChatBubble.d.ts.map +0 -1
  161. package/dist/src/components/TkxAIConfidenceBar.d.ts.map +0 -1
  162. package/dist/src/components/TkxAIThinking.d.ts.map +0 -1
  163. package/dist/src/components/TkxAccordion.d.ts.map +0 -1
  164. package/dist/src/components/TkxAffix.d.ts.map +0 -1
  165. package/dist/src/components/TkxAlert.d.ts.map +0 -1
  166. package/dist/src/components/TkxAnchor.d.ts.map +0 -1
  167. package/dist/src/components/TkxAppBar.d.ts.map +0 -1
  168. package/dist/src/components/TkxAutocomplete.d.ts.map +0 -1
  169. package/dist/src/components/TkxAvatar.d.ts.map +0 -1
  170. package/dist/src/components/TkxBadge.d.ts.map +0 -1
  171. package/dist/src/components/TkxBottomNav.d.ts.map +0 -1
  172. package/dist/src/components/TkxBreadcrumb.d.ts.map +0 -1
  173. package/dist/src/components/TkxButton.d.ts.map +0 -1
  174. package/dist/src/components/TkxCard.d.ts.map +0 -1
  175. package/dist/src/components/TkxCarousel.d.ts.map +0 -1
  176. package/dist/src/components/TkxCascader.d.ts.map +0 -1
  177. package/dist/src/components/TkxChat.d.ts.map +0 -1
  178. package/dist/src/components/TkxCheckbox.d.ts.map +0 -1
  179. package/dist/src/components/TkxClock.d.ts.map +0 -1
  180. package/dist/src/components/TkxColorPicker.d.ts.map +0 -1
  181. package/dist/src/components/TkxCommand.d.ts.map +0 -1
  182. package/dist/src/components/TkxConfigProvider.d.ts.map +0 -1
  183. package/dist/src/components/TkxDataGrid.d.ts.map +0 -1
  184. package/dist/src/components/TkxDatePicker.d.ts.map +0 -1
  185. package/dist/src/components/TkxDivider.d.ts.map +0 -1
  186. package/dist/src/components/TkxDrawer.d.ts.map +0 -1
  187. package/dist/src/components/TkxDropdown.d.ts.map +0 -1
  188. package/dist/src/components/TkxEmpty.d.ts.map +0 -1
  189. package/dist/src/components/TkxFileUpload.d.ts.map +0 -1
  190. package/dist/src/components/TkxForm.d.ts.map +0 -1
  191. package/dist/src/components/TkxIcon.d.ts.map +0 -1
  192. package/dist/src/components/TkxImage.d.ts.map +0 -1
  193. package/dist/src/components/TkxInput.d.ts.map +0 -1
  194. package/dist/src/components/TkxLayout.d.ts.map +0 -1
  195. package/dist/src/components/TkxList.d.ts.map +0 -1
  196. package/dist/src/components/TkxLiveFeed.d.ts.map +0 -1
  197. package/dist/src/components/TkxLiveLog.d.ts.map +0 -1
  198. package/dist/src/components/TkxLiveMetrics.d.ts.map +0 -1
  199. package/dist/src/components/TkxLogo.d.ts.map +0 -1
  200. package/dist/src/components/TkxMasonry.d.ts.map +0 -1
  201. package/dist/src/components/TkxMentions.d.ts.map +0 -1
  202. package/dist/src/components/TkxMenu.d.ts.map +0 -1
  203. package/dist/src/components/TkxModal.d.ts.map +0 -1
  204. package/dist/src/components/TkxNumberInput.d.ts.map +0 -1
  205. package/dist/src/components/TkxOTP.d.ts.map +0 -1
  206. package/dist/src/components/TkxPagination.d.ts.map +0 -1
  207. package/dist/src/components/TkxPlayground.d.ts.map +0 -1
  208. package/dist/src/components/TkxPopover.d.ts.map +0 -1
  209. package/dist/src/components/TkxProgress.d.ts.map +0 -1
  210. package/dist/src/components/TkxQRCode.d.ts.map +0 -1
  211. package/dist/src/components/TkxQuantumForm.d.ts.map +0 -1
  212. package/dist/src/components/TkxRadio.d.ts.map +0 -1
  213. package/dist/src/components/TkxRating.d.ts.map +0 -1
  214. package/dist/src/components/TkxRealTimeChart.d.ts.map +0 -1
  215. package/dist/src/components/TkxResult.d.ts.map +0 -1
  216. package/dist/src/components/TkxRichTextDisplay.d.ts.map +0 -1
  217. package/dist/src/components/TkxSegmented.d.ts.map +0 -1
  218. package/dist/src/components/TkxSelect.d.ts.map +0 -1
  219. package/dist/src/components/TkxSkeleton.d.ts.map +0 -1
  220. package/dist/src/components/TkxSlider.d.ts.map +0 -1
  221. package/dist/src/components/TkxSnackbar.d.ts.map +0 -1
  222. package/dist/src/components/TkxSpeedDial.d.ts.map +0 -1
  223. package/dist/src/components/TkxSpin.d.ts.map +0 -1
  224. package/dist/src/components/TkxStatistic.d.ts.map +0 -1
  225. package/dist/src/components/TkxStepper.d.ts.map +0 -1
  226. package/dist/src/components/TkxTable.d.ts.map +0 -1
  227. package/dist/src/components/TkxTabs.d.ts.map +0 -1
  228. package/dist/src/components/TkxTag.d.ts.map +0 -1
  229. package/dist/src/components/TkxThemeBuilder.d.ts.map +0 -1
  230. package/dist/src/components/TkxTimeline.d.ts.map +0 -1
  231. package/dist/src/components/TkxToast.d.ts.map +0 -1
  232. package/dist/src/components/TkxToggle.d.ts.map +0 -1
  233. package/dist/src/components/TkxToolbar.d.ts.map +0 -1
  234. package/dist/src/components/TkxTooltip.d.ts.map +0 -1
  235. package/dist/src/components/TkxTour.d.ts.map +0 -1
  236. package/dist/src/components/TkxTransferList.d.ts.map +0 -1
  237. package/dist/src/components/TkxTreeView.d.ts.map +0 -1
  238. package/dist/src/components/TkxTypography.d.ts.map +0 -1
  239. package/dist/src/components/TkxVideoPlayer.d.ts.map +0 -1
  240. package/dist/src/components/TkxWatermark.d.ts.map +0 -1
  241. package/dist/src/components/index.d.ts.map +0 -1
  242. package/dist/src/engine/css.d.ts.map +0 -1
  243. package/dist/src/engine/index.d.ts.map +0 -1
  244. package/dist/src/engine/quantum-ai.d.ts.map +0 -1
  245. package/dist/src/engine/quantum.d.ts.map +0 -1
  246. package/dist/src/engine/security.d.ts.map +0 -1
  247. package/dist/src/engine/tkx.d.ts.map +0 -1
  248. package/dist/src/engine/wcag.d.ts.map +0 -1
  249. package/dist/src/headless/index.d.ts.map +0 -1
  250. package/dist/src/headless/useControllable.d.ts.map +0 -1
  251. package/dist/src/headless/useDebounce.d.ts.map +0 -1
  252. package/dist/src/headless/useDisclosure.d.ts.map +0 -1
  253. package/dist/src/headless/useFormState.d.ts.map +0 -1
  254. package/dist/src/headless/useInfiniteQuery.d.ts.map +0 -1
  255. package/dist/src/headless/useIntersectionObserver.d.ts.map +0 -1
  256. package/dist/src/headless/useListSelection.d.ts.map +0 -1
  257. package/dist/src/headless/useLocalStorage.d.ts.map +0 -1
  258. package/dist/src/headless/useMediaQuery.d.ts.map +0 -1
  259. package/dist/src/headless/useRovingTabIndex.d.ts.map +0 -1
  260. package/dist/src/headless/useSSE.d.ts.map +0 -1
  261. package/dist/src/headless/useThrottle.d.ts.map +0 -1
  262. package/dist/src/headless/useWebSocket.d.ts.map +0 -1
  263. package/dist/src/hooks/index.d.ts.map +0 -1
  264. package/dist/src/i18n/I18nProvider.d.ts.map +0 -1
  265. package/dist/src/i18n/index.d.ts.map +0 -1
  266. package/dist/src/quantum/index.d.ts.map +0 -1
  267. package/dist/src/realtime/index.d.ts.map +0 -1
  268. package/dist/src/themes/index.d.ts.map +0 -1
  269. package/dist/themes-BbJanqiC.js +0 -498
  270. package/dist/themes-CMq2vWXj.cjs +0 -2
  271. package/dist/tkx-BoP5V5zy.cjs +0 -4
  272. package/dist/tkx-mOKMzvUK.js +0 -1174
  273. package/src/a11y/index.tsx +0 -87
  274. package/src/charts/TkxAreaChart.tsx +0 -121
  275. package/src/charts/TkxBarChart.tsx +0 -117
  276. package/src/charts/TkxDonutChart.tsx +0 -164
  277. package/src/charts/TkxLineChart.tsx +0 -137
  278. package/src/charts/TkxPieChart.tsx +0 -103
  279. package/src/charts/TkxRadarChart.tsx +0 -92
  280. package/src/charts/TkxScatterChart.tsx +0 -104
  281. package/src/charts/index.ts +0 -22
  282. package/src/charts/shared.ts +0 -47
  283. package/src/components/TkxAIChatBubble.tsx +0 -256
  284. package/src/components/TkxAIConfidenceBar.tsx +0 -133
  285. package/src/components/TkxAIThinking.tsx +0 -193
  286. package/src/components/TkxAccordion.tsx +0 -590
  287. package/src/components/TkxAffix.tsx +0 -140
  288. package/src/components/TkxAlert.tsx +0 -94
  289. package/src/components/TkxAnchor.tsx +0 -195
  290. package/src/components/TkxAppBar.tsx +0 -262
  291. package/src/components/TkxAutocomplete.tsx +0 -455
  292. package/src/components/TkxAvatar.tsx +0 -103
  293. package/src/components/TkxBadge.tsx +0 -75
  294. package/src/components/TkxBottomNav.tsx +0 -241
  295. package/src/components/TkxBreadcrumb.tsx +0 -324
  296. package/src/components/TkxButton.tsx +0 -155
  297. package/src/components/TkxCard.tsx +0 -96
  298. package/src/components/TkxCarousel.tsx +0 -554
  299. package/src/components/TkxCascader.tsx +0 -278
  300. package/src/components/TkxChat.tsx +0 -356
  301. package/src/components/TkxCheckbox.tsx +0 -220
  302. package/src/components/TkxClock.tsx +0 -603
  303. package/src/components/TkxColorPicker.tsx +0 -635
  304. package/src/components/TkxCommand.tsx +0 -646
  305. package/src/components/TkxConfigProvider.tsx +0 -460
  306. package/src/components/TkxDataGrid.tsx +0 -941
  307. package/src/components/TkxDatePicker.tsx +0 -1625
  308. package/src/components/TkxDivider.tsx +0 -51
  309. package/src/components/TkxDrawer.tsx +0 -236
  310. package/src/components/TkxDropdown.tsx +0 -804
  311. package/src/components/TkxEmpty.tsx +0 -221
  312. package/src/components/TkxFileUpload.tsx +0 -373
  313. package/src/components/TkxForm.tsx +0 -683
  314. package/src/components/TkxIcon.tsx +0 -685
  315. package/src/components/TkxImage.tsx +0 -279
  316. package/src/components/TkxInput.tsx +0 -103
  317. package/src/components/TkxLayout.tsx +0 -649
  318. package/src/components/TkxList.tsx +0 -244
  319. package/src/components/TkxLiveFeed.tsx +0 -331
  320. package/src/components/TkxLiveLog.tsx +0 -472
  321. package/src/components/TkxLiveMetrics.tsx +0 -315
  322. package/src/components/TkxLogo.tsx +0 -299
  323. package/src/components/TkxMasonry.tsx +0 -178
  324. package/src/components/TkxMentions.tsx +0 -212
  325. package/src/components/TkxMenu.tsx +0 -1044
  326. package/src/components/TkxModal.tsx +0 -122
  327. package/src/components/TkxNumberInput.tsx +0 -410
  328. package/src/components/TkxOTP.tsx +0 -297
  329. package/src/components/TkxPagination.tsx +0 -390
  330. package/src/components/TkxPlayground.tsx +0 -845
  331. package/src/components/TkxPopover.tsx +0 -297
  332. package/src/components/TkxProgress.tsx +0 -114
  333. package/src/components/TkxQRCode.tsx +0 -176
  334. package/src/components/TkxQuantumForm.tsx +0 -594
  335. package/src/components/TkxRadio.tsx +0 -286
  336. package/src/components/TkxRating.tsx +0 -288
  337. package/src/components/TkxRealTimeChart.tsx +0 -383
  338. package/src/components/TkxResult.tsx +0 -130
  339. package/src/components/TkxRichTextDisplay.tsx +0 -396
  340. package/src/components/TkxSegmented.tsx +0 -171
  341. package/src/components/TkxSelect.tsx +0 -1130
  342. package/src/components/TkxSkeleton.tsx +0 -107
  343. package/src/components/TkxSlider.tsx +0 -495
  344. package/src/components/TkxSnackbar.tsx +0 -316
  345. package/src/components/TkxSpeedDial.tsx +0 -397
  346. package/src/components/TkxSpin.tsx +0 -263
  347. package/src/components/TkxStatistic.tsx +0 -263
  348. package/src/components/TkxStepper.tsx +0 -487
  349. package/src/components/TkxTable.tsx +0 -424
  350. package/src/components/TkxTabs.tsx +0 -126
  351. package/src/components/TkxTag.tsx +0 -321
  352. package/src/components/TkxThemeBuilder.tsx +0 -687
  353. package/src/components/TkxTimeline.tsx +0 -305
  354. package/src/components/TkxToast.tsx +0 -287
  355. package/src/components/TkxToggle.tsx +0 -95
  356. package/src/components/TkxToolbar.tsx +0 -262
  357. package/src/components/TkxTooltip.tsx +0 -85
  358. package/src/components/TkxTour.tsx +0 -241
  359. package/src/components/TkxTransferList.tsx +0 -489
  360. package/src/components/TkxTreeView.tsx +0 -423
  361. package/src/components/TkxTypography.tsx +0 -267
  362. package/src/components/TkxVideoPlayer.tsx +0 -1015
  363. package/src/components/TkxWatermark.tsx +0 -145
  364. package/src/components/index.ts +0 -79
  365. package/src/engine/css.ts +0 -126
  366. package/src/engine/index.ts +0 -12
  367. package/src/engine/quantum-ai.ts +0 -1045
  368. package/src/engine/quantum.ts +0 -207
  369. package/src/engine/security.ts +0 -232
  370. package/src/engine/tkx.ts +0 -1084
  371. package/src/engine/wcag.ts +0 -276
  372. package/src/headless/index.ts +0 -52
  373. package/src/headless/useControllable.ts +0 -42
  374. package/src/headless/useDebounce.ts +0 -37
  375. package/src/headless/useDisclosure.ts +0 -30
  376. package/src/headless/useFormState.ts +0 -113
  377. package/src/headless/useInfiniteQuery.ts +0 -155
  378. package/src/headless/useIntersectionObserver.ts +0 -53
  379. package/src/headless/useListSelection.ts +0 -103
  380. package/src/headless/useLocalStorage.ts +0 -48
  381. package/src/headless/useMediaQuery.ts +0 -39
  382. package/src/headless/useRovingTabIndex.ts +0 -86
  383. package/src/headless/useSSE.ts +0 -167
  384. package/src/headless/useThrottle.ts +0 -48
  385. package/src/headless/useWebSocket.ts +0 -231
  386. package/src/hooks/index.ts +0 -122
  387. package/src/i18n/I18nProvider.tsx +0 -36
  388. package/src/i18n/index.ts +0 -877
  389. package/src/quantum/index.ts +0 -39
  390. package/src/realtime/index.ts +0 -21
  391. package/src/styles/global.css +0 -167
  392. package/src/themes/index.ts +0 -294
@@ -1,845 +0,0 @@
1
- 'use client';
2
-
3
- // ── TkxPlayground ─────────────────────────────────────────────────────────────
4
- // In-browser live component playground. Type JSX, see it render instantly.
5
- // Uses new Function() evaluation, an error boundary, quantum component
6
- // suggestions via AmplitudeAmplifier, and real-time render-time metrics.
7
- //
8
- // ⚠ SECURITY NOTICE — new Function() / arbitrary code execution
9
- // ─────────────────────────────────────────────────────────────────────────────
10
- // TkxPlayground intentionally evaluates user-supplied JSX using new Function().
11
- // This is an INTENTIONAL design decision for a developer-facing live playground;
12
- // it is NOT suitable for executing untrusted user content.
13
- //
14
- // Risk: new Function() does NOT provide a true sandbox. Code running inside it
15
- // has access to the JavaScript global scope, including window, document, and
16
- // fetch. A malicious actor with access to the playground input could exfiltrate
17
- // data or execute arbitrary browser-side code.
18
- //
19
- // Mitigation in this component:
20
- // • The playground is intended for developer tooling / docs sites only.
21
- // • "use strict" is applied inside the evaluated function.
22
- // • An ErrorBoundary catches runtime exceptions from bad code.
23
- // • All output is rendered inside React's reconciler (no innerHTML).
24
- //
25
- // If you need a true sandbox (e.g. for user-facing code execution):
26
- // • Use a sandboxed <iframe sandbox="allow-scripts"> with a restrictive CSP.
27
- // • Or run evaluation in a Web Worker (no DOM access).
28
- // • Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox
29
- // ─────────────────────────────────────────────────────────────────────────────
30
-
31
- import { useState, useCallback, useRef, useEffect, type ReactNode } from 'react';
32
- import React from 'react';
33
- import { useTheme } from '../themes';
34
- import { AmplitudeAmplifier } from '../engine/quantum-ai';
35
-
36
- // ── Public API ────────────────────────────────────────────────────────────────
37
-
38
- export interface PlaygroundExample {
39
- label: string;
40
- code: string;
41
- }
42
-
43
- export interface TkxPlaygroundProps {
44
- defaultCode?: string;
45
- examples?: PlaygroundExample[];
46
- height?: number;
47
- imports?: Record<string, unknown>;
48
- /**
49
- * When true, reject code containing high-risk tokens (fetch, XMLHttpRequest,
50
- * document.cookie, localStorage, sessionStorage, import(), window.*, eval).
51
- * Defense-in-depth — not a true sandbox. Default: true.
52
- *
53
- * Set to `false` only in trusted developer environments where the playground
54
- * input cannot come from an untrusted third party.
55
- */
56
- strictMode?: boolean;
57
- /**
58
- * Additional forbidden substrings appended to the default deny list
59
- * (when strictMode is on).
60
- */
61
- forbiddenTokens?: string[];
62
- }
63
-
64
- // Conservative deny list for strictMode. These patterns signal network
65
- // exfiltration, storage access, or global-scope escape — capabilities that
66
- // live-playground snippets should never need. Matching is substring-based
67
- // and case-insensitive; it is intentionally coarse (false-positives are
68
- // acceptable when the alternative is arbitrary code execution).
69
- const DEFAULT_FORBIDDEN_TOKENS = [
70
- 'fetch(',
71
- 'XMLHttpRequest',
72
- 'navigator.sendBeacon',
73
- 'document.cookie',
74
- 'localStorage',
75
- 'sessionStorage',
76
- 'indexedDB',
77
- 'WebSocket',
78
- 'EventSource',
79
- 'import(',
80
- 'eval(',
81
- 'new Function(',
82
- 'postMessage',
83
- 'window.open',
84
- 'location.href',
85
- 'location.replace',
86
- 'location.assign',
87
- 'document.write',
88
- 'crypto.subtle',
89
- ];
90
-
91
- function detectForbiddenToken(code: string, extra?: string[]): string | null {
92
- const needles = [...DEFAULT_FORBIDDEN_TOKENS, ...(extra ?? [])];
93
- const lower = code.toLowerCase();
94
- for (const n of needles) {
95
- if (lower.includes(n.toLowerCase())) return n;
96
- }
97
- return null;
98
- }
99
-
100
- // ── Built-in examples ─────────────────────────────────────────────────────────
101
-
102
- const BUILT_IN_EXAMPLES: PlaygroundExample[] = [
103
- {
104
- label: 'Hello World',
105
- code: `<div style={{ padding: 24, fontFamily: 'sans-serif', color: '#e8e8f4' }}>
106
- <h2 style={{ margin: 0 }}>👋 Hello, TkxPlayground!</h2>
107
- <p style={{ marginTop: 8, opacity: 0.7 }}>Edit the code on the left to see live updates.</p>
108
- </div>`,
109
- },
110
- {
111
- label: 'Button Styles',
112
- code: `<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', padding: 24 }}>
113
- {['primary', 'success', 'danger', 'warning', 'info'].map(color => (
114
- <button
115
- key={color}
116
- style={{
117
- padding: '8px 18px',
118
- borderRadius: 8,
119
- border: 'none',
120
- background: color === 'primary' ? '#00f5d4' : color === 'success' ? '#06d6a0' : color === 'danger' ? '#f72585' : color === 'warning' ? '#ffbe0b' : '#3a86ff',
121
- color: '#0a0a0f',
122
- fontWeight: 700,
123
- cursor: 'pointer',
124
- textTransform: 'capitalize',
125
- }}
126
- >
127
- {color}
128
- </button>
129
- ))}
130
- </div>`,
131
- },
132
- {
133
- label: 'Card Grid',
134
- code: `<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16, padding: 24 }}>
135
- {['Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta'].map(name => (
136
- <div key={name} style={{
137
- background: '#1a1a2e',
138
- borderRadius: 10,
139
- border: '1px solid #2a2a3e',
140
- padding: '16px',
141
- }}>
142
- <div style={{ fontWeight: 700, color: '#00f5d4', marginBottom: 4 }}>{name}</div>
143
- <div style={{ fontSize: 12, color: '#8888aa' }}>Quantum module {name.toLowerCase()}</div>
144
- </div>
145
- ))}
146
- </div>`,
147
- },
148
- {
149
- label: 'Animated Counter',
150
- code: `(() => {
151
- const [count, setCount] = React.useState(0);
152
- return (
153
- <div style={{ padding: 32, textAlign: 'center', fontFamily: 'sans-serif' }}>
154
- <div style={{ fontSize: 64, fontWeight: 900, color: '#00f5d4', marginBottom: 16 }}>
155
- {count}
156
- </div>
157
- <div style={{ display: 'flex', gap: 12, justifyContent: 'center' }}>
158
- <button onClick={() => setCount(c => c - 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>−</button>
159
- <button onClick={() => setCount(0)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#8888aa', cursor: 'pointer' }}>Reset</button>
160
- <button onClick={() => setCount(c => c + 1)} style={{ padding: '8px 20px', borderRadius: 8, border: '1px solid #2a2a3e', background: '#1a1a2e', color: '#e8e8f4', fontSize: 20, cursor: 'pointer' }}>+</button>
161
- </div>
162
- </div>
163
- );
164
- })()`,
165
- },
166
- {
167
- label: 'Data Table',
168
- code: `(() => {
169
- const rows = [
170
- { id: 1, name: 'Hydrogen', symbol: 'H', mass: 1.008 },
171
- { id: 2, name: 'Helium', symbol: 'He', mass: 4.003 },
172
- { id: 3, name: 'Lithium', symbol: 'Li', mass: 6.941 },
173
- { id: 4, name: 'Carbon', symbol: 'C', mass: 12.011 },
174
- { id: 5, name: 'Nitrogen', symbol: 'N', mass: 14.007 },
175
- ];
176
- const cell = { padding: '8px 14px', borderBottom: '1px solid #2a2a3e', color: '#e8e8f4', fontSize: 13 };
177
- const hcell = { ...cell, color: '#8888aa', fontWeight: 600, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.06em' };
178
- return (
179
- <div style={{ padding: 16 }}>
180
- <table style={{ width: '100%', borderCollapse: 'collapse', fontFamily: 'sans-serif' }}>
181
- <thead>
182
- <tr>{['ID','Element','Symbol','Atomic Mass'].map(h => <th key={h} style={hcell}>{h}</th>)}</tr>
183
- </thead>
184
- <tbody>
185
- {rows.map(r => (
186
- <tr key={r.id} style={{ transition: 'background 0.15s' }}>
187
- <td style={cell}>{r.id}</td>
188
- <td style={cell}>{r.name}</td>
189
- <td style={{ ...cell, color: '#00f5d4', fontWeight: 700 }}>{r.symbol}</td>
190
- <td style={cell}>{r.mass}</td>
191
- </tr>
192
- ))}
193
- </tbody>
194
- </table>
195
- </div>
196
- );
197
- })()`,
198
- },
199
- ];
200
-
201
- // ── Error Boundary (class component) ─────────────────────────────────────────
202
-
203
- interface ErrorBoundaryProps {
204
- children: ReactNode;
205
- onError: (msg: string) => void;
206
- }
207
- interface ErrorBoundaryState {
208
- hasError: boolean;
209
- }
210
-
211
- class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
212
- constructor(props: ErrorBoundaryProps) {
213
- super(props);
214
- this.state = { hasError: false };
215
- }
216
- static getDerivedStateFromError(): ErrorBoundaryState {
217
- return { hasError: true };
218
- }
219
- componentDidCatch(error: Error) {
220
- this.props.onError(error.message);
221
- }
222
- componentDidUpdate(prev: ErrorBoundaryProps) {
223
- // Reset when children change (new render)
224
- if (prev.children !== this.props.children && this.state.hasError) {
225
- this.setState({ hasError: false });
226
- }
227
- }
228
- render() {
229
- if (this.state.hasError) return null;
230
- return this.props.children;
231
- }
232
- }
233
-
234
- // ── Code evaluator ────────────────────────────────────────────────────────────
235
-
236
- // Babel standalone is loaded via <script> tag in the host page (see demo/index.html)
237
- // for JSX transformation. We probe for it lazily so the library bundle stays clean.
238
- interface BabelStandalone {
239
- transform(code: string, opts: Record<string, unknown>): { code: string };
240
- }
241
- function getBabel(): BabelStandalone | null {
242
- if (typeof window === 'undefined') return null;
243
- return (window as unknown as { Babel?: BabelStandalone }).Babel ?? null;
244
- }
245
-
246
- function evalCode(
247
- code: string,
248
- importsObj: Record<string, unknown>,
249
- opts?: { strictMode?: boolean; forbiddenTokens?: string[] },
250
- ): { element: ReactNode | null; error: string | null; renderMs: number } {
251
- const t0 = performance.now();
252
- try {
253
- const trimmed = code.trim();
254
-
255
- // Strict-mode defense: block high-risk tokens before evaluation.
256
- // Not a sandbox — a layer of protection against accidental exfiltration
257
- // when a playground is wired to untrusted input (e.g. shared snippets).
258
- if (opts?.strictMode !== false) {
259
- const hit = detectForbiddenToken(trimmed, opts?.forbiddenTokens);
260
- if (hit) {
261
- const renderMs = parseFloat((performance.now() - t0).toFixed(2));
262
- return {
263
- element: null,
264
- error:
265
- `Blocked by playground strictMode: code contains "${hit}". ` +
266
- `This token is disallowed because playground snippets run in the ` +
267
- `page's JavaScript context. If you trust the source, pass ` +
268
- `strictMode={false} to <TkxPlayground>.`,
269
- renderMs,
270
- };
271
- }
272
- }
273
-
274
- // Always wrap user code in a function component so React hooks (useState,
275
- // useEffect, ...) work — they require an active render context to dispatch.
276
- // The user can write a single JSX expression OR a function body that returns JSX.
277
- const looksLikeExpression = trimmed.startsWith('<') || trimmed.startsWith('(');
278
- const componentBody = looksLikeExpression
279
- ? `return (${trimmed});`
280
- : trimmed; // assume the user wrote `const x = ...; return <jsx>;`
281
-
282
- // Babel transforms the JSX source first, then we inject it into new Function().
283
- // IMPORTANT: `return PlaygroundRoot` must NOT be in the Babel-transformed source —
284
- // Babel treats the input as a module/script where top-level `return` is a syntax error.
285
- // Instead, Babel only sees the function definition; the `return` is appended afterward
286
- // as a plain JS string that never passes through Babel.
287
- let jsxSource = `
288
- function PlaygroundRoot() {
289
- ${componentBody}
290
- }
291
- `;
292
-
293
- const babel = getBabel();
294
- if (babel) {
295
- jsxSource = babel.transform(jsxSource, {
296
- presets: ['react'],
297
- filename: 'playground.jsx',
298
- }).code ?? jsxSource;
299
- }
300
-
301
- // SECURITY: new Function() is used intentionally for the live playground.
302
- // This executes user-provided JSX in a sandboxed scope with only React and
303
- // component imports available. No access to window, document, or globals.
304
- // NOTE: new Function() does NOT create a true sandbox — window/document are
305
- // still reachable via the global scope. A true sandbox would require an
306
- // iframe with a restrictive CSP (e.g., Content-Security-Policy: script-src 'none').
307
- // For production deployments, consider wrapping this in a sandboxed iframe.
308
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
309
- const fn = new Function(
310
- 'React',
311
- 'imports',
312
- `
313
- "use strict";
314
- const { ${Object.keys(importsObj).join(', ')} } = imports;
315
- ${jsxSource}
316
- return PlaygroundRoot;
317
- `,
318
- ) as (r: typeof React, i: Record<string, unknown>) => React.ComponentType;
319
- const Component = fn(React, importsObj);
320
- const element = React.createElement(Component);
321
- const renderMs = parseFloat((performance.now() - t0).toFixed(2));
322
- return { element, error: null, renderMs };
323
- } catch (err) {
324
- const renderMs = parseFloat((performance.now() - t0).toFixed(2));
325
- return { element: null, error: err instanceof Error ? err.message : String(err), renderMs };
326
- }
327
- }
328
-
329
- // ── Line numbers overlay ──────────────────────────────────────────────────────
330
-
331
- function LineNumbers({ code, lineHeight }: { code: string; lineHeight: number }) {
332
- const lines = code.split('\n');
333
- return (
334
- <div
335
- aria-hidden="true"
336
- style={{
337
- position: 'absolute',
338
- top: 0,
339
- left: 0,
340
- width: '36px',
341
- padding: '12px 0',
342
- textAlign: 'right',
343
- paddingRight: '8px',
344
- userSelect: 'none',
345
- pointerEvents: 'none',
346
- fontSize: '12px',
347
- lineHeight: `${lineHeight}px`,
348
- color: '#555577',
349
- fontFamily: '"Fira Code", "Cascadia Code", "Consolas", monospace',
350
- boxSizing: 'border-box',
351
- }}
352
- >
353
- {lines.map((_, i) => (
354
- <div key={i}>{i + 1}</div>
355
- ))}
356
- </div>
357
- );
358
- }
359
-
360
- // ── Amplifier (amplitude-based suggestions) ───────────────────────────────────
361
-
362
- const COMPONENT_CORPUS = [
363
- 'TkxButton', 'TkxInput', 'TkxCard', 'TkxModal', 'TkxTable',
364
- 'TkxSelect', 'TkxCheckbox', 'TkxRadio', 'TkxSwitch', 'TkxSlider',
365
- 'TkxBadge', 'TkxAlert', 'TkxToast', 'TkxTooltip', 'TkxPopover',
366
- 'TkxTabs', 'TkxAccordion', 'TkxDrawer', 'TkxDropdown', 'TkxMenu',
367
- 'TkxForm', 'TkxDataGrid', 'TkxChart', 'TkxSpinner', 'TkxSkeleton',
368
- 'TkxAvatar', 'TkxTag', 'TkxDivider', 'TkxProgress', 'TkxStatistic',
369
- 'TkxQuantumForm', 'TkxPlayground',
370
- ];
371
-
372
- const amplifier = new AmplitudeAmplifier();
373
-
374
- function extractLastToken(code: string): string {
375
- const match = code.match(/([A-Z][a-zA-Z0-9]*)$/);
376
- return match ? match[1] : '';
377
- }
378
-
379
- function querySuggestions(query: string, topK = 4): { name: string; amplitude: number }[] {
380
- if (!query || query.length < 2) return [];
381
- const q = query.toLowerCase();
382
- const results = amplifier.amplify(
383
- COMPONENT_CORPUS,
384
- (name) => {
385
- const lower = name.toLowerCase();
386
- if (lower.startsWith(q)) return 1.0;
387
- if (lower.includes(q)) return 0.7;
388
- // bigram overlap
389
- let score = 0;
390
- for (let i = 0; i < q.length - 1; i++) {
391
- if (lower.includes(q.slice(i, i + 2))) score += 0.15;
392
- }
393
- return Math.min(score, 0.5);
394
- },
395
- 0.1,
396
- );
397
- return results.slice(0, topK).map((r) => ({
398
- name: COMPONENT_CORPUS[r.index] ?? '',
399
- amplitude: parseFloat(r.combined.toFixed(3)),
400
- })).filter((s) => s.name !== '');
401
- }
402
-
403
- // ── Main Playground Component ─────────────────────────────────────────────────
404
-
405
- export function TkxPlayground({
406
- defaultCode,
407
- examples: userExamples,
408
- height = 480,
409
- imports = {},
410
- strictMode = true,
411
- forbiddenTokens,
412
- }: TkxPlaygroundProps) {
413
- const theme = useTheme();
414
- const allExamples = [...BUILT_IN_EXAMPLES, ...(userExamples ?? [])];
415
- const initialCode = defaultCode ?? BUILT_IN_EXAMPLES[0]!.code;
416
-
417
- const [code, setCode] = useState(initialCode);
418
- const [preview, setPreview] = useState<{ element: ReactNode | null; error: string | null; renderMs: number }>({
419
- element: null,
420
- error: null,
421
- renderMs: 0,
422
- });
423
- const [boundaryError, setBoundaryError] = useState<string | null>(null);
424
- const [suggestions, setSuggestions] = useState<{ name: string; amplitude: number }[]>([]);
425
- const [copied, setCopied] = useState(false);
426
- const [activeExample, setActiveExample] = useState<number>(0);
427
- const textareaRef = useRef<HTMLTextAreaElement>(null);
428
- const LINE_HEIGHT = 18;
429
-
430
- // Debounced evaluation
431
- const evalTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
432
-
433
- const runEval = useCallback(
434
- (src: string) => {
435
- setBoundaryError(null);
436
- const result = evalCode(src, imports, { strictMode, forbiddenTokens });
437
- setPreview(result);
438
- },
439
- [imports, strictMode, forbiddenTokens],
440
- );
441
-
442
- useEffect(() => {
443
- if (evalTimerRef.current) clearTimeout(evalTimerRef.current);
444
- evalTimerRef.current = setTimeout(() => runEval(code), 300);
445
- return () => {
446
- if (evalTimerRef.current) clearTimeout(evalTimerRef.current);
447
- };
448
- }, [code, runEval]);
449
-
450
- // Initial render
451
- useEffect(() => {
452
- runEval(initialCode);
453
- // eslint-disable-next-line react-hooks/exhaustive-deps
454
- }, []);
455
-
456
- const handleCodeChange = useCallback(
457
- (e: React.ChangeEvent<HTMLTextAreaElement>) => {
458
- const val = e.target.value;
459
- setCode(val);
460
- // Quantum suggestions
461
- const token = extractLastToken(val);
462
- if (token.length >= 2) {
463
- setSuggestions(querySuggestions(token, 4));
464
- } else {
465
- setSuggestions([]);
466
- }
467
- },
468
- [],
469
- );
470
-
471
- const handleExampleSelect = useCallback(
472
- (idx: number) => {
473
- const ex = allExamples[idx];
474
- if (!ex) return;
475
- setActiveExample(idx);
476
- setCode(ex.code);
477
- setSuggestions([]);
478
- },
479
- [allExamples],
480
- );
481
-
482
- const handleCopy = useCallback(async () => {
483
- try {
484
- await navigator.clipboard.writeText(code);
485
- setCopied(true);
486
- setTimeout(() => setCopied(false), 1500);
487
- } catch {
488
- /* ignore */
489
- }
490
- }, [code]);
491
-
492
- const handleReset = useCallback(() => {
493
- setCode(initialCode);
494
- setActiveExample(0);
495
- setSuggestions([]);
496
- }, [initialCode]);
497
-
498
- const applySuggestion = useCallback(
499
- (name: string) => {
500
- const token = extractLastToken(code);
501
- if (token) {
502
- setCode((prev) => prev.slice(0, prev.lastIndexOf(token)) + name);
503
- }
504
- setSuggestions([]);
505
- },
506
- [code],
507
- );
508
-
509
- const hasError = preview.error !== null || boundaryError !== null;
510
- const errorMsg = preview.error ?? boundaryError ?? '';
511
-
512
- const editorBg = theme.bg;
513
- const previewBg = theme.surfaceAlt;
514
- const borderColor = theme.border;
515
- const statusBg = theme.surface;
516
-
517
- const editorAreaStyle: React.CSSProperties = {
518
- width: '50%',
519
- display: 'flex',
520
- flexDirection: 'column',
521
- borderRight: `1px solid ${borderColor}`,
522
- position: 'relative',
523
- };
524
-
525
- const toolbarStyle: React.CSSProperties = {
526
- display: 'flex',
527
- alignItems: 'center',
528
- gap: '6px',
529
- padding: '6px 10px',
530
- borderBottom: `1px solid ${borderColor}`,
531
- backgroundColor: theme.surface,
532
- flexWrap: 'wrap',
533
- };
534
-
535
- const iconBtnStyle: React.CSSProperties = {
536
- padding: '3px 10px',
537
- borderRadius: '6px',
538
- border: `1px solid ${borderColor}`,
539
- backgroundColor: 'transparent',
540
- color: theme.textMuted,
541
- fontSize: '11px',
542
- fontWeight: 600,
543
- cursor: 'pointer',
544
- fontFamily: 'inherit',
545
- transition: 'color 0.15s, border-color 0.15s',
546
- };
547
-
548
- return (
549
- <div
550
- style={{
551
- display: 'flex',
552
- flexDirection: 'column',
553
- border: `1px solid ${borderColor}`,
554
- borderRadius: '12px',
555
- overflow: 'hidden',
556
- backgroundColor: editorBg,
557
- fontFamily: 'inherit',
558
- boxSizing: 'border-box',
559
- position: 'relative',
560
- }}
561
- >
562
- {/* ── Header bar ── */}
563
- <div
564
- style={{
565
- display: 'flex',
566
- alignItems: 'center',
567
- justifyContent: 'space-between',
568
- padding: '8px 14px',
569
- borderBottom: `1px solid ${borderColor}`,
570
- backgroundColor: theme.surface,
571
- }}
572
- >
573
- <span style={{ fontSize: '12px', fontWeight: 700, color: theme.primary, letterSpacing: '0.05em' }}>
574
- ⚛ TkxPlayground
575
- </span>
576
- <span style={{ fontSize: '10px', color: theme.textMuted }}>Live JSX Preview</span>
577
- </div>
578
-
579
- {/* ── Example tabs ── */}
580
- <div
581
- style={{
582
- display: 'flex',
583
- gap: '4px',
584
- padding: '6px 10px',
585
- borderBottom: `1px solid ${borderColor}`,
586
- backgroundColor: theme.surface,
587
- overflowX: 'auto',
588
- }}
589
- >
590
- {allExamples.map((ex, i) => (
591
- <button
592
- key={i}
593
- onClick={() => handleExampleSelect(i)}
594
- style={{
595
- padding: '3px 10px',
596
- borderRadius: '6px',
597
- border: `1px solid ${i === activeExample ? theme.primary : borderColor}`,
598
- backgroundColor: i === activeExample ? `${theme.primary}20` : 'transparent',
599
- color: i === activeExample ? theme.primary : theme.textMuted,
600
- fontSize: '11px',
601
- fontWeight: i === activeExample ? 700 : 400,
602
- cursor: 'pointer',
603
- whiteSpace: 'nowrap',
604
- fontFamily: 'inherit',
605
- transition: 'all 0.15s',
606
- }}
607
- >
608
- {ex.label}
609
- </button>
610
- ))}
611
- </div>
612
-
613
- {/* ── Split pane ── */}
614
- <div style={{ display: 'flex', height: `${height}px` }}>
615
- {/* Left: Editor */}
616
- <div style={editorAreaStyle}>
617
- {/* Toolbar */}
618
- <div style={toolbarStyle}>
619
- <span style={{ fontSize: '11px', color: theme.textMuted, marginRight: 'auto' }}>editor.tsx</span>
620
- <button onClick={handleCopy} style={iconBtnStyle} title="Copy code">
621
- {copied ? '✓ Copied' : '⎘ Copy'}
622
- </button>
623
- <button onClick={handleReset} style={iconBtnStyle} title="Reset to default">
624
- ↺ Reset
625
- </button>
626
- </div>
627
-
628
- {/* Code area */}
629
- <div style={{ position: 'relative', flex: 1, overflow: 'hidden' }}>
630
- <LineNumbers code={code} lineHeight={LINE_HEIGHT} />
631
- <textarea
632
- ref={textareaRef}
633
- value={code}
634
- onChange={handleCodeChange}
635
- spellCheck={false}
636
- autoCorrect="off"
637
- autoCapitalize="off"
638
- style={{
639
- position: 'absolute',
640
- top: 0,
641
- left: 0,
642
- width: '100%',
643
- height: '100%',
644
- padding: '12px 12px 12px 44px',
645
- margin: 0,
646
- border: 'none',
647
- outline: 'none',
648
- resize: 'none',
649
- backgroundColor: editorBg,
650
- color: theme.text,
651
- fontSize: '12px',
652
- lineHeight: `${LINE_HEIGHT}px`,
653
- fontFamily: '"Fira Code", "Cascadia Code", "Consolas", "Courier New", monospace',
654
- boxSizing: 'border-box',
655
- overflowY: 'auto',
656
- tabSize: 2,
657
- }}
658
- />
659
- </div>
660
-
661
- {/* Quantum suggestions overlay */}
662
- {suggestions.length > 0 && (
663
- <div
664
- style={{
665
- position: 'absolute',
666
- bottom: '40px',
667
- left: '44px',
668
- zIndex: 10,
669
- backgroundColor: theme.surface,
670
- border: `1px solid ${theme.primary}44`,
671
- borderRadius: '8px',
672
- overflow: 'hidden',
673
- boxShadow: `0 4px 16px rgba(0,0,0,0.3)`,
674
- minWidth: '180px',
675
- }}
676
- >
677
- <div
678
- style={{
679
- padding: '4px 10px 4px',
680
- fontSize: '10px',
681
- color: theme.primary,
682
- fontWeight: 700,
683
- borderBottom: `1px solid ${borderColor}`,
684
- letterSpacing: '0.05em',
685
- }}
686
- >
687
- ⚛ Quantum Suggestions
688
- </div>
689
- {suggestions.map((s) => (
690
- <button
691
- key={s.name}
692
- onClick={() => applySuggestion(s.name)}
693
- style={{
694
- display: 'flex',
695
- alignItems: 'center',
696
- justifyContent: 'space-between',
697
- width: '100%',
698
- padding: '6px 10px',
699
- border: 'none',
700
- backgroundColor: 'transparent',
701
- color: theme.text,
702
- fontSize: '12px',
703
- fontFamily: '"Fira Code", monospace',
704
- cursor: 'pointer',
705
- textAlign: 'left',
706
- gap: '12px',
707
- }}
708
- >
709
- <span>{s.name}</span>
710
- <span
711
- style={{
712
- fontSize: '10px',
713
- color: theme.textMuted,
714
- flexShrink: 0,
715
- }}
716
- >
717
- {Math.round(s.amplitude * 100)}%
718
- </span>
719
- </button>
720
- ))}
721
- </div>
722
- )}
723
- </div>
724
-
725
- {/* Right: Preview */}
726
- <div
727
- style={{
728
- width: '50%',
729
- display: 'flex',
730
- flexDirection: 'column',
731
- }}
732
- >
733
- <div
734
- style={{
735
- padding: '6px 10px',
736
- borderBottom: `1px solid ${borderColor}`,
737
- backgroundColor: theme.surface,
738
- fontSize: '11px',
739
- color: theme.textMuted,
740
- fontWeight: 600,
741
- }}
742
- >
743
- Preview
744
- </div>
745
- <div
746
- style={{
747
- flex: 1,
748
- overflow: 'auto',
749
- backgroundColor: previewBg,
750
- position: 'relative',
751
- }}
752
- >
753
- {hasError ? (
754
- <div
755
- style={{
756
- padding: '16px',
757
- color: theme.danger,
758
- fontFamily: '"Fira Code", monospace',
759
- fontSize: '12px',
760
- lineHeight: 1.6,
761
- whiteSpace: 'pre-wrap',
762
- wordBreak: 'break-word',
763
- }}
764
- >
765
- <div
766
- style={{
767
- marginBottom: '8px',
768
- fontWeight: 700,
769
- display: 'flex',
770
- alignItems: 'center',
771
- gap: '6px',
772
- }}
773
- >
774
- <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
775
- <path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" />
776
- </svg>
777
- Runtime Error
778
- </div>
779
- {errorMsg}
780
- </div>
781
- ) : (
782
- <ErrorBoundary onError={setBoundaryError}>
783
- <div style={{ minHeight: '100%' }}>{preview.element}</div>
784
- </ErrorBoundary>
785
- )}
786
- </div>
787
- </div>
788
- </div>
789
-
790
- {/* ── Status bar ── */}
791
- <div
792
- style={{
793
- display: 'flex',
794
- alignItems: 'center',
795
- gap: '16px',
796
- padding: '4px 12px',
797
- backgroundColor: statusBg,
798
- borderTop: `1px solid ${borderColor}`,
799
- fontSize: '11px',
800
- color: theme.textMuted,
801
- }}
802
- >
803
- {/* Error / OK indicator */}
804
- <span
805
- style={{
806
- display: 'flex',
807
- alignItems: 'center',
808
- gap: '4px',
809
- color: hasError ? theme.danger : theme.success,
810
- fontWeight: 600,
811
- }}
812
- >
813
- <span
814
- style={{
815
- width: '6px',
816
- height: '6px',
817
- borderRadius: '50%',
818
- backgroundColor: hasError ? theme.danger : theme.success,
819
- display: 'inline-block',
820
- }}
821
- />
822
- {hasError ? 'Error' : 'OK'}
823
- </span>
824
-
825
- {/* Render time */}
826
- <span>⏱ {preview.renderMs} ms</span>
827
-
828
- {/* Lines */}
829
- <span>{code.split('\n').length} lines</span>
830
-
831
- {/* Characters */}
832
- <span>{code.length} chars</span>
833
-
834
- {/* Quantum suggestions hint */}
835
- {suggestions.length > 0 && (
836
- <span style={{ marginLeft: 'auto', color: theme.primary, fontWeight: 600 }}>
837
- ⚛ {suggestions.length} suggestion{suggestions.length > 1 ? 's' : ''}
838
- </span>
839
- )}
840
- </div>
841
- </div>
842
- );
843
- }
844
-
845
- TkxPlayground.displayName = 'TkxPlayground';