robindoc 3.7.4 → 3.7.6
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/README.md +1 -1
- package/lib/components/blocks/code-section/index.d.ts +3 -2
- package/lib/components/blocks/code-section/index.d.ts.map +1 -1
- package/lib/components/blocks/code-section/index.js +1 -1
- package/lib/components/blocks/code-section/index.js.map +1 -1
- package/lib/components/elements/article/document.d.ts.map +1 -1
- package/lib/components/elements/article/document.js +1 -1
- package/lib/components/elements/article/document.js.map +1 -1
- package/lib/components/elements/article/tags.d.ts +1 -1
- package/lib/components/elements/article/tags.js +1 -1
- package/lib/components/elements/article/tags.js.map +1 -1
- package/lib/components/elements/article/utils.d.ts.map +1 -1
- package/lib/components/elements/article/utils.js +1 -1
- package/lib/components/elements/article/utils.js.map +1 -1
- package/lib/components/ui/code-block/{index.d.ts → index.client.d.ts} +1 -1
- package/lib/components/ui/code-block/index.client.d.ts.map +1 -0
- package/lib/components/ui/code-block/index.client.js +3 -0
- package/lib/components/ui/code-block/index.client.js.map +1 -0
- package/lib/components/ui/code-block/index.isomorphic.d.ts +11 -0
- package/lib/components/ui/code-block/index.isomorphic.d.ts.map +1 -0
- package/lib/components/ui/code-block/index.isomorphic.js +2 -0
- package/lib/components/ui/code-block/index.isomorphic.js.map +1 -0
- package/lib/components/ui/code-block/index.server.d.ts +11 -0
- package/lib/components/ui/code-block/index.server.d.ts.map +1 -0
- package/lib/components/ui/code-block/index.server.js +2 -0
- package/lib/components/ui/code-block/index.server.js.map +1 -0
- package/lib/components/ui/code-block/shared.d.ts +3 -0
- package/lib/components/ui/code-block/shared.d.ts.map +1 -0
- package/lib/components/ui/code-block/shared.js +2 -0
- package/lib/components/ui/code-block/shared.js.map +1 -0
- package/lib/components/ui/code-span/index.d.ts +1 -4
- package/lib/components/ui/code-span/index.d.ts.map +1 -1
- package/lib/components/ui/code-span/index.js +1 -1
- package/lib/components/ui/code-span/index.js.map +1 -1
- package/lib/components/ui/tabs/index.d.ts.map +1 -1
- package/lib/components/ui/tabs/index.js.map +1 -1
- package/lib/styles.css +787 -787
- package/package.json +11 -10
- package/lib/components/ui/code-block/index.d.ts.map +0 -1
- package/lib/components/ui/code-block/index.js +0 -2
- package/lib/components/ui/code-block/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Read the documentation in a convenient interface at [robindoc.com/docs](https://
|
|
|
11
11
|
|
|
12
12
|
<!---robin PackageLinks /-->
|
|
13
13
|
|
|
14
|
-
Robindoc is a framework for automatically creating documentation websites based on markdown files, built on React
|
|
14
|
+
Robindoc is a framework for automatically creating documentation websites based on markdown files, built on React Server Components.
|
|
15
15
|
|
|
16
16
|
```tsx filename="app/docs/page.tsx" switcher tab="TypeScript" clone="jsx|JavaScript|app/docs/page.jsx"
|
|
17
17
|
const DocumentationPage = () => (
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type CodeBlockProps } from "../../ui/code-block";
|
|
2
|
+
import { type CodeBlockProps } from "../../ui/code-block/index.server";
|
|
3
3
|
import { type CopyButtonProps } from "../../ui/copy-button";
|
|
4
4
|
import { type CopyTextProps } from "../../ui/copy-text";
|
|
5
5
|
import "./code-section.scss";
|
|
6
|
-
export interface CodeSectionProps extends CodeBlockProps {
|
|
6
|
+
export interface CodeSectionProps extends Pick<CodeBlockProps, "code"> {
|
|
7
7
|
filename?: string;
|
|
8
8
|
translations?: CopyButtonProps["translations"] & CopyTextProps["translations"];
|
|
9
|
+
children?: React.ReactNode;
|
|
9
10
|
}
|
|
10
11
|
export declare const CodeSection: React.FC<CodeSectionProps>;
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/blocks/code-section/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/blocks/code-section/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,cAAc,EAAE,yCAAmD;AACjF,OAAO,EAAc,KAAK,eAAe,EAAE,6BAAuC;AAClF,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,qBAAqB,CAAC;AAE7B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,eAAe,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;IAC/E,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAYlD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import
|
|
1
|
+
import e from"react";import{CopyButton as t}from"../../ui/copy-button/index.js";import{CopyText as c}from"../../ui/copy-text/index.js";const o=({filename:o,code:r,children:a})=>e.createElement("div",{className:"r-code-section"},o?e.createElement("div",{className:"r-code-section-header"},e.createElement(c,{className:"r-code-section-filename",text:o}),e.createElement(t,{raw:r})):e.createElement(t,{raw:r,className:"r-code-section-copy"}),a);export{o as CodeSection};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/blocks/code-section/index.tsx"],"sourcesContent":["import React from \"react\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/blocks/code-section/index.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { type CodeBlockProps } from \"@src/components/ui/code-block/index.server\";\nimport { CopyButton, type CopyButtonProps } from \"@src/components/ui/copy-button\";\nimport { CopyText, type CopyTextProps } from \"../../ui/copy-text\";\n\nimport \"./code-section.scss\";\n\nexport interface CodeSectionProps extends Pick<CodeBlockProps, \"code\"> {\n filename?: string;\n translations?: CopyButtonProps[\"translations\"] & CopyTextProps[\"translations\"];\n children?: React.ReactNode;\n}\n\nexport const CodeSection: React.FC<CodeSectionProps> = ({ filename, code, children }) => (\n <div className=\"r-code-section\">\n {filename ? (\n <div className=\"r-code-section-header\">\n <CopyText className=\"r-code-section-filename\" text={filename} />\n <CopyButton raw={code} />\n </div>\n ) : (\n <CopyButton raw={code} className=\"r-code-section-copy\" />\n )}\n {children}\n </div>\n);\n"],"names":["CodeSection","filename","code","children","React","createElement","className","CopyText","text","CopyButton","raw"],"mappings":"uIAcO,MAAMA,EAA0C,EAAGC,WAAUC,OAAMC,cACtEC,EAAAC,cAAA,MAAA,CAAKC,UAAU,kBACVL,EACGG,EAAAC,cAAA,MAAA,CAAKC,UAAU,yBACXF,EAAAC,cAACE,GAASD,UAAU,0BAA0BE,KAAMP,IACpDG,EAAAC,cAACI,GAAWC,IAAKR,KAGrBE,EAAAC,cAACI,EAAU,CAACC,IAAKR,EAAMI,UAAU,wBAEpCH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../../src/components/elements/article/document.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAElE,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../../src/components/elements/article/document.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,QAAQ,CAAC;AAElE,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,OAAO,EAAE,KAAK,YAAY,EAAE,qCAAiC;AAC7D,OAAO,EAAE,KAAK,UAAU,EAAmB,oCAAgC;AAE3E,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAOH,KAAK,UAAU,EAClB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAgEtC,MAAM,MAAM,aAAa,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,CAAC,EAAE;QACL,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC;IACF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACrC,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC,OAAO,YAAY,CAAC,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAsV5C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import t,{Text as n,domToReact as r,attributesToProps as a}from"html-react-parser";import{
|
|
1
|
+
import e from"react";import t,{Text as n,domToReact as r,attributesToProps as a}from"html-react-parser";import o from"clsx";import{parseCodeLang as s,validateComponentName as c,formatId as l,parseBlockqoute as i,formatLinkHref as m,parseMarkdown as u}from"./utils.js";import{DEFAULT_TAGS as k}from"./tags.js";const p=({raw:o,components:s,tags:l,...i})=>{const k={replace(t){if(t instanceof n&&t.data){const{headings:n,tokens:r}=u(t.data);return e.createElement(d,{headings:n,tokens:r,components:s,tags:l,subtree:!0,...i})}if(!("name"in t))return e.createElement(e.Fragment,null);if("a"===t.name&&"attribs"in t){const{href:n,external:o}=m(t.attribs.href,i.pathname,i.pages);return""===n?r(t.children,k):e.createElement(l.ContentLink,{...a(t.attribs),href:n,external:o},r(t.children,k))}if(!c(t.name))return t;if(!s||!(t.name in s))return console.warn(`Unknown component: "${t.name}"`),e.createElement(e.Fragment,null);const o="attribs"in t?a(t.attribs):{},p=s[t.name],h="children"in t?t.children:null;return e.createElement(p,{...o},h?r(h,k):null)},htmlparser2:{lowerCaseTags:!1,lowerCaseAttributeNames:!1}};return t(o,k)},d=({pathname:t,components:n,tags:r={},uri:a,targetProvider:u,tokens:d,headings:h,config:E={},subtree:g,pages:y})=>{const{publicDirs:f}=E,w={...k,...r};let b=null;const x=new Set,T=({token:r})=>{if(!r)return null;if(b){if(Array.isArray(r)||"html"!==r.type||"\x3c!---/robin--\x3e"!==r.raw.trim())return"dummy"===b.type||(Array.isArray(r)?b.childTokens.push(...r):b.childTokens.push(r)),null;{if("dummy"===b.type)return b=null,null;const{componentName:t,childTokens:r,props:a}=b,o=n[t];return b=null,e.createElement(o,{...a},e.createElement(T,{token:r}))}}if(Array.isArray(r))return r.reduce((t,n,r)=>{if("code"===n.type&&s(n.lang).configuration.switcher)return t.codeQueue.push(n),t;if(t.codeQueue.length>0&&"space"!==n.type){const n=t.codeQueue.map(e=>e.raw).join("");t.list.push(e.createElement(T,{token:{type:"code-group",tabs:t.codeQueue,raw:n},key:n+r})),t.codeQueue=[]}return t.list.push(e.createElement(T,{token:n,key:n.raw+r})),t},{list:[],codeQueue:[]}).list;switch(r.type){case"heading":const k=`h${r.depth}`,d=h.find(e=>e.token===r);return d?.id?e.createElement(w.AnchorHeading,{component:k,id:d.id},r.tokens?e.createElement(T,{token:r.tokens}):r.raw):e.createElement(w.Heading,{component:k,id:1===r.depth?"main-content":void 0},r.tokens?e.createElement(T,{token:r.tokens}):r.raw);case"table":return e.createElement(w.Block,null,e.createElement(w.Table,null,e.createElement(w.Thead,null,e.createElement(w.Tr,null,r.header.map((t,n)=>e.createElement(w.Th,{key:t.text+n,align:t.align},t.tokens?e.createElement(T,{token:t.tokens}):t.text)))),e.createElement(w.Tbody,null,r.rows.map((t,n)=>e.createElement(w.Tr,{key:n},t.map((t,n)=>e.createElement(w.Td,{key:t.text+n,align:t.align},t.tokens?e.createElement(T,{token:t.tokens}):t.text)))))));case"link":const{href:$,external:C}=m(r.href,t,y);return""===$?r.tokens?e.createElement(T,{token:r.tokens}):r.raw:e.createElement(w.ContentLink,{href:$,external:C},r.tokens?e.createElement(T,{token:r.tokens}):r.raw);case"hr":return e.createElement(w.Hr,null);case"image":return e.createElement(w.Img,{src:r.href,publicDirs:f,provider:u,uri:a,alt:r.title||""});case"paragraph":return g?r.tokens?e.createElement(T,{token:r.tokens}):r.raw:r.tokens?.some(e=>"html"===e.type)&&r.tokens?.every(e=>"html"===e.type||"text"===e.type||"\n"===e.raw)?e.createElement(T,{token:{...r,type:"html"}}):e.createElement(w.Paragraph,null,r.tokens?e.createElement(T,{token:r.tokens}):r.raw);case"strong":return e.createElement(w.Strong,null,r.tokens?e.createElement(T,{token:r.tokens}):r.raw);case"del":return e.createElement(w.Del,null,r.tokens?e.createElement(T,{token:r.tokens}):r.raw);case"em":return e.createElement(w.Em,null,r.tokens?e.createElement(T,{token:r.tokens}):r.raw);case"blockquote":const{token:A,type:L}=i(r);return e.createElement(w.Blockquote,{type:L},A.tokens?e.createElement(T,{token:A.tokens}):A.raw);case"codespan":const S=r.raw.replace(/^`|`$/g,""),v=S.match(/(.+){:([a-zA-Z]+)}$/);if(v){const[,t,n]=v;return e.createElement(w.CodeBlock,{code:t,lang:n,inline:!0})}return e.createElement(w.CodeSpan,null,S);case"code-group":const N=r.tabs.reduce((t,n)=>{const{lang:r,configuration:a}=s(n.lang||""),o="string"==typeof a.tab?l(a.tab):r;if(t[o]={tabName:(a.tab||r).toString(),element:e.createElement(T,{token:n,key:n.raw})},"string"==typeof a.clone){a.clone.split(",").forEach(o=>{const[s,c,i]=o.split("|"),m="string"==typeof c?l(c):s;t[m]={tabName:(a.tab||r).toString(),element:e.createElement(T,{token:{...n,lang:`${s} switcher tab="${m}" filename="${i}"`},key:n.raw})}})}return t},[]),Q=Object.keys(N).sort().join("-");return x.add(Q),e.createElement(w.Tabs,{type:"code",tabsData:N,insertStyles:!x.has(Q)||"useState"in e,blockKey:Q});case"code":const{lang:U,configuration:j}=s(r.lang);return e.createElement(w.CodeSection,{code:r.text,...j},e.createElement(w.CodeBlock,{className:o("r-code-section-block",!j.filename&&"_space-right"),code:r.text,lang:U}));case"escape":return r.text;case"list":if(r.items.every(e=>e.task)){const t=r.ordered?w.TaskOrderedList:w.TaskUnorderedList;return e.createElement(t,{start:r.start},r.items.map((t,n)=>e.createElement(w.TaskListItem,{key:t.raw+n,defaultChecked:t.checked},t.tokens?e.createElement(T,{token:t.tokens}):t.raw)))}const B=r.ordered?w.OrderedList:w.UnorderedList;return e.createElement(B,{start:r.start},r.items.map((t,n)=>e.createElement(w.ListItem,{key:t.raw+n},t.tokens?e.createElement(T,{token:t.tokens}):t.raw)));case"html":const D=r.raw.trim();if(D.startsWith("\x3c!---robin")&&D.endsWith("--\x3e")){const t=D.endsWith("/--\x3e"),r=D.match(/<!---robin ([\w]+)/)?.[1];if(!r)return t||(b={type:"dummy"}),null;if(!c(r))return console.warn(`"${r}" is using incorrect casing. Use PascalCase for Robin components`),t||(b={type:"dummy"}),null;if(!n||!(r in n))return console.warn(`Unknown component: "${r}"`),t||(b={type:"dummy"}),null;const a=D.split(/\r?\n/).slice(1,-1).reduce((e,t)=>{const[n,r,a]=t.match(/^([\w]+)(?:="(.+)")?$/)||[];return n?(e[r]=a??!0,e):(console.warn(`Invalid component attribute: "${t}"`),e)},{});if(t){const t=n[r];return e.createElement(t,{...a})}return b={props:a,componentName:r,childTokens:[],type:"base"},null}return e.createElement(p,{raw:r.raw,components:n,config:E,targetProvider:u,pathname:t,uri:a,pages:y,tags:w});case"text":return"tokens"in r?e.createElement(T,{token:r.tokens||[]}):r.raw;case"space":case"def":case"br":case"checkbox":return null;default:return!r.type&&"raw"in r?r.raw:(console.warn(`Unknown token ${r.type}`,r),null)}};return e.createElement(T,{token:[...d,{type:"text",raw:""}]})};export{d as Document};
|
|
2
2
|
//# sourceMappingURL=document.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sources":["../../../../src/components/elements/article/document.tsx"],"sourcesContent":["import { type Token, type Tokens, type TokensList } from \"marked\";\nimport { type BundledLanguage } from \"shiki\";\nimport React from \"react\";\nimport parse, { attributesToProps, DOMNode, domToReact, HTMLReactParserOptions, Text } from \"html-react-parser\";\n\nimport { type BaseProvider } from \"@src/core/providers/base\";\nimport { type Components, type RobinProps } from \"@src/core/types/content\";\n\nimport { type PagesType } from \"./types\";\nimport {\n formatId,\n formatLinkHref,\n isNewCodeToken,\n parseBlockqoute,\n parseCodeLang,\n parseMarkdown,\n validateComponentName,\n type AnchorData,\n} from \"./utils\";\nimport { DEFAULT_TAGS } from \"./tags\";\n\ninterface DocumentJSXProps extends Omit<DocumentProps, \"tokens\" | \"headings\"> {\n raw: string;\n pages?: PagesType;\n tags: typeof DEFAULT_TAGS;\n}\n\nconst DocumentJSX: React.FC<DocumentJSXProps> = ({ raw, components, tags: Tags, ...baseProps }) => {\n const parseOptions: HTMLReactParserOptions = {\n replace(domNode) {\n if (domNode instanceof Text && domNode.data) {\n const { headings, tokens } = parseMarkdown(domNode.data);\n\n return (\n <Document\n headings={headings}\n tokens={tokens}\n components={components}\n tags={Tags}\n subtree\n {...baseProps}\n />\n );\n }\n\n if (!(\"name\" in domNode)) return <></>;\n\n if (domNode.name === \"a\" && \"attribs\" in domNode) {\n const { href, external } = formatLinkHref(domNode.attribs.href, baseProps.pathname, baseProps.pages);\n\n if (href === \"\") return domToReact(domNode.children as DOMNode[], parseOptions);\n\n return (\n <Tags.ContentLink {...attributesToProps(domNode.attribs)} href={href} external={external}>\n {domToReact(domNode.children as DOMNode[], parseOptions)}\n </Tags.ContentLink>\n );\n }\n\n if (!validateComponentName(domNode.name)) return domNode;\n\n if (!components || !(domNode.name in components)) {\n console.warn(`Unknown component: \"${domNode.name}\"`);\n return <></>;\n }\n\n const props = \"attribs\" in domNode ? attributesToProps(domNode.attribs) : {};\n const Component = components[domNode.name];\n const children = \"children\" in domNode ? domNode.children : null;\n\n return (\n <Component {...props}>{children ? domToReact(children as DOMNode[], parseOptions) : null}</Component>\n );\n },\n htmlparser2: {\n lowerCaseTags: false,\n lowerCaseAttributeNames: false,\n },\n };\n return parse(raw, parseOptions);\n};\n\nexport type DocumentProps = {\n pathname: string;\n components?: Components;\n config?: {\n publicDirs?: string[];\n };\n uri?: string;\n targetProvider?: BaseProvider | null;\n tokens: TokensList;\n headings: AnchorData[];\n subtree?: boolean;\n pages?: PagesType;\n tags?: Partial<typeof DEFAULT_TAGS>;\n};\n\nexport const Document: React.FC<DocumentProps> = ({\n pathname,\n components,\n tags: userTags = {},\n uri,\n targetProvider,\n tokens,\n headings,\n config = {},\n subtree,\n pages,\n}) => {\n const { publicDirs } = config;\n const Tags = { ...DEFAULT_TAGS, ...userTags };\n\n let robin:\n | null\n | { props: RobinProps; childTokens: Token[]; componentName: string; type: \"base\" }\n | { type: \"dummy\" } = null;\n let codeQueue: { [lang: string]: { element: React.ReactNode; tabName: string } } = {};\n const insertedCodeKeys: string[] = [];\n const DocumentToken: React.FC<{ token: Token | Token[] }> = ({ token }) => {\n if (!token) return null;\n\n if (isNewCodeToken(token, codeQueue)) {\n const tabsData = codeQueue;\n codeQueue = {};\n const tabsKey = Object.keys(tabsData).sort().join(\"-\");\n const isInsertedKey = insertedCodeKeys.includes(tabsKey);\n if (!isInsertedKey) insertedCodeKeys.push(tabsKey);\n\n return (\n <>\n <Tags.Tabs type=\"code\" tabsData={tabsData} insertStyles={!isInsertedKey} blockKey={tabsKey} />\n <DocumentToken token={token} />\n </>\n );\n }\n\n if (robin) {\n if (!Array.isArray(token) && token.type === \"html\" && token.raw.trim() === \"<!---/robin-->\") {\n if (robin.type === \"dummy\") {\n robin = null;\n return null;\n }\n\n const { componentName, childTokens, props } = robin;\n const RobinComponent = components![componentName];\n robin = null;\n return (\n <RobinComponent {...props}>\n <DocumentToken token={childTokens} />\n </RobinComponent>\n );\n } else {\n if (robin.type === \"dummy\") return null;\n\n if (Array.isArray(token)) {\n robin.childTokens.push(...token);\n } else {\n robin.childTokens.push(token);\n }\n return null;\n }\n }\n\n if (Array.isArray(token)) {\n return token.map((t, index) => <DocumentToken token={t} key={(t as Tokens.Text).raw + index} />);\n }\n\n switch (token.type) {\n case \"heading\":\n const Component = `h${token.depth}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n const predefinedData = headings.find((heading) => heading.token === token);\n if (predefinedData?.id) {\n return (\n <Tags.AnchorHeading component={Component} id={predefinedData.id}>\n {token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}\n </Tags.AnchorHeading>\n );\n }\n\n return (\n <Tags.Heading component={Component} id={token.depth === 1 ? \"main-content\" : undefined}>\n {token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}\n </Tags.Heading>\n );\n case \"table\":\n return (\n <Tags.Block>\n <Tags.Table>\n <Tags.Thead>\n <Tags.Tr>\n {token.header.map((t: Tokens.TableCell, index: number) => (\n <Tags.Th key={t.text + index} align={t.align}>\n {t.tokens ? <DocumentToken token={t.tokens} /> : t.text}\n </Tags.Th>\n ))}\n </Tags.Tr>\n </Tags.Thead>\n <Tags.Tbody>\n {token.rows.map((row: Tokens.TableCell[], rowIndex: number) => (\n <Tags.Tr key={rowIndex}>\n {row.map((elem, elemIndex) => (\n <Tags.Td key={elem.text + elemIndex} align={elem.align}>\n {elem.tokens ? <DocumentToken token={elem.tokens} /> : elem.text}\n </Tags.Td>\n ))}\n </Tags.Tr>\n ))}\n </Tags.Tbody>\n </Tags.Table>\n </Tags.Block>\n );\n case \"link\":\n const { href, external } = formatLinkHref(token.href, pathname, pages);\n\n if (href === \"\") return token.tokens ? <DocumentToken token={token.tokens} /> : token.raw;\n\n return (\n <Tags.ContentLink href={href} external={external}>\n {token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}\n </Tags.ContentLink>\n );\n case \"hr\":\n return <Tags.Hr />;\n case \"image\":\n return (\n <Tags.Img\n src={token.href}\n publicDirs={publicDirs}\n provider={targetProvider}\n uri={uri}\n alt={token.title || \"\"}\n />\n );\n case \"paragraph\":\n if (subtree) return token.tokens ? <DocumentToken token={token.tokens} /> : token.raw;\n if (\n token.tokens?.some((t) => t.type === \"html\") &&\n token.tokens?.every((t) => t.type === \"html\" || t.type === \"text\" || t.raw === \"\\n\")\n ) {\n return <DocumentToken token={{ ...token, type: \"html\" }} />;\n }\n\n return (\n <Tags.Paragraph>{token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}</Tags.Paragraph>\n );\n case \"strong\":\n return <Tags.Strong>{token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}</Tags.Strong>;\n case \"del\":\n return <Tags.Del>{token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}</Tags.Del>;\n case \"em\":\n return <Tags.Em>{token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}</Tags.Em>;\n case \"blockquote\":\n const { token: blockquoteToken, type } = parseBlockqoute(token);\n\n return (\n <Tags.Blockquote type={type}>\n {blockquoteToken.tokens ? (\n <DocumentToken token={blockquoteToken.tokens} />\n ) : (\n blockquoteToken.raw\n )}\n </Tags.Blockquote>\n );\n case \"codespan\":\n const inlineCode = token.raw.replace(/^`|`$/g, \"\");\n const hightlightMatch = inlineCode.match(/(.+){:([a-zA-Z]+)}$/);\n if (hightlightMatch) {\n const [, raw, lang] = hightlightMatch;\n return <Tags.CodeBlock code={raw} lang={lang as BundledLanguage} inline />;\n }\n\n return <Tags.CodeSpan code={inlineCode} />;\n case \"code\":\n const { lang, configuration } = parseCodeLang(token.lang);\n if (configuration.switcher && lang) {\n const tabKey = typeof configuration.tab === \"string\" ? formatId(configuration.tab) : lang;\n codeQueue[tabKey] = {\n tabName: (configuration.tab || lang).toString(),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n element: <Tags.CodeSection lang={lang as any} code={token.text} {...configuration} />,\n };\n\n if (typeof configuration.clone === \"string\") {\n const copies = configuration.clone.split(\",\");\n\n copies.forEach((copy) => {\n const [copyLang, copyTab, copyFileName] = copy.split(\"|\");\n const copyTabKey = typeof copyTab === \"string\" ? formatId(copyTab) : copyLang;\n\n codeQueue[copyTabKey] = {\n tabName: (copyTab || copyLang).toString(),\n element: (\n <Tags.CodeSection\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n lang={copyLang as any}\n code={token.text}\n {...configuration}\n filename={copyFileName || (configuration.filename as string)}\n />\n ),\n };\n });\n }\n return null;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return <Tags.CodeSection lang={lang as any} code={token.text} {...configuration} />;\n case \"escape\":\n return token.text;\n case \"list\":\n const isTaskList = token.items.every((i: Tokens.ListItem) => i.task);\n if (isTaskList) {\n const ListComponent = token.ordered ? Tags.TaskOrderedList : Tags.TaskUnorderedList;\n return (\n <ListComponent start={token.start}>\n {token.items.map((elem: Tokens.ListItem, index: number) => (\n <Tags.TaskListItem key={elem.raw + index} defaultChecked={elem.checked}>\n {elem.tokens ? <DocumentToken token={elem.tokens} /> : elem.raw}\n </Tags.TaskListItem>\n ))}\n </ListComponent>\n );\n }\n\n const ListComponent = token.ordered ? Tags.OrderedList : Tags.UnorderedList;\n return (\n <ListComponent start={token.start}>\n {token.items.map((elem: Tokens.ListItem, index: number) => (\n <Tags.ListItem key={elem.raw + index}>\n {elem.tokens ? <DocumentToken token={elem.tokens} /> : elem.raw}\n </Tags.ListItem>\n ))}\n </ListComponent>\n );\n case \"html\":\n const text = token.raw.trim();\n\n if (text.startsWith(\"<!---robin\") && text.endsWith(\"-->\")) {\n const selfClosed = text.endsWith(\"/-->\");\n const componentName = text.match(/<!---robin ([\\w]+)/)?.[1];\n\n if (!componentName) {\n if (!selfClosed) robin = { type: \"dummy\" };\n return null;\n }\n\n if (!validateComponentName(componentName)) {\n console.warn(\n `\"${componentName}\" is using incorrect casing. Use PascalCase for Robin components`,\n );\n if (!selfClosed) robin = { type: \"dummy\" };\n return null;\n }\n\n if (!components || !(componentName in components)) {\n console.warn(`Unknown component: \"${componentName}\"`);\n if (!selfClosed) robin = { type: \"dummy\" };\n return null;\n }\n const propRows = text.split(/\\r?\\n/).slice(1, -1);\n const props = propRows.reduce<{ [key: string]: string | true }>((acc, cur) => {\n const [_match, key, value] = cur.match(/^([\\w]+)(?:=\"(.+)\")?$/) || [];\n\n if (!_match) {\n console.warn(`Invalid component attribute: \"${cur}\"`);\n return acc;\n }\n\n acc[key] = value ?? true;\n return acc;\n }, {});\n\n if (selfClosed) {\n const Component = components[componentName as keyof typeof components];\n return <Component {...props} />;\n }\n\n robin = { props, componentName, childTokens: [], type: \"base\" };\n return null;\n }\n\n return (\n <DocumentJSX\n raw={token.raw}\n components={components}\n config={config}\n targetProvider={targetProvider}\n pathname={pathname}\n uri={uri}\n pages={pages}\n tags={Tags}\n />\n );\n case \"text\":\n if (\"tokens\" in token) {\n return <DocumentToken token={token.tokens || []} />;\n }\n return token.raw;\n case \"space\":\n return null;\n // Definitions should not be rendered, they are used only as comments or meta data\n case \"def\":\n return null;\n // br are inserted between elements. In our case, sufficient indentation is set everywhere, so we ignore them\n case \"br\":\n return null;\n // checkbox are rendered as part of the task list item, so we ignore them\n case \"checkbox\":\n return null;\n default:\n if (!token.type && \"raw\" in token) return token.raw;\n\n console.warn(`Unknown token ${token.type}`, token);\n return null;\n }\n };\n\n tokens.push({ type: \"text\", raw: \"\" });\n return <DocumentToken token={tokens} />;\n};\n"],"names":["DocumentJSX","raw","components","tags","Tags","baseProps","parseOptions","replace","domNode","Text","data","headings","tokens","parseMarkdown","React","createElement","Document","subtree","name","href","external","formatLinkHref","attribs","pathname","pages","domToReact","children","ContentLink","attributesToProps","validateComponentName","console","warn","props","Component","htmlparser2","lowerCaseTags","lowerCaseAttributeNames","parse","userTags","uri","targetProvider","config","publicDirs","DEFAULT_TAGS","robin","codeQueue","insertedCodeKeys","DocumentToken","token","isNewCodeToken","tabsData","tabsKey","Object","keys","sort","join","isInsertedKey","includes","push","Fragment","Tabs","type","insertStyles","blockKey","Array","isArray","trim","childTokens","componentName","RobinComponent","map","t","index","key","depth","predefinedData","find","heading","id","AnchorHeading","component","Heading","undefined","Block","Table","Thead","Tr","header","Th","text","align","Tbody","rows","row","rowIndex","elem","elemIndex","Td","Hr","Img","src","provider","alt","title","some","every","Paragraph","Strong","Del","Em","blockquoteToken","parseBlockqoute","Blockquote","inlineCode","hightlightMatch","match","lang","CodeBlock","code","inline","CodeSpan","configuration","parseCodeLang","switcher","tabKey","tab","formatId","tabName","toString","element","CodeSection","clone","split","forEach","copy","copyLang","copyTab","copyFileName","copyTabKey","filename","items","i","task","ListComponent","ordered","TaskOrderedList","TaskUnorderedList","start","TaskListItem","defaultChecked","checked","OrderedList","UnorderedList","ListItem","startsWith","endsWith","selfClosed","slice","reduce","acc","cur","_match","value"],"mappings":"qTA2BA,MAAMA,EAA0C,EAAGC,MAAKC,aAAYC,KAAMC,KAASC,MAC/E,MAAMC,EAAuC,CACzC,OAAAC,CAAQC,GACJ,GAAIA,aAAmBC,GAAQD,EAAQE,KAAM,CACzC,MAAMC,SAAEA,EAAQC,OAAEA,GAAWC,EAAcL,EAAQE,MAEnD,OACII,EAAAC,cAACC,EAAQ,CACLL,SAAUA,EACVC,OAAQA,EACRV,WAAYA,EACZC,KAAMC,EACNa,SAAO,KACHZ,GAGhB,CAEA,KAAM,SAAUG,GAAU,OAAOM,iCAEjC,GAAqB,MAAjBN,EAAQU,MAAgB,YAAaV,EAAS,CAC9C,MAAMW,KAAEA,EAAIC,SAAEA,GAAaC,EAAeb,EAAQc,QAAQH,KAAMd,EAAUkB,SAAUlB,EAAUmB,OAE9F,MAAa,KAATL,EAAoBM,EAAWjB,EAAQkB,SAAuBpB,GAG9DQ,EAAAC,cAACX,EAAKuB,YAAW,IAAKC,EAAkBpB,EAAQc,SAAUH,KAAMA,EAAMC,SAAUA,GAC3EK,EAAWjB,EAAQkB,SAAuBpB,GAGvD,CAEA,IAAKuB,EAAsBrB,EAAQU,MAAO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IAAK,QAGL,IAAK,MAGL,IAAK,KAGL,IAAK,WACD,OAAO,KACX,QACI,OAAK+C,EAAMa,MAAQ,QAASb,EAAcA,EAAM/C,KAEhD6B,QAAQC,KAAK,iBAAiBiB,EAAMa,OAAQb,GACrC,QAKnB,OADApC,EAAO8C,KAAK,CAAEG,KAAM,OAAQ5D,IAAK,KAC1Ba,gBAACiC,EAAa,CAACC,MAAOpC"}
|
|
1
|
+
{"version":3,"file":"document.js","sources":["../../../../src/components/elements/article/document.tsx"],"sourcesContent":["import { type Token, type Tokens, type TokensList } from \"marked\";\nimport { type BundledLanguage } from \"shiki\";\nimport React from \"react\";\nimport parse, {\n attributesToProps,\n domToReact,\n Text,\n type DOMNode,\n type HTMLReactParserOptions,\n} from \"html-react-parser\";\nimport clsx from \"clsx\";\n\nimport { type BaseProvider } from \"@src/core/providers/base\";\nimport { type Components, type RobinProps } from \"@src/core/types/content\";\n\nimport { type PagesType } from \"./types\";\nimport {\n formatId,\n formatLinkHref,\n parseBlockqoute,\n parseCodeLang,\n parseMarkdown,\n validateComponentName,\n type AnchorData,\n} from \"./utils\";\nimport { DEFAULT_TAGS } from \"./tags\";\nimport { TabsProps } from \"@src/components/ui/tabs\";\n\ninterface DocumentJSXProps extends Omit<DocumentProps, \"tokens\" | \"headings\"> {\n raw: string;\n pages?: PagesType;\n tags: typeof DEFAULT_TAGS;\n}\n\nconst DocumentJSX: React.FC<DocumentJSXProps> = ({ raw, components, tags: Tags, ...baseProps }) => {\n const parseOptions: HTMLReactParserOptions = {\n replace(domNode) {\n if (domNode instanceof Text && domNode.data) {\n const { headings, tokens } = parseMarkdown(domNode.data);\n\n return (\n <Document\n headings={headings}\n tokens={tokens}\n components={components}\n tags={Tags}\n subtree\n {...baseProps}\n />\n );\n }\n\n if (!(\"name\" in domNode)) return <></>;\n\n if (domNode.name === \"a\" && \"attribs\" in domNode) {\n const { href, external } = formatLinkHref(domNode.attribs.href, baseProps.pathname, baseProps.pages);\n\n if (href === \"\") return domToReact(domNode.children as DOMNode[], parseOptions);\n\n return (\n <Tags.ContentLink {...attributesToProps(domNode.attribs)} href={href} external={external}>\n {domToReact(domNode.children as DOMNode[], parseOptions)}\n </Tags.ContentLink>\n );\n }\n\n if (!validateComponentName(domNode.name)) return domNode;\n\n if (!components || !(domNode.name in components)) {\n console.warn(`Unknown component: \"${domNode.name}\"`);\n return <></>;\n }\n\n const props = \"attribs\" in domNode ? attributesToProps(domNode.attribs) : {};\n const Component = components[domNode.name];\n const children = \"children\" in domNode ? domNode.children : null;\n\n return (\n <Component {...props}>{children ? domToReact(children as DOMNode[], parseOptions) : null}</Component>\n );\n },\n htmlparser2: {\n lowerCaseTags: false,\n lowerCaseAttributeNames: false,\n },\n };\n return parse(raw, parseOptions);\n};\n\nexport type DocumentProps = {\n pathname: string;\n components?: Components;\n config?: {\n publicDirs?: string[];\n };\n uri?: string;\n targetProvider?: BaseProvider | null;\n tokens: TokensList;\n headings: AnchorData[];\n subtree?: boolean;\n pages?: PagesType;\n tags?: Partial<typeof DEFAULT_TAGS>;\n};\n\nexport const Document: React.FC<DocumentProps> = ({\n pathname,\n components,\n tags: userTags = {},\n uri,\n targetProvider,\n tokens,\n headings,\n config = {},\n subtree,\n pages,\n}) => {\n const { publicDirs } = config;\n const Tags = { ...DEFAULT_TAGS, ...userTags };\n\n let robin:\n | null\n | { props: RobinProps; childTokens: Token[]; componentName: string; type: \"base\" }\n | { type: \"dummy\" } = null;\n const insertedCodeKeys = new Set();\n const DocumentToken: React.FC<{ token: Token | Token[] }> = ({ token }) => {\n if (!token) return null;\n\n if (robin) {\n if (!Array.isArray(token) && token.type === \"html\" && token.raw.trim() === \"<!---/robin-->\") {\n if (robin.type === \"dummy\") {\n robin = null;\n return null;\n }\n\n const { componentName, childTokens, props } = robin;\n const RobinComponent = components![componentName];\n robin = null;\n return (\n <RobinComponent {...props}>\n <DocumentToken token={childTokens} />\n </RobinComponent>\n );\n } else {\n if (robin.type === \"dummy\") return null;\n\n if (Array.isArray(token)) {\n robin.childTokens.push(...token);\n } else {\n robin.childTokens.push(token);\n }\n return null;\n }\n }\n\n if (Array.isArray(token)) {\n return token.reduce<{ list: React.ReactNode[]; codeQueue: Token[] }>(\n (acc, t, index) => {\n if (t.type === \"code\" && parseCodeLang(t.lang).configuration.switcher) {\n acc.codeQueue.push(t);\n return acc;\n }\n if (acc.codeQueue.length > 0 && t.type !== \"space\") {\n const collectedRaw = acc.codeQueue.map((t) => t.raw).join(\"\");\n acc.list.push(\n <DocumentToken\n token={{ type: \"code-group\", tabs: acc.codeQueue, raw: collectedRaw }}\n key={collectedRaw + index}\n />,\n );\n acc.codeQueue = [];\n }\n acc.list.push(<DocumentToken token={t} key={(t as Tokens.Text).raw + index} />);\n return acc;\n },\n { list: [], codeQueue: [] },\n ).list;\n }\n\n switch (token.type) {\n case \"heading\":\n const Component = `h${token.depth}` as \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n const predefinedData = headings.find((heading) => heading.token === token);\n if (predefinedData?.id) {\n return (\n <Tags.AnchorHeading component={Component} id={predefinedData.id}>\n {token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}\n </Tags.AnchorHeading>\n );\n }\n\n return (\n <Tags.Heading component={Component} id={token.depth === 1 ? \"main-content\" : undefined}>\n {token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}\n </Tags.Heading>\n );\n case \"table\":\n return (\n <Tags.Block>\n <Tags.Table>\n <Tags.Thead>\n <Tags.Tr>\n {token.header.map((t: Tokens.TableCell, index: number) => (\n <Tags.Th key={t.text + index} align={t.align}>\n {t.tokens ? <DocumentToken token={t.tokens} /> : t.text}\n </Tags.Th>\n ))}\n </Tags.Tr>\n </Tags.Thead>\n <Tags.Tbody>\n {token.rows.map((row: Tokens.TableCell[], rowIndex: number) => (\n <Tags.Tr key={rowIndex}>\n {row.map((elem, elemIndex) => (\n <Tags.Td key={elem.text + elemIndex} align={elem.align}>\n {elem.tokens ? <DocumentToken token={elem.tokens} /> : elem.text}\n </Tags.Td>\n ))}\n </Tags.Tr>\n ))}\n </Tags.Tbody>\n </Tags.Table>\n </Tags.Block>\n );\n case \"link\":\n const { href, external } = formatLinkHref(token.href, pathname, pages);\n\n if (href === \"\") return token.tokens ? <DocumentToken token={token.tokens} /> : token.raw;\n\n return (\n <Tags.ContentLink href={href} external={external}>\n {token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}\n </Tags.ContentLink>\n );\n case \"hr\":\n return <Tags.Hr />;\n case \"image\":\n return (\n <Tags.Img\n src={token.href}\n publicDirs={publicDirs}\n provider={targetProvider}\n uri={uri}\n alt={token.title || \"\"}\n />\n );\n case \"paragraph\":\n if (subtree) return token.tokens ? <DocumentToken token={token.tokens} /> : token.raw;\n if (\n token.tokens?.some((t) => t.type === \"html\") &&\n token.tokens?.every((t) => t.type === \"html\" || t.type === \"text\" || t.raw === \"\\n\")\n ) {\n return <DocumentToken token={{ ...token, type: \"html\" }} />;\n }\n\n return (\n <Tags.Paragraph>{token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}</Tags.Paragraph>\n );\n case \"strong\":\n return <Tags.Strong>{token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}</Tags.Strong>;\n case \"del\":\n return <Tags.Del>{token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}</Tags.Del>;\n case \"em\":\n return <Tags.Em>{token.tokens ? <DocumentToken token={token.tokens} /> : token.raw}</Tags.Em>;\n case \"blockquote\":\n const { token: blockquoteToken, type } = parseBlockqoute(token);\n\n return (\n <Tags.Blockquote type={type}>\n {blockquoteToken.tokens ? (\n <DocumentToken token={blockquoteToken.tokens} />\n ) : (\n blockquoteToken.raw\n )}\n </Tags.Blockquote>\n );\n case \"codespan\":\n const inlineCode = token.raw.replace(/^`|`$/g, \"\");\n const hightlightMatch = inlineCode.match(/(.+){:([a-zA-Z]+)}$/);\n if (hightlightMatch) {\n const [, raw, lang] = hightlightMatch;\n return <Tags.CodeBlock code={raw} lang={lang as BundledLanguage} inline />;\n }\n\n return <Tags.CodeSpan>{inlineCode}</Tags.CodeSpan>;\n case \"code-group\":\n const tabsData = token.tabs.reduce((acc: TabsProps[\"tabsData\"], t: Tokens.Code) => {\n const { lang, configuration } = parseCodeLang(t.lang || \"\");\n const tabKey = typeof configuration.tab === \"string\" ? formatId(configuration.tab) : lang;\n acc[tabKey] = {\n tabName: (configuration.tab || lang).toString(),\n element: <DocumentToken token={t} key={t.raw} />,\n };\n if (typeof configuration.clone === \"string\") {\n const copies = configuration.clone.split(\",\");\n\n copies.forEach((copy) => {\n const [copyLang, copyTab, filename] = copy.split(\"|\");\n const copyTabKey = typeof copyTab === \"string\" ? formatId(copyTab) : copyLang;\n acc[copyTabKey] = {\n tabName: (configuration.tab || lang).toString(),\n element: (\n <DocumentToken\n token={{\n ...t,\n lang: `${copyLang} switcher tab=\"${copyTabKey}\" filename=\"${filename}\"`,\n }}\n key={t.raw}\n />\n ),\n };\n });\n }\n return acc;\n }, []);\n const tabsKey = Object.keys(tabsData).sort().join(\"-\");\n insertedCodeKeys.add(tabsKey);\n return (\n <Tags.Tabs\n type=\"code\"\n tabsData={tabsData}\n insertStyles={!insertedCodeKeys.has(tabsKey) || \"useState\" in React}\n blockKey={tabsKey}\n />\n );\n case \"code\":\n const { lang, configuration } = parseCodeLang(token.lang);\n\n return (\n <Tags.CodeSection code={token.text} {...configuration}>\n <Tags.CodeBlock\n className={clsx(\"r-code-section-block\", !configuration.filename && \"_space-right\")}\n code={token.text}\n lang={lang as BundledLanguage}\n />\n </Tags.CodeSection>\n );\n case \"escape\":\n return token.text;\n case \"list\":\n const isTaskList = token.items.every((i: Tokens.ListItem) => i.task);\n if (isTaskList) {\n const ListComponent = token.ordered ? Tags.TaskOrderedList : Tags.TaskUnorderedList;\n return (\n <ListComponent start={token.start}>\n {token.items.map((elem: Tokens.ListItem, index: number) => (\n <Tags.TaskListItem key={elem.raw + index} defaultChecked={elem.checked}>\n {elem.tokens ? <DocumentToken token={elem.tokens} /> : elem.raw}\n </Tags.TaskListItem>\n ))}\n </ListComponent>\n );\n }\n\n const ListComponent = token.ordered ? Tags.OrderedList : Tags.UnorderedList;\n return (\n <ListComponent start={token.start}>\n {token.items.map((elem: Tokens.ListItem, index: number) => (\n <Tags.ListItem key={elem.raw + index}>\n {elem.tokens ? <DocumentToken token={elem.tokens} /> : elem.raw}\n </Tags.ListItem>\n ))}\n </ListComponent>\n );\n case \"html\":\n const text = token.raw.trim();\n\n if (text.startsWith(\"<!---robin\") && text.endsWith(\"-->\")) {\n const selfClosed = text.endsWith(\"/-->\");\n const componentName = text.match(/<!---robin ([\\w]+)/)?.[1];\n\n if (!componentName) {\n if (!selfClosed) robin = { type: \"dummy\" };\n return null;\n }\n\n if (!validateComponentName(componentName)) {\n console.warn(\n `\"${componentName}\" is using incorrect casing. Use PascalCase for Robin components`,\n );\n if (!selfClosed) robin = { type: \"dummy\" };\n return null;\n }\n\n if (!components || !(componentName in components)) {\n console.warn(`Unknown component: \"${componentName}\"`);\n if (!selfClosed) robin = { type: \"dummy\" };\n return null;\n }\n const propRows = text.split(/\\r?\\n/).slice(1, -1);\n const props = propRows.reduce<{ [key: string]: string | true }>((acc, cur) => {\n const [_match, key, value] = cur.match(/^([\\w]+)(?:=\"(.+)\")?$/) || [];\n\n if (!_match) {\n console.warn(`Invalid component attribute: \"${cur}\"`);\n return acc;\n }\n\n acc[key] = value ?? true;\n return acc;\n }, {});\n\n if (selfClosed) {\n const Component = components[componentName as keyof typeof components];\n return <Component {...props} />;\n }\n\n robin = { props, componentName, childTokens: [], type: \"base\" };\n return null;\n }\n\n return (\n <DocumentJSX\n raw={token.raw}\n components={components}\n config={config}\n targetProvider={targetProvider}\n pathname={pathname}\n uri={uri}\n pages={pages}\n tags={Tags}\n />\n );\n case \"text\":\n if (\"tokens\" in token) {\n return <DocumentToken token={token.tokens || []} />;\n }\n return token.raw;\n case \"space\":\n return null;\n // Definitions should not be rendered, they are used only as comments or meta data\n case \"def\":\n return null;\n // br are inserted between elements. In our case, sufficient indentation is set everywhere, so we ignore them\n case \"br\":\n return null;\n // checkbox are rendered as part of the task list item, so we ignore them\n case \"checkbox\":\n return null;\n default:\n if (!token.type && \"raw\" in token) return token.raw;\n\n console.warn(`Unknown token ${token.type}`, token);\n return null;\n }\n };\n\n return <DocumentToken token={[...tokens, { type: \"text\", raw: \"\" }]} />;\n};\n"],"names":["DocumentJSX","raw","components","tags","Tags","baseProps","parseOptions","replace","domNode","Text","data","headings","tokens","parseMarkdown","React","createElement","Document","subtree","name","href","external","formatLinkHref","attribs","pathname","pages","domToReact","children","ContentLink","attributesToProps","validateComponentName","console","warn","props","Component","htmlparser2","lowerCaseTags","lowerCaseAttributeNames","parse","userTags","uri","targetProvider","config","publicDirs","DEFAULT_TAGS","robin","insertedCodeKeys","Set","DocumentToken","token","Array","isArray","type","trim","childTokens","push","componentName","RobinComponent","reduce","acc","t","index","parseCodeLang","lang","configuration","switcher","codeQueue","length","collectedRaw","map","join","list","tabs","key","depth","predefinedData","find","heading","id","AnchorHeading","component","Heading","undefined","Block","Table","Thead","Tr","header","Th","text","align","Tbody","rows","row","rowIndex","elem","elemIndex","Td","Hr","Img","src","provider","alt","title","some","every","Paragraph","Strong","Del","Em","blockquoteToken","parseBlockqoute","Blockquote","inlineCode","hightlightMatch","match","CodeBlock","code","inline","CodeSpan","tabsData","tabKey","tab","formatId","tabName","toString","element","clone","split","forEach","copy","copyLang","copyTab","filename","copyTabKey","tabsKey","Object","keys","sort","add","Tabs","insertStyles","has","blockKey","CodeSection","className","clsx","items","i","task","ListComponent","ordered","TaskOrderedList","TaskUnorderedList","start","TaskListItem","defaultChecked","checked","OrderedList","UnorderedList","ListItem","startsWith","endsWith","selfClosed","slice","cur","_match","value"],"mappings":"qTAkCA,MAAMA,EAA0C,EAAGC,MAAKC,aAAYC,KAAMC,KAASC,MAC/E,MAAMC,EAAuC,CACzC,OAAAC,CAAQC,GACJ,GAAIA,aAAmBC,GAAQD,EAAQE,KAAM,CACzC,MAAMC,SAA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AAMG,OAAQH,GACrC,QAInB,OAAOlC,EAAAC,cAACgC,EAAa,CAACC,MAAO,IAAIpC,EAAQ,CAAEuC,KAAM,OAAQlD,IAAK"}
|
|
@@ -9,7 +9,7 @@ export declare const DEFAULT_TAGS: {
|
|
|
9
9
|
Th: import("react").FC<import("react").PropsWithChildren<import("../../ui/table").ThProps>>;
|
|
10
10
|
Tbody: import("react").FC<import("react").PropsWithChildren<import("../../ui/table").TbodyProps>>;
|
|
11
11
|
Td: import("react").FC<import("react").PropsWithChildren<import("../../ui/table").TdProps>>;
|
|
12
|
-
CodeBlock: import("react").FC<import("../../ui/code-block").CodeBlockProps>;
|
|
12
|
+
CodeBlock: import("react").FC<import("../../ui/code-block/index.server").CodeBlockProps>;
|
|
13
13
|
CodeSpan: import("react").FC<import("../../ui/code-span").CodeSpanProps>;
|
|
14
14
|
Del: import("react").FC<import("react").PropsWithChildren<import("../../ui/del").DelProps>>;
|
|
15
15
|
Em: import("react").FC<import("react").PropsWithChildren<import("../../ui/em").EmProps>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{AnchorHeading as i}from"../../blocks/anchor-heading/index.js";import{CodeSection as o}from"../../blocks/code-section/index.js";import{NavContentLink as r}from"../../blocks/nav-content-link/index.js";import{Block as t}from"../../ui/block/index.js";import{Blockquote as e}from"../../ui/blockquote/index.js";import{CodeBlock as s}from"../../ui/code-block/index.js";import{CodeSpan as m}from"../../ui/code-span/index.js";import{Del as d}from"../../ui/del/index.js";import{Em as n}from"../../ui/em/index.js";import{Heading as a}from"../../ui/heading/index.js";import{Hr as p}from"../../ui/hr/index.js";import{Img as l}from"../../ui/img/index.js";import{ListItem as u}from"../../ui/list/list-item/index.js";import{OrderedList as x}from"../../ui/list/ordered-list/index.js";import{UnorderedList as f}from"../../ui/list/unordered-list/index.js";import{Paragraph as j}from"../../ui/paragraph/index.js";import{Strong as k}from"../../ui/strong/index.js";import{Table as b}from"../../ui/table/table/index.js";import{Tbody as c}from"../../ui/table/tbody/index.js";import{Td as h}from"../../ui/table/td/index.js";import{Th as g}from"../../ui/table/th/index.js";import{Thead as T}from"../../ui/table/thead/index.js";import{Tr as L}from"../../ui/table/tr/index.js";import{Tabs as C}from"../../ui/tabs/index.js";import{TaskListItem as B}from"../../ui/task-list/task-list-item/index.js";import{TaskOrderedList as H}from"../../ui/task-list/task-ordered-list/index.js";import{TaskUnorderedList as I}from"../../ui/task-list/task-unordered-list/index.js";const S={Heading:a,AnchorHeading:i,ContentLink:r,Block:t,Table:b,Thead:T,Tr:L,Th:g,Tbody:c,Td:h,CodeBlock:s,CodeSpan:m,Del:d,Em:n,Hr:p,Img:l,ListItem:u,OrderedList:x,UnorderedList:f,Paragraph:j,Strong:k,TaskListItem:B,TaskOrderedList:H,TaskUnorderedList:I,Tabs:C,CodeSection:o,Blockquote:e};export{S as DEFAULT_TAGS};
|
|
1
|
+
import{AnchorHeading as i}from"../../blocks/anchor-heading/index.js";import{CodeSection as o}from"../../blocks/code-section/index.js";import{NavContentLink as r}from"../../blocks/nav-content-link/index.js";import{Block as t}from"../../ui/block/index.js";import{Blockquote as e}from"../../ui/blockquote/index.js";import{CodeBlock as s}from"../../ui/code-block/index.server.js";import{CodeSpan as m}from"../../ui/code-span/index.js";import{Del as d}from"../../ui/del/index.js";import{Em as n}from"../../ui/em/index.js";import{Heading as a}from"../../ui/heading/index.js";import{Hr as p}from"../../ui/hr/index.js";import{Img as l}from"../../ui/img/index.js";import{ListItem as u}from"../../ui/list/list-item/index.js";import{OrderedList as x}from"../../ui/list/ordered-list/index.js";import{UnorderedList as f}from"../../ui/list/unordered-list/index.js";import{Paragraph as j}from"../../ui/paragraph/index.js";import{Strong as k}from"../../ui/strong/index.js";import{Table as b}from"../../ui/table/table/index.js";import{Tbody as c}from"../../ui/table/tbody/index.js";import{Td as h}from"../../ui/table/td/index.js";import{Th as g}from"../../ui/table/th/index.js";import{Thead as T}from"../../ui/table/thead/index.js";import{Tr as L}from"../../ui/table/tr/index.js";import{Tabs as C}from"../../ui/tabs/index.js";import{TaskListItem as B}from"../../ui/task-list/task-list-item/index.js";import{TaskOrderedList as H}from"../../ui/task-list/task-ordered-list/index.js";import{TaskUnorderedList as I}from"../../ui/task-list/task-unordered-list/index.js";const S={Heading:a,AnchorHeading:i,ContentLink:r,Block:t,Table:b,Thead:T,Tr:L,Th:g,Tbody:c,Td:h,CodeBlock:s,CodeSpan:m,Del:d,Em:n,Hr:p,Img:l,ListItem:u,OrderedList:x,UnorderedList:f,Paragraph:j,Strong:k,TaskListItem:B,TaskOrderedList:H,TaskUnorderedList:I,Tabs:C,CodeSection:o,Blockquote:e};export{S as DEFAULT_TAGS};
|
|
2
2
|
//# sourceMappingURL=tags.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.js","sources":["../../../../src/components/elements/article/tags.tsx"],"sourcesContent":["import { AnchorHeading } from \"@src/components/blocks/anchor-heading\";\nimport { CodeSection } from \"@src/components/blocks/code-section\";\nimport { NavContentLink } from \"@src/components/blocks/nav-content-link\";\nimport { Block } from \"@src/components/ui/block\";\nimport { Blockquote } from \"@src/components/ui/blockquote\";\nimport { CodeBlock } from \"@src/components/ui/code-block\";\nimport { CodeSpan } from \"@src/components/ui/code-span\";\nimport { Del } from \"@src/components/ui/del\";\nimport { Em } from \"@src/components/ui/em\";\nimport { Heading } from \"@src/components/ui/heading\";\nimport { Hr } from \"@src/components/ui/hr\";\nimport { Img } from \"@src/components/ui/img\";\nimport { ListItem, OrderedList, UnorderedList } from \"@src/components/ui/list\";\nimport { Paragraph } from \"@src/components/ui/paragraph\";\nimport { Strong } from \"@src/components/ui/strong\";\nimport { Table, Tbody, Td, Th, Thead, Tr } from \"@src/components/ui/table\";\nimport { Tabs } from \"@src/components/ui/tabs\";\nimport { TaskListItem, TaskOrderedList, TaskUnorderedList } from \"@src/components/ui/task-list\";\n\nexport const DEFAULT_TAGS = {\n Heading,\n AnchorHeading,\n ContentLink: NavContentLink,\n Block,\n Table,\n Thead,\n Tr,\n Th,\n Tbody,\n Td,\n CodeBlock,\n CodeSpan,\n Del,\n Em,\n Hr,\n Img,\n ListItem,\n OrderedList,\n UnorderedList,\n Paragraph,\n Strong,\n TaskListItem,\n TaskOrderedList,\n TaskUnorderedList,\n Tabs,\n CodeSection,\n Blockquote,\n};\n"],"names":["DEFAULT_TAGS","Heading","AnchorHeading","ContentLink","NavContentLink","Block","Table","Thead","Tr","Th","Tbody","Td","CodeBlock","CodeSpan","Del","Em","Hr","Img","ListItem","OrderedList","UnorderedList","Paragraph","Strong","TaskListItem","TaskOrderedList","TaskUnorderedList","Tabs","CodeSection","Blockquote"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tags.js","sources":["../../../../src/components/elements/article/tags.tsx"],"sourcesContent":["import { AnchorHeading } from \"@src/components/blocks/anchor-heading\";\nimport { CodeSection } from \"@src/components/blocks/code-section\";\nimport { NavContentLink } from \"@src/components/blocks/nav-content-link\";\nimport { Block } from \"@src/components/ui/block\";\nimport { Blockquote } from \"@src/components/ui/blockquote\";\nimport { CodeBlock } from \"@src/components/ui/code-block/index.server\";\nimport { CodeSpan } from \"@src/components/ui/code-span\";\nimport { Del } from \"@src/components/ui/del\";\nimport { Em } from \"@src/components/ui/em\";\nimport { Heading } from \"@src/components/ui/heading\";\nimport { Hr } from \"@src/components/ui/hr\";\nimport { Img } from \"@src/components/ui/img\";\nimport { ListItem, OrderedList, UnorderedList } from \"@src/components/ui/list\";\nimport { Paragraph } from \"@src/components/ui/paragraph\";\nimport { Strong } from \"@src/components/ui/strong\";\nimport { Table, Tbody, Td, Th, Thead, Tr } from \"@src/components/ui/table\";\nimport { Tabs } from \"@src/components/ui/tabs\";\nimport { TaskListItem, TaskOrderedList, TaskUnorderedList } from \"@src/components/ui/task-list\";\n\nexport const DEFAULT_TAGS = {\n Heading,\n AnchorHeading,\n ContentLink: NavContentLink,\n Block,\n Table,\n Thead,\n Tr,\n Th,\n Tbody,\n Td,\n CodeBlock,\n CodeSpan,\n Del,\n Em,\n Hr,\n Img,\n ListItem,\n OrderedList,\n UnorderedList,\n Paragraph,\n Strong,\n TaskListItem,\n TaskOrderedList,\n TaskUnorderedList,\n Tabs,\n CodeSection,\n Blockquote,\n};\n"],"names":["DEFAULT_TAGS","Heading","AnchorHeading","ContentLink","NavContentLink","Block","Table","Thead","Tr","Th","Tbody","Td","CodeBlock","CodeSpan","Del","Em","Hr","Img","ListItem","OrderedList","UnorderedList","Paragraph","Strong","TaskListItem","TaskOrderedList","TaskUnorderedList","Tabs","CodeSection","Blockquote"],"mappings":"2gDAmBO,MAAMA,EAAe,CACxBC,UACAC,gBACAC,YAAaC,EACbC,QACAC,QACAC,QACAC,KACAC,KACAC,QACAC,KACAC,YACAC,WACAC,MACAC,KACAC,KACAC,MACAC,WACAC,cACAC,gBACAC,YACAC,SACAC,eACAC,kBACAC,oBACAC,OACAC,cACAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/elements/article/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,KAAK,MAAM,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAGxD,OAAO,EAAE,KAAK,cAAc,EAAE,4BAAsC;AAGpE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,UAAU,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM;;;CAmB5C,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,WAEnC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,YAEjD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM;;;;;CAmBxC,CAAC;AAEF,eAA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AE,CAAA;CAAE,YAa/E,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,iBAAiB,MAAM,EAAE,QAAQ,SAAS;;;CAyBtF,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,OAAO;;;;;;;;;;;UAwBjC,cAAc;;;;CAKrD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"github-slugger";import e from"gray-matter";import{lexer as r}from"marked";import{join as n,dirname as o}from"path";import{parseTokenText as s}from"../../../core/utils/content-tools.js";const a=n=>{const{content:o}=e(n),a=r(o.trim()),i=new t,c=a.reduce((t,e)=>{if("heading"===e.type&&(2===e.depth||3===e.depth)){const r=s(e);t.push({title:r,id:i.slug(r),token:e,nested:3===e.depth})}return t},[]);return{tokens:a,headings:c}},i=t=>t.toLowerCase().replace(/\W/g,"_").replace(/_+/g,"_"),c=t=>/^[A-Z][a-zA-Z0-9]+$/.test(t),
|
|
1
|
+
import t from"github-slugger";import e from"gray-matter";import{lexer as r}from"marked";import{join as n,dirname as o}from"path";import{parseTokenText as s}from"../../../core/utils/content-tools.js";const a=n=>{const{content:o}=e(n),a=r(o.trim()),i=new t,c=a.reduce((t,e)=>{if("heading"===e.type&&(2===e.depth||3===e.depth)){const r=s(e);t.push({title:r,id:i.slug(r),token:e,nested:3===e.depth})}return t},[]);return{tokens:a,headings:c}},i=t=>t.toLowerCase().replace(/\W/g,"_").replace(/_+/g,"_"),c=t=>/^[A-Z][a-zA-Z0-9]+$/.test(t),l=t=>{let e={},r=t;const n=t.match(/[a-z]+=("[^"]+"|'[^']+'|[^ ]+)|[a-z]+/g);if(Array.isArray(n)){const[t,...o]=n;r=t,e=o.reduce((t,e)=>{const[r,...n]=e.split("=");return t[r]=!n||(0===n.length||n.join("=").replace(/(^["']|['"]$)/g,"")),t},{})}return{lang:r,configuration:e}},g=(t,e,r)=>{let s=t;const a=/^(https?:\/\/|\/)/.test(t);if(s.startsWith("#"))return{href:t,external:!1};if(r&&!a){const a=r.find(t=>t.clientPath===e);if(!a)throw new Error("Can not find requested page in parsed data");{const[,e,i]=t.match(/^([^?#]+)([?#].+)?/)||[t,t],c=n(o(a.origPath),e).replace(/\\/g,"/"),l=r.find(t=>t.origPath===c);l?s=l.clientPath+(i||""):(console.error(`Can not find link to internal file: "${t}"`),s="")}}return{href:s,external:a}},h=t=>{const e=t.raw.match(/^> \[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\n/);if(e){const[r,n]=e,o={...t,raw:t.raw.substring(r.length)},s=[...t.tokens||[]];if(s){const t={...s[0]};t.raw=t.raw.substring(n.length+4),t.text=t.text.substring(n.length+4),s[0]=t;const e=[...t.tokens];if(e[0]){const t={...e[0]};t.raw=t.raw.substring(n.length+4),t.text=t.text.substring(n.length+4),e[0]=t}t.tokens=e,o.tokens=s}return{token:o,type:n.toLowerCase()}}return{token:t,type:null}};export{i as formatId,g as formatLinkHref,h as parseBlockqoute,l as parseCodeLang,a as parseMarkdown,c as validateComponentName};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/components/elements/article/utils.ts"],"sourcesContent":["import GithubSlugger from \"github-slugger\";\nimport matter from \"gray-matter\";\nimport { lexer, type Tokens, type Token } from \"marked\";\nimport { dirname, join } from \"path\";\n\nimport { type BlockquoteType } from \"@src/components/ui/blockquote\";\nimport { parseTokenText } from \"@src/core/utils/content-tools\";\n\nimport { type PagesType } from \"./types\";\n\nexport type AnchorData = {\n title: string;\n id: string;\n nested: boolean;\n token: Token;\n};\n\nexport const parseMarkdown = (content: string) => {\n const { content: matterContent } = matter(content);\n const tokens = lexer(matterContent.trim());\n\n const slugger = new GithubSlugger();\n const headings = tokens.reduce<AnchorData[]>((acc, token) => {\n if (token.type === \"heading\" && (token.depth === 2 || token.depth === 3)) {\n const title = parseTokenText(token);\n acc.push({\n title,\n id: slugger.slug(title),\n token,\n nested: token.depth === 3,\n });\n }\n return acc;\n }, []);\n\n return { tokens, headings };\n};\n\nexport const formatId = (raw: string) => {\n return raw.toLowerCase().replace(/\\W/g, \"_\").replace(/_+/g, \"_\");\n};\n\nexport const validateComponentName = (name: string) => {\n return /^[A-Z][a-zA-Z0-9]+$/.test(name);\n};\n\nexport const parseCodeLang = (raw: string) => {\n let configuration: { [key: string]: string | boolean } = {};\n let lang: string = raw;\n\n const match = raw.match(/[a-z]+=(\"[^\"]+\"|'[^']+'|[^ ]+)|[a-z]+/g);\n if (Array.isArray(match)) {\n const [language, ...modifiers] = match as string[];\n lang = language;\n configuration = modifiers.reduce<{ [key: string]: string | boolean }>((acc, cur) => {\n const [key, ...value] = cur.split(\"=\");\n if (value) {\n acc[key] = value.length === 0 ? true : value.join(\"=\").replace(/(^[\"']|['\"]$)/g, \"\");\n } else {\n acc[key] = true;\n }\n return acc;\n }, {});\n }\n return { lang, configuration };\n};\n\nexport const isNewCodeToken = (\n token: Token | Token[],\n codeQueue: { [lang: string]: { element: React.ReactNode; tabName: string } },\n) => {\n if (Array.isArray(token) || !Object.keys(codeQueue).length) return false;\n\n if (token.type === \"code\") {\n const { lang, configuration } = parseCodeLang(token.lang);\n const tabKey = typeof configuration.tab === \"string\" ? formatId(configuration.tab) : lang;\n if (codeQueue[tabKey] || !configuration.switcher) return true;\n }\n\n if (token.type !== \"space\" && token.type !== \"code\") return true;\n\n return false;\n};\n\nexport const formatLinkHref = (href: string, currentPathname: string, pages?: PagesType) => {\n let finalHref: string = href;\n const external = /^(https?:\\/\\/|\\/)/.test(href);\n\n if (finalHref.startsWith(\"#\")) return { href, external: false };\n\n if (pages && !external) {\n const currentPageData = pages.find((item) => item.clientPath === currentPathname);\n\n if (currentPageData) {\n const [, linkMain, linkAdditional] = href.match(/^([^?#]+)([?#].+)?/) || [href, href];\n const linkOrigPath = join(dirname(currentPageData.origPath), linkMain).replace(/\\\\/g, \"/\");\n const linkData = pages.find((item) => item.origPath === linkOrigPath);\n\n if (linkData) {\n finalHref = linkData.clientPath + (linkAdditional || \"\");\n } else {\n console.error(`Can not find link to internal file: \"${href}\"`);\n finalHref = \"\";\n }\n } else {\n throw new Error(\"Can not find requested page in parsed data\");\n }\n }\n return { href: finalHref, external };\n};\n\nexport const parseBlockqoute = (token: Tokens.Blockquote | Tokens.Generic) => {\n const typeMatch = token.raw.match(/^> \\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\\]\\n/);\n if (typeMatch) {\n const [raw, type] = typeMatch;\n const newToken = { ...token, raw: token.raw.substring(raw.length) };\n
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/components/elements/article/utils.ts"],"sourcesContent":["import GithubSlugger from \"github-slugger\";\nimport matter from \"gray-matter\";\nimport { lexer, type Tokens, type Token } from \"marked\";\nimport { dirname, join } from \"path\";\n\nimport { type BlockquoteType } from \"@src/components/ui/blockquote\";\nimport { parseTokenText } from \"@src/core/utils/content-tools\";\n\nimport { type PagesType } from \"./types\";\n\nexport type AnchorData = {\n title: string;\n id: string;\n nested: boolean;\n token: Token;\n};\n\nexport const parseMarkdown = (content: string) => {\n const { content: matterContent } = matter(content);\n const tokens = lexer(matterContent.trim());\n\n const slugger = new GithubSlugger();\n const headings = tokens.reduce<AnchorData[]>((acc, token) => {\n if (token.type === \"heading\" && (token.depth === 2 || token.depth === 3)) {\n const title = parseTokenText(token);\n acc.push({\n title,\n id: slugger.slug(title),\n token,\n nested: token.depth === 3,\n });\n }\n return acc;\n }, []);\n\n return { tokens, headings };\n};\n\nexport const formatId = (raw: string) => {\n return raw.toLowerCase().replace(/\\W/g, \"_\").replace(/_+/g, \"_\");\n};\n\nexport const validateComponentName = (name: string) => {\n return /^[A-Z][a-zA-Z0-9]+$/.test(name);\n};\n\nexport const parseCodeLang = (raw: string) => {\n let configuration: { [key: string]: string | boolean } = {};\n let lang: string = raw;\n\n const match = raw.match(/[a-z]+=(\"[^\"]+\"|'[^']+'|[^ ]+)|[a-z]+/g);\n if (Array.isArray(match)) {\n const [language, ...modifiers] = match as string[];\n lang = language;\n configuration = modifiers.reduce<{ [key: string]: string | boolean }>((acc, cur) => {\n const [key, ...value] = cur.split(\"=\");\n if (value) {\n acc[key] = value.length === 0 ? true : value.join(\"=\").replace(/(^[\"']|['\"]$)/g, \"\");\n } else {\n acc[key] = true;\n }\n return acc;\n }, {});\n }\n return { lang, configuration };\n};\n\nexport const isNewCodeToken = (\n token: Token | Token[],\n codeQueue: { [lang: string]: { element: React.ReactNode; tabName: string } },\n) => {\n if (Array.isArray(token) || !Object.keys(codeQueue).length) return false;\n\n if (token.type === \"code\") {\n const { lang, configuration } = parseCodeLang(token.lang);\n const tabKey = typeof configuration.tab === \"string\" ? formatId(configuration.tab) : lang;\n if (codeQueue[tabKey] || !configuration.switcher) return true;\n }\n\n if (token.type !== \"space\" && token.type !== \"code\") return true;\n\n return false;\n};\n\nexport const formatLinkHref = (href: string, currentPathname: string, pages?: PagesType) => {\n let finalHref: string = href;\n const external = /^(https?:\\/\\/|\\/)/.test(href);\n\n if (finalHref.startsWith(\"#\")) return { href, external: false };\n\n if (pages && !external) {\n const currentPageData = pages.find((item) => item.clientPath === currentPathname);\n\n if (currentPageData) {\n const [, linkMain, linkAdditional] = href.match(/^([^?#]+)([?#].+)?/) || [href, href];\n const linkOrigPath = join(dirname(currentPageData.origPath), linkMain).replace(/\\\\/g, \"/\");\n const linkData = pages.find((item) => item.origPath === linkOrigPath);\n\n if (linkData) {\n finalHref = linkData.clientPath + (linkAdditional || \"\");\n } else {\n console.error(`Can not find link to internal file: \"${href}\"`);\n finalHref = \"\";\n }\n } else {\n throw new Error(\"Can not find requested page in parsed data\");\n }\n }\n return { href: finalHref, external };\n};\n\nexport const parseBlockqoute = (token: Tokens.Blockquote | Tokens.Generic) => {\n const typeMatch = token.raw.match(/^> \\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\\]\\n/);\n if (typeMatch) {\n const [raw, type] = typeMatch;\n const newToken = { ...token, raw: token.raw.substring(raw.length) };\n const newTokenTokens = [...(token.tokens || [])];\n if (newTokenTokens) {\n const firstToken = { ...newTokenTokens[0] } as Tokens.Paragraph;\n firstToken.raw = firstToken.raw.substring(type.length + 4);\n firstToken.text = firstToken.text.substring(type.length + 4);\n newTokenTokens[0] = firstToken;\n const firstTokenTokens = [...firstToken.tokens];\n if (firstTokenTokens[0]) {\n const firstSubtoken = { ...firstTokenTokens[0] } as Tokens.Paragraph;\n firstSubtoken.raw = firstSubtoken.raw.substring(type.length + 4);\n firstSubtoken.text = firstSubtoken.text.substring(type.length + 4);\n firstTokenTokens[0] = firstSubtoken;\n }\n firstToken.tokens = firstTokenTokens;\n newToken.tokens = newTokenTokens;\n }\n\n return {\n token: newToken,\n type: type.toLowerCase() as BlockquoteType,\n };\n }\n\n return { token, type: null };\n};\n"],"names":["parseMarkdown","content","matterContent","matter","tokens","lexer","trim","slugger","GithubSlugger","headings","reduce","acc","token","type","depth","title","parseTokenText","push","id","slug","nested","formatId","raw","toLowerCase","replace","validateComponentName","name","test","parseCodeLang","configuration","lang","match","Array","isArray","language","modifiers","cur","key","value","split","length","join","formatLinkHref","href","currentPathname","pages","finalHref","external","startsWith","currentPageData","find","item","clientPath","Error","linkMain","linkAdditional","linkOrigPath","dirname","origPath","linkData","console","error","parseBlockqoute","typeMatch","newToken","substring","newTokenTokens","firstToken","text","firstTokenTokens","firstSubtoken"],"mappings":"uMAiBO,MAAMA,EAAiBC,IAC1B,MAAQA,QAASC,GAAkBC,EAAOF,GACpCG,EAASC,EAAMH,EAAcI,QAE7BC,EAAU,IAAIC,EACdC,EAAWL,EAAOM,OAAqB,CAACC,EAAKC,KAC/C,GAAmB,YAAfA,EAAMC,OAAuC,IAAhBD,EAAME,OAA+B,IAAhBF,EAAME,OAAc,CACtE,MAAMC,EAAQC,EAAeJ,GAC7BD,EAAIM,KAAK,CACLF,QACAG,GAAIX,EAAQY,KAAKJ,GACjBH,QACAQ,OAAwB,IAAh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AAMU,IAAIS,MAAM,kDAClC,GAAIgC,EAAW,CACX,MAAOzC,EAAKT,GAAQkD,EACdC,EAAW,IAAKpD,EAAOU,IAAKV,EAAMU,IAAI2C,UAAU3C,EAAIkB,SACpD0B,EAAiB,IAAKtD,EAAMR,QAAU,IAC5C,GAAI8D,EAAgB,CAChB,MAAMC,EAAa,IAAKD,EAAe,IACvCC,EAAW7C,IAAM6C,EAAW7C,IAAI2C,UAAUpD,EAAK2B,OAAS,GACxD2B,EAAWC,KAAOD,EAAWC,KAAKH,UAAUpD,EAAK2B,OAAS,GAC1D0B,EAAe,GAAKC,EACpB,MAAME,EAAmB,IAAIF,EAAW/D,QACxC,GAAIiE,EAAiB,GAAI,CACrB,MAAMC,EAAgB,IAAKD,EAAiB,IAC5CC,EAAchD,IAAMgD,EAAchD,IAAI2C,UAAUpD,EAAK2B,OAAS,GAC9D8B,EAAcF,KAAOE,EAAcF,KAAKH,UAAUpD,EAAK2B,OAAS,GAChE6B,EAAiB,GAAKC,CAC1B,CACAH,EAAW/D,OAASiE,EACpBL,EAAS5D,OAAS8D,CACtB,CAEA,MAAO,CACHtD,MAAOoD,EACPnD,KAAMA,EAAKU,cAEnB,CAEA,MAAO,CAAEX,QAAOC,KAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/code-block/index.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,OAAO,CAAC;AAM7C,OAAO,mBAAmB,CAAC;AAE3B,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,eAAe,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAU9C,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import e,{useState as r,useLayoutEffect as o}from"react";import t from"clsx";import{CodeSpan as n}from"../code-span/index.js";import{highlight as c}from"./shared.js";const l=({code:l,lang:m,className:s,inline:a})=>{const[i,p]=r(null);return o(()=>{c(l,m).then(p)},[]),a?e.createElement(n,null,i):e.createElement("pre",{className:t("r-code-block",s)},i)};export{l as CodeBlock};
|
|
3
|
+
//# sourceMappingURL=index.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.client.js","sources":["../../../../src/components/ui/code-block/index.client.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useState, useLayoutEffect } from \"react\";\nimport { type BuiltinLanguage } from \"shiki\";\nimport clsx from \"clsx\";\n\nimport { CodeSpan } from \"../code-span\";\nimport { highlight } from \"./shared\";\n\nimport \"./code-block.scss\";\n\nexport interface CodeBlockProps {\n code: string;\n lang: BuiltinLanguage;\n className?: string;\n inline?: boolean;\n}\n\nexport const CodeBlock: React.FC<CodeBlockProps> = ({ code, lang, className, inline }) => {\n const [nodes, setNodes] = useState<React.ReactElement | null>(null);\n\n useLayoutEffect(() => {\n void highlight(code, lang).then(setNodes);\n }, []);\n\n if (inline) return <CodeSpan>{nodes}</CodeSpan>;\n\n return <pre className={clsx(\"r-code-block\", className)}>{nodes}</pre>;\n};\n"],"names":["CodeBlock","code","lang","className","inline","nodes","setNodes","useState","useLayoutEffect","highlight","then","React","createElement","CodeSpan","clsx"],"mappings":";sKAkBO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMA,EAAsC,CAAA,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAMC,OAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAWC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CACzE,MAAOC,CAAAA,CAAOC,CAAAA,CAAAA,CAAYC,EAAoC,CAAA,CAAA,CAAA,CAAA,CAAA,CAM9D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAJAC,EAAgB,CAAA,CAAA,CAAA,CAAA,CACPC,CAAAA,CAAUR,EAAMC,CAAAA,CAAAA,CAAMQ,CAAAA,CAAAA,CAAAA,CAAAA,CAAKJ,IACjC,CAAA,CAAA,CAAA,CAECF,CAAAA,CAAeO,EAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAACC,CAAAA,CAAQ,KAAER,CAAAA,CAAAA,CAEvBM,CAAAA,CAAAC,cAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAKT,UAAWW,CAAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgBX,IAAaE,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type BuiltinLanguage } from "shiki";
|
|
3
|
+
import "./code-block.scss";
|
|
4
|
+
export interface CodeBlockProps {
|
|
5
|
+
code: string;
|
|
6
|
+
lang: BuiltinLanguage;
|
|
7
|
+
className?: string;
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const CodeBlock: React.FC<CodeBlockProps>;
|
|
11
|
+
//# sourceMappingURL=index.isomorphic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.isomorphic.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/code-block/index.isomorphic.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,OAAO,CAAC;AAI7C,OAAO,mBAAmB,CAAC;AAE3B,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,eAAe,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAGD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAU9C,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{lazy as l,Suspense as n}from"react";import{CodeBlock as a}from"./index.server.js";const t=l(()=>import("./index.client.js").then(e=>({default:e.CodeBlock}))),c=({code:l,lang:c,className:o,inline:r})=>"useState"in e?e.createElement(n,{fallback:e.createElement("pre",null,l)},e.createElement(t,{code:l,lang:c,className:o,inline:r})):e.createElement(a,{code:l,lang:c,className:o,inline:r});export{c as CodeBlock};
|
|
2
|
+
//# sourceMappingURL=index.isomorphic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.isomorphic.js","sources":["../../../../src/components/ui/code-block/index.isomorphic.tsx"],"sourcesContent":["import React, { lazy, Suspense } from \"react\";\n\nimport { type BuiltinLanguage } from \"shiki\";\n\nimport { CodeBlock as CodeBlockServer } from \"./index.server\";\n\nimport \"./code-block.scss\";\n\nexport interface CodeBlockProps {\n code: string;\n lang: BuiltinLanguage;\n className?: string;\n inline?: boolean;\n}\nconst CodeBlockClient = lazy(() => import(\"./index.client\").then((module) => ({ default: module.CodeBlock })));\n\nexport const CodeBlock: React.FC<CodeBlockProps> = ({ code, lang, className, inline }) => {\n if (\"useState\" in React) {\n return (\n <Suspense fallback={<pre>{code}</pre>}>\n <CodeBlockClient code={code} lang={lang} className={className} inline={inline} />\n </Suspense>\n );\n }\n\n return <CodeBlockServer code={code} lang={lang} className={className} inline={inline} />;\n};\n"],"names":["CodeBlockClient","lazy","import","then","module","default","CodeBlock","code","lang","className","inline","React","Suspense","fallback","createElement","CodeBlockServer"],"mappings":"4FAcA,MAAMA,EAAkBC,EAAK,IAAMC,OAAO,qBAAkBC,KAAMC,IAAM,CAAQC,QAASD,EAAOE,cAEnFA,EAAsC,EAAGC,OAAMC,OAAMC,YAAWC,YACrE,aAAcC,EAEVA,gBAACC,EAAQ,CAACC,SAAUF,EAAAG,cAAA,MAAA,KAAMP,IACtBI,EAAAG,cAACd,GAAgBO,KAAMA,EAAMC,KAAMA,EAAMC,UAAWA,EAAWC,OAAQA,KAK5EC,gBAACI,EAAe,CAACR,KAAMA,EAAMC,KAAMA,EAAMC,UAAWA,EAAWC,OAAQA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type BuiltinLanguage } from "shiki";
|
|
3
|
+
import "./code-block.scss";
|
|
4
|
+
export interface CodeBlockProps {
|
|
5
|
+
code: string;
|
|
6
|
+
lang: BuiltinLanguage;
|
|
7
|
+
className?: string;
|
|
8
|
+
inline?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const CodeBlock: React.FC<CodeBlockProps>;
|
|
11
|
+
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/code-block/index.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,OAAO,CAAC;AAMhE,OAAO,mBAAmB,CAAC;AAE3B,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,eAAe,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAsBD,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAY9C,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{cache as t,use as a}from"react";import{createHighlighter as n}from"shiki";import r from"clsx";import{CodeSpan as o}from"../code-span/index.js";import{githubDynamic as m}from"./theme.js";const s=(async()=>{const e=await n({langs:[],themes:[]});return await e.loadTheme(m),e})(),c=t(async e=>{const t=await s;t.loadTheme(m);return t.getLoadedLanguages().includes(e)||await t.loadLanguage(e),t}),l=({code:t,lang:n,className:m,inline:s})=>{const l=a(c(n)).codeToHtml(t,{lang:n,theme:"github-dynamic",structure:"inline"});return s?e.createElement(o,{dangerouslySetInnerHTML:{__html:l}}):e.createElement("pre",{className:r("r-code-block",m),dangerouslySetInnerHTML:{__html:l}})};export{l as CodeBlock};
|
|
2
|
+
//# sourceMappingURL=index.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.server.js","sources":["../../../../src/components/ui/code-block/index.server.tsx"],"sourcesContent":["import React, { cache, use } from \"react\";\nimport { createHighlighter, type BuiltinLanguage } from \"shiki\";\nimport clsx from \"clsx\";\n\nimport { CodeSpan } from \"../code-span\";\nimport { githubDynamic } from \"./theme\";\n\nimport \"./code-block.scss\";\n\nexport interface CodeBlockProps {\n code: string;\n lang: BuiltinLanguage;\n className?: string;\n inline?: boolean;\n}\n\nconst initBaseHighlighter = async () => {\n const highlighter = await createHighlighter({ langs: [], themes: [] });\n await highlighter.loadTheme(githubDynamic);\n return highlighter;\n};\n\nconst highlighterPromise = initBaseHighlighter();\n\nconst getHighlighter = cache(async (language: BuiltinLanguage) => {\n const highlighter = await highlighterPromise;\n highlighter.loadTheme(githubDynamic);\n const loadedLanguages = highlighter.getLoadedLanguages();\n\n if (!loadedLanguages.includes(language)) {\n await highlighter.loadLanguage(language);\n }\n\n return highlighter;\n});\n\nexport const CodeBlock: React.FC<CodeBlockProps> = ({ code, lang, className, inline }) => {\n const highlighter = use(getHighlighter(lang));\n\n const html = highlighter.codeToHtml(code, {\n lang,\n theme: \"github-dynamic\",\n structure: \"inline\",\n });\n\n if (inline) return <CodeSpan dangerouslySetInnerHTML={{ __html: html }} />;\n\n return <pre className={clsx(\"r-code-block\", className)} dangerouslySetInnerHTML={{ __html: html }} />;\n};\n"],"names":["highlighterPromise","async","highlighter","createHighlighter","langs","themes","loadTheme","githubDynamic","initBaseHighlighter","getHighlighter","cache","language","getLoadedLanguages","includes","loadLanguage","CodeBlock","code","lang","className","inline","html","use","codeToHtml","theme","structure","React","createElement","CodeSpan","dangerouslySetInnerHTML","__html","clsx"],"mappings":"oMAgBA,MAMMA,EANsBC,WACxB,MAAMC,QAAoBC,EAAkB,CAAEC,MAAO,GAAIC,OAAQ,KAEjE,aADMH,EAAYI,UAAUC,GACrBL,GAGgBM,GAErBC,EAAiBC,EAAMT,MAAOU,IAChC,MAAMT,QAAoBF,EAC1BE,EAAYI,UAAUC,GAOtB,OANwBL,EAAYU,qBAEfC,SAASF,UACpBT,EAAYY,aAAaH,GAG5BT,IAGEa,EAAsC,EAAGC,OAAMC,OAAMC,YAAWC,aACzE,MAEMC,EAFcC,EAAIZ,EAAeQ,IAEdK,WAAWN,EAAM,CACtCC,OACAM,MAAO,iBACPC,UAAW,WAGf,OAAIL,EAAeM,EAAAC,cAACC,EAAQ,CAACC,wBAAyB,CAAEC,OAAQT,KAEzDK,uBAAKP,UAAWY,EAAK,eAAgBZ,GAAYU,wBAAyB,CAAEC,OAAQT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/code-block/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,OAAO,CAAC;AAQ7C,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,uGAYlE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{toJsxRuntime as t}from"hast-util-to-jsx-runtime";import{Fragment as r}from"react";import{jsxs as e,jsx as m}from"react/jsx-runtime";import{codeToHast as i}from"shiki/bundle/web";import{githubDynamic as o}from"./theme.js";async function n(n,s){const a=await i(n,{lang:s,theme:o,structure:"inline"});return t(a,{Fragment:r,jsx:m,jsxs:e})}export{n as highlight};
|
|
2
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sources":["../../../../src/components/ui/code-block/shared.ts"],"sourcesContent":["import { type BuiltinLanguage } from \"shiki\";\nimport { toJsxRuntime } from \"hast-util-to-jsx-runtime\";\nimport { Fragment } from \"react\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nimport { codeToHast } from \"shiki/bundle/web\";\n\nimport { githubDynamic } from \"./theme\";\n\nexport async function highlight(code: string, lang: BuiltinLanguage) {\n const out = await codeToHast(code, {\n lang,\n theme: githubDynamic,\n structure: \"inline\",\n });\n\n return toJsxRuntime(out, {\n Fragment,\n jsx,\n jsxs,\n }) as React.ReactElement;\n}\n"],"names":["async","highlight","code","lang","out","codeToHast","theme","githubDynamic","structure","toJsxRuntime","Fragment","jsx","jsxs"],"mappings":"oOAQOA,eAAeC,EAAUC,EAAcC,GAC1C,MAAMC,QAAYC,EAAWH,EAAM,CAC/BC,OACAG,MAAOC,EACPC,UAAW,WAGf,OAAOC,EAAaL,EAAK,CACrBM,WACAC,MACAC,QAER"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./code-span.scss";
|
|
3
|
-
export
|
|
4
|
-
code: string;
|
|
5
|
-
className?: string;
|
|
6
|
-
}
|
|
3
|
+
export type CodeSpanProps = React.HTMLAttributes<HTMLElement>;
|
|
7
4
|
export declare const CodeSpan: React.FC<CodeSpanProps>;
|
|
8
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/code-span/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,kBAAkB,CAAC;AAE1B,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/code-span/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,kBAAkB,CAAC;AAE1B,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;AAE9D,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAM5C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import c from"clsx";const
|
|
1
|
+
import e from"react";import c from"clsx";const r=({className:r,children:o,...a})=>e.createElement("code",{className:c("r-code-span",r),...a},o);export{r as CodeSpan};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/code-span/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport \"./code-span.scss\";\n\nexport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/code-span/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport \"./code-span.scss\";\n\nexport type CodeSpanProps = React.HTMLAttributes<HTMLElement>;\n\nexport const CodeSpan: React.FC<CodeSpanProps> = ({ className, children, ...props }) => {\n return (\n <code className={clsx(\"r-code-span\", className)} {...props}>\n {children}\n </code>\n );\n};\n"],"names":["CodeSpan","className","children","props","React","createElement","clsx"],"mappings":"yCAOO,MAAMA,EAAoC,EAAGC,YAAWC,cAAaC,KAEpEC,EAAAC,cAAA,OAAA,CAAMJ,UAAWK,EAAK,cAAeL,MAAgBE,GAChDD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/tabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/tabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAGjE,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,SAAS;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE;QAAE,CAAC,MAAM,EAAE,MAAM,GAAG;YAAE,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;CAClC;AAED,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAuBpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/tabs/index.tsx"],"sourcesContent":["import React from \"react\";\nimport { TabsHeader, type TabsHeaderProps } from \"./tabs-header\";\nimport { TabsStyles } from \"./tabs-styles\";\n\nimport \"./tabs.scss\";\n\nexport interface TabsProps {\n insertStyles?: boolean;\n tabsData: { [tabKey: string]: { element: React.ReactNode; tabName: string } };\n blockKey?: string;\n type?: TabsHeaderProps[\"type\"];\n}\n\nexport const Tabs: React.FC<TabsProps> = ({ insertStyles, tabsData, blockKey, type }) => {\n const tabsKeys = Object.keys(tabsData);\n\n if (tabsKeys.length === 1) {\n return tabsData[tabsKeys[0]].element;\n }\n\n const tabs = tabsKeys.map((tab) => ({ name: tabsData[tab].tabName, id: tab }));\n const tabsTypeId = blockKey || tabsKeys.sort().join(\"-\");\n\n return (\n <div className={`r-tabs r-tabs__${tabsTypeId}`}>\n {insertStyles && <TabsStyles tabsKeys={tabsKeys} tabsTypeId={tabsTypeId} />}\n <TabsHeader tabs={tabs} tabsTypeId={tabsTypeId} type={type} />\n <div className={`r-tab-list r-tab-list__${tabsTypeId}`}>\n {tabsKeys.map((tabKey) => (\n <div key={tabKey} className={`r-tab r-tab_${tabKey}`}>\n {tabsData[tabKey].element}\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["Tabs","insertStyles","tabsData","blockKey","type","tabsKeys","Object","keys","length","element","tabs","map","tab","name","tabName","id","tabsTypeId","sort","join","React","createElement","className","TabsStyles","TabsHeader","tabKey","key"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/tabs/index.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { TabsHeader, type TabsHeaderProps } from \"./tabs-header\";\nimport { TabsStyles } from \"./tabs-styles\";\n\nimport \"./tabs.scss\";\n\nexport interface TabsProps {\n insertStyles?: boolean;\n tabsData: { [tabKey: string]: { element: React.ReactNode; tabName: string } };\n blockKey?: string;\n type?: TabsHeaderProps[\"type\"];\n}\n\nexport const Tabs: React.FC<TabsProps> = ({ insertStyles, tabsData, blockKey, type }) => {\n const tabsKeys = Object.keys(tabsData);\n\n if (tabsKeys.length === 1) {\n return tabsData[tabsKeys[0]].element;\n }\n\n const tabs = tabsKeys.map((tab) => ({ name: tabsData[tab].tabName, id: tab }));\n const tabsTypeId = blockKey || tabsKeys.sort().join(\"-\");\n\n return (\n <div className={`r-tabs r-tabs__${tabsTypeId}`}>\n {insertStyles && <TabsStyles tabsKeys={tabsKeys} tabsTypeId={tabsTypeId} />}\n <TabsHeader tabs={tabs} tabsTypeId={tabsTypeId} type={type} />\n <div className={`r-tab-list r-tab-list__${tabsTypeId}`}>\n {tabsKeys.map((tabKey) => (\n <div key={tabKey} className={`r-tab r-tab_${tabKey}`}>\n {tabsData[tabKey].element}\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"names":["Tabs","insertStyles","tabsData","blockKey","type","tabsKeys","Object","keys","length","element","tabs","map","tab","name","tabName","id","tabsTypeId","sort","join","React","createElement","className","TabsStyles","TabsHeader","tabKey","key"],"mappings":"6HAcO,MAAMA,EAA4B,EAAGC,eAAcC,WAAUC,WAAUC,WAC1E,MAAMC,EAAWC,OAAOC,KAAKL,GAE7B,GAAwB,IAApBG,EAASG,OACT,OAAON,EAASG,EAAS,IAAII,QAGjC,MAAMC,EAAOL,EAASM,IAAKC,IAAG,CAAQC,KAAMX,EAASU,GAAKE,QAASC,GAAIH,KACjEI,EAAab,GAAYE,EAASY,OAAOC,KAAK,KAEpD,OACIC,EAAAC,cAAA,MAAA,CAAKC,UAAW,kBAAkBL,KAC7Bf,GAAgBkB,EAAAC,cAACE,EAAU,CAACjB,SAAUA,EAAUW,WAAYA,IAC7DG,EAAAC,cAACG,EAAU,CAACb,KAAMA,EAAMM,WAAYA,EAAYZ,KAAMA,IACtDe,EAAAC,cAAA,MAAA,CAAKC,UAAW,0BAA0BL,KACrCX,EAASM,IAAKa,GACXL,uBAAKM,IAAKD,EAAQH,UAAW,eAAeG,KACvCtB,EAASsB,GAAQf"}
|