@xyd-js/components 0.1.0-xyd.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/README.md +3 -0
  2. package/coder.ts +1 -0
  3. package/content.ts +3 -0
  4. package/dist/CTABanner-CWX9isVG.js +1 -0
  5. package/dist/CodeSample-C5YaEpAi.js +1 -0
  6. package/dist/HomeView-CnAj-VYl.js +1 -0
  7. package/dist/UnderlineNav-C8onw9Na.js +1 -0
  8. package/dist/_rollupPluginBabelHelpers-DfQAiTCw.js +1 -0
  9. package/dist/abap-kIO_7z1o.js +1 -0
  10. package/dist/actionscript-3-DiaraCXE.js +1 -0
  11. package/dist/ada-aNFKX2pl.js +1 -0
  12. package/dist/angular-html-y0qIEhS2.js +1 -0
  13. package/dist/angular-ts-Bn_6f37o.js +1 -0
  14. package/dist/apache-Cx7e0H64.js +1 -0
  15. package/dist/apex-CdSCJjuL.js +1 -0
  16. package/dist/apl-BDzWBUim.js +1 -0
  17. package/dist/applescript-CJFkzk5i.js +1 -0
  18. package/dist/ara-BC9R9M5c.js +1 -0
  19. package/dist/asciidoc-lqQQs4M0.js +1 -0
  20. package/dist/asm-QQeI-gwp.js +1 -0
  21. package/dist/astro-BPstp8LF.js +1 -0
  22. package/dist/awk-Cxb7Sqvk.js +1 -0
  23. package/dist/ballerina-G8TyVc6O.js +1 -0
  24. package/dist/bat-UDEmXz-g.js +1 -0
  25. package/dist/beancount-BWg86rhE.js +1 -0
  26. package/dist/berry-5E5uGOYg.js +1 -0
  27. package/dist/bibtex-CZn_FFnb.js +1 -0
  28. package/dist/bicep-D_G0XT5J.js +1 -0
  29. package/dist/blade-7dxmctkK.js +1 -0
  30. package/dist/brand.d.ts +30 -0
  31. package/dist/brand.js +1 -0
  32. package/dist/c-CrEz-oYf.js +1 -0
  33. package/dist/cadence-BulSIR1A.js +1 -0
  34. package/dist/clarity-m2OigCMT.js +1 -0
  35. package/dist/clojure-Bpes2rhL.js +1 -0
  36. package/dist/cmake-C4Tr1SQC.js +1 -0
  37. package/dist/cobol-Dp8xGW1S.js +1 -0
  38. package/dist/codeowners-Bs3mpoau.js +1 -0
  39. package/dist/codeql-CvQzaisq.js +1 -0
  40. package/dist/coder.d.ts +19 -0
  41. package/dist/coder.js +1 -0
  42. package/dist/coffee-DOjtyJj_.js +1 -0
  43. package/dist/common-lisp-DGVR8DFi.js +1 -0
  44. package/dist/content.d.ts +225 -0
  45. package/dist/content.js +1 -0
  46. package/dist/cpp-BUT7C4Bo.js +1 -0
  47. package/dist/crystal-BJh9OJ1_.js +1 -0
  48. package/dist/csharp-BhZuAD8H.js +1 -0
  49. package/dist/css-8_G4_UCW.js +1 -0
  50. package/dist/csv-DLRyYdMG.js +1 -0
  51. package/dist/cue-DAgMCCsT.js +1 -0
  52. package/dist/cypher-CtSiSKRh.js +1 -0
  53. package/dist/d-feZJOTtr.js +1 -0
  54. package/dist/dark-plus-Dcn2h2HL.js +1 -0
  55. package/dist/dart-CNOu4aud.js +1 -0
  56. package/dist/dax-Dkp1Uj6t.js +1 -0
  57. package/dist/desktop-CAGQzotA.js +1 -0
  58. package/dist/diff-D6yk3_ZG.js +1 -0
  59. package/dist/docker-BdTrQq0b.js +1 -0
  60. package/dist/dotenv-BeHGAMs7.js +1 -0
  61. package/dist/dracula-BUaMrXr0.js +1 -0
  62. package/dist/dracula-soft-CBx6n76m.js +1 -0
  63. package/dist/dream-maker-BU0sZZmb.js +1 -0
  64. package/dist/edge-D2Tk5tmg.js +1 -0
  65. package/dist/elixir-B-l3Nz-G.js +1 -0
  66. package/dist/elm-Bqm7aRpV.js +1 -0
  67. package/dist/emacs-lisp-BSvpfolf.js +1 -0
  68. package/dist/erb-CwBHxfFV.js +1 -0
  69. package/dist/erlang-B0PtHWg2.js +1 -0
  70. package/dist/fennel-CdN4E9Xo.js +1 -0
  71. package/dist/fish-XrbYjeRx.js +1 -0
  72. package/dist/fluent-zYsEgElv.js +1 -0
  73. package/dist/fortran-fixed-form-CPwX6okW.js +1 -0
  74. package/dist/fortran-free-form-B6Kk9658.js +1 -0
  75. package/dist/fsharp-CbMfVCMr.js +1 -0
  76. package/dist/gdresource-CdRUpBQO.js +1 -0
  77. package/dist/gdscript-CYXv_Ac9.js +1 -0
  78. package/dist/gdshader-CtiaGYI5.js +1 -0
  79. package/dist/genie-C-gOIth7.js +1 -0
  80. package/dist/gherkin-uGsOfG-k.js +1 -0
  81. package/dist/git-commit-CWQvkRNX.js +1 -0
  82. package/dist/git-rebase-BZ0YVJ-O.js +1 -0
  83. package/dist/github-dark-DCm4kydX.js +1 -0
  84. package/dist/github-dark-dimmed-CsRUrOJA.js +1 -0
  85. package/dist/github-from-css-CTRi6tFC.js +1 -0
  86. package/dist/github-light-B2ofRYMU.js +1 -0
  87. package/dist/gleam-C9ZZ3Vp2.js +1 -0
  88. package/dist/glimmer-js-Cuwfndkm.js +1 -0
  89. package/dist/glimmer-ts-D8nR8_k2.js +1 -0
  90. package/dist/glsl-qc_rLvzz.js +1 -0
  91. package/dist/gnuplot-BgHAcd--.js +1 -0
  92. package/dist/go-Dm8VBUM2.js +1 -0
  93. package/dist/graphql-CRmnB6D5.js +1 -0
  94. package/dist/groovy-DJcw8dX4.js +1 -0
  95. package/dist/hack-DYOVz52F.js +1 -0
  96. package/dist/haml-j8Vx_P4q.js +1 -0
  97. package/dist/handlebars-Qz3hgrPG.js +1 -0
  98. package/dist/haskell-DE3vVmXn.js +1 -0
  99. package/dist/haxe-DpuNPTTj.js +1 -0
  100. package/dist/hcl-BvV3VZ9s.js +1 -0
  101. package/dist/hjson-CsTZvU0B.js +1 -0
  102. package/dist/hlsl-BLZumTGu.js +1 -0
  103. package/dist/html-BJsWDmIe.js +1 -0
  104. package/dist/html-derivative-zDWJvwg5.js +1 -0
  105. package/dist/http-BiMppEBd.js +1 -0
  106. package/dist/hxml-DG2jWwyK.js +1 -0
  107. package/dist/hy-C9zVJlJf.js +1 -0
  108. package/dist/imba-DGD1mm8E.js +1 -0
  109. package/dist/index-TKJ66_wI.js +1 -0
  110. package/dist/index.css +135 -0
  111. package/dist/index.d.ts +2 -0
  112. package/dist/index.js +1 -0
  113. package/dist/ini-CU7wgrgh.js +1 -0
  114. package/dist/java-DyOZhX5L.js +1 -0
  115. package/dist/javascript-C0AWZ4eK.js +1 -0
  116. package/dist/jinja-Lc82IfGI.js +1 -0
  117. package/dist/jison-DT7Oqeqm.js +1 -0
  118. package/dist/json-Zoq3rK60.js +1 -0
  119. package/dist/json5-BOFh3mt2.js +1 -0
  120. package/dist/jsonc-CPutX9W5.js +1 -0
  121. package/dist/jsonl-xWfKSBhV.js +1 -0
  122. package/dist/jsonnet-UcnvaLwK.js +1 -0
  123. package/dist/jssm-BRT8_Uqd.js +1 -0
  124. package/dist/jsx-B4WNxrCK.js +1 -0
  125. package/dist/julia-i7_3XSV_.js +1 -0
  126. package/dist/kotlin-B_s0KNy5.js +1 -0
  127. package/dist/kusto-CDr4m-xT.js +1 -0
  128. package/dist/latex-BNB6MZrj.js +1 -0
  129. package/dist/layouts.d.ts +19 -0
  130. package/dist/layouts.js +1 -0
  131. package/dist/lean-2dBp1asm.js +1 -0
  132. package/dist/less-CfPPFFsV.js +1 -0
  133. package/dist/light-plus-glPHycm5.js +1 -0
  134. package/dist/liquid-Bj1DN66U.js +1 -0
  135. package/dist/log-CKSz9t_o.js +1 -0
  136. package/dist/logo-D3UPVeLP.js +1 -0
  137. package/dist/lua-C1EFGxtA.js +1 -0
  138. package/dist/luau-Dvb2LLsw.js +1 -0
  139. package/dist/make-TqphZF-7.js +1 -0
  140. package/dist/markdown-yX62Igf3.js +1 -0
  141. package/dist/marko-LH6NoP97.js +1 -0
  142. package/dist/material-darker-D6whucX3.js +1 -0
  143. package/dist/material-default-DYqS7fqa.js +1 -0
  144. package/dist/material-from-css-DlWo_ZDV.js +1 -0
  145. package/dist/material-lighter-CYQaMsGh.js +1 -0
  146. package/dist/material-ocean-Dl_zLA-F.js +1 -0
  147. package/dist/material-palenight-Cd4X9kqy.js +1 -0
  148. package/dist/matlab-Dy9K5GW8.js +1 -0
  149. package/dist/mdc-DhAfBnnn.js +1 -0
  150. package/dist/mdx-tnT2uTqR.js +1 -0
  151. package/dist/mermaid-aEaCok9S.js +1 -0
  152. package/dist/min-dark-CpapYCVz.js +1 -0
  153. package/dist/min-light-plRN0zW-.js +1 -0
  154. package/dist/mojo-BanaVmFY.js +1 -0
  155. package/dist/monokai-Cs2_BG4b.js +1 -0
  156. package/dist/move-B_kaWhAV.js +1 -0
  157. package/dist/narrat-6tChrAmV.js +1 -0
  158. package/dist/nextflow-BYB6CU6V.js +1 -0
  159. package/dist/nginx-Clr7XfzW.js +1 -0
  160. package/dist/nim-gLesixmv.js +1 -0
  161. package/dist/nix-DCgUXh-o.js +1 -0
  162. package/dist/nord-BHSE8FbR.js +1 -0
  163. package/dist/nushell-DDKGkuZY.js +1 -0
  164. package/dist/objective-c-BsQdhSk0.js +1 -0
  165. package/dist/objective-cpp-B-VZlBXW.js +1 -0
  166. package/dist/ocaml-B19L2xxl.js +1 -0
  167. package/dist/one-dark-pro-AWPQgJbJ.js +1 -0
  168. package/dist/pages.d.ts +30 -0
  169. package/dist/pages.js +1 -0
  170. package/dist/pascal-B0kVBVTU.js +1 -0
  171. package/dist/perl-Bs2cXIO6.js +1 -0
  172. package/dist/php-BgaH_AHK.js +1 -0
  173. package/dist/plsql-CPY7hT9n.js +1 -0
  174. package/dist/po-BszTsnLZ.js +1 -0
  175. package/dist/poimandres-CZF4JUv5.js +1 -0
  176. package/dist/postcss-DQ0frX96.js +1 -0
  177. package/dist/powerquery-BitONm6p.js +1 -0
  178. package/dist/powershell-B_lVHVgu.js +1 -0
  179. package/dist/prisma-CqkE3olT.js +1 -0
  180. package/dist/prolog-Bpuon3aK.js +1 -0
  181. package/dist/proto-C349dup0.js +1 -0
  182. package/dist/pug-Bbf3g_hT.js +1 -0
  183. package/dist/puppet-qDtDc0so.js +1 -0
  184. package/dist/purescript-C03CHyrT.js +1 -0
  185. package/dist/python-D5e4BtVB.js +1 -0
  186. package/dist/qml-LVCeHqxw.js +1 -0
  187. package/dist/qmldir-BEg8Q-XX.js +1 -0
  188. package/dist/qss-vq-U9k0N.js +1 -0
  189. package/dist/r-DnCIdoUu.js +1 -0
  190. package/dist/racket-BQt8mf2o.js +1 -0
  191. package/dist/raku-ChTHpuBS.js +1 -0
  192. package/dist/razor-CjFZSXD2.js +1 -0
  193. package/dist/reg-12gGsscy.js +1 -0
  194. package/dist/regexp-zLCCZKTi.js +1 -0
  195. package/dist/rel-aZ4oe34Q.js +1 -0
  196. package/dist/riscv-BA9R8KI2.js +1 -0
  197. package/dist/rose-pine-8QECO0Ox.js +1 -0
  198. package/dist/rose-pine-dawn-DT77ObZh.js +1 -0
  199. package/dist/rose-pine-moon-D3-I8ETF.js +1 -0
  200. package/dist/rst-DFKlxnrd.js +1 -0
  201. package/dist/ruby-BypI_hk5.js +1 -0
  202. package/dist/rust-tE6tRkqD.js +1 -0
  203. package/dist/sas-D1sMUJql.js +1 -0
  204. package/dist/sass-DBEOLVv3.js +1 -0
  205. package/dist/scala-DUzir4os.js +1 -0
  206. package/dist/scheme-dsSqVZz3.js +1 -0
  207. package/dist/scss-B0kJw1gM.js +1 -0
  208. package/dist/shaderlab-Cd8Cbryn.js +1 -0
  209. package/dist/shellscript-BL-Ihj2z.js +1 -0
  210. package/dist/shellsession-C5KJPcFG.js +1 -0
  211. package/dist/slack-dark-JbsLGggd.js +1 -0
  212. package/dist/slack-ochin-hTeCADjA.js +1 -0
  213. package/dist/smalltalk-DQ23HuGh.js +1 -0
  214. package/dist/solarized-dark-D2bQRcX7.js +1 -0
  215. package/dist/solarized-light-6xrOKoxI.js +1 -0
  216. package/dist/solidity-DUCwohjn.js +1 -0
  217. package/dist/soy-Cy4pRjbu.js +1 -0
  218. package/dist/sparql-D7gNTkUq.js +1 -0
  219. package/dist/splunk-Dvl5Xm98.js +1 -0
  220. package/dist/sql-BfoT44Al.js +1 -0
  221. package/dist/ssh-config-C-ZFySPN.js +1 -0
  222. package/dist/stata-Dpw9jvge.js +1 -0
  223. package/dist/stylus-mJ9_5M6n.js +1 -0
  224. package/dist/svelte-DD5dtnEi.js +1 -0
  225. package/dist/swift-DDernUpH.js +1 -0
  226. package/dist/system-verilog-DeXSd9Py.js +1 -0
  227. package/dist/systemd-NetTuLPL.js +1 -0
  228. package/dist/tasl-BCm9L3tI.js +1 -0
  229. package/dist/tcl-DmWVgxCm.js +1 -0
  230. package/dist/templ-B7wt_K-d.js +1 -0
  231. package/dist/terraform-DYIIsq8p.js +1 -0
  232. package/dist/tex-DFj0qpOD.js +1 -0
  233. package/dist/toml-CFu3vY0Q.js +1 -0
  234. package/dist/ts-tags-BvMEeGTJ.js +1 -0
  235. package/dist/tslib.es6-C3PNVQlC.js +1 -0
  236. package/dist/tsv-DnenRF8k.js +1 -0
  237. package/dist/tsx-DooqfEr1.js +1 -0
  238. package/dist/turtle-DKlxyehf.js +1 -0
  239. package/dist/twig-DpQc8FUF.js +1 -0
  240. package/dist/txt-C4tHEtDr.js +1 -0
  241. package/dist/typescript-DtE5sB_4.js +1 -0
  242. package/dist/typespec-B69vp3jc.js +1 -0
  243. package/dist/typst-BzEngGMo.js +1 -0
  244. package/dist/v-Dy6tTX8K.js +1 -0
  245. package/dist/vala-DQnmDtkE.js +1 -0
  246. package/dist/vb-CqTjXY4K.js +1 -0
  247. package/dist/verilog-D6Zfe00a.js +1 -0
  248. package/dist/vhdl-Dxu0BOr9.js +1 -0
  249. package/dist/views.d.ts +17 -0
  250. package/dist/views.js +1 -0
  251. package/dist/viml-eXtfIM-m.js +1 -0
  252. package/dist/vue-D3vey6Cu.js +1 -0
  253. package/dist/vue-html-DyaqvCGV.js +1 -0
  254. package/dist/vyper-C6AULW8C.js +1 -0
  255. package/dist/wasm-Cl39COlm.js +1 -0
  256. package/dist/wenyan-DJGdsiXE.js +1 -0
  257. package/dist/wgsl-CDhIPMwJ.js +1 -0
  258. package/dist/wikitext-D05PpJ8X.js +1 -0
  259. package/dist/wolfram-JgWnd2g7.js +1 -0
  260. package/dist/writer.d.ts +157 -0
  261. package/dist/writer.js +1 -0
  262. package/dist/xml-Cc1Sy-d4.js +1 -0
  263. package/dist/xsl-CEYTrbD0.js +1 -0
  264. package/dist/yaml-NvTdC05o.js +1 -0
  265. package/dist/zenscript-De0mU_BW.js +1 -0
  266. package/dist/zig-D9TJVGyp.js +1 -0
  267. package/index.ts +1 -0
  268. package/layouts.ts +1 -0
  269. package/package.json +58 -0
  270. package/postcss.config.cjs +5 -0
  271. package/rollup.config.js +149 -0
  272. package/src/brand/Button/Button.tsx +48 -0
  273. package/src/brand/Button/index.ts +7 -0
  274. package/src/brand/CTABanner/CTABanner.tsx +127 -0
  275. package/src/brand/CTABanner/index.ts +8 -0
  276. package/src/brand/Footer/Footer.tsx +36 -0
  277. package/src/brand/Footer/index.ts +3 -0
  278. package/src/brand/index.ts +5 -0
  279. package/src/coder/CodeCopy/CodeCopy.style.tsx +21 -0
  280. package/src/coder/CodeCopy/CodeCopy.tsx +32 -0
  281. package/src/coder/CodeCopy/index.ts +7 -0
  282. package/src/coder/CodeSample/CodeSample.styles.tsx +137 -0
  283. package/src/coder/CodeSample/CodeSample.tsx +150 -0
  284. package/src/coder/CodeSample/default-theme.ts +266 -0
  285. package/src/coder/CodeSample/index.ts +12 -0
  286. package/src/coder/CodeSample/withLocalStored.tsx +50 -0
  287. package/src/coder/README.md +1 -0
  288. package/src/coder/index.ts +3 -0
  289. package/src/content/Anchor/Anchor.tsx +63 -0
  290. package/src/content/Anchor/index.tsx +3 -0
  291. package/src/content/Content/Content.tsx +20 -0
  292. package/src/content/Content/index.tsx +3 -0
  293. package/src/content/Content.tsx +137 -0
  294. package/src/content/Subtitle/Subtitle.tsx +21 -0
  295. package/src/content/Subtitle/index.tsx +3 -0
  296. package/src/content/index.ts +3 -0
  297. package/src/layouts/Layout.styles.tsx +151 -0
  298. package/src/layouts/Layout.tsx +121 -0
  299. package/src/layouts/index.ts +7 -0
  300. package/src/pages/HomePage/HomePage.tsx +93 -0
  301. package/src/pages/HomePage/index.ts +5 -0
  302. package/src/pages/HomePage/types.ts +41 -0
  303. package/src/pages/index.ts +1 -0
  304. package/src/views/HomeView/HomeView.tsx +74 -0
  305. package/src/views/HomeView/index.ts +3 -0
  306. package/src/views/index.ts +1 -0
  307. package/src/writer/Badge/Badge.styles.tsx +29 -0
  308. package/src/writer/Badge/Badge.tsx +28 -0
  309. package/src/writer/Badge/index.ts +7 -0
  310. package/src/writer/Blockquote/Blockquote.styles.tsx +10 -0
  311. package/src/writer/Blockquote/Blockquote.tsx +13 -0
  312. package/src/writer/Blockquote/index.ts +7 -0
  313. package/src/writer/Breadcrumbs/Breadcrumbs.styles.ts +28 -0
  314. package/src/writer/Breadcrumbs/Breadcrumbs.tsx +46 -0
  315. package/src/writer/Breadcrumbs/index.ts +7 -0
  316. package/src/writer/Callout/Callout.styles.tsx +50 -0
  317. package/src/writer/Callout/Callout.tsx +37 -0
  318. package/src/writer/Callout/index.tsx +3 -0
  319. package/src/writer/Code/Code.styles.tsx +17 -0
  320. package/src/writer/Code/Code.tsx +13 -0
  321. package/src/writer/Code/index.ts +3 -0
  322. package/src/writer/Details/Details.styles.tsx +76 -0
  323. package/src/writer/Details/Details.tsx +122 -0
  324. package/src/writer/Details/index.ts +3 -0
  325. package/src/writer/GuideCard/GuideCard.styles.tsx +115 -0
  326. package/src/writer/GuideCard/GuideCard.tsx +81 -0
  327. package/src/writer/GuideCard/index.ts +1 -0
  328. package/src/writer/Heading/Heading.styles.tsx +73 -0
  329. package/src/writer/Heading/Heading.tsx +53 -0
  330. package/src/writer/Heading/index.ts +7 -0
  331. package/src/writer/Hr/Hr.styles.tsx +7 -0
  332. package/src/writer/Hr/Hr.tsx +13 -0
  333. package/src/writer/Hr/index.ts +3 -0
  334. package/src/writer/Icon/index.tsx +112 -0
  335. package/src/writer/NavLinks/NavLinks.styles.ts +32 -0
  336. package/src/writer/NavLinks/NavLinks.tsx +48 -0
  337. package/src/writer/NavLinks/index.ts +7 -0
  338. package/src/writer/Pre/Pre.styles.tsx +13 -0
  339. package/src/writer/Pre/Pre.tsx +13 -0
  340. package/src/writer/Pre/index.ts +3 -0
  341. package/src/writer/README.md +1 -0
  342. package/src/writer/Steps/Steps.styles.tsx +36 -0
  343. package/src/writer/Steps/Steps.tsx +24 -0
  344. package/src/writer/Steps/index.ts +5 -0
  345. package/src/writer/Table/Table.styles.tsx +39 -0
  346. package/src/writer/Table/Table.tsx +45 -0
  347. package/src/writer/Table/index.ts +10 -0
  348. package/src/writer/Tabs/Tabs.styles.tsx +77 -0
  349. package/src/writer/Tabs/Tabs.tsx +104 -0
  350. package/src/writer/Tabs/index.ts +7 -0
  351. package/src/writer/UnderlineNav/UnderlineNav.styles.tsx +45 -0
  352. package/src/writer/UnderlineNav/UnderlineNav.tsx +38 -0
  353. package/src/writer/UnderlineNav/index.ts +1 -0
  354. package/src/writer/index.ts +32 -0
  355. package/tsconfig.json +41 -0
  356. package/writer.ts +1 -0
@@ -0,0 +1,50 @@
1
+ import React, {useState, useEffect} from "react"
2
+
3
+ export interface CodeTabsProps {
4
+ $localStorageKey: string
5
+ $defaultValue: string
6
+
7
+ children: React.ReactNode
8
+ }
9
+
10
+ // TODO: interface
11
+ export function withLocalStored(Component: any) {
12
+ return function LocalStored(props: CodeTabsProps) {
13
+ const [value, setValue] = useState(
14
+ typeof localStorage !== "undefined"
15
+ ? localStorage?.getItem(props.$localStorageKey) || props.$defaultValue
16
+ : props.$defaultValue,
17
+ )
18
+
19
+ useEffect(() => {
20
+ const handler = (e: StorageEvent) => {
21
+ if (e.key === props.$localStorageKey) {
22
+ setValue(e.newValue || props.$defaultValue)
23
+ }
24
+ }
25
+ window.addEventListener("storage", handler)
26
+ return () => {
27
+ window.removeEventListener("storage", handler)
28
+ }
29
+ }, [props.$localStorageKey])
30
+
31
+ function onValueChange(value: string) {
32
+ localStorage.setItem(props.$localStorageKey, value)
33
+ window.dispatchEvent(
34
+ new StorageEvent("storage", {
35
+ key: props.$localStorageKey,
36
+ newValue: value,
37
+ }),
38
+ )
39
+ }
40
+
41
+ return (
42
+ <Component
43
+ onValueChange={onValueChange}
44
+ value={value}
45
+ >
46
+ {props.children}
47
+ </Component>
48
+ )
49
+ }
50
+ }
@@ -0,0 +1 @@
1
+ # @xyd-js/components/coder
@@ -0,0 +1,3 @@
1
+ export {CodeSample} from "./CodeSample";
2
+
3
+ export type {CodeSampleProps} from "./CodeSample";
@@ -0,0 +1,63 @@
1
+ import React, {forwardRef} from 'react'
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
+ };
11
+
12
+ export type AnchorProps = Omit<ComponentProps<'a'>, 'ref'> & {
13
+ newWindow?: boolean
14
+ }
15
+
16
+ // TODO: where react-router?
17
+
18
+ export const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(function (
19
+ {href = '', children, newWindow},
20
+ // ref is used in <NavbarMenu />
21
+ forwardedRef
22
+ ): ReactElement {
23
+ if (newWindow) {
24
+ return (
25
+ <a
26
+ ref={forwardedRef}
27
+ to={href}
28
+ href={href}
29
+ target="_blank"
30
+ rel="noreferrer"
31
+ className={$anchor.host}
32
+ >
33
+ {children}
34
+ </a>
35
+ )
36
+ }
37
+
38
+ if (!href) {
39
+ return (
40
+ <a
41
+ ref={forwardedRef}
42
+ to={href}
43
+ href={href}
44
+ className={$anchor.host}
45
+ >
46
+ {children}
47
+ </a>
48
+ )
49
+ }
50
+
51
+ return (
52
+ <a
53
+ ref={forwardedRef}
54
+ to={href}
55
+ href={href}
56
+ className={$anchor.host}
57
+ >
58
+ {children}
59
+ </a>
60
+ )
61
+ })
62
+
63
+ Anchor.displayName = 'Anchor'
@@ -0,0 +1,3 @@
1
+ export type {AnchorProps} from "./Anchor";
2
+
3
+ export {Anchor} from "./Anchor";
@@ -0,0 +1,20 @@
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
+ }
11
+
12
+ export interface ContentProps {
13
+ children: React.ReactNode
14
+ }
15
+
16
+ export function Content({children}: ContentProps) {
17
+ return <div className={$content.host}>
18
+ {children}
19
+ </div>
20
+ }
@@ -0,0 +1,3 @@
1
+ export type {ContentProps} from "./Content";
2
+
3
+ export {Content} from "./Content";
@@ -0,0 +1,137 @@
1
+ import React from 'react'
2
+
3
+ import {
4
+ Badge,
5
+ Blockquote,
6
+ Callout,
7
+ Code,
8
+ Details,
9
+ GuideCard,
10
+ Heading,
11
+ Hr,
12
+ Table,
13
+ Tabs,
14
+ Steps,
15
+
16
+ IconCode,
17
+ IconCustomEvent,
18
+ IconFunnels,
19
+ IconMetrics,
20
+ IconSessionReplay,
21
+ } from '../writer'
22
+ import {CodeSample} from "../coder";
23
+
24
+ import {Content as ContentComponent} from "./Content/index";
25
+ import {Subtitle} from "./Subtitle";
26
+ import {Anchor} from "./Anchor";
27
+
28
+ const EXTERNAL_HREF_REGEX = /https?:\/\//
29
+
30
+ const Link = ({href = '', className, ...props}) => (
31
+ <Anchor
32
+ href={href}
33
+ newWindow={EXTERNAL_HREF_REGEX.test(href)}
34
+ {...props}
35
+ />
36
+ )
37
+
38
+ // TODO: options?
39
+ export default function content() {
40
+ return {
41
+ ...stdContent(),
42
+ ...writerContent(),
43
+ ...helperContent(),
44
+ ...iconContent(),
45
+ ...coderContent(),
46
+ }
47
+ }
48
+
49
+ export function stdContent() {
50
+ return {
51
+ h1: (props) => <div><Heading id={props.children} {...props}/></div>,
52
+ h2: props => <div><Heading id={props.children} size={2} {...props} /></div>,
53
+ h3: props => <div><Heading id={props.children} size={3} {...props} /></div>,
54
+ h4: props => <div><Heading id={props.children} size={4} {...props} /></div>,
55
+ h5: props => <div><Heading id={props.children} size={5} {...props} /></div>,
56
+ h6: props => <div><Heading id={props.children} size={6} {...props} /></div>,
57
+ p: props => <p {...props} />,
58
+
59
+ ul: props => (
60
+ <ul{...props}>
61
+ {props.children}
62
+ </ul>
63
+ ),
64
+ ol: props => (
65
+ <ol{...props}
66
+ >
67
+ {props.children}
68
+ </ol>
69
+ ),
70
+ li: props => <li {...props} >
71
+ {props.children}
72
+ </li>,
73
+
74
+ table: Table,
75
+ tr: Table.Tr,
76
+ th: Table.Th,
77
+ td: Table.Td,
78
+
79
+ code: Code,
80
+ pre: props => {
81
+ const lang = (props?.children?.props?.className || "").replace("language-", "") // TODO: better solution
82
+
83
+ return <CodeSample
84
+ name={lang}
85
+ description={props?.children?.props?.meta}
86
+ codeblocks={[
87
+ {
88
+ value: props?.children?.props?.children,
89
+ lang: lang,
90
+ meta: lang,
91
+ }
92
+ ]}
93
+ size="full" // TODO: in the future configurable
94
+ />
95
+ },
96
+ details: Details,
97
+ blockquote: Blockquote,
98
+
99
+ hr: Hr,
100
+ a: Link,
101
+ }
102
+ }
103
+
104
+ export function writerContent() {
105
+ return {
106
+ Callout,
107
+ Details,
108
+ GuideCard,
109
+ Steps,
110
+ Tabs,
111
+ Table,
112
+ Badge,
113
+ }
114
+ }
115
+
116
+ export function helperContent() {
117
+ return {
118
+ Content: ContentComponent,
119
+ Subtitle
120
+ }
121
+ }
122
+
123
+ export function iconContent() {
124
+ return {
125
+ IconSessionReplay,
126
+ IconMetrics,
127
+ IconFunnels,
128
+ IconCode,
129
+ IconCustomEvent,
130
+ }
131
+ }
132
+
133
+ export function coderContent() {
134
+ return {
135
+ CodeSample,
136
+ }
137
+ }
@@ -0,0 +1,21 @@
1
+ import React from "react"
2
+ import {css} from "@linaria/core";
3
+
4
+ const $subitlte = {
5
+ host: css`
6
+ margin-top: -18px;
7
+ font-size: 18px;
8
+ color: #7051d4;
9
+ font-weight: 300;
10
+ `
11
+ }
12
+
13
+ export interface SubtitleProps {
14
+ children: React.ReactNode
15
+ }
16
+
17
+ export function Subtitle({children}: SubtitleProps) {
18
+ return <div className={$subitlte.host}>
19
+ {children}
20
+ </div>
21
+ }
@@ -0,0 +1,3 @@
1
+ export type {SubtitleProps} from "./Subtitle";
2
+
3
+ export {Subtitle} from "./Subtitle";
@@ -0,0 +1,3 @@
1
+ export * from "./Content"
2
+
3
+ export {default as MDX} from "./Content"
@@ -0,0 +1,151 @@
1
+ import {css} from "@linaria/core";
2
+
3
+ const globalPageGutter = '8px';
4
+ export const globalHeaderHeight = '46px';
5
+ const globalHeaderWarningHeight = "0px";
6
+ const contentTopSpace = "12px";
7
+
8
+ const globalHeaderHeightWithSub = '90px';
9
+
10
+ const cubicMove = "cubic-bezier(.65, 0, .35, 1)";
11
+ const sidebarWidth = "210px";
12
+
13
+ // TODO: better solution - design tokens
14
+ export const globals = css`
15
+ :global() {
16
+ :root {
17
+ --xyd-navbar-height: ${globalHeaderHeight};
18
+ --xyd-global-page-gutter: ${globalPageGutter};
19
+ }
20
+ }
21
+ `;
22
+
23
+ export const $layout = {
24
+ host: css`
25
+ width: 100%;
26
+ `,
27
+ header: css`
28
+ display: flex;
29
+ justify-content: space-between;
30
+ align-items: center;
31
+
32
+ position: fixed;
33
+ top: ${globalHeaderWarningHeight};
34
+ right: ${globalPageGutter};
35
+ left: ${globalPageGutter};
36
+
37
+ height: ${globalHeaderHeight};
38
+ `,
39
+ header$$sub: css`
40
+ flex-direction: column;
41
+ height: ${globalHeaderHeightWithSub};
42
+ transition: transform 200ms;
43
+ `,
44
+ header$$hideMain: css`
45
+ transform: translateY(calc(-${globalHeaderHeight} + 3px));
46
+ `,
47
+ main: css`
48
+ position: fixed;
49
+ top: calc(${globalHeaderHeight} + ${globalHeaderWarningHeight});
50
+ bottom: ${globalPageGutter};
51
+ left: ${globalPageGutter};
52
+ right: ${globalPageGutter};
53
+ }`,
54
+ main$$sub: css`
55
+ top: calc(${globalHeaderHeightWithSub} + ${globalHeaderWarningHeight});
56
+ transition: top 200ms;
57
+ `,
58
+ sidebar: css`
59
+ flex-direction: column;
60
+ position: absolute;
61
+ top: 0;
62
+ left: 0;
63
+ bottom: 0;
64
+ right: 0;
65
+ z-index: 101;
66
+ width: ${sidebarWidth};
67
+ border: 0;
68
+ padding: ${contentTopSpace} 0 0;
69
+ overflow: visible;
70
+ background: none;
71
+ border-radius: 0;
72
+ opacity: 1;
73
+ visibility: visible;
74
+ transition: opacity .3s ${cubicMove};
75
+ `,
76
+ }
77
+
78
+ export const $page = {
79
+ host: css`
80
+ position: absolute;
81
+ top: ${contentTopSpace};
82
+ right: 0;
83
+ bottom: 0;
84
+ z-index: 201;
85
+ background: #fff;
86
+
87
+ //border-radius: 8px;
88
+ //border: 1px solid #ececf1;
89
+
90
+ overflow: hidden;
91
+ transition: opacity .3s ${cubicMove};
92
+
93
+ left: ${sidebarWidth};
94
+ `,
95
+ scroll: css`
96
+ //position: absolute;
97
+ //top: 0;
98
+ //right: 0;
99
+ //bottom: 0;
100
+ //left: 0;
101
+ //overflow: auto;
102
+
103
+ overflow: scroll;
104
+ height: 100%;
105
+
106
+ `,
107
+ container: css`
108
+ padding: 0;
109
+ width: 100%;
110
+ //position: relative; TODO: unset if during client render?
111
+ min-height: 100%;
112
+
113
+ max-width: 100%;
114
+ margin: 0 auto;
115
+ font-size: 15px;
116
+ line-height: 24px;
117
+ `,
118
+ articleContainer: css`
119
+ width: 980px;
120
+ padding: 40px 56px;
121
+ padding-top: 20px;
122
+ max-width: 100%;
123
+ margin: 0 auto;
124
+ `,
125
+ articleContainer$$fullWidth: css`
126
+ width: 1200px;
127
+ `,
128
+
129
+ }
130
+
131
+ export const $article = {
132
+ host: css`
133
+ display: flex;
134
+ gap: 30px;
135
+ width: 100%;
136
+ align-items: flex-start;;
137
+ `,
138
+ content: css`
139
+ flex: 1 1 0;
140
+ overflow: hidden;
141
+ `,
142
+ nav: css`
143
+ position: sticky;
144
+ top: 30px;
145
+ width: 180px;
146
+ margin-top: 0;
147
+ margin-left: 50px;
148
+ padding-left: 16px;
149
+ flex: none;
150
+ `
151
+ }
@@ -0,0 +1,121 @@
1
+ import React, {useEffect, useState} from "react"
2
+
3
+ import {$layout, $page, $article, globalHeaderHeight} from "./Layout.styles"
4
+
5
+ export interface LayoutProps {
6
+ header: React.ReactNode;
7
+ aside: React.ReactNode;
8
+ content: React.ReactNode;
9
+ contentNav: React.ReactNode;
10
+ subheader?: boolean;
11
+ kind?: "fullwidth"
12
+ }
13
+
14
+ export function Layout(props: LayoutProps) {
15
+ const [hideMainHeader, setHideMainHeader] = useState(false)
16
+ const [scrollTop, setScrollTop] = useState(0)
17
+ const [controlScrollPos, setControlScrollPos] = useState(0)
18
+
19
+ useEffect(() => {
20
+ if (scrollTop === controlScrollPos) {
21
+ return
22
+ }
23
+
24
+ const checkpoint = parseInt(globalHeaderHeight, 10) / 2
25
+ const diff = scrollTop - controlScrollPos
26
+ const reversePosDiff = Math.abs(scrollTop - controlScrollPos)
27
+
28
+ if (diff > checkpoint) {
29
+ setHideMainHeader(true)
30
+ } else if (reversePosDiff > checkpoint) {
31
+ setHideMainHeader(false)
32
+ }
33
+ }, [
34
+ scrollTop,
35
+ controlScrollPos,
36
+ ]);
37
+
38
+ function onScroll(e: Event) {
39
+ if (!(e.target instanceof HTMLElement)) {
40
+ return
41
+ }
42
+
43
+ const scroll = e.target?.scrollTop
44
+ setScrollTop(scroll)
45
+ }
46
+
47
+ function onScrollFinish(e: Event) {
48
+ if (!(e.target instanceof HTMLElement)) {
49
+ return
50
+ }
51
+
52
+ setControlScrollPos(e.target?.scrollTop)
53
+ }
54
+
55
+ // TODO: by ref?
56
+ // TODO: MOVE SOMEWHERE ELSE BECAUSE IT DECREASE PERFORMANCE (RERENDER)
57
+ useEffect(() => {
58
+ // return // TODO: UNCOMMENT
59
+
60
+ if (!props.subheader) {
61
+ return
62
+ }
63
+
64
+ document.querySelector(`.${$page.scroll}`)?.addEventListener("scroll", onScroll)
65
+ document.querySelector(`.${$page.scroll}`)?.addEventListener("scrollend", onScrollFinish)
66
+
67
+ return () => {
68
+ document.querySelector(`.${$page.scroll}`)?.removeEventListener("scroll", onScroll)
69
+ document.querySelector(`.${$page.scroll}`)?.removeEventListener("scrollend", onScrollFinish)
70
+ }
71
+ }, []);
72
+
73
+ return <div className={$layout.host}>
74
+ <Layout.Header className={`
75
+ ${props.subheader && $layout.header$$sub}
76
+ ${hideMainHeader && $layout.header$$hideMain}
77
+ `}>
78
+ {props.header}
79
+ </Layout.Header>
80
+ <main className={`
81
+ ${$layout.main}
82
+ ${!hideMainHeader && props.subheader && $layout.main$$sub}
83
+ `}>
84
+ <aside className={$layout.sidebar}>
85
+ {props.aside}
86
+ </aside>
87
+ <div className={$page.host}>
88
+ <div className={$page.scroll}>
89
+ <div className={$page.container}>
90
+ <div className={`
91
+ ${$page.articleContainer}
92
+ ${props.kind == "fullwidth" && $page.articleContainer$$fullWidth}
93
+ `}>
94
+ <article className={$article.host}>
95
+ <section className={$article.content}>
96
+ {props.content}
97
+ </section>
98
+ {
99
+ props.contentNav && <nav className={`
100
+ ${$article.nav}
101
+ `}>
102
+ {props.contentNav}
103
+ </nav>
104
+ }
105
+ </article>
106
+ </div>
107
+ </div>
108
+ </div>
109
+ </div>
110
+ </main>
111
+ </div>
112
+ }
113
+
114
+ Layout.Header = function LayoutHeader({className, children}: { className?: string, children: React.ReactNode }) {
115
+ return <header className={`
116
+ ${$layout.header}
117
+ ${className}
118
+ `}>
119
+ {children}
120
+ </header>
121
+ }
@@ -0,0 +1,7 @@
1
+ // TODO: move this pkg @xyd-js/layouts ?
2
+
3
+ export {
4
+ Layout
5
+ } from "./Layout";
6
+
7
+ export type {LayoutProps} from "./Layout";
@@ -0,0 +1,93 @@
1
+ import React from 'react'
2
+ import {css} from "@linaria/core";
3
+
4
+ import {
5
+ GuideCard,
6
+ } from "../../writer"
7
+ import {Button, CTABanner} from "../../brand"
8
+ import {HomeView} from "../../views"
9
+
10
+ import {IHomePageHero, IHomePageFeature} from "./types";
11
+
12
+ const $cards = {
13
+ host: css`
14
+ display: grid;
15
+ grid-template-columns: repeat(2, 500px);
16
+ justify-content: center;
17
+ gap: 30px;
18
+
19
+ @media (max-width: 1200px) {
20
+ grid-template-columns: repeat(2, 1fr);
21
+ }
22
+
23
+ @media (max-width: 768px) {
24
+ grid-template-columns: 1fr;
25
+ }
26
+ `,
27
+ }
28
+
29
+ export interface HomePageProps {
30
+ header: React.ReactNode
31
+
32
+ children?: React.ReactNode
33
+ hero?: IHomePageHero
34
+ footer?: React.ReactNode
35
+ features?: IHomePageFeature[]
36
+ }
37
+
38
+ export function HomePage(props: HomePageProps) {
39
+ return <HomeView
40
+ header={props.header}
41
+ body={<HomeView.Body>
42
+ <$Hero {...props}/>
43
+
44
+ {props.hero?.actions && <$Cards {...props}/>}
45
+
46
+ {props.children}
47
+ </HomeView.Body>}
48
+ footer={props.footer}
49
+ />
50
+ }
51
+
52
+ function $Hero(props: HomePageProps) {
53
+ return <CTABanner>
54
+ <CTABanner.Heading
55
+ title={props.hero?.text || ""}
56
+ headingEffect={props.hero?.textEffect}
57
+ subtitle={props.hero?.subtitle}
58
+ />
59
+ {props?.hero?.actions && <CTABanner.ButtonGroup>
60
+ {props?.hero?.actions.map((action, index) => (
61
+ <a href={action.href}>
62
+ <Button key={action.text + index} kind={action.kind}>
63
+ {action.text}
64
+ </Button>
65
+ </a>
66
+ ))}
67
+ </CTABanner.ButtonGroup>}
68
+ </CTABanner>
69
+ }
70
+
71
+ function $Cards(props: HomePageProps) {
72
+ // TODO: cards gridTemplateColumns based on elements
73
+ return <div
74
+ className={`
75
+ ${$cards.host}
76
+ xyd_page-comp-homepage-cards
77
+ `}>
78
+ {props.features?.map((feat, index) => (
79
+ <GuideCard
80
+ key={feat.title + index}
81
+ href={feat.href || ""}
82
+ title={feat.title}
83
+ icon={feat.icon}
84
+ kind="secondary"
85
+ size="md"
86
+ >
87
+ {feat.description}
88
+ </GuideCard>
89
+ ))}
90
+ </div>
91
+ }
92
+
93
+
@@ -0,0 +1,5 @@
1
+ export type * from "./types"
2
+
3
+ export type {HomePageProps} from "./HomePage"
4
+
5
+ export {HomePage} from "./HomePage"