@xyd-js/components 0.1.0-xyd.0 → 0.1.0-xyd.10

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 (492) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/LICENSE +21 -0
  3. package/dist/CTABanner-4FVIoaTR.js +2 -0
  4. package/dist/CTABanner-4FVIoaTR.js.map +1 -0
  5. package/dist/CTABanner-BQx2SLf8.js +2 -0
  6. package/dist/CTABanner-BQx2SLf8.js.map +1 -0
  7. package/dist/CTABanner-C6afsXoE.js +2 -0
  8. package/dist/CTABanner-C6afsXoE.js.map +1 -0
  9. package/dist/CTABanner-CEKs-Hb-.js +2 -0
  10. package/dist/CTABanner-CEKs-Hb-.js.map +1 -0
  11. package/dist/CTABanner-CUNcTr6s.js +2 -0
  12. package/dist/CTABanner-CUNcTr6s.js.map +1 -0
  13. package/dist/CTABanner-D02aIAsD.js +2 -0
  14. package/dist/CTABanner-D02aIAsD.js.map +1 -0
  15. package/dist/CTABanner-Dm3tUG3I.js +2 -0
  16. package/dist/CTABanner-Dm3tUG3I.js.map +1 -0
  17. package/dist/CTABanner-MCOcVowa.js +2 -0
  18. package/dist/CTABanner-MCOcVowa.js.map +1 -0
  19. package/dist/CTABanner-X6K49gSr.js +2 -0
  20. package/dist/CTABanner-X6K49gSr.js.map +1 -0
  21. package/dist/CodeSample-B9VUhTKF.js +2 -0
  22. package/dist/CodeSample-B9VUhTKF.js.map +1 -0
  23. package/dist/CodeSample-BSXeFy0x.js +2 -0
  24. package/dist/CodeSample-BSXeFy0x.js.map +1 -0
  25. package/dist/CodeSample-BwP208sQ.js +2 -0
  26. package/dist/CodeSample-BwP208sQ.js.map +1 -0
  27. package/dist/CodeSample-CK-CQYrV.js +2 -0
  28. package/dist/CodeSample-CK-CQYrV.js.map +1 -0
  29. package/dist/CodeSample-CUemtj_W.js +2 -0
  30. package/dist/CodeSample-CUemtj_W.js.map +1 -0
  31. package/dist/CodeSample-D0iKih-A.js +2 -0
  32. package/dist/CodeSample-D0iKih-A.js.map +1 -0
  33. package/dist/CodeSample-D33vTa6M.js +2 -0
  34. package/dist/CodeSample-D33vTa6M.js.map +1 -0
  35. package/dist/CodeSample-DUSx2KBt.js +2 -0
  36. package/dist/CodeSample-DUSx2KBt.js.map +1 -0
  37. package/dist/CodeSample-P4yxkHPW.js +2 -0
  38. package/dist/CodeSample-P4yxkHPW.js.map +1 -0
  39. package/dist/HomeView-ACBdUgyz.js +2 -0
  40. package/dist/HomeView-ACBdUgyz.js.map +1 -0
  41. package/dist/HomeView-B0ATNUF1.js +2 -0
  42. package/dist/HomeView-B0ATNUF1.js.map +1 -0
  43. package/dist/HomeView-CHSb4HL6.js +2 -0
  44. package/dist/HomeView-CHSb4HL6.js.map +1 -0
  45. package/dist/HomeView-COJrg8Ju.js +2 -0
  46. package/dist/HomeView-COJrg8Ju.js.map +1 -0
  47. package/dist/HomeView-Cun4apuy.js +2 -0
  48. package/dist/HomeView-Cun4apuy.js.map +1 -0
  49. package/dist/HomeView-D4DXEOOn.js +2 -0
  50. package/dist/HomeView-D4DXEOOn.js.map +1 -0
  51. package/dist/HomeView-DaH1PSBB.js +2 -0
  52. package/dist/HomeView-DaH1PSBB.js.map +1 -0
  53. package/dist/HomeView-O_lj2c2t.js +2 -0
  54. package/dist/HomeView-O_lj2c2t.js.map +1 -0
  55. package/dist/HomeView-_Nu2RcOM.js +2 -0
  56. package/dist/HomeView-_Nu2RcOM.js.map +1 -0
  57. package/dist/UnderlineNav-3-KptDYD.js +2 -0
  58. package/dist/UnderlineNav-3-KptDYD.js.map +1 -0
  59. package/dist/UnderlineNav-BCyB0G5d.js +2 -0
  60. package/dist/UnderlineNav-BCyB0G5d.js.map +1 -0
  61. package/dist/UnderlineNav-BEhDJk0H.js +2 -0
  62. package/dist/UnderlineNav-BEhDJk0H.js.map +1 -0
  63. package/dist/UnderlineNav-BqZ2xAp7.js +2 -0
  64. package/dist/UnderlineNav-BqZ2xAp7.js.map +1 -0
  65. package/dist/UnderlineNav-C2-4Vyj8.js +2 -0
  66. package/dist/UnderlineNav-C2-4Vyj8.js.map +1 -0
  67. package/dist/UnderlineNav-Co08Gykm.js +2 -0
  68. package/dist/UnderlineNav-Co08Gykm.js.map +1 -0
  69. package/dist/UnderlineNav-DC3UVmnZ.js +2 -0
  70. package/dist/UnderlineNav-DC3UVmnZ.js.map +1 -0
  71. package/dist/UnderlineNav-DsRYwuGB.js +2 -0
  72. package/dist/UnderlineNav-DsRYwuGB.js.map +1 -0
  73. package/dist/UnderlineNav-FbclXKUW.js +2 -0
  74. package/dist/UnderlineNav-FbclXKUW.js.map +1 -0
  75. package/dist/_rollupPluginBabelHelpers-BEouSrrZ.js +2 -0
  76. package/dist/_rollupPluginBabelHelpers-BEouSrrZ.js.map +1 -0
  77. package/dist/_rollupPluginBabelHelpers-BHehKRBq.js +2 -0
  78. package/dist/_rollupPluginBabelHelpers-BHehKRBq.js.map +1 -0
  79. package/dist/_rollupPluginBabelHelpers-Bunpz22T.js +2 -0
  80. package/dist/_rollupPluginBabelHelpers-Bunpz22T.js.map +1 -0
  81. package/dist/_rollupPluginBabelHelpers-CVblpRvU.js +2 -0
  82. package/dist/_rollupPluginBabelHelpers-CVblpRvU.js.map +1 -0
  83. package/dist/_rollupPluginBabelHelpers-CxmswfqM.js +2 -0
  84. package/dist/_rollupPluginBabelHelpers-CxmswfqM.js.map +1 -0
  85. package/dist/_rollupPluginBabelHelpers-D0XU6lDu.js +2 -0
  86. package/dist/_rollupPluginBabelHelpers-D0XU6lDu.js.map +1 -0
  87. package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js +2 -0
  88. package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js.map +1 -0
  89. package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js +2 -0
  90. package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js.map +1 -0
  91. package/dist/_rollupPluginBabelHelpers-tRAa4O0f.js +2 -0
  92. package/dist/_rollupPluginBabelHelpers-tRAa4O0f.js.map +1 -0
  93. package/dist/brand.d.ts +11 -10
  94. package/dist/brand.js +2 -1
  95. package/dist/brand.js.map +1 -0
  96. package/dist/coder/themes/cosmo-light.d.ts +5 -0
  97. package/dist/coder/themes/cosmo-light.js +2 -0
  98. package/dist/coder/themes/cosmo-light.js.map +1 -0
  99. package/dist/coder.d.ts +54 -3
  100. package/dist/coder.js +2 -1
  101. package/dist/coder.js.map +1 -0
  102. package/dist/content.d.ts +103 -37
  103. package/dist/content.js +2 -1
  104. package/dist/content.js.map +1 -0
  105. package/dist/index-B0FncPxO.js +2 -0
  106. package/dist/index-B0FncPxO.js.map +1 -0
  107. package/dist/index-BEm-xkm-.js +2 -0
  108. package/dist/index-BEm-xkm-.js.map +1 -0
  109. package/dist/index-BHwtxG27.js +2 -0
  110. package/dist/index-BHwtxG27.js.map +1 -0
  111. package/dist/index-BTcmIG47.js +2 -0
  112. package/dist/index-BTcmIG47.js.map +1 -0
  113. package/dist/index-BbIMmTvo.js +2 -0
  114. package/dist/index-BbIMmTvo.js.map +1 -0
  115. package/dist/index-CNkHt1r7.js +2 -0
  116. package/dist/index-CNkHt1r7.js.map +1 -0
  117. package/dist/index-D0XuyFm7.js +2 -0
  118. package/dist/index-D0XuyFm7.js.map +1 -0
  119. package/dist/index-DBspcqWq.js +2 -0
  120. package/dist/index-DBspcqWq.js.map +1 -0
  121. package/dist/index-DVBO4gYE.js +2 -0
  122. package/dist/index-DVBO4gYE.js.map +1 -0
  123. package/dist/index.css +217 -135
  124. package/dist/index.d.ts +1 -1
  125. package/dist/index.js +1 -0
  126. package/dist/index.js.map +1 -0
  127. package/dist/layouts.d.ts +12 -1
  128. package/dist/layouts.js +2 -1
  129. package/dist/layouts.js.map +1 -0
  130. package/dist/pages.d.ts +2 -1
  131. package/dist/pages.js +2 -1
  132. package/dist/pages.js.map +1 -0
  133. package/dist/{tslib.es6-C3PNVQlC.js → tslib.es6-BBkx4Se1.js} +1 -0
  134. package/dist/tslib.es6-BBkx4Se1.js.map +1 -0
  135. package/dist/tslib.es6-BF6ZLEXa.js +2 -0
  136. package/dist/tslib.es6-BF6ZLEXa.js.map +1 -0
  137. package/dist/tslib.es6-BOZCDgb8.js +2 -0
  138. package/dist/tslib.es6-BOZCDgb8.js.map +1 -0
  139. package/dist/tslib.es6-CNVK7Xcu.js +2 -0
  140. package/dist/tslib.es6-CNVK7Xcu.js.map +1 -0
  141. package/dist/tslib.es6-Cjl5tesf.js +2 -0
  142. package/dist/tslib.es6-Cjl5tesf.js.map +1 -0
  143. package/dist/tslib.es6-DEH7Dkgy.js +2 -0
  144. package/dist/tslib.es6-DEH7Dkgy.js.map +1 -0
  145. package/dist/tslib.es6-DTeJ7dWi.js +2 -0
  146. package/dist/tslib.es6-DTeJ7dWi.js.map +1 -0
  147. package/dist/tslib.es6-U9-f6pA7.js +2 -0
  148. package/dist/tslib.es6-U9-f6pA7.js.map +1 -0
  149. package/dist/tslib.es6-cb69JjeS.js +2 -0
  150. package/dist/tslib.es6-cb69JjeS.js.map +1 -0
  151. package/dist/views.d.ts +2 -1
  152. package/dist/views.js +2 -1
  153. package/dist/views.js.map +1 -0
  154. package/dist/writer.d.ts +62 -8
  155. package/dist/writer.js +2 -1
  156. package/dist/writer.js.map +1 -0
  157. package/package.json +35 -12
  158. package/rollup.config.js +53 -8
  159. package/src/brand/Button/Button.styles.tsx +31 -0
  160. package/src/brand/Button/Button.tsx +3 -35
  161. package/src/brand/CTABanner/CTABanner.styles.tsx +82 -0
  162. package/src/brand/CTABanner/CTABanner.tsx +34 -112
  163. package/src/brand/Footer/Footer.styles.tsx +21 -0
  164. package/src/brand/Footer/Footer.tsx +4 -24
  165. package/src/brand/TODO.md +1 -0
  166. package/src/coder/Code/Code.styles.tsx +47 -0
  167. package/src/coder/Code/Code.tsx +76 -0
  168. package/src/coder/Code/CodeLoader.tsx +10 -0
  169. package/src/coder/Code/annotations.tsx +31 -0
  170. package/src/coder/Code/highlight.ts +170 -0
  171. package/src/coder/Code/index.ts +15 -0
  172. package/src/coder/CodeCopy/CodeCopy.styles.tsx +19 -0
  173. package/src/coder/CodeCopy/CodeCopy.tsx +2 -4
  174. package/src/coder/CodeSample/CodeSample.tsx +42 -133
  175. package/src/coder/CodeSample/index.ts +0 -1
  176. package/src/coder/CodeSample/withLocalStored.tsx +1 -1
  177. package/src/coder/CodeTabs/CodeTabs.styles.tsx +104 -0
  178. package/src/coder/CodeTabs/CodeTabs.tsx +95 -0
  179. package/src/coder/CodeTabs/index.ts +6 -0
  180. package/src/coder/CodeTheme/CodeTheme.tsx +79 -0
  181. package/src/coder/CodeTheme/index.ts +8 -0
  182. package/src/coder/hooks/highlight.ts +182 -0
  183. package/src/coder/index.ts +31 -1
  184. package/src/coder/{CodeSample/default-theme.ts → themes/cosmo-light.ts} +3 -2
  185. package/src/content/Anchor/Anchor.styles.tsx +5 -0
  186. package/src/content/Anchor/Anchor.tsx +4 -14
  187. package/src/content/Content/Content.styles.tsx +9 -0
  188. package/src/content/Content/Content.tsx +4 -11
  189. package/src/content/Content.tsx +48 -6
  190. package/src/content/Subtitle/Subtitle.styles.ts +8 -0
  191. package/src/content/Subtitle/Subtitle.tsx +2 -11
  192. package/src/layouts/Layout.styles.tsx +135 -131
  193. package/src/layouts/Layout.tsx +21 -23
  194. package/src/layouts/LayoutPrimary/LayoutPrimary.styles.tsx +341 -0
  195. package/src/layouts/LayoutPrimary/LayoutPrimary.tsx +157 -0
  196. package/src/layouts/LayoutPrimary/index.ts +5 -0
  197. package/src/layouts/index.ts +7 -1
  198. package/src/pages/HomePage/HomePage.styles.tsx +16 -0
  199. package/src/pages/HomePage/HomePage.tsx +7 -21
  200. package/src/pages/TODO.md +1 -0
  201. package/src/pages/index.ts +1 -0
  202. package/src/ui/Loader/Loader.styles.tsx +54 -0
  203. package/src/ui/Loader/Loader.tsx +26 -0
  204. package/src/ui/TODO.md +2 -0
  205. package/src/ui/index.ts +1 -0
  206. package/src/utils/useStyle.ts +19 -0
  207. package/src/views/HomeView/HomeView.styles.tsx +37 -0
  208. package/src/views/HomeView/HomeView.tsx +5 -45
  209. package/src/views/TODO.md +1 -0
  210. package/src/views/index.ts +1 -0
  211. package/src/writer/Badge/Badge.styles.tsx +31 -26
  212. package/src/writer/Badge/Badge.tsx +42 -9
  213. package/src/writer/Blockquote/Blockquote.styles.tsx +6 -8
  214. package/src/writer/Blockquote/Blockquote.tsx +2 -2
  215. package/src/writer/Breadcrumbs/Breadcrumbs.styles.ts +27 -26
  216. package/src/writer/Breadcrumbs/Breadcrumbs.tsx +5 -5
  217. package/src/writer/Callout/Callout.styles.tsx +44 -48
  218. package/src/writer/Callout/Callout.tsx +5 -5
  219. package/src/writer/Code/Code.styles.tsx +11 -13
  220. package/src/writer/Code/Code.tsx +2 -2
  221. package/src/writer/Details/Details.styles.tsx +102 -74
  222. package/src/writer/Details/Details.tsx +46 -30
  223. package/src/writer/GuideCard/GuideCard.styles.tsx +116 -112
  224. package/src/writer/GuideCard/GuideCard.tsx +19 -19
  225. package/src/writer/Heading/Heading.styles.tsx +65 -61
  226. package/src/writer/Heading/Heading.tsx +11 -11
  227. package/src/writer/Hr/Hr.styles.tsx +3 -5
  228. package/src/writer/Hr/Hr.tsx +2 -2
  229. package/src/writer/Icon/index.tsx +243 -0
  230. package/src/writer/NavLinks/NavLinks.styles.ts +30 -30
  231. package/src/writer/NavLinks/NavLinks.tsx +6 -6
  232. package/src/writer/Pre/Pre.styles.tsx +8 -10
  233. package/src/writer/Pre/Pre.tsx +2 -2
  234. package/src/writer/Steps/Steps.styles.tsx +30 -31
  235. package/src/writer/Steps/Steps.tsx +3 -4
  236. package/src/writer/Table/Table.styles.tsx +32 -31
  237. package/src/writer/Table/Table.tsx +5 -5
  238. package/src/writer/Table/TableV2.styles.tsx +117 -0
  239. package/src/writer/Table/TableV2.tsx +83 -0
  240. package/src/writer/Table/index.ts +4 -0
  241. package/src/writer/Tabs/Tabs.styles.tsx +60 -63
  242. package/src/writer/Tabs/Tabs.tsx +11 -16
  243. package/src/writer/UnderlineNav/UnderlineNav.styles.tsx +44 -42
  244. package/src/writer/UnderlineNav/UnderlineNav.tsx +5 -5
  245. package/tsconfig.json +2 -3
  246. package/dist/CTABanner-CWX9isVG.js +0 -1
  247. package/dist/CodeSample-C5YaEpAi.js +0 -1
  248. package/dist/HomeView-CnAj-VYl.js +0 -1
  249. package/dist/UnderlineNav-C8onw9Na.js +0 -1
  250. package/dist/_rollupPluginBabelHelpers-DfQAiTCw.js +0 -1
  251. package/dist/abap-kIO_7z1o.js +0 -1
  252. package/dist/actionscript-3-DiaraCXE.js +0 -1
  253. package/dist/ada-aNFKX2pl.js +0 -1
  254. package/dist/angular-html-y0qIEhS2.js +0 -1
  255. package/dist/angular-ts-Bn_6f37o.js +0 -1
  256. package/dist/apache-Cx7e0H64.js +0 -1
  257. package/dist/apex-CdSCJjuL.js +0 -1
  258. package/dist/apl-BDzWBUim.js +0 -1
  259. package/dist/applescript-CJFkzk5i.js +0 -1
  260. package/dist/ara-BC9R9M5c.js +0 -1
  261. package/dist/asciidoc-lqQQs4M0.js +0 -1
  262. package/dist/asm-QQeI-gwp.js +0 -1
  263. package/dist/astro-BPstp8LF.js +0 -1
  264. package/dist/awk-Cxb7Sqvk.js +0 -1
  265. package/dist/ballerina-G8TyVc6O.js +0 -1
  266. package/dist/bat-UDEmXz-g.js +0 -1
  267. package/dist/beancount-BWg86rhE.js +0 -1
  268. package/dist/berry-5E5uGOYg.js +0 -1
  269. package/dist/bibtex-CZn_FFnb.js +0 -1
  270. package/dist/bicep-D_G0XT5J.js +0 -1
  271. package/dist/blade-7dxmctkK.js +0 -1
  272. package/dist/c-CrEz-oYf.js +0 -1
  273. package/dist/cadence-BulSIR1A.js +0 -1
  274. package/dist/clarity-m2OigCMT.js +0 -1
  275. package/dist/clojure-Bpes2rhL.js +0 -1
  276. package/dist/cmake-C4Tr1SQC.js +0 -1
  277. package/dist/cobol-Dp8xGW1S.js +0 -1
  278. package/dist/codeowners-Bs3mpoau.js +0 -1
  279. package/dist/codeql-CvQzaisq.js +0 -1
  280. package/dist/coffee-DOjtyJj_.js +0 -1
  281. package/dist/common-lisp-DGVR8DFi.js +0 -1
  282. package/dist/cpp-BUT7C4Bo.js +0 -1
  283. package/dist/crystal-BJh9OJ1_.js +0 -1
  284. package/dist/csharp-BhZuAD8H.js +0 -1
  285. package/dist/css-8_G4_UCW.js +0 -1
  286. package/dist/csv-DLRyYdMG.js +0 -1
  287. package/dist/cue-DAgMCCsT.js +0 -1
  288. package/dist/cypher-CtSiSKRh.js +0 -1
  289. package/dist/d-feZJOTtr.js +0 -1
  290. package/dist/dark-plus-Dcn2h2HL.js +0 -1
  291. package/dist/dart-CNOu4aud.js +0 -1
  292. package/dist/dax-Dkp1Uj6t.js +0 -1
  293. package/dist/desktop-CAGQzotA.js +0 -1
  294. package/dist/diff-D6yk3_ZG.js +0 -1
  295. package/dist/docker-BdTrQq0b.js +0 -1
  296. package/dist/dotenv-BeHGAMs7.js +0 -1
  297. package/dist/dracula-BUaMrXr0.js +0 -1
  298. package/dist/dracula-soft-CBx6n76m.js +0 -1
  299. package/dist/dream-maker-BU0sZZmb.js +0 -1
  300. package/dist/edge-D2Tk5tmg.js +0 -1
  301. package/dist/elixir-B-l3Nz-G.js +0 -1
  302. package/dist/elm-Bqm7aRpV.js +0 -1
  303. package/dist/emacs-lisp-BSvpfolf.js +0 -1
  304. package/dist/erb-CwBHxfFV.js +0 -1
  305. package/dist/erlang-B0PtHWg2.js +0 -1
  306. package/dist/fennel-CdN4E9Xo.js +0 -1
  307. package/dist/fish-XrbYjeRx.js +0 -1
  308. package/dist/fluent-zYsEgElv.js +0 -1
  309. package/dist/fortran-fixed-form-CPwX6okW.js +0 -1
  310. package/dist/fortran-free-form-B6Kk9658.js +0 -1
  311. package/dist/fsharp-CbMfVCMr.js +0 -1
  312. package/dist/gdresource-CdRUpBQO.js +0 -1
  313. package/dist/gdscript-CYXv_Ac9.js +0 -1
  314. package/dist/gdshader-CtiaGYI5.js +0 -1
  315. package/dist/genie-C-gOIth7.js +0 -1
  316. package/dist/gherkin-uGsOfG-k.js +0 -1
  317. package/dist/git-commit-CWQvkRNX.js +0 -1
  318. package/dist/git-rebase-BZ0YVJ-O.js +0 -1
  319. package/dist/github-dark-DCm4kydX.js +0 -1
  320. package/dist/github-dark-dimmed-CsRUrOJA.js +0 -1
  321. package/dist/github-from-css-CTRi6tFC.js +0 -1
  322. package/dist/github-light-B2ofRYMU.js +0 -1
  323. package/dist/gleam-C9ZZ3Vp2.js +0 -1
  324. package/dist/glimmer-js-Cuwfndkm.js +0 -1
  325. package/dist/glimmer-ts-D8nR8_k2.js +0 -1
  326. package/dist/glsl-qc_rLvzz.js +0 -1
  327. package/dist/gnuplot-BgHAcd--.js +0 -1
  328. package/dist/go-Dm8VBUM2.js +0 -1
  329. package/dist/graphql-CRmnB6D5.js +0 -1
  330. package/dist/groovy-DJcw8dX4.js +0 -1
  331. package/dist/hack-DYOVz52F.js +0 -1
  332. package/dist/haml-j8Vx_P4q.js +0 -1
  333. package/dist/handlebars-Qz3hgrPG.js +0 -1
  334. package/dist/haskell-DE3vVmXn.js +0 -1
  335. package/dist/haxe-DpuNPTTj.js +0 -1
  336. package/dist/hcl-BvV3VZ9s.js +0 -1
  337. package/dist/hjson-CsTZvU0B.js +0 -1
  338. package/dist/hlsl-BLZumTGu.js +0 -1
  339. package/dist/html-BJsWDmIe.js +0 -1
  340. package/dist/html-derivative-zDWJvwg5.js +0 -1
  341. package/dist/http-BiMppEBd.js +0 -1
  342. package/dist/hxml-DG2jWwyK.js +0 -1
  343. package/dist/hy-C9zVJlJf.js +0 -1
  344. package/dist/imba-DGD1mm8E.js +0 -1
  345. package/dist/index-TKJ66_wI.js +0 -1
  346. package/dist/ini-CU7wgrgh.js +0 -1
  347. package/dist/java-DyOZhX5L.js +0 -1
  348. package/dist/javascript-C0AWZ4eK.js +0 -1
  349. package/dist/jinja-Lc82IfGI.js +0 -1
  350. package/dist/jison-DT7Oqeqm.js +0 -1
  351. package/dist/json-Zoq3rK60.js +0 -1
  352. package/dist/json5-BOFh3mt2.js +0 -1
  353. package/dist/jsonc-CPutX9W5.js +0 -1
  354. package/dist/jsonl-xWfKSBhV.js +0 -1
  355. package/dist/jsonnet-UcnvaLwK.js +0 -1
  356. package/dist/jssm-BRT8_Uqd.js +0 -1
  357. package/dist/jsx-B4WNxrCK.js +0 -1
  358. package/dist/julia-i7_3XSV_.js +0 -1
  359. package/dist/kotlin-B_s0KNy5.js +0 -1
  360. package/dist/kusto-CDr4m-xT.js +0 -1
  361. package/dist/latex-BNB6MZrj.js +0 -1
  362. package/dist/lean-2dBp1asm.js +0 -1
  363. package/dist/less-CfPPFFsV.js +0 -1
  364. package/dist/light-plus-glPHycm5.js +0 -1
  365. package/dist/liquid-Bj1DN66U.js +0 -1
  366. package/dist/log-CKSz9t_o.js +0 -1
  367. package/dist/logo-D3UPVeLP.js +0 -1
  368. package/dist/lua-C1EFGxtA.js +0 -1
  369. package/dist/luau-Dvb2LLsw.js +0 -1
  370. package/dist/make-TqphZF-7.js +0 -1
  371. package/dist/markdown-yX62Igf3.js +0 -1
  372. package/dist/marko-LH6NoP97.js +0 -1
  373. package/dist/material-darker-D6whucX3.js +0 -1
  374. package/dist/material-default-DYqS7fqa.js +0 -1
  375. package/dist/material-from-css-DlWo_ZDV.js +0 -1
  376. package/dist/material-lighter-CYQaMsGh.js +0 -1
  377. package/dist/material-ocean-Dl_zLA-F.js +0 -1
  378. package/dist/material-palenight-Cd4X9kqy.js +0 -1
  379. package/dist/matlab-Dy9K5GW8.js +0 -1
  380. package/dist/mdc-DhAfBnnn.js +0 -1
  381. package/dist/mdx-tnT2uTqR.js +0 -1
  382. package/dist/mermaid-aEaCok9S.js +0 -1
  383. package/dist/min-dark-CpapYCVz.js +0 -1
  384. package/dist/min-light-plRN0zW-.js +0 -1
  385. package/dist/mojo-BanaVmFY.js +0 -1
  386. package/dist/monokai-Cs2_BG4b.js +0 -1
  387. package/dist/move-B_kaWhAV.js +0 -1
  388. package/dist/narrat-6tChrAmV.js +0 -1
  389. package/dist/nextflow-BYB6CU6V.js +0 -1
  390. package/dist/nginx-Clr7XfzW.js +0 -1
  391. package/dist/nim-gLesixmv.js +0 -1
  392. package/dist/nix-DCgUXh-o.js +0 -1
  393. package/dist/nord-BHSE8FbR.js +0 -1
  394. package/dist/nushell-DDKGkuZY.js +0 -1
  395. package/dist/objective-c-BsQdhSk0.js +0 -1
  396. package/dist/objective-cpp-B-VZlBXW.js +0 -1
  397. package/dist/ocaml-B19L2xxl.js +0 -1
  398. package/dist/one-dark-pro-AWPQgJbJ.js +0 -1
  399. package/dist/pascal-B0kVBVTU.js +0 -1
  400. package/dist/perl-Bs2cXIO6.js +0 -1
  401. package/dist/php-BgaH_AHK.js +0 -1
  402. package/dist/plsql-CPY7hT9n.js +0 -1
  403. package/dist/po-BszTsnLZ.js +0 -1
  404. package/dist/poimandres-CZF4JUv5.js +0 -1
  405. package/dist/postcss-DQ0frX96.js +0 -1
  406. package/dist/powerquery-BitONm6p.js +0 -1
  407. package/dist/powershell-B_lVHVgu.js +0 -1
  408. package/dist/prisma-CqkE3olT.js +0 -1
  409. package/dist/prolog-Bpuon3aK.js +0 -1
  410. package/dist/proto-C349dup0.js +0 -1
  411. package/dist/pug-Bbf3g_hT.js +0 -1
  412. package/dist/puppet-qDtDc0so.js +0 -1
  413. package/dist/purescript-C03CHyrT.js +0 -1
  414. package/dist/python-D5e4BtVB.js +0 -1
  415. package/dist/qml-LVCeHqxw.js +0 -1
  416. package/dist/qmldir-BEg8Q-XX.js +0 -1
  417. package/dist/qss-vq-U9k0N.js +0 -1
  418. package/dist/r-DnCIdoUu.js +0 -1
  419. package/dist/racket-BQt8mf2o.js +0 -1
  420. package/dist/raku-ChTHpuBS.js +0 -1
  421. package/dist/razor-CjFZSXD2.js +0 -1
  422. package/dist/reg-12gGsscy.js +0 -1
  423. package/dist/regexp-zLCCZKTi.js +0 -1
  424. package/dist/rel-aZ4oe34Q.js +0 -1
  425. package/dist/riscv-BA9R8KI2.js +0 -1
  426. package/dist/rose-pine-8QECO0Ox.js +0 -1
  427. package/dist/rose-pine-dawn-DT77ObZh.js +0 -1
  428. package/dist/rose-pine-moon-D3-I8ETF.js +0 -1
  429. package/dist/rst-DFKlxnrd.js +0 -1
  430. package/dist/ruby-BypI_hk5.js +0 -1
  431. package/dist/rust-tE6tRkqD.js +0 -1
  432. package/dist/sas-D1sMUJql.js +0 -1
  433. package/dist/sass-DBEOLVv3.js +0 -1
  434. package/dist/scala-DUzir4os.js +0 -1
  435. package/dist/scheme-dsSqVZz3.js +0 -1
  436. package/dist/scss-B0kJw1gM.js +0 -1
  437. package/dist/shaderlab-Cd8Cbryn.js +0 -1
  438. package/dist/shellscript-BL-Ihj2z.js +0 -1
  439. package/dist/shellsession-C5KJPcFG.js +0 -1
  440. package/dist/slack-dark-JbsLGggd.js +0 -1
  441. package/dist/slack-ochin-hTeCADjA.js +0 -1
  442. package/dist/smalltalk-DQ23HuGh.js +0 -1
  443. package/dist/solarized-dark-D2bQRcX7.js +0 -1
  444. package/dist/solarized-light-6xrOKoxI.js +0 -1
  445. package/dist/solidity-DUCwohjn.js +0 -1
  446. package/dist/soy-Cy4pRjbu.js +0 -1
  447. package/dist/sparql-D7gNTkUq.js +0 -1
  448. package/dist/splunk-Dvl5Xm98.js +0 -1
  449. package/dist/sql-BfoT44Al.js +0 -1
  450. package/dist/ssh-config-C-ZFySPN.js +0 -1
  451. package/dist/stata-Dpw9jvge.js +0 -1
  452. package/dist/stylus-mJ9_5M6n.js +0 -1
  453. package/dist/svelte-DD5dtnEi.js +0 -1
  454. package/dist/swift-DDernUpH.js +0 -1
  455. package/dist/system-verilog-DeXSd9Py.js +0 -1
  456. package/dist/systemd-NetTuLPL.js +0 -1
  457. package/dist/tasl-BCm9L3tI.js +0 -1
  458. package/dist/tcl-DmWVgxCm.js +0 -1
  459. package/dist/templ-B7wt_K-d.js +0 -1
  460. package/dist/terraform-DYIIsq8p.js +0 -1
  461. package/dist/tex-DFj0qpOD.js +0 -1
  462. package/dist/toml-CFu3vY0Q.js +0 -1
  463. package/dist/ts-tags-BvMEeGTJ.js +0 -1
  464. package/dist/tsv-DnenRF8k.js +0 -1
  465. package/dist/tsx-DooqfEr1.js +0 -1
  466. package/dist/turtle-DKlxyehf.js +0 -1
  467. package/dist/twig-DpQc8FUF.js +0 -1
  468. package/dist/txt-C4tHEtDr.js +0 -1
  469. package/dist/typescript-DtE5sB_4.js +0 -1
  470. package/dist/typespec-B69vp3jc.js +0 -1
  471. package/dist/typst-BzEngGMo.js +0 -1
  472. package/dist/v-Dy6tTX8K.js +0 -1
  473. package/dist/vala-DQnmDtkE.js +0 -1
  474. package/dist/vb-CqTjXY4K.js +0 -1
  475. package/dist/verilog-D6Zfe00a.js +0 -1
  476. package/dist/vhdl-Dxu0BOr9.js +0 -1
  477. package/dist/viml-eXtfIM-m.js +0 -1
  478. package/dist/vue-D3vey6Cu.js +0 -1
  479. package/dist/vue-html-DyaqvCGV.js +0 -1
  480. package/dist/vyper-C6AULW8C.js +0 -1
  481. package/dist/wasm-Cl39COlm.js +0 -1
  482. package/dist/wenyan-DJGdsiXE.js +0 -1
  483. package/dist/wgsl-CDhIPMwJ.js +0 -1
  484. package/dist/wikitext-D05PpJ8X.js +0 -1
  485. package/dist/wolfram-JgWnd2g7.js +0 -1
  486. package/dist/xml-Cc1Sy-d4.js +0 -1
  487. package/dist/xsl-CEYTrbD0.js +0 -1
  488. package/dist/yaml-NvTdC05o.js +0 -1
  489. package/dist/zenscript-De0mU_BW.js +0 -1
  490. package/dist/zig-D9TJVGyp.js +0 -1
  491. package/src/coder/CodeCopy/CodeCopy.style.tsx +0 -21
  492. package/src/coder/CodeSample/CodeSample.styles.tsx +0 -137
@@ -0,0 +1,104 @@
1
+ import {css} from "@linaria/core";
2
+
3
+ export const CodeTabsHost = css`
4
+ overflow: hidden;
5
+ min-width: 0;
6
+ //flex: 1 1 0;
7
+ //max-width: 512px;
8
+
9
+ border: 1px solid rgb(236, 236, 241);
10
+ border-radius: 16px;
11
+ `;
12
+
13
+ export const CodeTabsPreSingle = css`
14
+ border: none !important; // TODO: bad, find another way - CodeSample another kind?
15
+ `;
16
+
17
+ export const CodeTabsLanguagesHost = css`
18
+ display: flex;
19
+ flex: 1 1 0%;
20
+ //padding: 8px 0px;
21
+
22
+ background: linear-gradient(45deg, rgb(247, 247, 248) 0%, rgb(247, 247, 248) 100%) !important;
23
+
24
+ border-top-right-radius: 10px;
25
+ border-top-left-radius: 10px;
26
+ border-bottom: 0px;
27
+
28
+ min-width: 0;
29
+ `;
30
+
31
+ export const CodeTabsLanguagesHostSingle = css`
32
+ height: 0;
33
+ `;
34
+
35
+ export const CodeTabsLanguagesList = css`
36
+ display: flex;
37
+ flex-grow: 1;
38
+ justify-content: end;
39
+ gap: 8px;
40
+ padding: 0 10px;
41
+ `;
42
+
43
+ export const CodeTabsLanguagesButton = css`
44
+ all: unset;
45
+
46
+ cursor: pointer;
47
+
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+
52
+ border-radius: 6px;
53
+ padding: 6px;
54
+
55
+ font-size: 14px;
56
+ color: rgb(53, 55, 64);
57
+
58
+ &[data-state="active"] {
59
+ color: rgb(112, 81, 212);
60
+ border-bottom: 1px solid rgb(112, 81, 212);
61
+ border-bottom-left-radius: 0px;
62
+ border-bottom-right-radius: 0px;
63
+ }
64
+
65
+ &:hover {
66
+ transition: ease-in 0.1s;
67
+ background: #e3e3eb;
68
+ }
69
+ `;
70
+
71
+ export const CodeTabsLanguagesDescription = css`
72
+ display: flex;
73
+ align-items: center;
74
+ gap: 4px;
75
+
76
+ font-size: 14px;
77
+ color: rgb(53, 55, 64);
78
+
79
+ margin-left: 4px;
80
+ margin-right: 4px;
81
+ `;
82
+
83
+ export const CodeTabsLanguagesDescriptionItem = css`
84
+ display: flex;
85
+ padding-left: 16px;
86
+ padding-right: 16px;
87
+ flex: 1 1 0%;
88
+ gap: 16px;
89
+ border-radius: 4px;
90
+ `;
91
+
92
+ export const CodeTabsLanguagesCopy = css`
93
+ display: flex;
94
+ padding-left: 8px;
95
+ padding-right: 8px;
96
+ align-items: center;
97
+ `;
98
+
99
+ export const CodeTabsLanguagesCopySingle = css`
100
+ top: 17px;
101
+ position: relative;
102
+ right: 5px;
103
+ `;
104
+
@@ -0,0 +1,95 @@
1
+ import React, {} from "react";
2
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
3
+ import {
4
+ HighlightedCode,
5
+ } from "codehike/code"
6
+
7
+ import {
8
+ CodeCopy,
9
+ } from "../CodeCopy";
10
+ import * as cn from "./CodeTabs.styles"; // TODO: style by highlighted?
11
+
12
+ export interface CodeTabsProps {
13
+ description: string;
14
+ highlighted: HighlightedCode[]
15
+ size?: "full"
16
+ }
17
+
18
+ export function withCodeTabs(PreComponent) {
19
+ return function CodeTabs(props: CodeTabsProps) {
20
+ const isSingle = props.highlighted.length === 1 && !props.description
21
+
22
+ return (
23
+ <TabsPrimitive.Root
24
+ className={cn.CodeTabsHost}
25
+ style={props.highlighted[0]?.style}
26
+ defaultValue={props.highlighted[0]?.meta}
27
+ >
28
+ <$LanguageTabSwitcher
29
+ description={props.description}
30
+ highlighted={props.highlighted}
31
+ />
32
+
33
+ {props.highlighted?.map((codeblock, i) => (
34
+ <TabsPrimitive.Content value={codeblock.meta} key={i}>
35
+ <PreComponent
36
+ style={codeblock?.style || codeblock?.style}
37
+ codeblock={codeblock}
38
+ className={`
39
+ ${isSingle && cn.CodeTabsPreSingle}
40
+ `}
41
+ />
42
+ </TabsPrimitive.Content>
43
+ ))}
44
+ </TabsPrimitive.Root>
45
+ )
46
+ }
47
+ }
48
+
49
+ interface LanguageTabSwitcherProps {
50
+ description: string;
51
+ highlighted: HighlightedCode[]
52
+ }
53
+
54
+ function $LanguageTabSwitcher(props: LanguageTabSwitcherProps) {
55
+ const isSingle = props.highlighted.length === 1 && !props.description
56
+
57
+ return <div className={`
58
+ ${cn.CodeTabsLanguagesHost}
59
+ ${isSingle && cn.CodeTabsLanguagesHostSingle}
60
+ `}>
61
+ <$Description description={props.description}/>
62
+
63
+ <TabsPrimitive.List className={cn.CodeTabsLanguagesList}>
64
+ {props.highlighted?.map(({meta}, i) => {
65
+ if (isSingle) {
66
+ return null
67
+ }
68
+ return <TabsPrimitive.Trigger value={meta!} key={i} className={cn.CodeTabsLanguagesButton}>
69
+ {meta}
70
+ </TabsPrimitive.Trigger>
71
+ })}
72
+ </TabsPrimitive.List>
73
+
74
+ <div className={`
75
+ ${cn.CodeTabsLanguagesCopy}
76
+ ${isSingle && cn.CodeTabsLanguagesCopySingle}
77
+ `}>
78
+ {props.highlighted?.map((codeblock, i) => (
79
+ <TabsPrimitive.Content value={codeblock.meta!} asChild key={i}>
80
+ <CodeCopy text={codeblock.value}/>
81
+ </TabsPrimitive.Content>
82
+ ))}
83
+ </div>
84
+ </div>
85
+ }
86
+
87
+ function $Description(props: { description: string }) {
88
+ return <div className={cn.CodeTabsLanguagesDescription}>
89
+ <div className={cn.CodeTabsLanguagesDescriptionItem}>
90
+ {props.description}
91
+ </div>
92
+ </div>
93
+ }
94
+
95
+
@@ -0,0 +1,6 @@
1
+ export type {
2
+ CodeTabsProps
3
+ } from "./CodeTabs";
4
+ export {
5
+ withCodeTabs
6
+ } from "./CodeTabs";
@@ -0,0 +1,79 @@
1
+ import React, { createContext, useState, use, useEffect } from "react";
2
+ import { Theme } from "@code-hike/lighter";
3
+ import { highlight } from "codehike/code";
4
+ import type { HighlightedCode } from "codehike/code";
5
+
6
+ import defaultTheme from "../themes/cosmo-light"
7
+ import { Loader } from "../../ui";
8
+
9
+ export interface CodeThemeProps {
10
+ codeblocks: CodeThemeBlockProps[];
11
+ children: React.ReactNode;
12
+ theme?: Theme;
13
+ }
14
+
15
+ export interface CodeThemeBlockProps {
16
+ /** This is the raw code. May include annotation comments. */
17
+ value: string;
18
+ /** The programming language. */
19
+ lang: string;
20
+ /** Metadata string (the content after the language name in a markdown codeblock). */
21
+ meta: string;
22
+ }
23
+
24
+ const CodeThemeProvider = createContext<{
25
+ highlighted: HighlightedCode[];
26
+ }>({
27
+ highlighted: [],
28
+ });
29
+
30
+ export function useCodeTheme() {
31
+ return use(CodeThemeProvider);
32
+ }
33
+
34
+ export function CodeTheme(props: CodeThemeProps) {
35
+ const highlighted = use(
36
+ fetchHighlight(props.codeblocks, props.theme || defaultTheme)
37
+ );
38
+
39
+ return (
40
+ <CodeThemeProvider
41
+ value={{
42
+ highlighted,
43
+ }}
44
+ >
45
+ {props.children}
46
+ </CodeThemeProvider>
47
+ );
48
+ }
49
+
50
+ // `CodeThemeSync` ?
51
+ export function CodeThemeCSR(props: CodeThemeProps) {
52
+ const [highlighted, setHighlighted] = useState<HighlightedCode[]>([]);
53
+
54
+ useEffect(() => {
55
+ fetchHighlight(props.codeblocks, props.theme || defaultTheme).then(
56
+ setHighlighted
57
+ );
58
+ }, [props.codeblocks, props.theme]);
59
+
60
+ if (!highlighted) {
61
+ return <Loader />;
62
+ }
63
+
64
+ return (
65
+ <CodeThemeProvider
66
+ value={{
67
+ highlighted,
68
+ }}
69
+ >
70
+ {props.children}
71
+ </CodeThemeProvider>
72
+ );
73
+ }
74
+
75
+ async function fetchHighlight(codeblocks: CodeThemeBlockProps[], theme: Theme) {
76
+ return await Promise.all(
77
+ codeblocks?.map((codeblock) => highlight(codeblock, theme))
78
+ );
79
+ }
@@ -0,0 +1,8 @@
1
+ export type {CodeThemeProps, CodeThemeBlockProps} from "./CodeTheme";
2
+
3
+ export {
4
+ CodeTheme,
5
+ CodeThemeCSR,
6
+
7
+ useCodeTheme
8
+ } from "./CodeTheme";
@@ -0,0 +1,182 @@
1
+ // import { splitAnnotationsAndCode } from './extract-annotations.js';
2
+ import {
3
+ type CodeAnnotation,
4
+ type RawCode,
5
+ type HighlightedCode,
6
+ type Token
7
+ // Whitespace,
8
+ // isWhitespace,
9
+ } from 'codehike/code';
10
+ import {
11
+ type Lines,
12
+ type Tokens,
13
+ highlightSync as lighter,
14
+ LANG_NAMES,
15
+ type Theme
16
+ } from '@code-hike/lighter';
17
+
18
+ type Whitespace = string
19
+
20
+ type AnyToken = Token | Whitespace
21
+
22
+ function isWhitespace(token: Token | Whitespace): token is Whitespace {
23
+ return typeof token === 'string';
24
+ }
25
+
26
+ export function highlight(
27
+ data: RawCode,
28
+ theme: Theme,
29
+ lang: string
30
+ ): HighlightedCode {
31
+ // let { value, lang = 'txt' } = data;
32
+
33
+ if (!LANG_NAMES.includes(lang)) {
34
+ console.warn(`Unknown language "${lang}"`);
35
+ lang = 'txt';
36
+ }
37
+
38
+ // const { code, annotations } = await splitAnnotationsAndCode(
39
+ // value,
40
+ // lang,
41
+ // config.annotationPrefix || '!'
42
+ // );
43
+ //
44
+
45
+ const {
46
+ lines,
47
+ lang: lighterLang,
48
+ style
49
+ } = lighter(data.value, lang, theme as any, {
50
+ annotations: [],
51
+ scopes: false // true for better token transitions, but breaks css themes
52
+ });
53
+
54
+ const tokens = joinLines(lines);
55
+ // split surrounding whitespace for each token
56
+ const splitTokens = splitWhitespace(tokens);
57
+ // join consecutive whitespace tokens
58
+ const joinedTokens = joinWhitespace(splitTokens);
59
+
60
+ return {
61
+ ...data,
62
+ code: data.value,
63
+ tokens: joinedTokens,
64
+ lang: lighterLang,
65
+ annotations: [], // TODO: in the future
66
+ // annotations: compatAnnotations(annotations),
67
+ themeName: typeof theme === 'string' ? theme : theme?.name || 'unknown',
68
+ style
69
+ };
70
+ }
71
+
72
+ function compatAnnotations(annotations: any[]): CodeAnnotation[] {
73
+ const newAnnotations: CodeAnnotation[] = [];
74
+ for (const a of annotations) {
75
+ const { name, query, ranges } = a;
76
+ for (const r of ranges) {
77
+ if (r.lineNumber) {
78
+ const { lineNumber, fromColumn, toColumn } = r;
79
+ newAnnotations.push({
80
+ name,
81
+ query,
82
+ lineNumber,
83
+ fromColumn,
84
+ toColumn
85
+ });
86
+ } else {
87
+ const { fromLineNumber, toLineNumber } = r;
88
+ newAnnotations.push({
89
+ name,
90
+ query,
91
+ fromLineNumber,
92
+ toLineNumber
93
+ });
94
+ }
95
+ }
96
+ }
97
+ return newAnnotations;
98
+ }
99
+
100
+ // group the Lines into one array
101
+ function joinLines(lines: Lines): AnyToken[] {
102
+ const joinedTokens: AnyToken[] = [];
103
+ lines.forEach((lineOrGroup, i) => {
104
+ if ('lines' in lineOrGroup) {
105
+ throw new Error('Shouldnt be groups');
106
+ } else {
107
+ const tokens = joinTokens(lineOrGroup.tokens);
108
+ joinedTokens.push(...tokens);
109
+ if (i < lines.length - 1) {
110
+ joinedTokens.push('\n');
111
+ }
112
+ }
113
+ });
114
+ return joinedTokens;
115
+ }
116
+
117
+ function joinTokens(tokens: Tokens): AnyToken[] {
118
+ return tokens.map((tokenOrGroup) => {
119
+ if ('tokens' in tokenOrGroup) {
120
+ throw new Error('Shouldnt be groups');
121
+ } else {
122
+ const t = [tokenOrGroup.content] as Token;
123
+ const { color, ...rest } = tokenOrGroup.style || {};
124
+ t.push(color);
125
+ if (Object.keys(rest).length) {
126
+ t.push(rest);
127
+ }
128
+ return t;
129
+ }
130
+ });
131
+ }
132
+
133
+ function splitWhitespace(tokens: AnyToken[]) {
134
+ const ejected: AnyToken[] = [];
135
+ tokens.forEach((tokenOrGroup) => {
136
+ if (isWhitespace(tokenOrGroup)) {
137
+ ejected.push(tokenOrGroup);
138
+ } else {
139
+ const [before, content, after] = splitSurroundingWhitespace(
140
+ tokenOrGroup[0]
141
+ );
142
+ if (before?.length) {
143
+ ejected.push(before);
144
+ }
145
+ if (content.length) {
146
+ const copy = [...tokenOrGroup] as Token;
147
+ copy[0] = content;
148
+ ejected.push(copy);
149
+ }
150
+ if (after?.length) {
151
+ ejected.push(after);
152
+ }
153
+ }
154
+ });
155
+ return ejected;
156
+ }
157
+
158
+ function joinWhitespace(tokens: AnyToken[]) {
159
+ const joinedTokens: AnyToken[] = [];
160
+ tokens.forEach((tokenOrGroup) => {
161
+ if (isWhitespace(tokenOrGroup)) {
162
+ let last = joinedTokens[joinedTokens.length - 1];
163
+ if (last && isWhitespace(last)) {
164
+ joinedTokens[joinedTokens.length - 1] += tokenOrGroup;
165
+ } else if (tokenOrGroup !== '') {
166
+ joinedTokens.push(tokenOrGroup);
167
+ }
168
+ } else if (tokenOrGroup[0].length > 0) {
169
+ joinedTokens.push(tokenOrGroup);
170
+ }
171
+ });
172
+ return joinedTokens;
173
+ }
174
+
175
+ // splits " \t foo bar \n" into [" \t ","foo bar"," \n"]
176
+ // "foo bar" -> ["","foo bar",""]
177
+ function splitSurroundingWhitespace(content: string) {
178
+ const trimmed = content.trim();
179
+ const before = content.slice(0, content.indexOf(trimmed));
180
+ const after = content.slice(content.indexOf(trimmed) + trimmed.length);
181
+ return [before, trimmed, after];
182
+ }
@@ -1,3 +1,33 @@
1
+ export {
2
+ annotations
3
+ } from "./Code"
4
+ export type {
5
+ CodeProps
6
+ } from "./Code"
7
+ export {
8
+ Code,
9
+ CodeLoader,
10
+
11
+ highlight
12
+ } from "./Code"
13
+ //
14
+
15
+ export type {CodeSampleProps} from "./CodeSample";
1
16
  export {CodeSample} from "./CodeSample";
17
+ //
18
+
19
+ export type {
20
+ CodeTabsProps
21
+ } from "./CodeTabs";
22
+ export {
23
+ withCodeTabs
24
+ } from "./CodeTabs";
25
+ //
26
+
27
+ export type {CodeThemeProps, CodeThemeBlockProps} from "./CodeTheme";
28
+ export {
29
+ CodeTheme,
30
+ CodeThemeCSR,
2
31
 
3
- export type {CodeSampleProps} from "./CodeSample";
32
+ useCodeTheme
33
+ } from "./CodeTheme";
@@ -2,7 +2,8 @@
2
2
 
3
3
  import {Theme} from "@code-hike/lighter";
4
4
 
5
- export const theme: Theme = {
5
+ export default {
6
+ name: "cosmo-light",
6
7
  type: "light",
7
8
  colors: {
8
9
  "list.focusForeground": "#FFFFFF",
@@ -263,4 +264,4 @@ export const theme: Theme = {
263
264
  },
264
265
  },
265
266
  ],
266
- }
267
+ } as Theme
@@ -0,0 +1,5 @@
1
+ import {css} from "@linaria/core";
2
+
3
+ export const AnchorHost = css`
4
+ color: #7051d4;
5
+ `;
@@ -1,13 +1,6 @@
1
1
  import React, {forwardRef} from 'react'
2
2
  import type {ComponentProps, ReactElement} from 'react'
3
-
4
- import {css} from "@linaria/core";
5
-
6
- const $anchor = {
7
- host: css`
8
- color: #7051d4;
9
- `,
10
- };
3
+ import * as cn from "./Anchor.styles";
11
4
 
12
5
  export type AnchorProps = Omit<ComponentProps<'a'>, 'ref'> & {
13
6
  newWindow?: boolean
@@ -24,11 +17,10 @@ export const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(function (
24
17
  return (
25
18
  <a
26
19
  ref={forwardedRef}
27
- to={href}
28
20
  href={href}
29
21
  target="_blank"
30
22
  rel="noreferrer"
31
- className={$anchor.host}
23
+ className={cn.AnchorHost}
32
24
  >
33
25
  {children}
34
26
  </a>
@@ -39,9 +31,8 @@ export const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(function (
39
31
  return (
40
32
  <a
41
33
  ref={forwardedRef}
42
- to={href}
43
34
  href={href}
44
- className={$anchor.host}
35
+ className={cn.AnchorHost}
45
36
  >
46
37
  {children}
47
38
  </a>
@@ -51,9 +42,8 @@ export const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(function (
51
42
  return (
52
43
  <a
53
44
  ref={forwardedRef}
54
- to={href}
55
45
  href={href}
56
- className={$anchor.host}
46
+ className={cn.AnchorHost}
57
47
  >
58
48
  {children}
59
49
  </a>
@@ -0,0 +1,9 @@
1
+ import {css} from "@linaria/core";
2
+
3
+ export const ContentHost = css`
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: 24px;
7
+ font-size: 16px;
8
+ line-height: 1.5;
9
+ `;
@@ -1,20 +1,13 @@
1
1
  import React from "react"
2
- import {css} from "@linaria/core";
3
-
4
- const $content = {
5
- host: css`
6
- display: flex;
7
- flex-direction: column;
8
- gap: 24px;
9
- `
10
- }
2
+ import * as cn from "./Content.styles";
11
3
 
12
4
  export interface ContentProps {
13
5
  children: React.ReactNode
14
6
  }
15
7
 
16
8
  export function Content({children}: ContentProps) {
17
- return <div className={$content.host}>
9
+ return <div className={cn.ContentHost}>
18
10
  {children}
19
11
  </div>
20
- }
12
+ }
13
+