@xyd-js/components 0.1.0-xyd.8 → 0.1.0-xyd.94
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/.idea/git_toolbox_blame.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/xyd-components.iml +12 -0
- package/CHANGELOG.md +712 -0
- package/TODO.md +1 -0
- package/content.ts +0 -2
- package/dist/CTABanner-Bc77pnms.js +2 -0
- package/dist/CTABanner-Bc77pnms.js.map +1 -0
- package/dist/CTABanner-DzO62aGj.js +2 -0
- package/dist/CTABanner-DzO62aGj.js.map +1 -0
- package/dist/CodeSample-BWPDgd2G.js +2 -0
- package/dist/CodeSample-BWPDgd2G.js.map +1 -0
- package/dist/CodeSample-DLnR-knP.js +2 -0
- package/dist/CodeSample-DLnR-knP.js.map +1 -0
- package/dist/HomeView-C8QlNdKh.js +2 -0
- package/dist/{HomeView-ACBdUgyz.js.map → HomeView-C8QlNdKh.js.map} +1 -1
- package/dist/HomeView-ZAP5saNy.js +2 -0
- package/dist/{HomeView-B0ATNUF1.js.map → HomeView-ZAP5saNy.js.map} +1 -1
- package/dist/Icon-BESh23UN.js +2 -0
- package/dist/Icon-BESh23UN.js.map +1 -0
- package/dist/Icon-xNucOqd2.js +2 -0
- package/dist/Icon-xNucOqd2.js.map +1 -0
- package/dist/Text-CfN9RkYA.js +2 -0
- package/dist/Text-CfN9RkYA.js.map +1 -0
- package/dist/Text-DKycD2zu.js +2 -0
- package/dist/Text-DKycD2zu.js.map +1 -0
- package/dist/Update-0XruJHjj.js +2 -0
- package/dist/Update-0XruJHjj.js.map +1 -0
- package/dist/Update-DKOAw8p9.js +2 -0
- package/dist/Update-DKOAw8p9.js.map +1 -0
- package/dist/VideoGuide-BUyomFVz.js +2 -0
- package/dist/VideoGuide-BUyomFVz.js.map +1 -0
- package/dist/VideoGuide-B_iUKKv7.js +2 -0
- package/dist/VideoGuide-B_iUKKv7.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-CxSUtGup.js +4 -0
- package/dist/_rollupPluginBabelHelpers-CxSUtGup.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-DZ-ucadG.js +4 -0
- package/dist/_rollupPluginBabelHelpers-DZ-ucadG.js.map +1 -0
- package/dist/brand.js +1 -1
- package/dist/brand.js.map +1 -1
- package/dist/coder/themes/cosmo-light.js.map +1 -1
- package/dist/coder.d.ts +29 -9
- package/dist/coder.js +1 -1
- package/dist/coder.js.map +1 -1
- package/dist/content.d.ts +264 -201
- package/dist/content.js +1 -1
- package/dist/content.js.map +1 -1
- package/dist/index.css +261 -211
- package/dist/layouts.d.ts +20 -21
- package/dist/layouts.js +1 -1
- package/dist/layouts.js.map +1 -1
- package/dist/pages.js +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/system.d.ts +10 -0
- package/dist/system.js +2 -0
- package/dist/system.js.map +1 -0
- package/dist/tslib.es6-DyL9kPq9.js +2 -0
- package/dist/{tslib.es6-BBkx4Se1.js.map → tslib.es6-DyL9kPq9.js.map} +1 -1
- package/dist/tslib.es6-Hqk-Mdr9.js +2 -0
- package/dist/{tslib.es6-BF6ZLEXa.js.map → tslib.es6-Hqk-Mdr9.js.map} +1 -1
- package/dist/views.js +1 -1
- package/dist/writer.d.ts +409 -77
- package/dist/writer.js +1 -1
- package/dist/writer.js.map +1 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +22 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1640 -0
- package/docs/functions/GuideCard.html +6 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +2 -0
- package/docs/interfaces/GuideCardProps.html +18 -0
- package/docs/modules.html +1 -0
- package/index.ts +0 -1
- package/package.json +9 -15
- package/project.json +677 -0
- package/rollup.config.js +30 -20
- package/src/brand/Button/Button.styles.tsx +0 -3
- package/src/brand/CTABanner/CTABanner.styles.tsx +2 -4
- package/src/brand/Footer/Footer.styles.tsx +0 -3
- package/src/coder/Code/Code.styles.tsx +135 -33
- package/src/coder/Code/Code.tsx +129 -38
- package/src/coder/Code/CodeLoader.tsx +3 -3
- package/src/coder/Code/annotations.tsx +28 -8
- package/src/coder/Code/highlight.ts +38 -0
- package/src/coder/Code/index.ts +2 -1
- package/src/coder/CodeCopy/CodeCopy.styles.tsx +13 -11
- package/src/coder/CodeCopy/CodeCopy.tsx +5 -3
- package/src/coder/CodeSample/CodeSample.tsx +83 -27
- package/src/coder/CodeTabs/CodeTabs.styles.tsx +111 -94
- package/src/coder/CodeTabs/CodeTabs.tsx +69 -51
- package/src/coder/CodeTheme/CodeTheme.tsx +89 -49
- package/src/coder/CodeTheme/index.ts +0 -1
- package/src/coder/CoderProvider.tsx +26 -0
- package/src/coder/index.ts +8 -4
- package/src/content/ContentDecoator.styles.tsx +113 -0
- package/src/content/ContentDecorator.tsx +17 -0
- package/src/content/GridDecorator.styles.tsx +67 -0
- package/src/content/GridDecorator.tsx +21 -0
- package/src/content/ReactContent.tsx +575 -0
- package/src/content/index.ts +10 -2
- package/src/icons/index.ts +0 -0
- package/src/kit/Loader/Loader.styles.tsx +53 -0
- package/src/kit/Loader/Loader.tsx +22 -0
- package/src/kit/index.ts +1 -0
- package/src/layouts/LayoutPrimary/LayoutPrimary.styles.tsx +270 -306
- package/src/layouts/LayoutPrimary/LayoutPrimary.tsx +171 -91
- package/src/layouts/LayoutPrimary/index.ts +0 -2
- package/src/layouts/index.ts +0 -7
- package/src/system/SearchButton/SearchButton.styles.tsx +86 -0
- package/src/system/SearchButton/SearchButton.tsx +116 -0
- package/src/system/SearchButton/index.ts +1 -0
- package/src/system/index.ts +1 -0
- package/src/writer/Anchor/Anchor.styles.tsx +11 -0
- package/src/{content → writer}/Anchor/Anchor.tsx +20 -22
- package/src/writer/Anchor/index.tsx +1 -0
- package/src/writer/Badge/Badge.styles.tsx +37 -27
- package/src/writer/Badge/Badge.tsx +34 -48
- package/src/writer/Banner/Banner.styles.tsx +91 -0
- package/src/writer/Banner/Banner.tsx +70 -0
- package/src/writer/Banner/index.ts +1 -0
- package/src/writer/Blockquote/Blockquote.styles.tsx +6 -4
- package/src/writer/Blockquote/Blockquote.tsx +5 -2
- package/src/writer/Breadcrumbs/Breadcrumbs.styles.ts +25 -25
- package/src/writer/Breadcrumbs/Breadcrumbs.tsx +18 -12
- package/src/writer/Button/Button.styles.tsx +137 -0
- package/src/writer/Button/Button.tsx +75 -0
- package/src/writer/Button/index.ts +2 -0
- package/src/writer/Callout/Callout.styles.tsx +35 -42
- package/src/writer/Callout/Callout.tsx +30 -15
- package/src/writer/Card/Card.styles.tsx +47 -0
- package/src/writer/Card/Card.tsx +69 -0
- package/src/writer/Card/index.ts +1 -0
- package/src/writer/Code/Code.styles.tsx +12 -11
- package/src/writer/Code/Code.tsx +6 -3
- package/src/writer/ColorSchemeButton/ColorSchemeButton.tsx +172 -0
- package/src/writer/ColorSchemeButton/index.ts +1 -0
- package/src/writer/Details/Details.styles.tsx +87 -98
- package/src/writer/Details/Details.tsx +65 -44
- package/src/writer/Example/index.tsx +5 -0
- package/src/writer/GuideCard/GuideCard.styles.tsx +100 -103
- package/src/writer/GuideCard/GuideCard.tsx +72 -37
- package/src/writer/Heading/Heading.styles.tsx +76 -60
- package/src/writer/Heading/Heading.tsx +92 -22
- package/src/writer/Hr/Hr.styles.tsx +3 -1
- package/src/writer/Hr/Hr.tsx +2 -5
- package/src/writer/Icon/Icon.tsx +48 -0
- package/src/writer/Icon/index.ts +1 -0
- package/src/writer/Image/Image.styles.tsx +9 -0
- package/src/writer/Image/Image.tsx +19 -0
- package/src/writer/Image/index.ts +1 -0
- package/src/writer/List/List.styles.tsx +47 -0
- package/src/writer/List/List.tsx +29 -0
- package/src/writer/List/index.ts +4 -0
- package/src/writer/NavLinks/NavLinks.styles.ts +26 -26
- package/src/writer/NavLinks/NavLinks.tsx +65 -18
- package/src/writer/Pre/Pre.styles.tsx +8 -6
- package/src/writer/Pre/Pre.tsx +3 -2
- package/src/writer/Steps/Steps.styles.tsx +27 -24
- package/src/writer/Steps/Steps.tsx +38 -8
- package/src/writer/Table/Table.styles.tsx +65 -34
- package/src/writer/Table/Table.tsx +121 -11
- package/src/writer/Table/index.ts +0 -11
- package/src/writer/Tabs/Tabs.styles.tsx +51 -55
- package/src/writer/Tabs/Tabs.tsx +30 -23
- package/src/writer/Text/Text.styles.tsx +66 -0
- package/src/writer/Text/Text.tsx +79 -0
- package/src/writer/Text/index.ts +3 -0
- package/src/writer/TocCard/TocCard.module.css +44 -0
- package/src/writer/TocCard/TocCard.tsx +42 -0
- package/src/writer/TocCard/index.ts +3 -0
- package/src/writer/UnderlineNav/Tabs.tsx +51 -0
- package/src/writer/UnderlineNav/TabsPrimary.styles.tsx +184 -0
- package/src/writer/UnderlineNav/TabsPrimary.tsx +209 -0
- package/src/writer/UnderlineNav/TabsSecondary.styles.tsx +77 -0
- package/src/writer/UnderlineNav/TabsSecondary.tsx +171 -0
- package/src/writer/UnderlineNav/UnderlineNav.styles.tsx +165 -31
- package/src/writer/UnderlineNav/UnderlineNav.tsx +257 -22
- package/src/writer/UnderlineNav/index.ts +2 -1
- package/src/writer/UnderlineNav/useValueChange.ts +60 -0
- package/src/writer/Update/Update.styles.tsx +33 -0
- package/src/writer/Update/Update.tsx +37 -0
- package/src/writer/Update/index.ts +1 -0
- package/src/writer/VideoGuide/VideoGuide.module.css +105 -0
- package/src/writer/VideoGuide/VideoGuide.tsx +75 -0
- package/src/writer/VideoGuide/index.ts +1 -0
- package/src/writer/index.ts +23 -1
- package/tsconfig.json +9 -3
- package/types.d.ts +50 -0
- package/writer.ts +1 -1
- package/dist/CTABanner-4FVIoaTR.js +0 -2
- package/dist/CTABanner-4FVIoaTR.js.map +0 -1
- package/dist/CTABanner-C6afsXoE.js +0 -2
- package/dist/CTABanner-C6afsXoE.js.map +0 -1
- package/dist/CTABanner-CEKs-Hb-.js +0 -2
- package/dist/CTABanner-CEKs-Hb-.js.map +0 -1
- package/dist/CTABanner-CUNcTr6s.js +0 -2
- package/dist/CTABanner-CUNcTr6s.js.map +0 -1
- package/dist/CTABanner-D02aIAsD.js +0 -2
- package/dist/CTABanner-D02aIAsD.js.map +0 -1
- package/dist/CTABanner-Dm3tUG3I.js +0 -2
- package/dist/CTABanner-Dm3tUG3I.js.map +0 -1
- package/dist/CTABanner-MCOcVowa.js +0 -2
- package/dist/CTABanner-MCOcVowa.js.map +0 -1
- package/dist/CTABanner-X6K49gSr.js +0 -2
- package/dist/CTABanner-X6K49gSr.js.map +0 -1
- package/dist/CodeSample-B9VUhTKF.js +0 -2
- package/dist/CodeSample-B9VUhTKF.js.map +0 -1
- package/dist/CodeSample-BSXeFy0x.js +0 -2
- package/dist/CodeSample-BSXeFy0x.js.map +0 -1
- package/dist/CodeSample-BwP208sQ.js +0 -2
- package/dist/CodeSample-BwP208sQ.js.map +0 -1
- package/dist/CodeSample-CUemtj_W.js +0 -2
- package/dist/CodeSample-CUemtj_W.js.map +0 -1
- package/dist/CodeSample-D0iKih-A.js +0 -2
- package/dist/CodeSample-D0iKih-A.js.map +0 -1
- package/dist/CodeSample-D33vTa6M.js +0 -2
- package/dist/CodeSample-D33vTa6M.js.map +0 -1
- package/dist/CodeSample-DUSx2KBt.js +0 -2
- package/dist/CodeSample-DUSx2KBt.js.map +0 -1
- package/dist/CodeSample-P4yxkHPW.js +0 -2
- package/dist/CodeSample-P4yxkHPW.js.map +0 -1
- package/dist/HomeView-ACBdUgyz.js +0 -2
- package/dist/HomeView-B0ATNUF1.js +0 -2
- package/dist/HomeView-COJrg8Ju.js +0 -2
- package/dist/HomeView-COJrg8Ju.js.map +0 -1
- package/dist/HomeView-Cun4apuy.js +0 -2
- package/dist/HomeView-Cun4apuy.js.map +0 -1
- package/dist/HomeView-D4DXEOOn.js +0 -2
- package/dist/HomeView-D4DXEOOn.js.map +0 -1
- package/dist/HomeView-DaH1PSBB.js +0 -2
- package/dist/HomeView-DaH1PSBB.js.map +0 -1
- package/dist/HomeView-O_lj2c2t.js +0 -2
- package/dist/HomeView-O_lj2c2t.js.map +0 -1
- package/dist/HomeView-_Nu2RcOM.js +0 -2
- package/dist/HomeView-_Nu2RcOM.js.map +0 -1
- package/dist/UnderlineNav-BCyB0G5d.js +0 -2
- package/dist/UnderlineNav-BCyB0G5d.js.map +0 -1
- package/dist/UnderlineNav-BEhDJk0H.js +0 -2
- package/dist/UnderlineNav-BEhDJk0H.js.map +0 -1
- package/dist/UnderlineNav-BqZ2xAp7.js +0 -2
- package/dist/UnderlineNav-BqZ2xAp7.js.map +0 -1
- package/dist/UnderlineNav-C2-4Vyj8.js +0 -2
- package/dist/UnderlineNav-C2-4Vyj8.js.map +0 -1
- package/dist/UnderlineNav-Co08Gykm.js +0 -2
- package/dist/UnderlineNav-Co08Gykm.js.map +0 -1
- package/dist/UnderlineNav-DC3UVmnZ.js +0 -2
- package/dist/UnderlineNav-DC3UVmnZ.js.map +0 -1
- package/dist/UnderlineNav-DsRYwuGB.js +0 -2
- package/dist/UnderlineNav-DsRYwuGB.js.map +0 -1
- package/dist/UnderlineNav-FbclXKUW.js +0 -2
- package/dist/UnderlineNav-FbclXKUW.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-BEouSrrZ.js +0 -2
- package/dist/_rollupPluginBabelHelpers-BEouSrrZ.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-BHehKRBq.js +0 -2
- package/dist/_rollupPluginBabelHelpers-BHehKRBq.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-Bunpz22T.js +0 -2
- package/dist/_rollupPluginBabelHelpers-Bunpz22T.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-CVblpRvU.js +0 -2
- package/dist/_rollupPluginBabelHelpers-CVblpRvU.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-CxmswfqM.js +0 -2
- package/dist/_rollupPluginBabelHelpers-CxmswfqM.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js +0 -2
- package/dist/_rollupPluginBabelHelpers-DQJTK9EO.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js +0 -2
- package/dist/_rollupPluginBabelHelpers-DuRQdJ01.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-tRAa4O0f.js +0 -2
- package/dist/_rollupPluginBabelHelpers-tRAa4O0f.js.map +0 -1
- package/dist/index-B0FncPxO.js +0 -2
- package/dist/index-B0FncPxO.js.map +0 -1
- package/dist/index-BEm-xkm-.js +0 -2
- package/dist/index-BEm-xkm-.js.map +0 -1
- package/dist/index-BHwtxG27.js +0 -2
- package/dist/index-BHwtxG27.js.map +0 -1
- package/dist/index-BTcmIG47.js +0 -2
- package/dist/index-BTcmIG47.js.map +0 -1
- package/dist/index-CNkHt1r7.js +0 -2
- package/dist/index-CNkHt1r7.js.map +0 -1
- package/dist/index-D0XuyFm7.js +0 -2
- package/dist/index-D0XuyFm7.js.map +0 -1
- package/dist/index-DBspcqWq.js +0 -2
- package/dist/index-DBspcqWq.js.map +0 -1
- package/dist/index-DVBO4gYE.js +0 -2
- package/dist/index-DVBO4gYE.js.map +0 -1
- package/dist/tslib.es6-BBkx4Se1.js +0 -2
- package/dist/tslib.es6-BF6ZLEXa.js +0 -2
- package/dist/tslib.es6-BOZCDgb8.js +0 -2
- package/dist/tslib.es6-BOZCDgb8.js.map +0 -1
- package/dist/tslib.es6-Cjl5tesf.js +0 -2
- package/dist/tslib.es6-Cjl5tesf.js.map +0 -1
- package/dist/tslib.es6-DEH7Dkgy.js +0 -2
- package/dist/tslib.es6-DEH7Dkgy.js.map +0 -1
- package/dist/tslib.es6-DTeJ7dWi.js +0 -2
- package/dist/tslib.es6-DTeJ7dWi.js.map +0 -1
- package/dist/tslib.es6-U9-f6pA7.js +0 -2
- package/dist/tslib.es6-U9-f6pA7.js.map +0 -1
- package/dist/tslib.es6-cb69JjeS.js +0 -2
- package/dist/tslib.es6-cb69JjeS.js.map +0 -1
- package/src/content/Anchor/Anchor.styles.tsx +0 -5
- package/src/content/Anchor/index.tsx +0 -3
- package/src/content/Content/Content.styles.tsx +0 -9
- package/src/content/Content/Content.tsx +0 -13
- package/src/content/Content/index.tsx +0 -3
- package/src/content/Content.tsx +0 -179
- package/src/content/Subtitle/Subtitle.styles.ts +0 -8
- package/src/content/Subtitle/Subtitle.tsx +0 -12
- package/src/content/Subtitle/index.tsx +0 -3
- package/src/layouts/Layout.styles.tsx +0 -155
- package/src/layouts/Layout.tsx +0 -119
- package/src/ui/Loader/Loader.styles.tsx +0 -54
- package/src/ui/Loader/Loader.tsx +0 -26
- package/src/ui/index.ts +0 -1
- package/src/writer/Icon/index.tsx +0 -355
- package/src/writer/Table/TableV2.styles.tsx +0 -117
- package/src/writer/Table/TableV2.tsx +0 -83
- /package/src/{ui → kit}/TODO.md +0 -0
package/rollup.config.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import {fileURLToPath} from 'url';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
4
|
|
|
5
5
|
import resolve from '@rollup/plugin-node-resolve';
|
|
6
6
|
import commonjs from '@rollup/plugin-commonjs';
|
|
7
7
|
import typescript from '@rollup/plugin-typescript';
|
|
8
8
|
import dts from 'rollup-plugin-dts';
|
|
9
|
-
import {terser} from 'rollup-plugin-terser';
|
|
9
|
+
import { terser } from 'rollup-plugin-terser';
|
|
10
10
|
import babel from '@rollup/plugin-babel';
|
|
11
11
|
import postcss from 'rollup-plugin-postcss';
|
|
12
12
|
import wyw from '@wyw-in-js/rollup';
|
|
13
13
|
|
|
14
|
-
import {createRequire} from 'module';
|
|
14
|
+
import { createRequire } from 'module';
|
|
15
15
|
|
|
16
16
|
const require = createRequire(import.meta.url);
|
|
17
17
|
const {
|
|
18
18
|
dependencies,
|
|
19
19
|
peerDependencies,
|
|
20
20
|
devDependencies
|
|
21
|
-
} = require('./package.json', {assert: {type: 'json'}});
|
|
21
|
+
} = require('./package.json', { assert: { type: 'json' } });
|
|
22
22
|
|
|
23
23
|
const external = [
|
|
24
24
|
...Object.keys(dependencies),
|
|
@@ -47,6 +47,7 @@ export default [
|
|
|
47
47
|
pages: 'src/pages/index.ts',
|
|
48
48
|
views: 'src/views/index.ts',
|
|
49
49
|
writer: 'writer.ts',
|
|
50
|
+
system: 'src/system/index.ts',
|
|
50
51
|
...themes
|
|
51
52
|
},
|
|
52
53
|
output: [
|
|
@@ -66,25 +67,25 @@ export default [
|
|
|
66
67
|
'@babel/preset-react'
|
|
67
68
|
],
|
|
68
69
|
},
|
|
69
|
-
classNameSlug: (hash, title, {file}) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
// classNameSlug: (hash, title, {file}) => {
|
|
71
|
+
// // Get the full path after 'src/components/'
|
|
72
|
+
// const pathParts = file.split('/');
|
|
73
|
+
// const componentsIndex = pathParts.indexOf('src');
|
|
74
|
+
// if (componentsIndex === -1) return `XydComponents-Component-${title}`;
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
// // Get everything after 'components' directory
|
|
77
|
+
// const componentPath = pathParts
|
|
78
|
+
// .slice(componentsIndex + 1)
|
|
79
|
+
// .filter(part => !part.endsWith('.styles.tsx')) // Remove styles.tsx
|
|
80
|
+
// .join('-');
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
// // Use the title as the style name (it's already the variable name)
|
|
83
|
+
// const styleName = title.replace(/^\$/, ''); // Remove $ prefix if present
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
85
|
+
// // TODO: in the future hash + system to override styles for specific components if hash
|
|
86
|
+
// return `XydComponents-Component-${componentPath}__${styleName}`;
|
|
87
|
+
// // return `XydComponents-Component-${componentPath}__${styleName}_${hash}`;
|
|
88
|
+
// }
|
|
88
89
|
}),
|
|
89
90
|
postcss({
|
|
90
91
|
extract: true,
|
|
@@ -182,6 +183,15 @@ export default [
|
|
|
182
183
|
plugins: [dts()],
|
|
183
184
|
external
|
|
184
185
|
},
|
|
186
|
+
{
|
|
187
|
+
input: 'src/system/index.ts',
|
|
188
|
+
output: {
|
|
189
|
+
file: 'dist/system.d.ts',
|
|
190
|
+
format: 'es',
|
|
191
|
+
},
|
|
192
|
+
plugins: [dts()],
|
|
193
|
+
external
|
|
194
|
+
},
|
|
185
195
|
...Object.keys(themes).map(theme => ({
|
|
186
196
|
input: themes[theme],
|
|
187
197
|
output: {
|
|
@@ -4,12 +4,9 @@ export const ButtonHost = css`
|
|
|
4
4
|
display: inline-block;
|
|
5
5
|
border: 1px solid transparent;
|
|
6
6
|
text-align: center;
|
|
7
|
-
font-weight: 600;
|
|
8
7
|
white-space: nowrap;
|
|
9
8
|
border-radius: 20px;
|
|
10
9
|
padding: 0 20px;
|
|
11
|
-
line-height: 38px;
|
|
12
|
-
font-size: 14px;
|
|
13
10
|
border-color: transparent;
|
|
14
11
|
color: #3c3c43;
|
|
15
12
|
background-color: #f7f7f8;
|
|
@@ -60,8 +60,7 @@ export const CTABannerHeadingHost = css`
|
|
|
60
60
|
`;
|
|
61
61
|
|
|
62
62
|
export const CTABannerHeadingTitle = css`
|
|
63
|
-
font-
|
|
64
|
-
font-weight: 900;
|
|
63
|
+
font-weight: var(--xyd-font-weight-black);
|
|
65
64
|
text-align: center;
|
|
66
65
|
letter-spacing: 3px;
|
|
67
66
|
margin: 0;
|
|
@@ -69,8 +68,7 @@ export const CTABannerHeadingTitle = css`
|
|
|
69
68
|
|
|
70
69
|
export const CTABannerHeadingSubtitle = css`
|
|
71
70
|
color: #3c3c43;
|
|
72
|
-
font-
|
|
73
|
-
font-weight: 600;
|
|
71
|
+
font-weight: var(--xyd-font-weight-semibold);
|
|
74
72
|
text-align: center;
|
|
75
73
|
`;
|
|
76
74
|
|
|
@@ -1,47 +1,149 @@
|
|
|
1
|
-
import {css} from "@linaria/core";
|
|
1
|
+
import { css } from "@linaria/core";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export const LineNumberHost = css`
|
|
4
|
+
@layer defaults {
|
|
5
|
+
display: flex;
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
[part="line-number"] {
|
|
9
|
+
/* margin: 0 12px 0px 4px; */
|
|
10
|
+
width: 25px;
|
|
11
|
+
left: -15px;
|
|
12
|
+
position: absolute;
|
|
13
|
+
margin: 0;
|
|
14
|
+
text-align: right;
|
|
15
|
+
user-select: none;
|
|
16
|
+
opacity: 0.5;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
8
19
|
`;
|
|
9
20
|
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
export const MarkHost = css`
|
|
22
|
+
@layer defaults {
|
|
23
|
+
display: flex;
|
|
24
|
+
border-left-width: 4px;
|
|
25
|
+
border-color: transparent;
|
|
26
|
+
margin: 4px 0;
|
|
13
27
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
28
|
+
&[data-annotated="true"] {
|
|
29
|
+
border-color: var(--xyd-coder-code-mark-border-color);
|
|
30
|
+
background-color: var(--xyd-coder-code-mark-bgcolor);
|
|
31
|
+
}
|
|
18
32
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
&[data-diff="true"] {
|
|
34
|
+
position: relative;
|
|
35
|
+
|
|
36
|
+
&[data-query="-"] {
|
|
37
|
+
border-color: var(--xyd-text-color--error--active);
|
|
38
|
+
background-color: var(--xyd-text-color--error--muted);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&[data-query="+"] {
|
|
42
|
+
border-color: var(--xyd-text-color--success--active);
|
|
43
|
+
background-color: var(--xyd-text-color--success--muted);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
& > :first-child {
|
|
47
|
+
position: absolute;
|
|
48
|
+
left: 5px;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[part="line"] {
|
|
53
|
+
flex: 1 1 0%;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
xyd-code-linenumber [part="line"]{
|
|
57
|
+
position: relative;
|
|
58
|
+
left: 25px;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
24
61
|
`;
|
|
25
62
|
|
|
63
|
+
export const MarkInlineHost = css`
|
|
64
|
+
@layer defaults {
|
|
65
|
+
display: inline-block;
|
|
66
|
+
|
|
67
|
+
outline: solid 1px var(--xyd-coder-code-mark-border-color);
|
|
68
|
+
background: var(--xyd-coder-code-mark-bgcolor);
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
&[data-diff="true"] {
|
|
72
|
+
&[data-query="-"] {
|
|
73
|
+
border-color: var(--xyd-text-color--error--active);
|
|
74
|
+
background-color: var(--xyd-text-color--error--muted);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&[data-query="+"] {
|
|
78
|
+
border-color: var(--xyd-text-color--success--active);
|
|
79
|
+
background-color: var(--xyd-text-color--success--muted);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`
|
|
84
|
+
|
|
85
|
+
export const BgHost = css`
|
|
86
|
+
@layer defaults {
|
|
87
|
+
&[data-annotated="true"] {
|
|
88
|
+
border-color: var(--xyd-coder-code-mark-border-color);
|
|
89
|
+
background-color: var(--xyd-coder-code-mark-bgcolor);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
`
|
|
93
|
+
|
|
26
94
|
export const CodeHost = css`
|
|
27
|
-
|
|
28
|
-
|
|
95
|
+
@layer defaults {
|
|
96
|
+
max-height: 400px;
|
|
97
|
+
background: var(--xyd-coder-code-background); // cuz can be overwritten by style - better solution in the future?
|
|
98
|
+
|
|
99
|
+
margin: 0;
|
|
100
|
+
padding: 8px 16px;
|
|
29
101
|
|
|
30
|
-
|
|
31
|
-
|
|
102
|
+
border-top: 1px solid var(--xyd-coder-code-border-color);
|
|
103
|
+
|
|
104
|
+
&:not(:has(+ [part="code-description"])) {
|
|
105
|
+
border-bottom-left-radius: 10px;
|
|
106
|
+
border-bottom-right-radius: 10px;
|
|
107
|
+
}
|
|
32
108
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
border-bottom-right-radius: 10px;
|
|
109
|
+
white-space: pre-wrap;
|
|
110
|
+
word-break: break-all;
|
|
36
111
|
|
|
37
|
-
|
|
38
|
-
line-height: 20px;
|
|
39
|
-
white-space: pre-wrap;
|
|
40
|
-
word-break: break-all;
|
|
112
|
+
overflow-y: scroll;
|
|
41
113
|
|
|
42
|
-
|
|
114
|
+
&[data-size="full"] {
|
|
115
|
+
max-height: 100%;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
& > div {
|
|
119
|
+
}
|
|
120
|
+
}
|
|
43
121
|
`;
|
|
44
122
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
123
|
+
|
|
124
|
+
export const CodeDescription = css`
|
|
125
|
+
padding: 17px 20px 10px;
|
|
126
|
+
background-color: var(--white);
|
|
127
|
+
border-radius: 0 0 8px 7px;
|
|
128
|
+
display: flex;
|
|
129
|
+
gap: 12px;
|
|
130
|
+
align-items: flex-start;
|
|
131
|
+
color: var(--text-primary);
|
|
132
|
+
|
|
133
|
+
& > div:first-child {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
padding-top: 5px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
& > div:last-child {
|
|
140
|
+
display: flex;
|
|
141
|
+
flex-direction: column;
|
|
142
|
+
gap: 4px;
|
|
143
|
+
|
|
144
|
+
> span {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
`
|
package/src/coder/Code/Code.tsx
CHANGED
|
@@ -1,76 +1,167 @@
|
|
|
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";
|
|
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
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { Text } from "../../writer/Text"
|
|
7
|
+
import { CodeTheme, type CodeThemeBlockProps } from "../CodeTheme";
|
|
7
8
|
import * as cn from "./Code.styles";
|
|
8
|
-
import {CodeLoader} from "./CodeLoader";
|
|
9
|
+
import { CodeLoader } from "./CodeLoader";
|
|
10
|
+
import { Icon } from "src/writer/Icon";
|
|
9
11
|
|
|
10
12
|
export interface CodeProps {
|
|
11
|
-
codeblocks
|
|
13
|
+
codeblocks?: CodeThemeBlockProps[];
|
|
12
14
|
theme?: Theme
|
|
13
15
|
children: React.ReactNode
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export function Code(props: CodeProps) {
|
|
17
|
-
return <Suspense fallback={<CodeLoader/>}>
|
|
18
|
-
<CodeTheme
|
|
19
|
+
return <Suspense fallback={<CodeLoader />}>
|
|
20
|
+
<CodeTheme
|
|
21
|
+
codeblocks={props.codeblocks}
|
|
22
|
+
theme={props.theme}
|
|
23
|
+
>
|
|
19
24
|
{props.children}
|
|
20
25
|
</CodeTheme>
|
|
21
26
|
</Suspense>
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
// TODO: fix any
|
|
25
|
-
Code.LineNumber = function
|
|
30
|
+
Code.LineNumber = function CodeLineNumber(props: any) {
|
|
26
31
|
if (!props.children || !props.children.length) {
|
|
27
32
|
return null
|
|
28
33
|
}
|
|
29
34
|
return (
|
|
30
|
-
|
|
31
|
-
<span
|
|
32
|
-
style={{minWidth: `${props.width}ch`}}
|
|
35
|
+
<xyd-code-linenumber
|
|
33
36
|
className={cn.LineNumberHost}
|
|
37
|
+
style={{ minWidth: `${props.width}ch` }}
|
|
34
38
|
>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
<span part="line-number">
|
|
40
|
+
{props.lineNumber}
|
|
41
|
+
</span>
|
|
42
|
+
<InnerLine merge={props} />
|
|
43
|
+
</xyd-code-linenumber>
|
|
39
44
|
)
|
|
40
45
|
}
|
|
41
46
|
|
|
42
47
|
// TODO: fix any
|
|
43
|
-
Code.Mark = function
|
|
44
|
-
return <
|
|
48
|
+
Code.Mark = function CodeMark(props: any) {
|
|
49
|
+
return <xyd-code-mark
|
|
50
|
+
data-diff={props.annotation?.diff ? "true" : undefined}
|
|
51
|
+
data-query={props.annotation?.diff && props.annotation?.query ? props.annotation?.query : undefined}
|
|
52
|
+
data-annotated={String(!!props.annotation)}
|
|
53
|
+
className={`${cn.MarkHost}`}
|
|
54
|
+
>
|
|
45
55
|
<InnerLine
|
|
56
|
+
part="line"
|
|
46
57
|
merge={props}
|
|
47
|
-
className={cn.MarkLine}
|
|
48
58
|
/>
|
|
49
|
-
</
|
|
59
|
+
</xyd-code-mark>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
Code.MarkInline = function CodeMarkInline(props: any) {
|
|
63
|
+
return (
|
|
64
|
+
<xyd-code-mark-inline
|
|
65
|
+
data-diff={props.annotation?.diff ? "true" : undefined}
|
|
66
|
+
data-query={props.annotation?.diff && props.annotation?.query ? props.annotation?.query : undefined}
|
|
67
|
+
className={cn.MarkInlineHost}
|
|
68
|
+
>
|
|
69
|
+
{props.children}
|
|
70
|
+
</xyd-code-mark-inline>
|
|
71
|
+
)
|
|
50
72
|
}
|
|
51
73
|
|
|
52
74
|
// TODO: fix any
|
|
53
75
|
Code.Bg = function CodeLine(props: any) {
|
|
54
|
-
return <
|
|
76
|
+
return <xyd-code-bg
|
|
77
|
+
data-annotated={String(!!props.annotation)}
|
|
78
|
+
className={`${cn.BgHost}`}
|
|
79
|
+
>
|
|
55
80
|
{props.children}
|
|
56
|
-
</
|
|
81
|
+
</xyd-code-bg>
|
|
57
82
|
}
|
|
58
83
|
|
|
59
84
|
Code.Pre = function CodePre(props: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
85
|
+
codeblock: HighlightedCode,
|
|
86
|
+
size?: "full",
|
|
87
|
+
handlers: AnnotationHandler[],
|
|
88
|
+
className?: string,
|
|
89
|
+
descriptionHead?: string | React.ReactNode,
|
|
90
|
+
descriptionContent?: string | React.ReactNode,
|
|
91
|
+
descriptionIcon?: string
|
|
92
|
+
}
|
|
65
93
|
) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
94
|
+
const {
|
|
95
|
+
size,
|
|
96
|
+
className,
|
|
97
|
+
codeblock,
|
|
98
|
+
handlers,
|
|
99
|
+
} = props;
|
|
100
|
+
|
|
101
|
+
fixLastToken(codeblock)
|
|
102
|
+
|
|
103
|
+
let description: React.ReactNode | null = null
|
|
104
|
+
|
|
105
|
+
if (props.descriptionHead || props.descriptionContent) {
|
|
106
|
+
description = <div part="code-description" className={cn.CodeDescription}>
|
|
107
|
+
<div>
|
|
108
|
+
{props.descriptionIcon ? <Icon name={props.descriptionIcon} size={16} /> : <_DefaultDescriptionIcon />}
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div>
|
|
112
|
+
<Text weight="bold">
|
|
113
|
+
{props.descriptionHead}
|
|
114
|
+
</Text>
|
|
115
|
+
<span>
|
|
116
|
+
{props.descriptionContent}
|
|
117
|
+
</span>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
}
|
|
122
|
+
return <xyd-code-pre>
|
|
123
|
+
<Pre
|
|
124
|
+
part="pre"
|
|
125
|
+
data-size={size}
|
|
126
|
+
style={codeblock?.style || codeblock?.style}
|
|
127
|
+
className={`${cn.CodeHost} ${className || ""}`}
|
|
128
|
+
code={codeblock}
|
|
129
|
+
handlers={handlers}
|
|
130
|
+
/>
|
|
131
|
+
|
|
132
|
+
{description}
|
|
133
|
+
</xyd-code-pre>
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* FOR SOME REASONS FOR SINGLE CODE BLOCKS LAST TOKEN IS EMPTY STRING
|
|
138
|
+
*
|
|
139
|
+
* @todo: fix this
|
|
140
|
+
*/
|
|
141
|
+
function fixLastToken(codeblock: HighlightedCode) {
|
|
142
|
+
const lastToken = codeblock.tokens[codeblock.tokens.length - 1]
|
|
143
|
+
if (typeof lastToken === 'string' && (lastToken === ' ' || lastToken === '\n')) {
|
|
144
|
+
codeblock.tokens.pop()
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function _DefaultDescriptionIcon() {
|
|
149
|
+
return <svg
|
|
150
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
151
|
+
viewBox="0 0 24 24"
|
|
152
|
+
strokeWidth={3}
|
|
153
|
+
stroke="currentColor"
|
|
154
|
+
fill="none"
|
|
155
|
+
width={16}
|
|
156
|
+
strokeLinecap="round"
|
|
157
|
+
strokeLinejoin="round"
|
|
158
|
+
>
|
|
159
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
160
|
+
<path d="M12 12l8 -4.5" />
|
|
161
|
+
<path d="M12 12v9" />
|
|
162
|
+
<path d="M12 12l-8 -4.5" />
|
|
163
|
+
<path d="M12 12l8 4.5" />
|
|
164
|
+
<path d="M12 3v9" />
|
|
165
|
+
<path d="M12 12l-8 4.5" />
|
|
166
|
+
</svg>
|
|
76
167
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import * as cn from "./Code.styles";
|
|
4
|
-
import {Loader} from "../../
|
|
4
|
+
import {Loader} from "../../kit";
|
|
5
5
|
|
|
6
6
|
export function CodeLoader() {
|
|
7
|
-
return <
|
|
7
|
+
return <xyd-code-loader className={cn.CodeHost}>
|
|
8
8
|
<Loader/>
|
|
9
|
-
</
|
|
9
|
+
</xyd-code-loader>
|
|
10
10
|
}
|
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {AnnotationHandler} from "codehike/code";
|
|
2
|
+
import { AnnotationHandler, BlockAnnotation, InnerLine } from "codehike/code";
|
|
3
3
|
|
|
4
|
-
import {Code} from "./Code";
|
|
4
|
+
import { Code } from "./Code";
|
|
5
5
|
|
|
6
6
|
const markAnnotation: AnnotationHandler = {
|
|
7
7
|
name: "mark",
|
|
8
8
|
Line: (props) => {
|
|
9
|
-
return <Code.Mark {...props}/>
|
|
10
|
-
}
|
|
9
|
+
return <Code.Mark {...props} />
|
|
10
|
+
},
|
|
11
|
+
Inline: (props) => {
|
|
12
|
+
return <Code.MarkInline {...props} />
|
|
13
|
+
},
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
const bgAnnotation: AnnotationHandler = {
|
|
14
17
|
name: "bg",
|
|
15
18
|
Inline: (props) => {
|
|
16
|
-
return <Code.Bg {...props}/>
|
|
19
|
+
return <Code.Bg {...props} />
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
const lineNumberAnnotation: AnnotationHandler = {
|
|
21
24
|
name: "line-numbers",
|
|
22
|
-
Line: ({annotation, ...props}) => {
|
|
23
|
-
return <Code.LineNumber {...props}/>
|
|
25
|
+
Line: ({ annotation, ...props }) => {
|
|
26
|
+
return <Code.LineNumber {...props} />
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const diffAnnotation: AnnotationHandler = {
|
|
31
|
+
name: "diff",
|
|
32
|
+
onlyIfAnnotated: true,
|
|
33
|
+
transform: (annotation: BlockAnnotation) => {
|
|
34
|
+
return [annotation, { ...annotation, name: "mark", query: annotation.query, diff: true }]
|
|
24
35
|
},
|
|
36
|
+
Line: ({ annotation, ...props }) => (
|
|
37
|
+
<>
|
|
38
|
+
<div>
|
|
39
|
+
{annotation?.query}
|
|
40
|
+
</div>
|
|
41
|
+
<InnerLine merge={props} />
|
|
42
|
+
</>
|
|
43
|
+
),
|
|
25
44
|
}
|
|
26
45
|
|
|
27
46
|
export const annotations = {
|
|
28
47
|
mark: markAnnotation,
|
|
29
48
|
bg: bgAnnotation,
|
|
30
|
-
lineNumbers: lineNumberAnnotation
|
|
49
|
+
lineNumbers: lineNumberAnnotation,
|
|
50
|
+
diff: diffAnnotation
|
|
31
51
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
type Lines,
|
|
9
9
|
type Tokens,
|
|
10
|
+
highlight as lighterAsync,
|
|
10
11
|
highlightSync as lighter,
|
|
11
12
|
LANG_NAMES,
|
|
12
13
|
type Theme
|
|
@@ -57,6 +58,43 @@ export function highlight(
|
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
export async function highlightAsync(
|
|
62
|
+
data: RawCode,
|
|
63
|
+
theme: Theme,
|
|
64
|
+
lang: string
|
|
65
|
+
): Promise<HighlightedCode> {
|
|
66
|
+
if (!LANG_NAMES.includes(lang)) {
|
|
67
|
+
console.warn(`Unknown language "${lang}"`);
|
|
68
|
+
lang = 'txt';
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const {
|
|
72
|
+
lines,
|
|
73
|
+
lang: lighterLang,
|
|
74
|
+
style
|
|
75
|
+
} = await lighterAsync(data.value, lang, theme as any, {
|
|
76
|
+
annotations: [],
|
|
77
|
+
scopes: false // true for better token transitions, but breaks css themes
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const tokens = joinLines(lines);
|
|
81
|
+
// split surrounding whitespace for each token
|
|
82
|
+
const splitTokens = splitWhitespace(tokens);
|
|
83
|
+
// join consecutive whitespace tokens
|
|
84
|
+
const joinedTokens = joinWhitespace(splitTokens);
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
...data,
|
|
88
|
+
code: data.value,
|
|
89
|
+
tokens: joinedTokens,
|
|
90
|
+
lang: lighterLang,
|
|
91
|
+
annotations: [], // TODO: in the future
|
|
92
|
+
// annotations: compatAnnotations(annotations),
|
|
93
|
+
themeName: typeof theme === 'string' ? theme : theme?.name || 'unknown',
|
|
94
|
+
style
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
60
98
|
function compatAnnotations(annotations: any[]): CodeAnnotation[] {
|
|
61
99
|
const newAnnotations: CodeAnnotation[] = [];
|
|
62
100
|
for (const a of annotations) {
|