@xyd-js/components 0.1.0-xyd.1 → 0.1.0-xyd.11
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.
- package/CHANGELOG.md +61 -0
- package/LICENSE +21 -0
- package/dist/CTABanner-BLDHbq5h.js +2 -0
- package/dist/CTABanner-BLDHbq5h.js.map +1 -0
- package/dist/CTABanner-n3vc4xW5.js +2 -0
- package/dist/CTABanner-n3vc4xW5.js.map +1 -0
- package/dist/CodeSample-CVki5fdQ.js +2 -0
- package/dist/CodeSample-CVki5fdQ.js.map +1 -0
- package/dist/CodeSample-Dkob5gWa.js +2 -0
- package/dist/CodeSample-Dkob5gWa.js.map +1 -0
- package/dist/HomeView-DHdqouwJ.js +2 -0
- package/dist/HomeView-DHdqouwJ.js.map +1 -0
- package/dist/HomeView-TDx2tcP_.js +2 -0
- package/dist/HomeView-TDx2tcP_.js.map +1 -0
- package/dist/UnderlineNav-9lJPvnIp.js +2 -0
- package/dist/UnderlineNav-9lJPvnIp.js.map +1 -0
- package/dist/UnderlineNav-VqB7jDQD.js +2 -0
- package/dist/UnderlineNav-VqB7jDQD.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-C8nLsqZ7.js +2 -0
- package/dist/_rollupPluginBabelHelpers-C8nLsqZ7.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-CrdNG0jb.js +2 -0
- package/dist/_rollupPluginBabelHelpers-CrdNG0jb.js.map +1 -0
- package/dist/brand.d.ts +11 -10
- package/dist/brand.js +2 -1
- package/dist/brand.js.map +1 -0
- package/dist/coder/themes/cosmo-light.d.ts +5 -0
- package/dist/coder/themes/cosmo-light.js +2 -0
- package/dist/coder/themes/cosmo-light.js.map +1 -0
- package/dist/coder.d.ts +52 -3
- package/dist/coder.js +2 -1
- package/dist/coder.js.map +1 -0
- package/dist/content.d.ts +103 -37
- package/dist/content.js +2 -1
- package/dist/content.js.map +1 -0
- package/dist/index-TkBHKzGT.js +2 -0
- package/dist/index-TkBHKzGT.js.map +1 -0
- package/dist/index-YH6Q3iH2.js +2 -0
- package/dist/index-YH6Q3iH2.js.map +1 -0
- package/dist/index.css +217 -135
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts.d.ts +12 -1
- package/dist/layouts.js +2 -1
- package/dist/layouts.js.map +1 -0
- package/dist/pages.d.ts +2 -1
- package/dist/pages.js +2 -1
- package/dist/pages.js.map +1 -0
- package/dist/{tslib.es6-B1gizQU6.js → tslib.es6-BI9zka_a.js} +1 -0
- package/dist/tslib.es6-BI9zka_a.js.map +1 -0
- package/dist/{tslib.es6-CMPV4d4T.js → tslib.es6-sxmRJynD.js} +1 -0
- package/dist/tslib.es6-sxmRJynD.js.map +1 -0
- package/dist/views.d.ts +2 -1
- package/dist/views.js +2 -1
- package/dist/views.js.map +1 -0
- package/dist/writer.d.ts +62 -8
- package/dist/writer.js +2 -1
- package/dist/writer.js.map +1 -0
- package/package.json +21 -14
- package/rollup.config.js +53 -8
- package/src/brand/Button/Button.styles.tsx +31 -0
- package/src/brand/Button/Button.tsx +3 -35
- package/src/brand/CTABanner/CTABanner.styles.tsx +82 -0
- package/src/brand/CTABanner/CTABanner.tsx +34 -112
- package/src/brand/Footer/Footer.styles.tsx +21 -0
- package/src/brand/Footer/Footer.tsx +4 -24
- package/src/brand/TODO.md +1 -0
- package/src/coder/Code/Code.styles.tsx +47 -0
- package/src/coder/Code/Code.tsx +76 -0
- package/src/coder/Code/CodeLoader.tsx +10 -0
- package/src/coder/Code/annotations.tsx +31 -0
- package/src/coder/Code/highlight.ts +170 -0
- package/src/coder/Code/index.ts +15 -0
- package/src/coder/CodeCopy/CodeCopy.styles.tsx +19 -0
- package/src/coder/CodeCopy/CodeCopy.tsx +2 -4
- package/src/coder/CodeSample/CodeSample.tsx +42 -133
- package/src/coder/CodeSample/index.ts +0 -1
- package/src/coder/CodeSample/withLocalStored.tsx +1 -1
- package/src/coder/CodeTabs/CodeTabs.styles.tsx +104 -0
- package/src/coder/CodeTabs/CodeTabs.tsx +95 -0
- package/src/coder/CodeTabs/index.ts +6 -0
- package/src/coder/CodeTheme/CodeTheme.tsx +79 -0
- package/src/coder/CodeTheme/index.ts +8 -0
- package/src/coder/hooks/highlight.ts +182 -0
- package/src/coder/index.ts +31 -1
- package/src/coder/{CodeSample/default-theme.ts → themes/cosmo-light.ts} +3 -2
- package/src/content/Anchor/Anchor.styles.tsx +5 -0
- package/src/content/Anchor/Anchor.tsx +4 -14
- package/src/content/Content/Content.styles.tsx +9 -0
- package/src/content/Content/Content.tsx +4 -11
- package/src/content/Content.tsx +48 -6
- package/src/content/Subtitle/Subtitle.styles.ts +8 -0
- package/src/content/Subtitle/Subtitle.tsx +2 -11
- package/src/layouts/Layout.styles.tsx +135 -131
- package/src/layouts/Layout.tsx +21 -23
- package/src/layouts/LayoutPrimary/LayoutPrimary.styles.tsx +341 -0
- package/src/layouts/LayoutPrimary/LayoutPrimary.tsx +157 -0
- package/src/layouts/LayoutPrimary/index.ts +5 -0
- package/src/layouts/index.ts +7 -1
- package/src/pages/HomePage/HomePage.styles.tsx +16 -0
- package/src/pages/HomePage/HomePage.tsx +7 -21
- package/src/pages/TODO.md +1 -0
- package/src/pages/index.ts +1 -0
- package/src/ui/Loader/Loader.styles.tsx +54 -0
- package/src/ui/Loader/Loader.tsx +26 -0
- package/src/ui/TODO.md +2 -0
- package/src/ui/index.ts +1 -0
- package/src/utils/useStyle.ts +19 -0
- package/src/views/HomeView/HomeView.styles.tsx +37 -0
- package/src/views/HomeView/HomeView.tsx +5 -45
- package/src/views/TODO.md +1 -0
- package/src/views/index.ts +1 -0
- package/src/writer/Badge/Badge.styles.tsx +31 -26
- package/src/writer/Badge/Badge.tsx +42 -9
- package/src/writer/Blockquote/Blockquote.styles.tsx +6 -8
- package/src/writer/Blockquote/Blockquote.tsx +2 -2
- package/src/writer/Breadcrumbs/Breadcrumbs.styles.ts +27 -26
- package/src/writer/Breadcrumbs/Breadcrumbs.tsx +5 -5
- package/src/writer/Callout/Callout.styles.tsx +44 -48
- package/src/writer/Callout/Callout.tsx +5 -5
- package/src/writer/Code/Code.styles.tsx +11 -13
- package/src/writer/Code/Code.tsx +2 -2
- package/src/writer/Details/Details.styles.tsx +102 -74
- package/src/writer/Details/Details.tsx +46 -30
- package/src/writer/GuideCard/GuideCard.styles.tsx +116 -112
- package/src/writer/GuideCard/GuideCard.tsx +19 -19
- package/src/writer/Heading/Heading.styles.tsx +65 -61
- package/src/writer/Heading/Heading.tsx +11 -11
- package/src/writer/Hr/Hr.styles.tsx +3 -5
- package/src/writer/Hr/Hr.tsx +2 -2
- package/src/writer/Icon/index.tsx +243 -0
- package/src/writer/NavLinks/NavLinks.styles.ts +30 -30
- package/src/writer/NavLinks/NavLinks.tsx +6 -6
- package/src/writer/Pre/Pre.styles.tsx +8 -10
- package/src/writer/Pre/Pre.tsx +2 -2
- package/src/writer/Steps/Steps.styles.tsx +30 -31
- package/src/writer/Steps/Steps.tsx +3 -4
- package/src/writer/Table/Table.styles.tsx +32 -31
- package/src/writer/Table/Table.tsx +5 -5
- package/src/writer/Table/TableV2.styles.tsx +117 -0
- package/src/writer/Table/TableV2.tsx +83 -0
- package/src/writer/Table/index.ts +4 -0
- package/src/writer/Tabs/Tabs.styles.tsx +60 -63
- package/src/writer/Tabs/Tabs.tsx +11 -16
- package/src/writer/UnderlineNav/UnderlineNav.styles.tsx +44 -42
- package/src/writer/UnderlineNav/UnderlineNav.tsx +5 -5
- package/tsconfig.json +2 -3
- package/dist/CTABanner-CYKba2Vn.js +0 -1
- package/dist/CTABanner-hV6NH0Xf.js +0 -1
- package/dist/CodeSample-D1QMQt89.js +0 -1
- package/dist/CodeSample-DLJNHIaK.js +0 -1
- package/dist/CodeSample-DZq0_qWL.js +0 -1
- package/dist/Footer-CkBDl828.js +0 -1
- package/dist/HomeView-CEgDQeAf.js +0 -1
- package/dist/UnderlineNav-BaOK-iez.js +0 -1
- package/dist/UnderlineNav-D5zXLK6j.js +0 -1
- package/dist/UnderlineNav-DGzjCvkM.js +0 -1
- package/dist/abap-DsN9RuMZ.js +0 -1
- package/dist/actionscript-3-B1SSyZyS.js +0 -1
- package/dist/ada-D_J1lW-E.js +0 -1
- package/dist/angular-html-CYREiUrW.js +0 -1
- package/dist/angular-ts-DcAOu8WU.js +0 -1
- package/dist/apache-CCuSaqCk.js +0 -1
- package/dist/apex-DblqgZJW.js +0 -1
- package/dist/apl-PFYbmQM7.js +0 -1
- package/dist/applescript-CxR8VFYt.js +0 -1
- package/dist/ara-DyvEMt1M.js +0 -1
- package/dist/asciidoc-CnwoPPuH.js +0 -1
- package/dist/asm-CjptKFp1.js +0 -1
- package/dist/astro-suE8bk8k.js +0 -1
- package/dist/awk-DCM8RPoH.js +0 -1
- package/dist/ballerina-Cj78GSWA.js +0 -1
- package/dist/bat-DOoDZywo.js +0 -1
- package/dist/beancount-t-WR86_8.js +0 -1
- package/dist/berry-B4bZSCCn.js +0 -1
- package/dist/bibtex-BrVhJY3k.js +0 -1
- package/dist/bicep-B9mKM727.js +0 -1
- package/dist/blade-C5Z797nx.js +0 -1
- package/dist/c-DAjGiO5B.js +0 -1
- package/dist/cadence-PrerV_VN.js +0 -1
- package/dist/clarity-BHTd5LJm.js +0 -1
- package/dist/clojure-CfEyl-7j.js +0 -1
- package/dist/cmake-CRA2Enzy.js +0 -1
- package/dist/cobol-BnLJxYQT.js +0 -1
- package/dist/codeowners-BvrirGey.js +0 -1
- package/dist/codeql-B2c2mBK0.js +0 -1
- package/dist/coffee-CG62yMWj.js +0 -1
- package/dist/common-lisp-CN6bltgb.js +0 -1
- package/dist/cpp-BbrQ837u.js +0 -1
- package/dist/crystal-rvb5jzSz.js +0 -1
- package/dist/csharp-CUz8u4K7.js +0 -1
- package/dist/css-JK7NOE59.js +0 -1
- package/dist/csv-CA_RykxK.js +0 -1
- package/dist/cue-AyD8vP8S.js +0 -1
- package/dist/cypher-eVjUZ0JC.js +0 -1
- package/dist/d-D1E5UK87.js +0 -1
- package/dist/dark-plus-C6xVaa39.js +0 -1
- package/dist/dart-DofOkkdM.js +0 -1
- package/dist/dax-DqGHRpF4.js +0 -1
- package/dist/desktop-j1oT-0Fo.js +0 -1
- package/dist/diff-ChebWHqI.js +0 -1
- package/dist/docker-BU6yAGy2.js +0 -1
- package/dist/dotenv-GyMvMNRw.js +0 -1
- package/dist/dracula-DUKRH7Zb.js +0 -1
- package/dist/dracula-soft-MlIR18G6.js +0 -1
- package/dist/dream-maker-BsQ1dbNp.js +0 -1
- package/dist/edge-F-AR7ZfW.js +0 -1
- package/dist/elixir-k4xxGl4V.js +0 -1
- package/dist/elm-CInOOHq9.js +0 -1
- package/dist/emacs-lisp-C6yIvom4.js +0 -1
- package/dist/erb-3pxr-NQS.js +0 -1
- package/dist/erlang-pmWC-Wee.js +0 -1
- package/dist/fennel-DViJm-jY.js +0 -1
- package/dist/fish-XcExlNEH.js +0 -1
- package/dist/fluent-DuJOAG6K.js +0 -1
- package/dist/fortran-fixed-form-Db5I_UFX.js +0 -1
- package/dist/fortran-free-form-B2xyqK-y.js +0 -1
- package/dist/fsharp-is-Hk3Eq.js +0 -1
- package/dist/gdresource-RuRLtBIa.js +0 -1
- package/dist/gdscript-pJ_75zwI.js +0 -1
- package/dist/gdshader-C5a9x3vh.js +0 -1
- package/dist/genie-BQ1oppDb.js +0 -1
- package/dist/gherkin-CuOELy7c.js +0 -1
- package/dist/git-commit-3zS8hqVZ.js +0 -1
- package/dist/git-rebase-DbS4r3GX.js +0 -1
- package/dist/github-dark-MxM60tcF.js +0 -1
- package/dist/github-dark-dimmed-DDWwGITy.js +0 -1
- package/dist/github-from-css-3tseHBGr.js +0 -1
- package/dist/github-light-pTwVS4k8.js +0 -1
- package/dist/gleam-DNxiWDAA.js +0 -1
- package/dist/glimmer-js-BGxcWjEE.js +0 -1
- package/dist/glimmer-ts-BB1An-Xq.js +0 -1
- package/dist/glsl-DaDHpxzv.js +0 -1
- package/dist/gnuplot-B1t-F_Gz.js +0 -1
- package/dist/go-BiVONvim.js +0 -1
- package/dist/graphql-LpWkIzuc.js +0 -1
- package/dist/groovy-DcxmRonw.js +0 -1
- package/dist/hack-BCsHcJ0e.js +0 -1
- package/dist/haml-CXlzR84c.js +0 -1
- package/dist/handlebars-DLTopqNS.js +0 -1
- package/dist/haskell-35U1u5gK.js +0 -1
- package/dist/haxe-ssN4Oy09.js +0 -1
- package/dist/hcl-kzI--7Cv.js +0 -1
- package/dist/hjson-pR2iiFsp.js +0 -1
- package/dist/hlsl-8PIy5U5-.js +0 -1
- package/dist/html-BEHbZ4zc.js +0 -1
- package/dist/html-derivative-K5xYNXck.js +0 -1
- package/dist/http-Cd2N6YgB.js +0 -1
- package/dist/hxml-BiAYlMbG.js +0 -1
- package/dist/hy-Cg5rcmur.js +0 -1
- package/dist/imba-DIe-G4Fn.js +0 -1
- package/dist/index-B7QE1KUr.js +0 -1
- package/dist/index-BE4Aq8NU.js +0 -1
- package/dist/index-CpFJxv5e.js +0 -1
- package/dist/index-DMAgLttD.js +0 -1
- package/dist/index-byGIVYaJ.js +0 -1
- package/dist/index-eU5so3Si.js +0 -1
- package/dist/ini-H0Ga-buI.js +0 -1
- package/dist/java-DoE_enjS.js +0 -1
- package/dist/javascript-__QKtyFe.js +0 -1
- package/dist/jinja-UYHlv864.js +0 -1
- package/dist/jison-B9nCySXt.js +0 -1
- package/dist/json-B7oi-vA0.js +0 -1
- package/dist/json5-BetPwqJO.js +0 -1
- package/dist/jsonc-pWWkBlCi.js +0 -1
- package/dist/jsonl-B6mt3pJZ.js +0 -1
- package/dist/jsonnet-CoMYTNCI.js +0 -1
- package/dist/jssm-Cid3TtQ5.js +0 -1
- package/dist/jsx-Ckobzlnq.js +0 -1
- package/dist/julia-C8xlDV3I.js +0 -1
- package/dist/kotlin-DvN1jcCb.js +0 -1
- package/dist/kusto-BCF_-dC3.js +0 -1
- package/dist/latex-DRFLltbj.js +0 -1
- package/dist/lean-DNZ3POMR.js +0 -1
- package/dist/less-XiEW6aqg.js +0 -1
- package/dist/light-plus-BnkOXVnc.js +0 -1
- package/dist/liquid-B40PlvwD.js +0 -1
- package/dist/log-xo3MDRlF.js +0 -1
- package/dist/logo-DTYzs3BE.js +0 -1
- package/dist/lua-BDEQNtpi.js +0 -1
- package/dist/luau-B1E5PlN9.js +0 -1
- package/dist/make-DtNOxXXX.js +0 -1
- package/dist/markdown-B6FKqc-0.js +0 -1
- package/dist/marko-mRmYVKe_.js +0 -1
- package/dist/material-darker-DFW2iB51.js +0 -1
- package/dist/material-default-BFApb2Ag.js +0 -1
- package/dist/material-from-css-bTkjEQjF.js +0 -1
- package/dist/material-lighter-CYEL5tGv.js +0 -1
- package/dist/material-ocean-BhuQqQbt.js +0 -1
- package/dist/material-palenight-B_DfQHjY.js +0 -1
- package/dist/matlab-BovMnqtG.js +0 -1
- package/dist/mdc-DIkT1TyN.js +0 -1
- package/dist/mdx-CxAyQTjI.js +0 -1
- package/dist/mermaid-i0z8tyOx.js +0 -1
- package/dist/min-dark-BE2n4wJj.js +0 -1
- package/dist/min-light-BJgErz0d.js +0 -1
- package/dist/mojo-C-lVJL5A.js +0 -1
- package/dist/monokai-eaa8L1cq.js +0 -1
- package/dist/move-C3Zui0bc.js +0 -1
- package/dist/narrat-THKEk6T8.js +0 -1
- package/dist/nextflow-CtnPKe-i.js +0 -1
- package/dist/nginx-CGEFMta9.js +0 -1
- package/dist/nim-C8mPZfis.js +0 -1
- package/dist/nix-JCk4_G_4.js +0 -1
- package/dist/nord-Doy8uXi5.js +0 -1
- package/dist/nushell-CX0evzNH.js +0 -1
- package/dist/objective-c-CRUJa2eY.js +0 -1
- package/dist/objective-cpp-CCYeWv4r.js +0 -1
- package/dist/ocaml-DGJqpgv5.js +0 -1
- package/dist/one-dark-pro-u8LD4Pzz.js +0 -1
- package/dist/pascal-DBmHAUBB.js +0 -1
- package/dist/perl-DeqR1cIo.js +0 -1
- package/dist/php-DgxB75vC.js +0 -1
- package/dist/plsql-7JGOsii8.js +0 -1
- package/dist/po-iKcL_E8G.js +0 -1
- package/dist/poimandres-CA110GE1.js +0 -1
- package/dist/postcss-Da2iRvoL.js +0 -1
- package/dist/powerquery-DPeggvzL.js +0 -1
- package/dist/powershell-CaJNoU_J.js +0 -1
- package/dist/prisma-CJb-Lxak.js +0 -1
- package/dist/prolog-DfSRFLOg.js +0 -1
- package/dist/proto-CQScmtFO.js +0 -1
- package/dist/pug-C812gnD5.js +0 -1
- package/dist/puppet-B1xO3kuT.js +0 -1
- package/dist/purescript-CNYgFxmJ.js +0 -1
- package/dist/python-D9HM-cQI.js +0 -1
- package/dist/qml-DJVpVDAW.js +0 -1
- package/dist/qmldir-CHfKHU4H.js +0 -1
- package/dist/qss-C4aoutlf.js +0 -1
- package/dist/r-CqYxKsjx.js +0 -1
- package/dist/racket-DUEDYd32.js +0 -1
- package/dist/raku-D9-XDqRz.js +0 -1
- package/dist/razor-3rNKfrrf.js +0 -1
- package/dist/reg-b5Nk8lNx.js +0 -1
- package/dist/regexp-DVRafeF7.js +0 -1
- package/dist/rel--gRyHcrO.js +0 -1
- package/dist/riscv-C8SxbbN2.js +0 -1
- package/dist/rose-pine-DPGqNU4b.js +0 -1
- package/dist/rose-pine-dawn-DymfQU_V.js +0 -1
- package/dist/rose-pine-moon-BQUAYUon.js +0 -1
- package/dist/rst-CmHkCKmJ.js +0 -1
- package/dist/ruby-Q-VH1uZA.js +0 -1
- package/dist/rust-ClS6MAIk.js +0 -1
- package/dist/sas-D3oI_z1n.js +0 -1
- package/dist/sass-C7IOYsXa.js +0 -1
- package/dist/scala-Bo-OrDK4.js +0 -1
- package/dist/scheme-CZPOfAv0.js +0 -1
- package/dist/scss-CrrfDAqb.js +0 -1
- package/dist/shaderlab-BHdRvEKr.js +0 -1
- package/dist/shellscript-CGx4lQcC.js +0 -1
- package/dist/shellsession-DNVyDTwx.js +0 -1
- package/dist/slack-dark-BdYiGGaR.js +0 -1
- package/dist/slack-ochin-D47ofNk9.js +0 -1
- package/dist/smalltalk-CSwwxfh6.js +0 -1
- package/dist/solarized-dark-B_ueb431.js +0 -1
- package/dist/solarized-light-ClfNXI7y.js +0 -1
- package/dist/solidity-DTxkUBi_.js +0 -1
- package/dist/soy-CWDkaEw-.js +0 -1
- package/dist/sparql-iRDOfWr5.js +0 -1
- package/dist/splunk-BEkc8uO-.js +0 -1
- package/dist/sql-BJ_taBmN.js +0 -1
- package/dist/ssh-config-Df9b2KGk.js +0 -1
- package/dist/stata-D3UR29Ve.js +0 -1
- package/dist/stylus-CdDBOxWC.js +0 -1
- package/dist/svelte-DyEd0oQk.js +0 -1
- package/dist/swift-BxhiGBjX.js +0 -1
- package/dist/system-verilog-CetQnQ4g.js +0 -1
- package/dist/systemd-BnD0vcw3.js +0 -1
- package/dist/tasl-DVvrvOfd.js +0 -1
- package/dist/tcl-DLSUI_zn.js +0 -1
- package/dist/templ-DSz21pzx.js +0 -1
- package/dist/terraform-EK_dQKQM.js +0 -1
- package/dist/tex-BM4Fklib.js +0 -1
- package/dist/toml-kuUrbkod.js +0 -1
- package/dist/ts-tags-By7dzkmj.js +0 -1
- package/dist/tslib.es6-DlLz3CkS.js +0 -1
- package/dist/tsv-BCJoRl62.js +0 -1
- package/dist/tsx-BjuLHzrJ.js +0 -1
- package/dist/turtle-CufS_WpN.js +0 -1
- package/dist/twig-JhO6NGAT.js +0 -1
- package/dist/txt-C4POgh3W.js +0 -1
- package/dist/typescript-B1VYfqvp.js +0 -1
- package/dist/typespec-CZzVsQ68.js +0 -1
- package/dist/typst-DLkGCZHs.js +0 -1
- package/dist/v-DNo0Cbkd.js +0 -1
- package/dist/vala-J9aWDLgT.js +0 -1
- package/dist/vb-CukbP-ad.js +0 -1
- package/dist/verilog-C7Ns4wPb.js +0 -1
- package/dist/vhdl-D94Lw1Fr.js +0 -1
- package/dist/viml-gaixGh_X.js +0 -1
- package/dist/vue-BX9d0W3t.js +0 -1
- package/dist/vue-html-CPRiJ8jH.js +0 -1
- package/dist/vyper-Ckj8wEzF.js +0 -1
- package/dist/wasm-BIwf60De.js +0 -1
- package/dist/wenyan-8NGlujRm.js +0 -1
- package/dist/wgsl-BcYJIOdN.js +0 -1
- package/dist/wikitext-B892rECa.js +0 -1
- package/dist/wolfram-CsrnIKPa.js +0 -1
- package/dist/xml-bnQL-E2F.js +0 -1
- package/dist/xsl-n4ZnN1T3.js +0 -1
- package/dist/yaml-8btRgevg.js +0 -1
- package/dist/zenscript-C4tShGxI.js +0 -1
- package/dist/zig-YA915rBO.js +0 -1
- package/src/coder/CodeCopy/CodeCopy.style.tsx +0 -21
- package/src/coder/CodeSample/CodeSample.styles.tsx +0 -137
|
@@ -1,127 +1,49 @@
|
|
|
1
|
-
import React from "react"
|
|
2
|
-
import
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as cn from "./CTABanner.styles";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
`,
|
|
8
|
-
container: css`
|
|
9
|
-
display: flex;
|
|
10
|
-
align-items: center;
|
|
11
|
-
justify-content: center;
|
|
12
|
-
gap: 80px;
|
|
13
|
-
`,
|
|
14
|
-
hero: css`
|
|
15
|
-
display: flex;
|
|
16
|
-
align-items: center;
|
|
17
|
-
justify-content: center;
|
|
18
|
-
flex-direction: column;
|
|
19
|
-
gap: 40px;
|
|
20
|
-
`,
|
|
21
|
-
headingEffect: css`
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
justify-content: center;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
|
|
27
|
-
background: -webkit-linear-gradient(
|
|
28
|
-
120deg,
|
|
29
|
-
var(--headingEffect-color-tertiary) 20%,
|
|
30
|
-
var(--headingEffect-color-tertiary) 30%,
|
|
31
|
-
var(--headingEffect-color-secondary) 60%,
|
|
32
|
-
var(--headingEffect-color-primary) 75%,
|
|
33
|
-
var(--headingEffect-color-primary) 85%
|
|
34
|
-
);
|
|
35
|
-
background-clip: text;
|
|
36
|
-
-webkit-text-fill-color: transparent;
|
|
37
|
-
animation: wave 5s infinite;
|
|
38
|
-
background-size: 200% 200%;
|
|
39
|
-
background-position: 50% 50%; // Start with all colors visible
|
|
4
|
+
export interface CTABannerProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
40
7
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
50% {
|
|
46
|
-
background-position: 0% 50%;
|
|
47
|
-
}
|
|
48
|
-
100% {
|
|
49
|
-
background-position: 50% 50%;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
`
|
|
8
|
+
export interface CTABannerHeadingProps {
|
|
9
|
+
title: string;
|
|
10
|
+
subtitle: string;
|
|
53
11
|
}
|
|
54
12
|
|
|
55
|
-
export interface
|
|
56
|
-
children: React.ReactNode
|
|
13
|
+
export interface CTABannerButtonGroupProps {
|
|
14
|
+
children: React.ReactNode;
|
|
57
15
|
}
|
|
58
16
|
|
|
59
17
|
export function CTABanner({children}: CTABannerProps) {
|
|
60
|
-
return
|
|
61
|
-
<div className={
|
|
62
|
-
<div className={
|
|
63
|
-
{
|
|
18
|
+
return (
|
|
19
|
+
<div className={cn.CTABannerHost}>
|
|
20
|
+
<div className={cn.CTABannerContainer}>
|
|
21
|
+
<div className={cn.CTABannerHero}>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
64
24
|
</div>
|
|
65
25
|
</div>
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const $heading = {
|
|
70
|
-
host: css`
|
|
71
|
-
display: flex;
|
|
72
|
-
align-items: center;
|
|
73
|
-
justify-content: center;
|
|
74
|
-
flex-direction: column;
|
|
75
|
-
`,
|
|
76
|
-
title: css`
|
|
77
|
-
font-size: 76px;
|
|
78
|
-
font-weight: 900;
|
|
79
|
-
text-align: center;
|
|
80
|
-
letter-spacing: 3px;
|
|
81
|
-
margin: 0;
|
|
82
|
-
`,
|
|
83
|
-
subtitle: css`
|
|
84
|
-
color: #3c3c43;
|
|
85
|
-
font-size: 46px;
|
|
86
|
-
font-weight: 600;
|
|
87
|
-
text-align: center;
|
|
88
|
-
`
|
|
26
|
+
);
|
|
89
27
|
}
|
|
90
28
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
headingEffect
|
|
102
|
-
? <span className={$banner.headingEffect}>
|
|
103
|
-
{title}
|
|
104
|
-
</span>
|
|
105
|
-
: title
|
|
106
|
-
}
|
|
107
|
-
</h1>
|
|
108
|
-
<p className={$heading.subtitle}>
|
|
109
|
-
{subtitle}
|
|
110
|
-
</p>
|
|
111
|
-
</div>
|
|
29
|
+
function Heading({title, subtitle}: CTABannerHeadingProps) {
|
|
30
|
+
return (
|
|
31
|
+
<div className={cn.CTABannerHeadingHost}>
|
|
32
|
+
<div className={cn.CTABannerHeadingEffect}>
|
|
33
|
+
<h1 className={cn.CTABannerHeadingTitle}>{title}</h1>
|
|
34
|
+
</div>
|
|
35
|
+
<h2 className={cn.CTABannerHeadingSubtitle}>{subtitle}</h2>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
112
38
|
}
|
|
113
39
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
`
|
|
40
|
+
function ButtonGroup({children}: CTABannerButtonGroupProps) {
|
|
41
|
+
return (
|
|
42
|
+
<div className={cn.CTABannerButtonGroupHost}>
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
121
46
|
}
|
|
122
47
|
|
|
123
|
-
CTABanner.
|
|
124
|
-
|
|
125
|
-
{children}
|
|
126
|
-
</div>
|
|
127
|
-
}
|
|
48
|
+
CTABanner.Heading = Heading;
|
|
49
|
+
CTABanner.ButtonGroup = ButtonGroup;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
|
|
3
|
+
export const FooterHost = css`
|
|
4
|
+
position: relative;
|
|
5
|
+
border-top: 1px solid #f0f0f0;
|
|
6
|
+
padding: 32px;
|
|
7
|
+
background-color: #fff;
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export const FooterContainer = css`
|
|
11
|
+
margin: 0 auto;
|
|
12
|
+
max-width: 1200px;
|
|
13
|
+
text-align: center;
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export const FooterTextContainer = css`
|
|
17
|
+
line-height: 24px;
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
font-weight: 500;
|
|
20
|
+
color: rgba(60, 60, 67, .78);
|
|
21
|
+
`;
|
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const $footer = {
|
|
5
|
-
host: css`
|
|
6
|
-
position: relative;
|
|
7
|
-
border-top: 1px solid #f0f0f0;
|
|
8
|
-
padding: 32px;
|
|
9
|
-
background-color: #fff;
|
|
10
|
-
`,
|
|
11
|
-
container: css`
|
|
12
|
-
margin: 0 auto;
|
|
13
|
-
max-width: 1200px;
|
|
14
|
-
text-align: center;
|
|
15
|
-
`,
|
|
16
|
-
textContainer: css`
|
|
17
|
-
line-height: 24px;
|
|
18
|
-
font-size: 14px;
|
|
19
|
-
font-weight: 500;
|
|
20
|
-
color: rgba(60, 60, 67, .78);
|
|
21
|
-
`
|
|
22
|
-
}
|
|
2
|
+
import * as cn from "./Footer.styles";
|
|
23
3
|
|
|
24
4
|
export interface FooterProps {
|
|
25
5
|
children?: React.ReactNode
|
|
26
6
|
}
|
|
27
7
|
|
|
28
8
|
export function Footer({children}: FooterProps) {
|
|
29
|
-
return <footer className={
|
|
30
|
-
<div className={
|
|
31
|
-
<div className={
|
|
9
|
+
return <footer className={cn.FooterHost}>
|
|
10
|
+
<div className={cn.FooterContainer}>
|
|
11
|
+
<div className={cn.FooterTextContainer}>
|
|
32
12
|
{children}
|
|
33
13
|
</div>
|
|
34
14
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DELETE `brand`
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
|
|
3
|
+
export const MarkHost = css`
|
|
4
|
+
display: flex;
|
|
5
|
+
border-left-width: 4px;
|
|
6
|
+
border-color: transparent;
|
|
7
|
+
margin: 4px 0;
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export const MarkLine = css`
|
|
11
|
+
flex: 1 1 0%;
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const MarkAnnotated = css`
|
|
15
|
+
border-color: #60A5FA;
|
|
16
|
+
background-color: #EEF2FF;
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export const LineNumberHost = css`
|
|
20
|
+
margin: 0 12px 0px 4px;
|
|
21
|
+
//text-align: right;
|
|
22
|
+
user-select: none;
|
|
23
|
+
opacity: 0.5;
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
export const CodeHost = css`
|
|
27
|
+
max-height: 400px;
|
|
28
|
+
background: linear-gradient(45deg, rgb(247, 247, 248) 0%, rgb(247, 247, 248) 100%) !important;
|
|
29
|
+
|
|
30
|
+
margin: 0;
|
|
31
|
+
padding: 8px 16px;
|
|
32
|
+
|
|
33
|
+
border-top: 1px solid rgb(236, 236, 241);
|
|
34
|
+
border-bottom-left-radius: 10px;
|
|
35
|
+
border-bottom-right-radius: 10px;
|
|
36
|
+
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
line-height: 20px;
|
|
39
|
+
white-space: pre-wrap;
|
|
40
|
+
word-break: break-all;
|
|
41
|
+
|
|
42
|
+
overflow-y: scroll;
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
export const CodeHostFull = css`
|
|
46
|
+
max-height: 100%;
|
|
47
|
+
`;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, {Suspense} from "react";
|
|
2
|
+
import type {HighlightedCode, AnnotationHandler} from "codehike/code";
|
|
3
|
+
import {InnerLine, Pre} from "codehike/code";
|
|
4
|
+
import {Theme} from "@code-hike/lighter";
|
|
5
|
+
|
|
6
|
+
import {CodeTheme, type CodeThemeBlockProps} from "../CodeTheme";
|
|
7
|
+
import * as cn from "./Code.styles";
|
|
8
|
+
import {CodeLoader} from "./CodeLoader";
|
|
9
|
+
|
|
10
|
+
export interface CodeProps {
|
|
11
|
+
codeblocks: CodeThemeBlockProps[];
|
|
12
|
+
theme?: Theme
|
|
13
|
+
children: React.ReactNode
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function Code(props: CodeProps) {
|
|
17
|
+
return <Suspense fallback={<CodeLoader/>}>
|
|
18
|
+
<CodeTheme codeblocks={props.codeblocks} theme={props.theme}>
|
|
19
|
+
{props.children}
|
|
20
|
+
</CodeTheme>
|
|
21
|
+
</Suspense>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// TODO: fix any
|
|
25
|
+
Code.LineNumber = function LineNumber(props: any) {
|
|
26
|
+
if (!props.children || !props.children.length) {
|
|
27
|
+
return null
|
|
28
|
+
}
|
|
29
|
+
return (
|
|
30
|
+
<>
|
|
31
|
+
<span
|
|
32
|
+
style={{minWidth: `${props.width}ch`}}
|
|
33
|
+
className={cn.LineNumberHost}
|
|
34
|
+
>
|
|
35
|
+
{props.lineNumber}
|
|
36
|
+
</span>
|
|
37
|
+
<InnerLine merge={props}/>
|
|
38
|
+
</>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// TODO: fix any
|
|
43
|
+
Code.Mark = function Mark(props: any) {
|
|
44
|
+
return <div className={`${cn.MarkHost} ${props.annotation && cn.MarkAnnotated}`}>
|
|
45
|
+
<InnerLine
|
|
46
|
+
merge={props}
|
|
47
|
+
className={cn.MarkLine}
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// TODO: fix any
|
|
53
|
+
Code.Bg = function CodeLine(props: any) {
|
|
54
|
+
return <span className={`${props.annotation && cn.MarkAnnotated}`}>
|
|
55
|
+
{props.children}
|
|
56
|
+
</span>
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
Code.Pre = function CodePre(props: {
|
|
60
|
+
codeblock: HighlightedCode,
|
|
61
|
+
size?: "full",
|
|
62
|
+
handlers: AnnotationHandler[],
|
|
63
|
+
className?: string,
|
|
64
|
+
}
|
|
65
|
+
) {
|
|
66
|
+
return <Pre
|
|
67
|
+
className={`
|
|
68
|
+
${cn.CodeHost}
|
|
69
|
+
${props?.size === "full" && cn.CodeHostFull}
|
|
70
|
+
${props.className}
|
|
71
|
+
`}
|
|
72
|
+
style={props.codeblock?.style || props.codeblock?.style}
|
|
73
|
+
code={props.codeblock}
|
|
74
|
+
handlers={props.handlers}
|
|
75
|
+
/>
|
|
76
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {AnnotationHandler} from "codehike/code";
|
|
3
|
+
|
|
4
|
+
import {Code} from "./Code";
|
|
5
|
+
|
|
6
|
+
const markAnnotation: AnnotationHandler = {
|
|
7
|
+
name: "mark",
|
|
8
|
+
Line: (props) => {
|
|
9
|
+
return <Code.Mark {...props}/>
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const bgAnnotation: AnnotationHandler = {
|
|
14
|
+
name: "bg",
|
|
15
|
+
Inline: (props) => {
|
|
16
|
+
return <Code.Bg {...props}/>
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const lineNumberAnnotation: AnnotationHandler = {
|
|
21
|
+
name: "line-numbers",
|
|
22
|
+
Line: ({annotation, ...props}) => {
|
|
23
|
+
return <Code.LineNumber {...props}/>
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const annotations = {
|
|
28
|
+
mark: markAnnotation,
|
|
29
|
+
bg: bgAnnotation,
|
|
30
|
+
lineNumbers: lineNumberAnnotation
|
|
31
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type CodeAnnotation,
|
|
3
|
+
type RawCode,
|
|
4
|
+
type HighlightedCode,
|
|
5
|
+
type Token
|
|
6
|
+
} from 'codehike/code';
|
|
7
|
+
import {
|
|
8
|
+
type Lines,
|
|
9
|
+
type Tokens,
|
|
10
|
+
highlightSync as lighter,
|
|
11
|
+
LANG_NAMES,
|
|
12
|
+
type Theme
|
|
13
|
+
} from '@code-hike/lighter';
|
|
14
|
+
|
|
15
|
+
type Whitespace = string
|
|
16
|
+
|
|
17
|
+
type AnyToken = Token | Whitespace
|
|
18
|
+
|
|
19
|
+
function isWhitespace(token: Token | Whitespace): token is Whitespace {
|
|
20
|
+
return typeof token === 'string';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function highlight(
|
|
24
|
+
data: RawCode,
|
|
25
|
+
theme: Theme,
|
|
26
|
+
lang: string
|
|
27
|
+
): HighlightedCode {
|
|
28
|
+
if (!LANG_NAMES.includes(lang)) {
|
|
29
|
+
console.warn(`Unknown language "${lang}"`);
|
|
30
|
+
lang = 'txt';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const {
|
|
34
|
+
lines,
|
|
35
|
+
lang: lighterLang,
|
|
36
|
+
style
|
|
37
|
+
} = lighter(data.value, lang, theme as any, {
|
|
38
|
+
annotations: [],
|
|
39
|
+
scopes: false // true for better token transitions, but breaks css themes
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const tokens = joinLines(lines);
|
|
43
|
+
// split surrounding whitespace for each token
|
|
44
|
+
const splitTokens = splitWhitespace(tokens);
|
|
45
|
+
// join consecutive whitespace tokens
|
|
46
|
+
const joinedTokens = joinWhitespace(splitTokens);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
...data,
|
|
50
|
+
code: data.value,
|
|
51
|
+
tokens: joinedTokens,
|
|
52
|
+
lang: lighterLang,
|
|
53
|
+
annotations: [], // TODO: in the future
|
|
54
|
+
// annotations: compatAnnotations(annotations),
|
|
55
|
+
themeName: typeof theme === 'string' ? theme : theme?.name || 'unknown',
|
|
56
|
+
style
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function compatAnnotations(annotations: any[]): CodeAnnotation[] {
|
|
61
|
+
const newAnnotations: CodeAnnotation[] = [];
|
|
62
|
+
for (const a of annotations) {
|
|
63
|
+
const {name, query, ranges} = a;
|
|
64
|
+
for (const r of ranges) {
|
|
65
|
+
if (r.lineNumber) {
|
|
66
|
+
const {lineNumber, fromColumn, toColumn} = r;
|
|
67
|
+
newAnnotations.push({
|
|
68
|
+
name,
|
|
69
|
+
query,
|
|
70
|
+
lineNumber,
|
|
71
|
+
fromColumn,
|
|
72
|
+
toColumn
|
|
73
|
+
});
|
|
74
|
+
} else {
|
|
75
|
+
const {fromLineNumber, toLineNumber} = r;
|
|
76
|
+
newAnnotations.push({
|
|
77
|
+
name,
|
|
78
|
+
query,
|
|
79
|
+
fromLineNumber,
|
|
80
|
+
toLineNumber
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return newAnnotations;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// group the Lines into one array
|
|
89
|
+
function joinLines(lines: Lines): AnyToken[] {
|
|
90
|
+
const joinedTokens: AnyToken[] = [];
|
|
91
|
+
lines.forEach((lineOrGroup, i) => {
|
|
92
|
+
if ('lines' in lineOrGroup) {
|
|
93
|
+
throw new Error('Shouldnt be groups');
|
|
94
|
+
} else {
|
|
95
|
+
const tokens = joinTokens(lineOrGroup.tokens);
|
|
96
|
+
joinedTokens.push(...tokens);
|
|
97
|
+
if (i < lines.length - 1) {
|
|
98
|
+
joinedTokens.push('\n');
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return joinedTokens;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function joinTokens(tokens: Tokens): AnyToken[] {
|
|
106
|
+
return tokens.map((tokenOrGroup) => {
|
|
107
|
+
if ('tokens' in tokenOrGroup) {
|
|
108
|
+
throw new Error('Shouldnt be groups');
|
|
109
|
+
} else {
|
|
110
|
+
const t = [tokenOrGroup.content] as Token;
|
|
111
|
+
const {color, ...rest} = tokenOrGroup.style || {};
|
|
112
|
+
t.push(color);
|
|
113
|
+
if (Object.keys(rest).length) {
|
|
114
|
+
t.push(rest);
|
|
115
|
+
}
|
|
116
|
+
return t;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function splitWhitespace(tokens: AnyToken[]) {
|
|
122
|
+
const ejected: AnyToken[] = [];
|
|
123
|
+
tokens.forEach((tokenOrGroup) => {
|
|
124
|
+
if (isWhitespace(tokenOrGroup)) {
|
|
125
|
+
ejected.push(tokenOrGroup);
|
|
126
|
+
} else {
|
|
127
|
+
const [before, content, after] = splitSurroundingWhitespace(
|
|
128
|
+
tokenOrGroup[0]
|
|
129
|
+
);
|
|
130
|
+
if (before?.length) {
|
|
131
|
+
ejected.push(before);
|
|
132
|
+
}
|
|
133
|
+
if (content.length) {
|
|
134
|
+
const copy = [...tokenOrGroup] as Token;
|
|
135
|
+
copy[0] = content;
|
|
136
|
+
ejected.push(copy);
|
|
137
|
+
}
|
|
138
|
+
if (after?.length) {
|
|
139
|
+
ejected.push(after);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
return ejected;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function joinWhitespace(tokens: AnyToken[]) {
|
|
147
|
+
const joinedTokens: AnyToken[] = [];
|
|
148
|
+
tokens.forEach((tokenOrGroup) => {
|
|
149
|
+
if (isWhitespace(tokenOrGroup)) {
|
|
150
|
+
let last = joinedTokens[joinedTokens.length - 1];
|
|
151
|
+
if (last && isWhitespace(last)) {
|
|
152
|
+
joinedTokens[joinedTokens.length - 1] += tokenOrGroup;
|
|
153
|
+
} else if (tokenOrGroup !== '') {
|
|
154
|
+
joinedTokens.push(tokenOrGroup);
|
|
155
|
+
}
|
|
156
|
+
} else if (tokenOrGroup[0].length > 0) {
|
|
157
|
+
joinedTokens.push(tokenOrGroup);
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
return joinedTokens;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// splits " \t foo bar \n" into [" \t ","foo bar"," \n"]
|
|
164
|
+
// "foo bar" -> ["","foo bar",""]
|
|
165
|
+
function splitSurroundingWhitespace(content: string) {
|
|
166
|
+
const trimmed = content.trim();
|
|
167
|
+
const before = content.slice(0, content.indexOf(trimmed));
|
|
168
|
+
const after = content.slice(content.indexOf(trimmed) + trimmed.length);
|
|
169
|
+
return [before, trimmed, after];
|
|
170
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
|
|
3
|
+
export const CodeCopyHost = css`
|
|
4
|
+
all: unset;
|
|
5
|
+
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
|
|
12
|
+
border-radius: 6px;
|
|
13
|
+
padding: 6px;
|
|
14
|
+
|
|
15
|
+
&:hover {
|
|
16
|
+
transition: ease-in 0.1s;
|
|
17
|
+
background: #e3e3eb;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React, {useState} from "react"
|
|
2
2
|
import {Copy, CheckCheck} from "lucide-react"
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
$copy
|
|
6
|
-
} from "./CodeCopy.style"
|
|
4
|
+
import * as cn from "./CodeCopy.styles"
|
|
7
5
|
|
|
8
6
|
export interface CodeCopyProps {
|
|
9
7
|
text: string
|
|
@@ -24,7 +22,7 @@ export function CodeCopy({text}: CodeCopyProps) {
|
|
|
24
22
|
<button
|
|
25
23
|
aria-label="Copy to clipboard"
|
|
26
24
|
onClick={onClick}
|
|
27
|
-
className={
|
|
25
|
+
className={cn.CodeCopyHost}
|
|
28
26
|
>
|
|
29
27
|
{copied ? <CheckCheck size={16}/> : <Copy size={16}/>}
|
|
30
28
|
</button>
|