@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.
- package/CHANGELOG.md +55 -0
- package/LICENSE +21 -0
- package/dist/CTABanner-4FVIoaTR.js +2 -0
- package/dist/CTABanner-4FVIoaTR.js.map +1 -0
- package/dist/CTABanner-BQx2SLf8.js +2 -0
- package/dist/CTABanner-BQx2SLf8.js.map +1 -0
- package/dist/CTABanner-C6afsXoE.js +2 -0
- package/dist/CTABanner-C6afsXoE.js.map +1 -0
- package/dist/CTABanner-CEKs-Hb-.js +2 -0
- package/dist/CTABanner-CEKs-Hb-.js.map +1 -0
- package/dist/CTABanner-CUNcTr6s.js +2 -0
- package/dist/CTABanner-CUNcTr6s.js.map +1 -0
- package/dist/CTABanner-D02aIAsD.js +2 -0
- package/dist/CTABanner-D02aIAsD.js.map +1 -0
- package/dist/CTABanner-Dm3tUG3I.js +2 -0
- package/dist/CTABanner-Dm3tUG3I.js.map +1 -0
- package/dist/CTABanner-MCOcVowa.js +2 -0
- package/dist/CTABanner-MCOcVowa.js.map +1 -0
- package/dist/CTABanner-X6K49gSr.js +2 -0
- package/dist/CTABanner-X6K49gSr.js.map +1 -0
- package/dist/CodeSample-B9VUhTKF.js +2 -0
- package/dist/CodeSample-B9VUhTKF.js.map +1 -0
- package/dist/CodeSample-BSXeFy0x.js +2 -0
- package/dist/CodeSample-BSXeFy0x.js.map +1 -0
- package/dist/CodeSample-BwP208sQ.js +2 -0
- package/dist/CodeSample-BwP208sQ.js.map +1 -0
- package/dist/CodeSample-CK-CQYrV.js +2 -0
- package/dist/CodeSample-CK-CQYrV.js.map +1 -0
- package/dist/CodeSample-CUemtj_W.js +2 -0
- package/dist/CodeSample-CUemtj_W.js.map +1 -0
- package/dist/CodeSample-D0iKih-A.js +2 -0
- package/dist/CodeSample-D0iKih-A.js.map +1 -0
- package/dist/CodeSample-D33vTa6M.js +2 -0
- package/dist/CodeSample-D33vTa6M.js.map +1 -0
- package/dist/CodeSample-DUSx2KBt.js +2 -0
- package/dist/CodeSample-DUSx2KBt.js.map +1 -0
- package/dist/CodeSample-P4yxkHPW.js +2 -0
- package/dist/CodeSample-P4yxkHPW.js.map +1 -0
- package/dist/HomeView-ACBdUgyz.js +2 -0
- package/dist/HomeView-ACBdUgyz.js.map +1 -0
- package/dist/HomeView-B0ATNUF1.js +2 -0
- package/dist/HomeView-B0ATNUF1.js.map +1 -0
- package/dist/HomeView-CHSb4HL6.js +2 -0
- package/dist/HomeView-CHSb4HL6.js.map +1 -0
- package/dist/HomeView-COJrg8Ju.js +2 -0
- package/dist/HomeView-COJrg8Ju.js.map +1 -0
- package/dist/HomeView-Cun4apuy.js +2 -0
- package/dist/HomeView-Cun4apuy.js.map +1 -0
- package/dist/HomeView-D4DXEOOn.js +2 -0
- package/dist/HomeView-D4DXEOOn.js.map +1 -0
- package/dist/HomeView-DaH1PSBB.js +2 -0
- package/dist/HomeView-DaH1PSBB.js.map +1 -0
- package/dist/HomeView-O_lj2c2t.js +2 -0
- package/dist/HomeView-O_lj2c2t.js.map +1 -0
- package/dist/HomeView-_Nu2RcOM.js +2 -0
- package/dist/HomeView-_Nu2RcOM.js.map +1 -0
- package/dist/UnderlineNav-3-KptDYD.js +2 -0
- package/dist/UnderlineNav-3-KptDYD.js.map +1 -0
- package/dist/UnderlineNav-BCyB0G5d.js +2 -0
- package/dist/UnderlineNav-BCyB0G5d.js.map +1 -0
- package/dist/UnderlineNav-BEhDJk0H.js +2 -0
- package/dist/UnderlineNav-BEhDJk0H.js.map +1 -0
- package/dist/UnderlineNav-BqZ2xAp7.js +2 -0
- package/dist/UnderlineNav-BqZ2xAp7.js.map +1 -0
- package/dist/UnderlineNav-C2-4Vyj8.js +2 -0
- package/dist/UnderlineNav-C2-4Vyj8.js.map +1 -0
- package/dist/UnderlineNav-Co08Gykm.js +2 -0
- package/dist/UnderlineNav-Co08Gykm.js.map +1 -0
- package/dist/UnderlineNav-DC3UVmnZ.js +2 -0
- package/dist/UnderlineNav-DC3UVmnZ.js.map +1 -0
- package/dist/UnderlineNav-DsRYwuGB.js +2 -0
- package/dist/UnderlineNav-DsRYwuGB.js.map +1 -0
- package/dist/UnderlineNav-FbclXKUW.js +2 -0
- package/dist/UnderlineNav-FbclXKUW.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-BEouSrrZ.js +2 -0
- package/dist/_rollupPluginBabelHelpers-BEouSrrZ.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-BHehKRBq.js +2 -0
- package/dist/_rollupPluginBabelHelpers-BHehKRBq.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-Bunpz22T.js +2 -0
- package/dist/_rollupPluginBabelHelpers-Bunpz22T.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-CVblpRvU.js +2 -0
- package/dist/_rollupPluginBabelHelpers-CVblpRvU.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-CxmswfqM.js +2 -0
- package/dist/_rollupPluginBabelHelpers-CxmswfqM.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-D0XU6lDu.js +2 -0
- package/dist/_rollupPluginBabelHelpers-D0XU6lDu.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js +2 -0
- package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js +2 -0
- package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-tRAa4O0f.js +2 -0
- package/dist/_rollupPluginBabelHelpers-tRAa4O0f.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 +54 -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-B0FncPxO.js +2 -0
- package/dist/index-B0FncPxO.js.map +1 -0
- package/dist/index-BEm-xkm-.js +2 -0
- package/dist/index-BEm-xkm-.js.map +1 -0
- package/dist/index-BHwtxG27.js +2 -0
- package/dist/index-BHwtxG27.js.map +1 -0
- package/dist/index-BTcmIG47.js +2 -0
- package/dist/index-BTcmIG47.js.map +1 -0
- package/dist/index-BbIMmTvo.js +2 -0
- package/dist/index-BbIMmTvo.js.map +1 -0
- package/dist/index-CNkHt1r7.js +2 -0
- package/dist/index-CNkHt1r7.js.map +1 -0
- package/dist/index-D0XuyFm7.js +2 -0
- package/dist/index-D0XuyFm7.js.map +1 -0
- package/dist/index-DBspcqWq.js +2 -0
- package/dist/index-DBspcqWq.js.map +1 -0
- package/dist/index-DVBO4gYE.js +2 -0
- package/dist/index-DVBO4gYE.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-C3PNVQlC.js → tslib.es6-BBkx4Se1.js} +1 -0
- package/dist/tslib.es6-BBkx4Se1.js.map +1 -0
- package/dist/tslib.es6-BF6ZLEXa.js +2 -0
- package/dist/tslib.es6-BF6ZLEXa.js.map +1 -0
- package/dist/tslib.es6-BOZCDgb8.js +2 -0
- package/dist/tslib.es6-BOZCDgb8.js.map +1 -0
- package/dist/tslib.es6-CNVK7Xcu.js +2 -0
- package/dist/tslib.es6-CNVK7Xcu.js.map +1 -0
- package/dist/tslib.es6-Cjl5tesf.js +2 -0
- package/dist/tslib.es6-Cjl5tesf.js.map +1 -0
- package/dist/tslib.es6-DEH7Dkgy.js +2 -0
- package/dist/tslib.es6-DEH7Dkgy.js.map +1 -0
- package/dist/tslib.es6-DTeJ7dWi.js +2 -0
- package/dist/tslib.es6-DTeJ7dWi.js.map +1 -0
- package/dist/tslib.es6-U9-f6pA7.js +2 -0
- package/dist/tslib.es6-U9-f6pA7.js.map +1 -0
- package/dist/tslib.es6-cb69JjeS.js +2 -0
- package/dist/tslib.es6-cb69JjeS.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 +35 -12
- 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-CWX9isVG.js +0 -1
- package/dist/CodeSample-C5YaEpAi.js +0 -1
- package/dist/HomeView-CnAj-VYl.js +0 -1
- package/dist/UnderlineNav-C8onw9Na.js +0 -1
- package/dist/_rollupPluginBabelHelpers-DfQAiTCw.js +0 -1
- package/dist/abap-kIO_7z1o.js +0 -1
- package/dist/actionscript-3-DiaraCXE.js +0 -1
- package/dist/ada-aNFKX2pl.js +0 -1
- package/dist/angular-html-y0qIEhS2.js +0 -1
- package/dist/angular-ts-Bn_6f37o.js +0 -1
- package/dist/apache-Cx7e0H64.js +0 -1
- package/dist/apex-CdSCJjuL.js +0 -1
- package/dist/apl-BDzWBUim.js +0 -1
- package/dist/applescript-CJFkzk5i.js +0 -1
- package/dist/ara-BC9R9M5c.js +0 -1
- package/dist/asciidoc-lqQQs4M0.js +0 -1
- package/dist/asm-QQeI-gwp.js +0 -1
- package/dist/astro-BPstp8LF.js +0 -1
- package/dist/awk-Cxb7Sqvk.js +0 -1
- package/dist/ballerina-G8TyVc6O.js +0 -1
- package/dist/bat-UDEmXz-g.js +0 -1
- package/dist/beancount-BWg86rhE.js +0 -1
- package/dist/berry-5E5uGOYg.js +0 -1
- package/dist/bibtex-CZn_FFnb.js +0 -1
- package/dist/bicep-D_G0XT5J.js +0 -1
- package/dist/blade-7dxmctkK.js +0 -1
- package/dist/c-CrEz-oYf.js +0 -1
- package/dist/cadence-BulSIR1A.js +0 -1
- package/dist/clarity-m2OigCMT.js +0 -1
- package/dist/clojure-Bpes2rhL.js +0 -1
- package/dist/cmake-C4Tr1SQC.js +0 -1
- package/dist/cobol-Dp8xGW1S.js +0 -1
- package/dist/codeowners-Bs3mpoau.js +0 -1
- package/dist/codeql-CvQzaisq.js +0 -1
- package/dist/coffee-DOjtyJj_.js +0 -1
- package/dist/common-lisp-DGVR8DFi.js +0 -1
- package/dist/cpp-BUT7C4Bo.js +0 -1
- package/dist/crystal-BJh9OJ1_.js +0 -1
- package/dist/csharp-BhZuAD8H.js +0 -1
- package/dist/css-8_G4_UCW.js +0 -1
- package/dist/csv-DLRyYdMG.js +0 -1
- package/dist/cue-DAgMCCsT.js +0 -1
- package/dist/cypher-CtSiSKRh.js +0 -1
- package/dist/d-feZJOTtr.js +0 -1
- package/dist/dark-plus-Dcn2h2HL.js +0 -1
- package/dist/dart-CNOu4aud.js +0 -1
- package/dist/dax-Dkp1Uj6t.js +0 -1
- package/dist/desktop-CAGQzotA.js +0 -1
- package/dist/diff-D6yk3_ZG.js +0 -1
- package/dist/docker-BdTrQq0b.js +0 -1
- package/dist/dotenv-BeHGAMs7.js +0 -1
- package/dist/dracula-BUaMrXr0.js +0 -1
- package/dist/dracula-soft-CBx6n76m.js +0 -1
- package/dist/dream-maker-BU0sZZmb.js +0 -1
- package/dist/edge-D2Tk5tmg.js +0 -1
- package/dist/elixir-B-l3Nz-G.js +0 -1
- package/dist/elm-Bqm7aRpV.js +0 -1
- package/dist/emacs-lisp-BSvpfolf.js +0 -1
- package/dist/erb-CwBHxfFV.js +0 -1
- package/dist/erlang-B0PtHWg2.js +0 -1
- package/dist/fennel-CdN4E9Xo.js +0 -1
- package/dist/fish-XrbYjeRx.js +0 -1
- package/dist/fluent-zYsEgElv.js +0 -1
- package/dist/fortran-fixed-form-CPwX6okW.js +0 -1
- package/dist/fortran-free-form-B6Kk9658.js +0 -1
- package/dist/fsharp-CbMfVCMr.js +0 -1
- package/dist/gdresource-CdRUpBQO.js +0 -1
- package/dist/gdscript-CYXv_Ac9.js +0 -1
- package/dist/gdshader-CtiaGYI5.js +0 -1
- package/dist/genie-C-gOIth7.js +0 -1
- package/dist/gherkin-uGsOfG-k.js +0 -1
- package/dist/git-commit-CWQvkRNX.js +0 -1
- package/dist/git-rebase-BZ0YVJ-O.js +0 -1
- package/dist/github-dark-DCm4kydX.js +0 -1
- package/dist/github-dark-dimmed-CsRUrOJA.js +0 -1
- package/dist/github-from-css-CTRi6tFC.js +0 -1
- package/dist/github-light-B2ofRYMU.js +0 -1
- package/dist/gleam-C9ZZ3Vp2.js +0 -1
- package/dist/glimmer-js-Cuwfndkm.js +0 -1
- package/dist/glimmer-ts-D8nR8_k2.js +0 -1
- package/dist/glsl-qc_rLvzz.js +0 -1
- package/dist/gnuplot-BgHAcd--.js +0 -1
- package/dist/go-Dm8VBUM2.js +0 -1
- package/dist/graphql-CRmnB6D5.js +0 -1
- package/dist/groovy-DJcw8dX4.js +0 -1
- package/dist/hack-DYOVz52F.js +0 -1
- package/dist/haml-j8Vx_P4q.js +0 -1
- package/dist/handlebars-Qz3hgrPG.js +0 -1
- package/dist/haskell-DE3vVmXn.js +0 -1
- package/dist/haxe-DpuNPTTj.js +0 -1
- package/dist/hcl-BvV3VZ9s.js +0 -1
- package/dist/hjson-CsTZvU0B.js +0 -1
- package/dist/hlsl-BLZumTGu.js +0 -1
- package/dist/html-BJsWDmIe.js +0 -1
- package/dist/html-derivative-zDWJvwg5.js +0 -1
- package/dist/http-BiMppEBd.js +0 -1
- package/dist/hxml-DG2jWwyK.js +0 -1
- package/dist/hy-C9zVJlJf.js +0 -1
- package/dist/imba-DGD1mm8E.js +0 -1
- package/dist/index-TKJ66_wI.js +0 -1
- package/dist/ini-CU7wgrgh.js +0 -1
- package/dist/java-DyOZhX5L.js +0 -1
- package/dist/javascript-C0AWZ4eK.js +0 -1
- package/dist/jinja-Lc82IfGI.js +0 -1
- package/dist/jison-DT7Oqeqm.js +0 -1
- package/dist/json-Zoq3rK60.js +0 -1
- package/dist/json5-BOFh3mt2.js +0 -1
- package/dist/jsonc-CPutX9W5.js +0 -1
- package/dist/jsonl-xWfKSBhV.js +0 -1
- package/dist/jsonnet-UcnvaLwK.js +0 -1
- package/dist/jssm-BRT8_Uqd.js +0 -1
- package/dist/jsx-B4WNxrCK.js +0 -1
- package/dist/julia-i7_3XSV_.js +0 -1
- package/dist/kotlin-B_s0KNy5.js +0 -1
- package/dist/kusto-CDr4m-xT.js +0 -1
- package/dist/latex-BNB6MZrj.js +0 -1
- package/dist/lean-2dBp1asm.js +0 -1
- package/dist/less-CfPPFFsV.js +0 -1
- package/dist/light-plus-glPHycm5.js +0 -1
- package/dist/liquid-Bj1DN66U.js +0 -1
- package/dist/log-CKSz9t_o.js +0 -1
- package/dist/logo-D3UPVeLP.js +0 -1
- package/dist/lua-C1EFGxtA.js +0 -1
- package/dist/luau-Dvb2LLsw.js +0 -1
- package/dist/make-TqphZF-7.js +0 -1
- package/dist/markdown-yX62Igf3.js +0 -1
- package/dist/marko-LH6NoP97.js +0 -1
- package/dist/material-darker-D6whucX3.js +0 -1
- package/dist/material-default-DYqS7fqa.js +0 -1
- package/dist/material-from-css-DlWo_ZDV.js +0 -1
- package/dist/material-lighter-CYQaMsGh.js +0 -1
- package/dist/material-ocean-Dl_zLA-F.js +0 -1
- package/dist/material-palenight-Cd4X9kqy.js +0 -1
- package/dist/matlab-Dy9K5GW8.js +0 -1
- package/dist/mdc-DhAfBnnn.js +0 -1
- package/dist/mdx-tnT2uTqR.js +0 -1
- package/dist/mermaid-aEaCok9S.js +0 -1
- package/dist/min-dark-CpapYCVz.js +0 -1
- package/dist/min-light-plRN0zW-.js +0 -1
- package/dist/mojo-BanaVmFY.js +0 -1
- package/dist/monokai-Cs2_BG4b.js +0 -1
- package/dist/move-B_kaWhAV.js +0 -1
- package/dist/narrat-6tChrAmV.js +0 -1
- package/dist/nextflow-BYB6CU6V.js +0 -1
- package/dist/nginx-Clr7XfzW.js +0 -1
- package/dist/nim-gLesixmv.js +0 -1
- package/dist/nix-DCgUXh-o.js +0 -1
- package/dist/nord-BHSE8FbR.js +0 -1
- package/dist/nushell-DDKGkuZY.js +0 -1
- package/dist/objective-c-BsQdhSk0.js +0 -1
- package/dist/objective-cpp-B-VZlBXW.js +0 -1
- package/dist/ocaml-B19L2xxl.js +0 -1
- package/dist/one-dark-pro-AWPQgJbJ.js +0 -1
- package/dist/pascal-B0kVBVTU.js +0 -1
- package/dist/perl-Bs2cXIO6.js +0 -1
- package/dist/php-BgaH_AHK.js +0 -1
- package/dist/plsql-CPY7hT9n.js +0 -1
- package/dist/po-BszTsnLZ.js +0 -1
- package/dist/poimandres-CZF4JUv5.js +0 -1
- package/dist/postcss-DQ0frX96.js +0 -1
- package/dist/powerquery-BitONm6p.js +0 -1
- package/dist/powershell-B_lVHVgu.js +0 -1
- package/dist/prisma-CqkE3olT.js +0 -1
- package/dist/prolog-Bpuon3aK.js +0 -1
- package/dist/proto-C349dup0.js +0 -1
- package/dist/pug-Bbf3g_hT.js +0 -1
- package/dist/puppet-qDtDc0so.js +0 -1
- package/dist/purescript-C03CHyrT.js +0 -1
- package/dist/python-D5e4BtVB.js +0 -1
- package/dist/qml-LVCeHqxw.js +0 -1
- package/dist/qmldir-BEg8Q-XX.js +0 -1
- package/dist/qss-vq-U9k0N.js +0 -1
- package/dist/r-DnCIdoUu.js +0 -1
- package/dist/racket-BQt8mf2o.js +0 -1
- package/dist/raku-ChTHpuBS.js +0 -1
- package/dist/razor-CjFZSXD2.js +0 -1
- package/dist/reg-12gGsscy.js +0 -1
- package/dist/regexp-zLCCZKTi.js +0 -1
- package/dist/rel-aZ4oe34Q.js +0 -1
- package/dist/riscv-BA9R8KI2.js +0 -1
- package/dist/rose-pine-8QECO0Ox.js +0 -1
- package/dist/rose-pine-dawn-DT77ObZh.js +0 -1
- package/dist/rose-pine-moon-D3-I8ETF.js +0 -1
- package/dist/rst-DFKlxnrd.js +0 -1
- package/dist/ruby-BypI_hk5.js +0 -1
- package/dist/rust-tE6tRkqD.js +0 -1
- package/dist/sas-D1sMUJql.js +0 -1
- package/dist/sass-DBEOLVv3.js +0 -1
- package/dist/scala-DUzir4os.js +0 -1
- package/dist/scheme-dsSqVZz3.js +0 -1
- package/dist/scss-B0kJw1gM.js +0 -1
- package/dist/shaderlab-Cd8Cbryn.js +0 -1
- package/dist/shellscript-BL-Ihj2z.js +0 -1
- package/dist/shellsession-C5KJPcFG.js +0 -1
- package/dist/slack-dark-JbsLGggd.js +0 -1
- package/dist/slack-ochin-hTeCADjA.js +0 -1
- package/dist/smalltalk-DQ23HuGh.js +0 -1
- package/dist/solarized-dark-D2bQRcX7.js +0 -1
- package/dist/solarized-light-6xrOKoxI.js +0 -1
- package/dist/solidity-DUCwohjn.js +0 -1
- package/dist/soy-Cy4pRjbu.js +0 -1
- package/dist/sparql-D7gNTkUq.js +0 -1
- package/dist/splunk-Dvl5Xm98.js +0 -1
- package/dist/sql-BfoT44Al.js +0 -1
- package/dist/ssh-config-C-ZFySPN.js +0 -1
- package/dist/stata-Dpw9jvge.js +0 -1
- package/dist/stylus-mJ9_5M6n.js +0 -1
- package/dist/svelte-DD5dtnEi.js +0 -1
- package/dist/swift-DDernUpH.js +0 -1
- package/dist/system-verilog-DeXSd9Py.js +0 -1
- package/dist/systemd-NetTuLPL.js +0 -1
- package/dist/tasl-BCm9L3tI.js +0 -1
- package/dist/tcl-DmWVgxCm.js +0 -1
- package/dist/templ-B7wt_K-d.js +0 -1
- package/dist/terraform-DYIIsq8p.js +0 -1
- package/dist/tex-DFj0qpOD.js +0 -1
- package/dist/toml-CFu3vY0Q.js +0 -1
- package/dist/ts-tags-BvMEeGTJ.js +0 -1
- package/dist/tsv-DnenRF8k.js +0 -1
- package/dist/tsx-DooqfEr1.js +0 -1
- package/dist/turtle-DKlxyehf.js +0 -1
- package/dist/twig-DpQc8FUF.js +0 -1
- package/dist/txt-C4tHEtDr.js +0 -1
- package/dist/typescript-DtE5sB_4.js +0 -1
- package/dist/typespec-B69vp3jc.js +0 -1
- package/dist/typst-BzEngGMo.js +0 -1
- package/dist/v-Dy6tTX8K.js +0 -1
- package/dist/vala-DQnmDtkE.js +0 -1
- package/dist/vb-CqTjXY4K.js +0 -1
- package/dist/verilog-D6Zfe00a.js +0 -1
- package/dist/vhdl-Dxu0BOr9.js +0 -1
- package/dist/viml-eXtfIM-m.js +0 -1
- package/dist/vue-D3vey6Cu.js +0 -1
- package/dist/vue-html-DyaqvCGV.js +0 -1
- package/dist/vyper-C6AULW8C.js +0 -1
- package/dist/wasm-Cl39COlm.js +0 -1
- package/dist/wenyan-DJGdsiXE.js +0 -1
- package/dist/wgsl-CDhIPMwJ.js +0 -1
- package/dist/wikitext-D05PpJ8X.js +0 -1
- package/dist/wolfram-JgWnd2g7.js +0 -1
- package/dist/xml-Cc1Sy-d4.js +0 -1
- package/dist/xsl-CEYTrbD0.js +0 -1
- package/dist/yaml-NvTdC05o.js +0 -1
- package/dist/zenscript-De0mU_BW.js +0 -1
- package/dist/zig-D9TJVGyp.js +0 -1
- package/src/coder/CodeCopy/CodeCopy.style.tsx +0 -21
- 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,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,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
|
+
}
|
package/src/coder/index.ts
CHANGED
|
@@ -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
|
-
|
|
32
|
+
useCodeTheme
|
|
33
|
+
} from "./CodeTheme";
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import {Theme} from "@code-hike/lighter";
|
|
4
4
|
|
|
5
|
-
export
|
|
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
|
|
@@ -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={
|
|
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={
|
|
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={
|
|
46
|
+
className={cn.AnchorHost}
|
|
57
47
|
>
|
|
58
48
|
{children}
|
|
59
49
|
</a>
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import React from "react"
|
|
2
|
-
import
|
|
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={
|
|
9
|
+
return <div className={cn.ContentHost}>
|
|
18
10
|
{children}
|
|
19
11
|
</div>
|
|
20
|
-
}
|
|
12
|
+
}
|
|
13
|
+
|