robindoc 3.3.3 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/lib/components/blocks/code-section/index.d.ts +3 -0
- 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/blocks/contents/index.d.ts.map +1 -1
- package/lib/components/blocks/contents/index.js +1 -1
- package/lib/components/blocks/contents/index.js.map +1 -1
- package/lib/components/blocks/no-js/index.js +1 -1
- package/lib/components/blocks/no-js/index.js.map +1 -1
- package/lib/components/blocks/pagination/index.d.ts +0 -6
- package/lib/components/blocks/pagination/index.d.ts.map +1 -1
- package/lib/components/blocks/pagination/index.js +1 -1
- package/lib/components/blocks/pagination/index.js.map +1 -1
- package/lib/components/contexts/contents/context.d.ts +4 -1
- package/lib/components/contexts/contents/context.d.ts.map +1 -1
- package/lib/components/contexts/contents/context.js +1 -1
- package/lib/components/contexts/contents/context.js.map +1 -1
- package/lib/components/contexts/contents/provider.d.ts.map +1 -1
- package/lib/components/contexts/contents/provider.js +1 -1
- package/lib/components/contexts/contents/provider.js.map +1 -1
- package/lib/components/contexts/contents/use-heading-index.d.ts +4 -1
- package/lib/components/contexts/contents/use-heading-index.d.ts.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/index.d.ts.map +1 -1
- package/lib/components/elements/article/index.js +1 -1
- package/lib/components/elements/article/index.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/elements/robin-provider/index.d.ts +0 -2
- package/lib/components/elements/robin-provider/index.d.ts.map +1 -1
- package/lib/components/elements/robin-provider/index.js +1 -1
- package/lib/components/elements/robin-provider/index.js.map +1 -1
- package/lib/components/elements/sidebar/sidebar-drop/index.d.ts.map +1 -1
- package/lib/components/elements/sidebar/sidebar-drop/index.js +1 -1
- package/lib/components/elements/sidebar/sidebar-drop/index.js.map +1 -1
- package/lib/components/ui/copy-button/index.d.ts +1 -2
- package/lib/components/ui/copy-button/index.d.ts.map +1 -1
- package/lib/components/ui/copy-button/index.js.map +1 -1
- package/lib/components/ui/copy-text/index.d.ts +2 -0
- package/lib/components/ui/copy-text/index.d.ts.map +1 -1
- package/lib/components/ui/copy-text/index.js +1 -1
- package/lib/components/ui/copy-text/index.js.map +1 -1
- package/lib/components/ui/tabs/tabs-styles/index.js +1 -1
- package/lib/components/ui/tabs/tabs-styles/index.js.map +1 -1
- package/lib/core/types/initialize.d.ts +7 -0
- package/lib/core/types/initialize.d.ts.map +1 -0
- package/lib/core/utils/initialize-robindoc.d.ts +5 -5
- package/lib/core/utils/initialize-robindoc.d.ts.map +1 -1
- package/lib/core/utils/initialize-robindoc.js +1 -1
- package/lib/core/utils/initialize-robindoc.js.map +1 -1
- package/lib/global.css +24 -0
- package/lib/styles.css +379 -436
- package/package.json +8 -7
- package/lib/components/blocks/theme-styles/index.js +0 -2
- package/lib/components/blocks/theme-styles/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/elements/article/index.tsx"],"sourcesContent":["import \"./article.scss\";\nimport React from \"react\";\n\nimport { type Components } from \"@src/core/types/content\";\nimport { type BaseProvider } from \"@src/core/providers/base\";\nimport { loadContent } from \"@src/core/utils/load-content\";\nimport { ContentsProvider } from \"@src/components/contexts/contents/provider\";\nimport { Contents, type ContentsProps } from \"@src/components/blocks/contents\";\nimport { Breadcrumbs, type BreadcrumbsProps } from \"@src/components/blocks/breadcrumbs\";\nimport { Pagination, type PaginationProps } from \"@src/components/blocks/pagination\";\nimport { parseMarkdown } from \"./utils\";\nimport { Document } from \"./document\";\nimport { LastModified } from \"@src/components/blocks/last-modified\";\n\nexport type ContentProps = {\n title: string;\n components?: Components;\n config?: {\n publicDirs?: string[];\n };\n provider?: BaseProvider;\n pathname: string;\n pages?: { clientPath: string; origPath: string }[];\n translations?: {\n /** Last modified on */\n lastModifiedOn?: string;\n };\n} & ({ content: string; uri?: undefined } | { uri: string; content?: undefined });\n\nexport type ArticleProps = Partial<PaginationProps> &\n Partial<BreadcrumbsProps> &\n Omit<ContentsProps, \"headings\"> &\n ContentProps;\n\nexport const Article: React.FC<ArticleProps> = async ({\n components,\n content,\n uri,\n config = {},\n provider,\n hideContents,\n editUri: editUriProp,\n pathname,\n title,\n breadcrumbs,\n prev,\n next,\n pages = [],\n translations,\n}) => {\n const {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/elements/article/index.tsx"],"sourcesContent":["import \"./article.scss\";\nimport React from \"react\";\n\nimport { type Components } from \"@src/core/types/content\";\nimport { type BaseProvider } from \"@src/core/providers/base\";\nimport { loadContent } from \"@src/core/utils/load-content\";\nimport { ContentsProvider } from \"@src/components/contexts/contents/provider\";\nimport { Contents, type ContentsProps } from \"@src/components/blocks/contents\";\nimport { Breadcrumbs, type BreadcrumbsProps } from \"@src/components/blocks/breadcrumbs\";\nimport { Pagination, type PaginationProps } from \"@src/components/blocks/pagination\";\nimport { parseMarkdown } from \"./utils\";\nimport { Document } from \"./document\";\nimport { LastModified } from \"@src/components/blocks/last-modified\";\n\nexport type ContentProps = {\n title: string;\n components?: Components;\n config?: {\n publicDirs?: string[];\n };\n provider?: BaseProvider;\n pathname: string;\n pages?: { clientPath: string; origPath: string }[];\n translations?: {\n /** Last modified on */\n lastModifiedOn?: string;\n };\n} & ({ content: string; uri?: undefined } | { uri: string; content?: undefined });\n\nexport type ArticleProps = Partial<PaginationProps> &\n Partial<BreadcrumbsProps> &\n Omit<ContentsProps, \"headings\"> &\n ContentProps;\n\nexport const Article: React.FC<ArticleProps> = async ({\n components,\n content,\n uri,\n config = {},\n provider,\n hideContents,\n editUri: editUriProp,\n pathname,\n title,\n breadcrumbs,\n prev,\n next,\n pages = [],\n translations,\n}) => {\n const { lastModifiedOn = \"Last modified on\", editOnService, onThisPage } = translations || {};\n const { data, provider: targetProvider } =\n content || !uri ? { data: content, provider: null } : await loadContent(uri, provider);\n\n if (!data) {\n throw new Error(\"Robindoc: Please provide content or valid uri\");\n }\n\n const { headings, tokens } = parseMarkdown(data);\n const editUri = uri && targetProvider && (await targetProvider.getEditUri(uri));\n const lastModified = uri && targetProvider && (await targetProvider.getLastModifiedDate(uri));\n\n return (\n <ContentsProvider>\n {breadcrumbs && breadcrumbs.length > 0 && <Breadcrumbs breadcrumbs={breadcrumbs} title={title} />}\n <Contents\n editUri={editUriProp === null ? null : editUriProp || editUri}\n hideContents={hideContents}\n headings={headings}\n translations={{ editOnService, onThisPage }}\n />\n <div className=\"r-article\">\n <Document\n headings={headings}\n tokens={tokens}\n pages={pages}\n components={components}\n config={config}\n targetProvider={targetProvider}\n pathname={pathname}\n uri={uri}\n />\n {lastModified && <LastModified date={lastModified}>{lastModifiedOn}</LastModified>}\n </div>\n {(prev || next) && <Pagination prev={prev} next={next} />}\n </ContentsProvider>\n );\n};\n"],"names":["Article","async","components","content","uri","config","provider","hideContents","editUri","editUriProp","pathname","title","breadcrumbs","prev","next","pages","translations","lastModifiedOn","editOnService","onThisPage","data","targetProvider","loadContent","Error","headings","tokens","parseMarkdown","getEditUri","lastModified","getLastModifiedDate","React","ContentsProvider","length","createElement","Breadcrumbs","Contents","className","Document","LastModified","date","Pagination"],"mappings":"6eAkCO,MAAMA,EAAkCC,OAC3CC,aACAC,UACAC,MACAC,SAAS,CAAA,EACTC,WACAC,eACAC,QAASC,EACTC,WACAC,QACAC,cACAC,OACAC,OACAC,QAAQ,GACRC,mBAEA,MAAMC,eAAEA,EAAiB,mBAAkBC,cAAEA,EAAaC,WAAEA,GAAeH,GAAgB,CAAA,GACrFI,KAAEA,EAAMd,SAAUe,GACpBlB,IAAYC,EAAM,CAAEgB,KAAMjB,EAASG,SAAU,YAAegB,EAAYlB,EAAKE,GAEjF,IAAKc,EACD,MAAM,IAAIG,MAAM,iDAGpB,MAAMC,SAAEA,EAAQC,OAAEA,GAAWC,EAAcN,GACrCZ,EAAUJ,GAAOiB,SAAyBA,EAAeM,WAAWvB,GACpEwB,EAAexB,GAAOiB,SAAyBA,EAAeQ,oBAAoBzB,GAExF,OACI0B,gBAACC,EAAgB,KACZnB,GAAeA,EAAYoB,OAAS,GAAKF,EAAAG,cAACC,EAAW,CAACtB,YAAaA,EAAaD,MAAOA,IACxFmB,EAAAG,cAACE,EAAQ,CACL3B,QAAyB,OAAhBC,EAAuB,KAAOA,GAAeD,EACtDD,aAAcA,EACdiB,SAAUA,EACVR,aAAc,CAAEE,gBAAeC,gBAEnCW,EAAAG,cAAA,MAAA,CAAKG,UAAU,aACXN,EAAAG,cAACI,EAAQ,CACLb,SAAUA,EACVC,OAAQA,EACRV,MAAOA,EACPb,WAAYA,EACZG,OAAQA,EACRgB,eAAgBA,EAChBX,SAAUA,EACVN,IAAKA,IAERwB,GAAgBE,EAAAG,cAACK,EAAY,CAACC,KAAMX,GAAeX,KAEtDJ,GAAQC,IAASgB,EAAAG,cAACO,EAAU,CAAC3B,KAAMA,EAAMC,KAAMA"}
|
|
@@ -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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KAAK,GAAG,KAAK,EAAE,EACtB,WAAW;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,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;;;;;;;;;;;UAoBjC,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),g=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}},
|
|
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),g=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}},l=(t,e)=>{if(Array.isArray(t)||!Object.keys(e).length)return!1;if("code"===t.type){const{lang:r,configuration:n}=g(t.lang);if(e["string"==typeof n.tab?i(n.tab):r]||!n.switcher)return!0}return"space"!==t.type&&"code"!==t.type},h=(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,"/"),g=r.find(t=>t.origPath===c);g?s=g.clientPath+(i||""):(console.error(`Can not find link to internal file: "${t}"`),s="")}}return{href:s,external:a}},p=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)};if(o.tokens){const t={...o.tokens[0]};if(t.raw=t.raw.substring(n.length+4),t.text=t.text.substring(n.length+4),t.tokens[0]){const e={...t.tokens[0]};e.raw=e.raw.substring(n.length+4),e.text=e.text.substring(n.length+4),t.tokens[0]=e}o.tokens[0]=t}return{token:o,type:n.toLowerCase()}}return{token:t,type:null}};export{i as formatId,h as formatLinkHref,l as isNewCodeToken,p as parseBlockqoute,g 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 (
|
|
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 if (newToken.tokens) {\n const firstToken = { ...newToken.tokens[0] } as Tokens.Paragraph;\n firstToken.raw = firstToken.raw.substring(type.length + 4);\n firstToken.text = firstToken.text.substring(type.length + 4);\n if (firstToken.tokens[0]) {\n const firstSubtoken = { ...firstToken.tokens[0] } as Tokens.Paragraph;\n firstSubtoken.raw = firstSubtoken.raw.substring(type.length + 4);\n firstSubtoken.text = firstSubtoken.text.substring(type.length + 4);\n firstToken.tokens[0] = firstSubtoken;\n }\n newToken.tokens[0] = firstToken;\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","isNewCodeToken","codeQueue","Object","keys","tab","switcher","formatLinkHref","href","currentPathname","pages","finalHref","external","startsWith","currentPageData","find","item","clientPath","Error","linkMain","linkAdditional","linkOrigPath","dirname","origPath","linkData","console","error","parseBlockqoute","typeMatch","newToken","substring","firstToken","text","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,IAAhBR,EAAME,OAEtB,CACA,OAAOH,GACR,IAEH,MAAO,CAAEP,SAAQK,aAGRY,EAAYC,GACdA,EAAIC,cAAcC,QAAQ,MAAO,KAAKA,QAAQ,MAAO,KAGnDC,EAAyBC,GAC3B,sBAAsBC,KAAKD,GAGzBE,EAAiB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AEpDG,EACAb,EAAYa,EAASP,YAAcG,GAAkB,KAErDK,QAAQC,MAAM,wCAAwClB,MACtDG,EAAY,GAEpB,CAGJ,CACA,MAAO,CAAEH,KAAMG,EAAWC,aAGjBe,EAAmBxD,IAC5B,MAAMyD,EAAYzD,EAAMU,IAAIS,MAAM,kDAClC,GAAIsC,EAAW,CACX,MAAO/C,EAAKT,GAAQwD,EACdC,EAAW,IAAK1D,EAAOU,IAAKV,EAAMU,IAAIiD,UAAUjD,EAAIkB,SAC1D,GAAI8B,EAASlE,OAAQ,CACjB,MAAMoE,EAAa,IAAKF,EAASlE,OAAO,IAGxC,GAFAoE,EAAWlD,IAAMkD,EAAWlD,IAAIiD,UAAU1D,EAAK2B,OAAS,GACxDgC,EAAWC,KAAOD,EAAWC,KAAKF,UAAU1D,EAAK2B,OAAS,GACtDgC,EAAWpE,OAAO,GAAI,CACtB,MAAMsE,EAAgB,IAAKF,EAAWpE,OAAO,IAC7CsE,EAAcpD,IAAMoD,EAAcpD,IAAIiD,UAAU1D,EAAK2B,OAAS,GAC9DkC,EAAcD,KAAOC,EAAcD,KAAKF,UAAU1D,EAAK2B,OAAS,GAChEgC,EAAWpE,OAAO,GAAKsE,CAC3B,CACAJ,EAASlE,OAAO,GAAKoE,CACzB,CAEA,MAAO,CACH5D,MAAO0D,EACPzD,KAAMA,EAAKU,cAEnB,CAEA,MAAO,CAAEX,QAAOC,KAAM"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type Theme } from "../../../core/types/theme";
|
|
3
2
|
import "./robin-provider.scss";
|
|
4
3
|
interface RobinProviderProps {
|
|
5
|
-
theme?: Theme;
|
|
6
4
|
component?: React.ElementType;
|
|
7
5
|
}
|
|
8
6
|
export declare const RobinProvider: React.FC<React.PropsWithChildren<RobinProviderProps>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/elements/robin-provider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/elements/robin-provider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,uBAAuB,CAAC;AAE/B,UAAU,kBAAkB;IACxB,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;CACjC;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,CAS/E,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"react";import{NavigateProvider as t}from"../../contexts/navigate/provider.js";import{
|
|
1
|
+
import e from"react";import{NavigateProvider as t}from"../../contexts/navigate/provider.js";import{ThemeDetector as r}from"../../blocks/theme-detector/index.js";import{NoJs as o}from"../../blocks/no-js/index.js";const n=({children:n,component:m="div"})=>e.createElement(m,{suppressHydrationWarning:!0,className:"r-root"},e.createElement(r,null),e.createElement(t,null,n),e.createElement(o,null));export{n as RobinProvider};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/elements/robin-provider/index.tsx"],"sourcesContent":["import React from \"react\";\n\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/elements/robin-provider/index.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { NavigateProvider } from \"@src/components/contexts/navigate/provider\";\nimport { ThemeDetector } from \"@src/components/blocks/theme-detector\";\nimport { NoJs } from \"@src/components/blocks/no-js\";\n\nimport \"./robin-provider.scss\";\n\ninterface RobinProviderProps {\n component?: React.ElementType;\n}\n\nexport const RobinProvider: React.FC<React.PropsWithChildren<RobinProviderProps>> = ({\n children,\n component: Component = \"div\",\n}) => (\n <Component suppressHydrationWarning className=\"r-root\">\n <ThemeDetector />\n <NavigateProvider>{children}</NavigateProvider>\n <NoJs />\n </Component>\n);\n"],"names":["RobinProvider","children","component","Component","React","createElement","suppressHydrationWarning","className","ThemeDetector","NavigateProvider","NoJs"],"mappings":"oNAYO,MAAMA,EAAuE,EAChFC,WACAC,UAAWC,EAAY,SAEvBC,EAAAC,cAACF,EAAS,CAACG,0BAAwB,EAACC,UAAU,UAC1CH,EAAAC,cAACG,EAAa,MACdJ,EAAAC,cAACI,EAAgB,KAAER,GACnBG,EAAAC,cAACK,EAAI"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/elements/sidebar/sidebar-drop/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/elements/sidebar/sidebar-drop/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAG3D,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAyC3E,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import e,{useState as r,useRef as t,useEffect as n}from"react";import{usePathname as o}from"next/navigation";const s=({childHrefs:s,label:a,children:i})=>{const l=o(),c=s.includes(l),[d,m]=r(c),u=t(null),p=t(null);return n(()=>{c&&!d&&m(!0),c&&p.current&&!p.current?.open&&(p.current.open=!0)},[c]),n(()=>{p.current?.style.setProperty("--drop-height",u.current?.offsetHeight.toString()+"px")},[]),e.createElement("details",{className:"r-sidebar-drop",open:d,ref:p},e.createElement("summary",{className:"r-sidebar-drop-btn","aria-label":a},e.createElement("svg",{className:"r-sidebar-drop-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"m9 18 6-6-6-6"}))),e.createElement("ul",{className:"r-sidebar-list r-sidebar-sublist",ref:u},i))};export{s as SidebarDrop};
|
|
2
|
+
import e,{useState as r,useRef as t,useEffect as n}from"react";import{usePathname as o}from"next/navigation";const s=({childHrefs:s,label:a,children:i})=>{const l=o(),c=s.includes(l),[d,m]=r(c),u=t(null),p=t(null);return n(()=>{c&&!d&&m(!0),c&&p.current&&!p.current?.open&&(p.current.open=!0)},[c]),n(()=>{p.current?.style.setProperty("--drop-height",(u.current?.offsetHeight||0).toString()+"px")},[]),e.createElement("details",{className:"r-sidebar-drop",open:d,ref:p},e.createElement("summary",{className:"r-sidebar-drop-btn","aria-label":a},e.createElement("svg",{className:"r-sidebar-drop-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"m9 18 6-6-6-6"}))),e.createElement("ul",{className:"r-sidebar-list r-sidebar-sublist",ref:u},i))};export{s as SidebarDrop};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/elements/sidebar/sidebar-drop/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { usePathname } from \"next/navigation\";\n\nexport interface SidebarDropProps {\n childHrefs: string[];\n defaultOpen?: boolean;\n label: string;\n id: string;\n}\n\nexport const SidebarDrop: React.FC<React.PropsWithChildren<SidebarDropProps>> = ({ childHrefs, label, children }) => {\n const pathname = usePathname();\n const openedByDefault = childHrefs.includes(pathname);\n const [opened, setOpened] = useState(openedByDefault);\n const dropdownRef = useRef<HTMLUListElement>(null);\n const detailsRef = useRef<HTMLDetailsElement>(null);\n\n useEffect(() => {\n if (openedByDefault && !opened) setOpened(true);\n if (openedByDefault && detailsRef.current && !detailsRef.current?.open) detailsRef.current.open = true;\n }, [openedByDefault]);\n\n useEffect(() => {\n detailsRef.current?.style.setProperty(\"--drop-height\"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/elements/sidebar/sidebar-drop/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useRef, useState } from \"react\";\nimport { usePathname } from \"next/navigation\";\n\nexport interface SidebarDropProps {\n childHrefs: string[];\n defaultOpen?: boolean;\n label: string;\n id: string;\n}\n\nexport const SidebarDrop: React.FC<React.PropsWithChildren<SidebarDropProps>> = ({ childHrefs, label, children }) => {\n const pathname = usePathname();\n const openedByDefault = childHrefs.includes(pathname);\n const [opened, setOpened] = useState(openedByDefault);\n const dropdownRef = useRef<HTMLUListElement>(null);\n const detailsRef = useRef<HTMLDetailsElement>(null);\n\n useEffect(() => {\n if (openedByDefault && !opened) setOpened(true);\n if (openedByDefault && detailsRef.current && !detailsRef.current?.open) detailsRef.current.open = true;\n }, [openedByDefault]);\n\n useEffect(() => {\n detailsRef.current?.style.setProperty(\n \"--drop-height\",\n (dropdownRef.current?.offsetHeight || 0).toString() + \"px\",\n );\n }, []);\n\n return (\n <details className=\"r-sidebar-drop\" open={opened} ref={detailsRef}>\n <summary className=\"r-sidebar-drop-btn\" aria-label={label}>\n <svg\n className=\"r-sidebar-drop-icon\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"m9 18 6-6-6-6\" />\n </svg>\n </summary>\n <ul className=\"r-sidebar-list r-sidebar-sublist\" ref={dropdownRef}>\n {children}\n </ul>\n </details>\n );\n};\n"],"names":["SidebarDrop","childHrefs","label","children","pathname","usePathname","openedByDefault","includes","opened","setOpened","useState","dropdownRef","useRef","detailsRef","useEffect","current","open","style","setProperty","offsetHeight","toString","React","createElement","className","ref","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d"],"mappings":";6GAYO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMA,CAAAA,CAAmE,CAAA,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAYC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAOC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAClG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMC,EAAWC,CAAAA,CAAAA,CAAAA,CACXC,CAAAA,CAAkBL,CAAAA,CAAWM,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAASH,CAAAA,CAAAA,CAAAA,CACrCI,CAAAA,CAAQC,CAAAA,CAAAA,CAAaC,CAAAA,CAASJ,CAAAA,CAAAA,CAC/BK,CAAAA,CAAcC,CAAAA,CAAyB,CAAA,CAAA,CAAA,CAAA,CAAA,CACvCC,CAAAA,CAAaD,CAAAA,CAA2B,MAc9C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAZAE,CAAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CACFR,CAAAA,CAAAA,CAAAA,CAAoBE,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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmCC,CAAAA,CAAAA,CAAAA,CAAKb,CAAAA,CAAAA,CACjDR,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./copy-button.scss";
|
|
3
|
-
interface CopyButtonProps {
|
|
3
|
+
export interface CopyButtonProps {
|
|
4
4
|
raw: string;
|
|
5
5
|
className?: string;
|
|
6
6
|
translations?: {
|
|
@@ -11,5 +11,4 @@ interface CopyButtonProps {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
export declare const CopyButton: React.FC<CopyButtonProps>;
|
|
14
|
-
export {};
|
|
15
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/copy-button/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,oBAAoB,CAAC;AAE5B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/copy-button/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,oBAAoB,CAAC;AAE5B,MAAM,WAAW,eAAe;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE;QACX,WAAW;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,kBAAkB;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACL;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA4ChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/copy-button/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useState } from \"react\";\nimport clsx from \"clsx\";\n\nimport { Tooltip } from \"../tooltip\";\n\nimport \"./copy-button.scss\";\n\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/copy-button/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useState } from \"react\";\nimport clsx from \"clsx\";\n\nimport { Tooltip } from \"../tooltip\";\n\nimport \"./copy-button.scss\";\n\nexport interface CopyButtonProps {\n raw: string;\n className?: string;\n translations?: {\n /** Copy */\n copy?: string;\n /** Code Copied */\n codeCopied?: string;\n };\n}\n\nexport const CopyButton: React.FC<CopyButtonProps> = ({ translations, raw, className }) => {\n const { copy = \"Copy\", codeCopied = \"Code Copied\" } = translations || {};\n const [copyTimeout, setCopyTimeout] = useState<NodeJS.Timeout | null>(null);\n const clickHandler = () => {\n if (copyTimeout) clearTimeout(copyTimeout);\n setCopyTimeout(\n setTimeout(() => {\n setCopyTimeout(null);\n }, 1500),\n );\n navigator.clipboard.writeText(raw);\n };\n\n return (\n <button\n tabIndex={-1}\n onClick={clickHandler}\n className={clsx(\"r-copy-button r-no-js\", copyTimeout && \"_active\", className)}\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"r-copy-button-svg\"\n >\n <title>{copy}</title>\n <g className=\"r-copy-button-success\">\n <path d=\"M20 6 9 17l-5-5\" />\n </g>\n <g className=\"r-copy-button-base\">\n <path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\" />\n <rect width=\"14\" height=\"14\" x=\"8\" y=\"8\" rx=\"2\" ry=\"2\" />\n </g>\n </svg>\n <Tooltip position=\"bottom-end\" visible={Boolean(copyTimeout)}>\n {codeCopied}\n </Tooltip>\n </button>\n );\n};\n"],"names":["CopyButton","translations","raw","className","copy","codeCopied","copyTimeout","setCopyTimeout","useState","React","tabIndex","onClick","clearTimeout","setTimeout","navigator","clipboard","writeText","clsx","createElement","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d","x","y","rx","ry","Tooltip","position","visible","Boolean"],"mappings":";sGAoBO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMA,CAAAA,CAAwC,CAAA,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAcC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAKC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CACvE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAEA,CAAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAEA,CAAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAkBJ,CAAAA,CAAAA,CAAgB,CAAA,CAAA,CAAA,CAC/DK,CAAAA,CAAaC,CAAAA,CAAAA,CAAkBC,CAAAA,CAAgC,CAAA,CAAA,CAAA,CAAA,CAAA,CAWtE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACIC,CAAAA,yBACIC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAU,CAAA,CACVC,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+1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/copy-text/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE;QACX,sBAAsB;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/copy-text/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAKxC,OAAO,kBAAkB,CAAC;AAE1B,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE;QACX,sBAAsB;QACtB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,WAAW;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACL;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA0B5C,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import t,{useState as e}from"react";import o from"clsx";import{Tooltip as i}from"../tooltip/index.js";const r=({translations:r,text:a,className:
|
|
2
|
+
import t,{useState as e}from"react";import o from"clsx";import{Tooltip as i}from"../tooltip/index.js";const r=({translations:r,text:a,className:l})=>{const{filenameCopied:n="Filename Copied",copy:m="Copy"}=r||{},[s,c]=e(null);return t.createElement("button",{tabIndex:-1,onClick:()=>{s&&clearTimeout(s),c(setTimeout(()=>{c(null)},1500)),navigator.clipboard.writeText(a)},className:o("r-copy-text r-no-js _to-right",s&&"_active",l),title:m},a,t.createElement(i,{position:"bottom-start",visible:Boolean(s)},n))};export{r as CopyText};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/copy-text/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useState } from \"react\";\nimport clsx from \"clsx\";\n\nimport { Tooltip } from \"../tooltip\";\n\nimport \"./copy-text.scss\";\n\nexport interface CopyTextProps {\n text: string;\n className?: string;\n translations?: {\n /** Filename Copied */\n filenameCopied?: string;\n };\n}\n\nexport const CopyText: React.FC<CopyTextProps> = ({ translations, text, className }) => {\n const { filenameCopied = \"Filename Copied\" } = translations || {};\n const [copyTimeout, setCopyTimeout] = useState<NodeJS.Timeout | null>(null);\n const clickHandler = () => {\n if (copyTimeout) clearTimeout(copyTimeout);\n setCopyTimeout(\n setTimeout(() => {\n setCopyTimeout(null);\n }, 1500),\n );\n navigator.clipboard.writeText(text);\n };\n\n return (\n <button\n tabIndex={-1}\n onClick={clickHandler}\n className={clsx(\"r-copy-text r-no-js _to-right\", copyTimeout && \"_active\", className)}\n >\n {text}\n <Tooltip position=\"bottom-start\" visible={Boolean(copyTimeout)}>\n {filenameCopied}\n </Tooltip>\n </button>\n );\n};\n"],"names":["CopyText","translations","text","className","filenameCopied","copyTimeout","setCopyTimeout","useState","React","tabIndex","onClick","clearTimeout","setTimeout","navigator","clipboard","writeText","clsx","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/copy-text/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useState } from \"react\";\nimport clsx from \"clsx\";\n\nimport { Tooltip } from \"../tooltip\";\n\nimport \"./copy-text.scss\";\n\nexport interface CopyTextProps {\n text: string;\n className?: string;\n translations?: {\n /** Filename Copied */\n filenameCopied?: string;\n /** Copy */\n copy?: string;\n };\n}\n\nexport const CopyText: React.FC<CopyTextProps> = ({ translations, text, className }) => {\n const { filenameCopied = \"Filename Copied\", copy = \"Copy\" } = translations || {};\n const [copyTimeout, setCopyTimeout] = useState<NodeJS.Timeout | null>(null);\n const clickHandler = () => {\n if (copyTimeout) clearTimeout(copyTimeout);\n setCopyTimeout(\n setTimeout(() => {\n setCopyTimeout(null);\n }, 1500),\n );\n navigator.clipboard.writeText(text);\n };\n\n return (\n <button\n tabIndex={-1}\n onClick={clickHandler}\n className={clsx(\"r-copy-text r-no-js _to-right\", copyTimeout && \"_active\", className)}\n title={copy}\n >\n {text}\n <Tooltip position=\"bottom-start\" visible={Boolean(copyTimeout)}>\n {filenameCopied}\n </Tooltip>\n </button>\n );\n};\n"],"names":["CopyText","translations","text","className","filenameCopied","copy","copyTimeout","setCopyTimeout","useState","React","createElement","tabIndex","onClick","clearTimeout","setTimeout","navigator","clipboard","writeText","clsx","title","Tooltip","position","visible","Boolean"],"mappings":";sGAoBO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMA,CAAAA,CAAoC,CAAA,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAcC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CACpE,MAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAEA,CAAAA,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiBC,CAAAA,CAAAA,CAAAA,CAAAA,CAAEA,CAAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAWJ,CAAAA,CAAAA,CAAgB,CAAA,GACvEK,CAAAA,CAAaC,CAAAA,CAAAA,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AA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAiCZ,CAAAA,CAAAA,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAWH,CAAAA,CAAAA,CAC3EgB,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAOd,CAAAA,CAAAA,CAENH,EACDO,CAAAA,CAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAACU,CAAAA,CAAO,CAACC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAeC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAASC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAQjB,IAC7CF,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from"react";const a=({tabsTypeId:a,tabsKeys:
|
|
1
|
+
import r from"react";const a=({tabsTypeId:a,tabsKeys:o})=>r.createElement("style",{dangerouslySetInnerHTML:{__html:`\n.r-root:not(.r-tabs-global__${a}) .r-tabs__${a} .r-tab:not(.r-tab_${o[0]}) {display: none}\n.r-root:not(.r-tabs-global__${a}) .r-tabs__${a} .r-tab-header_${o[0]} {border-color:var(--r-main-950);color:var(--r-main-950)}\n${o.map(r=>`.r-tabs-global__${a}_${r} .r-tabs__${a} .r-tab:not(.r-tab_${r}) {display: none}`).join("")}\n${o.map(r=>`.r-tabs-global__${a}_${r} .r-tabs__${a} .r-tab-header_${r} {border-color:var(--r-main-950);color:var(--r-main-950)}`).join("")}\n`}});export{a as TabsStyles};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/ui/tabs/tabs-styles/index.tsx"],"sourcesContent":["import React from \"react\";\n\nexport interface TabsStylesProps {\n tabsTypeId: string;\n tabsKeys: string[];\n}\n\nexport const TabsStyles: React.FC<TabsStylesProps> = ({ tabsTypeId, tabsKeys }) => (\n <style\n dangerouslySetInnerHTML={{\n __html: `\n.r-root:not(.r-tabs-global__${tabsTypeId}) .r-tabs__${tabsTypeId} .r-tab:not(.r-tab_${tabsKeys[0]}) {display: none}\n.r-root:not(.r-tabs-global__${tabsTypeId}) .r-tabs__${tabsTypeId} .r-tab-header_${tabsKeys[0]} {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/ui/tabs/tabs-styles/index.tsx"],"sourcesContent":["import React from \"react\";\n\nexport interface TabsStylesProps {\n tabsTypeId: string;\n tabsKeys: string[];\n}\n\nexport const TabsStyles: React.FC<TabsStylesProps> = ({ tabsTypeId, tabsKeys }) => (\n <style\n dangerouslySetInnerHTML={{\n __html: `\n.r-root:not(.r-tabs-global__${tabsTypeId}) .r-tabs__${tabsTypeId} .r-tab:not(.r-tab_${tabsKeys[0]}) {display: none}\n.r-root:not(.r-tabs-global__${tabsTypeId}) .r-tabs__${tabsTypeId} .r-tab-header_${tabsKeys[0]} {border-color:var(--r-main-950);color:var(--r-main-950)}\n${tabsKeys.map((tabKey) => `.r-tabs-global__${tabsTypeId}_${tabKey} .r-tabs__${tabsTypeId} .r-tab:not(.r-tab_${tabKey}) {display: none}`).join(\"\")}\n${tabsKeys.map((tabKey) => `.r-tabs-global__${tabsTypeId}_${tabKey} .r-tabs__${tabsTypeId} .r-tab-header_${tabKey} {border-color:var(--r-main-950);color:var(--r-main-950)}`).join(\"\")}\n`,\n }}\n />\n);\n"],"names":["TabsStyles","tabsTypeId","tabsKeys","React","createElement","dangerouslySetInnerHTML","__html","map","tabKey","join"],"mappings":"qBAOO,MAAMA,EAAwC,EAAGC,aAAYC,cAChEC,EAAAC,cAAA,QAAA,CACIC,wBAAyB,CACrBC,OAAQ,iCACUL,eAAwBA,uBAAgCC,EAAS,oDACjED,eAAwBA,mBAA4BC,EAAS,gEACzFA,EAASK,IAAKC,GAAW,mBAAmBP,KAAcO,cAAmBP,uBAAgCO,sBAA2BC,KAAK,QAC7IP,EAASK,IAAKC,GAAW,mBAAmBP,KAAcO,cAAmBP,mBAA4BO,8DAAmEC,KAAK"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Structure } from "./structure";
|
|
2
|
+
export type StructureTemplate = Structure | (() => Structure | Promise<Structure>);
|
|
3
|
+
export type Options = {
|
|
4
|
+
processError?: (status: number, statusText: string) => void | null | never;
|
|
5
|
+
matcher?: string[];
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=initialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../../src/core/types/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AAEnF,MAAM,MAAM,OAAO,GAAG;IAClB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { type ArticleProps as ArticlePropsBase } from "../../components/elements/article";
|
|
3
3
|
import { type SidebarProps as SidebarPropsBase } from "../../components/elements/sidebar";
|
|
4
|
-
import { type
|
|
4
|
+
import { type StructureTemplate, type Options } from "../types/initialize";
|
|
5
5
|
type PageProps = Omit<Partial<ArticlePropsBase>, "uri" | "content" | "provider" | "pathname" | "pages"> & {
|
|
6
6
|
pathname: string;
|
|
7
7
|
};
|
|
8
8
|
type SidebarProps = Omit<SidebarPropsBase, "tree">;
|
|
9
|
-
export declare const initializeRobindoc: (structureTemplate:
|
|
9
|
+
export declare const initializeRobindoc: (structureTemplate: StructureTemplate, options?: Options) => {
|
|
10
10
|
Page: React.FC<PageProps>;
|
|
11
11
|
Sidebar: React.FC<SidebarProps>;
|
|
12
12
|
getStaticParams: <T extends string = "segments">(prefix?: string, segmentsParamKey?: T) => Promise<Record<T, string[]>[]>;
|
|
13
|
-
getMetadata: (pathname: string) => Promise<Record<string, string
|
|
13
|
+
getMetadata: (pathname: string) => Promise<Record<string, string> | null>;
|
|
14
14
|
getPageData: (pathname: string) => Promise<{
|
|
15
15
|
title: string;
|
|
16
16
|
raw: string;
|
|
17
|
-
}>;
|
|
18
|
-
getPageInstruction: (pathname: string) => Promise<import("../types/content").Page>;
|
|
17
|
+
} | null>;
|
|
18
|
+
getPageInstruction: (pathname: string) => Promise<import("../types/content").Page | null>;
|
|
19
19
|
};
|
|
20
20
|
export {};
|
|
21
21
|
//# sourceMappingURL=initialize-robindoc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-robindoc.d.ts","sourceRoot":"","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AACjH,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AAEjH,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"initialize-robindoc.d.ts","sourceRoot":"","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AACjH,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AAEjH,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAO3E,KAAK,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IACtG,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAenD,eAAO,MAAM,kBAAkB,GAAI,mBAAmB,iBAAiB,EAAE,UAAS,OAAY;;;sBA0D3D,CAAC,SAAS,MAAM,wBACnC,MAAM,qBACI,CAAC;4BAiBc,MAAM;4BAwBN,MAAM;;;;mCAuBC,MAAM;CAqBrD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"react";import{Article as t}from"../../components/elements/article/index.js";import{Sidebar as e}from"../../components/elements/sidebar/index.js";import{parseStructure as o}from"./parse-structure.js";import{getConfiguration as s}from"./get-configuration.js";import{getMetadata as n}from"./get-metadata.js";import{normalizePathname as a,removeTrailingSlash as c}from"./path-tools.js";import{loadContent as i}from"./load-content.js";const p=(p,u={})=>{const l=(async r=>{let t;t="function"==typeof r?await r():r;const e=s(t.configuration||{});return o(t.items||[],e)})(p),m=u.matcher?.map(r=>new RegExp(`^${r.replace(/^\^|\$$/g,"")}$`));return{Page:async({pathname:e,...o})=>{const s=a(e);if(m&&!m.every(r=>r.test(e))){const r=`Pathname "${s}" doesn't pass matcher rules check`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const{pages:n}=await l,c=n[s];if(!c){const r=`Can not find data for "${s}". Please check structure`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const i=Object.keys(n),p=i.indexOf(s),f=i[p-1],h=p<i.length-1&&i[p+1],d=f&&{pathname:f,title:n[f].title},g=h&&{pathname:h,title:n[h].title},w=c.crumbs.map(r=>({title:n[r].title,pathname:r})),E=Object.entries(n).reduce((r,[t,{origPath:e}])=>(e&&r.push({clientPath:t,origPath:e}),r),[]);return r.createElement(t,{pathname:s,provider:c.configuration.provider,uri:c.uri,title:c.title,breadcrumbs:w,prev:d||void 0,next:g||void 0,pages:E,...o})},Sidebar:async t=>{const{tree:o}=await l;return r.createElement(e,{tree:o,...t})},getStaticParams:async(r="",t="segments")=>{const{pages:e}=await l,o=Object.keys(e),s=c(r);return o.reduce((r,e)=>e.startsWith(s)?(r.push({[t]:e.substring(s.length+1).split("/")}),r):r,[])},getMetadata:async r=>{const t=a(r);if(m&&!m.every(t=>t.test(r))){const r=`Pathname "${t}" doesn't pass matcher rules check`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const{pages:e}=await l,o=e[t];if(!o){const r=`Can not find data for "${t}". Please check structure`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}return await n({uri:o.uri,provider:o.configuration.provider})},getPageData:async r=>{const t=a(r);if(m&&!m.every(t=>t.test(r))){const r=`Pathname "${t}" doesn't pass matcher rules check`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const{pages:e}=await l,o=e[t];if(!o){const r=`Can not find data for "${t}". Please check structure`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const s=o.title,{data:n}=await i(o.uri,o.configuration.provider);return{title:s,raw:n}},getPageInstruction:async r=>{const t=a(r);if(m&&!m.every(t=>t.test(r))){const r=`Pathname "${t}" doesn't pass matcher rules check`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const{pages:e}=await l,o=e[t];if(!o){const r=`Can not find data for "${t}". Please check structure`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}return o}}};export{p as initializeRobindoc};
|
|
2
2
|
//# sourceMappingURL=initialize-robindoc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-robindoc.js","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { Article as ArticleBase, type ArticleProps as ArticlePropsBase } from \"@src/components/elements/article\";\nimport { Sidebar as SidebarBase, type SidebarProps as SidebarPropsBase } from \"@src/components/elements/sidebar\";\n\nimport { type Structure } from \"../types/structure\";\nimport { parseStructure } from \"./parse-structure\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMetadata as getMetadataBase } from \"./get-metadata\";\nimport { normalizePathname, removeTrailingSlash } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\ntype PageProps = Omit<Partial<ArticlePropsBase>, \"uri\" | \"content\" | \"provider\" | \"pathname\" | \"pages\"> & {\n pathname: string;\n};\n\ntype SidebarProps = Omit<SidebarPropsBase, \"tree\">;\n\nconst loadStructure = async (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {\n if (typeof structureTemplate === \"function\") {\n return structureTemplate();\n } else {\n return structureTemplate;\n }\n};\n\nexport const initializeRobindoc = (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {\n const structureParsedPromise = loadStructure(structureTemplate).then((structure) =>\n parseStructure(structure.items || [], getConfiguration(structure.configuration || {})),\n );\n\n const Page: React.FC<PageProps> = async ({ pathname, ...props }) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const paths = Object.keys(pages);\n const targetPageIndex = paths.indexOf(pathnameNormalized);\n const prevPagePathname = paths[targetPageIndex - 1];\n const nextPagePathname = targetPageIndex < paths.length - 1 && paths[targetPageIndex + 1];\n const prev = prevPagePathname && { pathname: prevPagePathname, title: pages[prevPagePathname].title };\n const next = nextPagePathname && { pathname: nextPagePathname, title: pages[nextPagePathname].title };\n\n const breadcrumbs = pageInstruction.crumbs.map((crumb) => ({ title: pages[crumb].title, pathname: crumb }));\n const clientPages = Object.entries(pages).reduce<{ clientPath: string; origPath: string }[]>(\n (acc, [clientPath, { origPath }]) => {\n if (origPath) acc.push({ clientPath, origPath });\n return acc;\n },\n [],\n );\n\n return (\n <ArticleBase\n pathname={pathnameNormalized}\n provider={pageInstruction.configuration.provider}\n uri={pageInstruction.uri}\n title={pageInstruction.title}\n breadcrumbs={breadcrumbs}\n prev={prev || undefined}\n next={next || undefined}\n pages={clientPages}\n {...props}\n />\n );\n };\n\n const Sidebar: React.FC<SidebarProps> = async (props) => {\n const { tree } = await structureParsedPromise;\n\n return <SidebarBase tree={tree} {...props} />;\n };\n\n const getStaticParams = async <T extends string = \"segments\">(\n prefix: string = \"\",\n segmentsParamKey: T = \"segments\" as T,\n ) => {\n const { pages } = await structureParsedPromise;\n const pagesArr = Object.keys(pages);\n const prefixWithoutTrailingSlash = removeTrailingSlash(prefix);\n\n return pagesArr.reduce<Record<T, string[]>[]>((acc, cur) => {\n if (!cur.startsWith(prefixWithoutTrailingSlash)) return acc;\n\n acc.push({\n [segmentsParamKey]: cur.substring(prefixWithoutTrailingSlash.length + 1).split(\"/\"),\n } as Record<T, string[]>);\n\n return acc;\n }, []);\n };\n\n const getMetadata = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const metadata = await getMetadataBase({\n uri: pageInstruction.uri,\n provider: pageInstruction.configuration.provider,\n });\n return metadata;\n };\n\n const getPageData = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const title = pageInstruction.title;\n const { data } = await loadContent(pageInstruction.uri, pageInstruction.configuration.provider);\n\n return { title, raw: data };\n };\n\n const getPageInstruction = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n return pageInstruction;\n };\n\n return { Page, Sidebar, getStaticParams, getMetadata, getPageData, getPageInstruction };\n};\n"],"names":["initializeRobindoc","structureTemplate","structureParsedPromise","async","loadStructure","then","structure","parseStructure","items","getConfiguration","configuration","Page","pathname","props","pages","pathnameNormalized","normalizePathname","pageInstruction","Error","paths","Object","keys","targetPageIndex","indexOf","prevPagePathname","nextPagePathname","length","prev","title","next","breadcrumbs","crumbs","map","crumb","clientPages","entries","reduce","acc","clientPath","origPath","push","React","ArticleBase","provider","uri","undefined","Sidebar","tree","createElement","SidebarBase","getStaticParams","prefix","segmentsParamKey","pagesArr","prefixWithoutTrailingSlash","removeTrailingSlash","cur","startsWith","substring","split","getMetadata","getMetadataBase","getPageData","data","loadContent","raw","getPageInstruction"],"mappings":"4bAkBA,MAQaA,EAAsBC,IAC/B,MAAMC,EATYC,OAAOF,GACQ,mBAAtBA,EACAA,IAEAA,EAKoBG,CAAcH,GAAmBI,KAAMC,GAClEC,EAAeD,EAAUE,OAAS,GAAIC,EAAiBH,EAAUI,eAAiB,CAAA,KA+GtF,MAAO,CAAEC,KA5GyBR,OAASS,cAAaC,MACpD,MAAMC,MAAEA,SAAgBZ,EAClBa,EAAqBC,EAAkBJ,GACvCK,EAAkBH,EAAMC,GAE9B,IAAKE,EACD,MAAM,IAAIC,MAAM,0BAA0BH,8BAG9C,MAAMI,EAAQC,OAAOC,KAAKP,GACpBQ,EAAkBH,EAAMI,QAAQR,GAChCS,EAAmBL,EAAMG,EAAkB,GAC3CG,EAAmBH,EAAkBH,EAAMO,OAAS,GAAKP,EAAMG,EAAkB,GACjFK,EAAOH,GAAoB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IACvB,MAAME,MAAEA,SAAgBZ,EAClBa,EAAqBC,EAAkBJ,GACvCK,EAAkBH,EAAMC,GAE9B,IAAKE,EACD,MAAM,IAAIC,MAAM,0BAA0BH,8BAG9C,MAAMa,EAAQX,EAAgBW,OACxBmC,KAAEA,SAAeC,EAAY/C,EAAgB2B,IAAK3B,EAAgBP,cAAciC,UAEtF,MAAO,CAAEf,QAAOqC,IAAKF,IAe0CG,mBAZxC/D,MAAOS,IAC9B,MAAME,MAAEA,SAAgBZ,EAClBa,EAAqBC,EAAkBJ,GACvCK,EAAkBH,EAAMC,GAE9B,IAAKE,EACD,MAAM,IAAIC,MAAM,0BAA0BH,8BAG9C,OAAOE"}
|
|
1
|
+
{"version":3,"file":"initialize-robindoc.js","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { Article as ArticleBase, type ArticleProps as ArticlePropsBase } from \"@src/components/elements/article\";\nimport { Sidebar as SidebarBase, type SidebarProps as SidebarPropsBase } from \"@src/components/elements/sidebar\";\n\nimport { type StructureTemplate, type Options } from \"../types/initialize\";\nimport { parseStructure } from \"./parse-structure\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMetadata as getMetadataBase } from \"./get-metadata\";\nimport { normalizePathname, removeTrailingSlash } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\ntype PageProps = Omit<Partial<ArticlePropsBase>, \"uri\" | \"content\" | \"provider\" | \"pathname\" | \"pages\"> & {\n pathname: string;\n};\n\ntype SidebarProps = Omit<SidebarPropsBase, \"tree\">;\n\nconst loadStructure = async (structureTemplate: StructureTemplate) => {\n let structure;\n if (typeof structureTemplate === \"function\") {\n structure = await structureTemplate();\n } else {\n structure = structureTemplate;\n }\n\n const configuration = getConfiguration(structure.configuration || {});\n\n return parseStructure(structure.items || [], configuration);\n};\n\nexport const initializeRobindoc = (structureTemplate: StructureTemplate, options: Options = {}) => {\n const structureParsedPromise = loadStructure(structureTemplate);\n const matchingRules = options.matcher?.map((rule) => new RegExp(`^${rule.replace(/^\\^|\\$$/g, \"\")}$`));\n\n const Page: React.FC<PageProps> = async ({ pathname, ...props }) => {\n const pathnameNormalized = normalizePathname(pathname);\n if (matchingRules && !matchingRules.every((rule) => rule.test(pathname))) {\n const errorMessage = `Pathname \"${pathnameNormalized}\" doesn't pass matcher rules check`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const { pages } = await structureParsedPromise;\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n const errorMessage = `Can not find data for \"${pathnameNormalized}\". Please check structure`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const paths = Object.keys(pages);\n const targetPageIndex = paths.indexOf(pathnameNormalized);\n const prevPagePathname = paths[targetPageIndex - 1];\n const nextPagePathname = targetPageIndex < paths.length - 1 && paths[targetPageIndex + 1];\n const prev = prevPagePathname && { pathname: prevPagePathname, title: pages[prevPagePathname].title };\n const next = nextPagePathname && { pathname: nextPagePathname, title: pages[nextPagePathname].title };\n\n const breadcrumbs = pageInstruction.crumbs.map((crumb) => ({ title: pages[crumb].title, pathname: crumb }));\n const clientPages = Object.entries(pages).reduce<{ clientPath: string; origPath: string }[]>(\n (acc, [clientPath, { origPath }]) => {\n if (origPath) acc.push({ clientPath, origPath });\n return acc;\n },\n [],\n );\n\n return (\n <ArticleBase\n pathname={pathnameNormalized}\n provider={pageInstruction.configuration.provider}\n uri={pageInstruction.uri}\n title={pageInstruction.title}\n breadcrumbs={breadcrumbs}\n prev={prev || undefined}\n next={next || undefined}\n pages={clientPages}\n {...props}\n />\n );\n };\n\n const Sidebar: React.FC<SidebarProps> = async (props) => {\n const { tree } = await structureParsedPromise;\n\n return <SidebarBase tree={tree} {...props} />;\n };\n\n const getStaticParams = async <T extends string = \"segments\">(\n prefix: string = \"\",\n segmentsParamKey: T = \"segments\" as T,\n ) => {\n const { pages } = await structureParsedPromise;\n const pagesArr = Object.keys(pages);\n const prefixWithoutTrailingSlash = removeTrailingSlash(prefix);\n\n return pagesArr.reduce<Record<T, string[]>[]>((acc, cur) => {\n if (!cur.startsWith(prefixWithoutTrailingSlash)) return acc;\n\n acc.push({\n [segmentsParamKey]: cur.substring(prefixWithoutTrailingSlash.length + 1).split(\"/\"),\n } as Record<T, string[]>);\n\n return acc;\n }, []);\n };\n\n const getMetadata = async (pathname: string) => {\n const pathnameNormalized = normalizePathname(pathname);\n if (matchingRules && !matchingRules.every((rule) => rule.test(pathname))) {\n const errorMessage = `Pathname \"${pathnameNormalized}\" doesn't pass matcher rules check`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const { pages } = await structureParsedPromise;\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n const errorMessage = `Can not find data for \"${pathnameNormalized}\". Please check structure`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const metadata = await getMetadataBase({\n uri: pageInstruction.uri,\n provider: pageInstruction.configuration.provider,\n });\n return metadata;\n };\n\n const getPageData = async (pathname: string) => {\n const pathnameNormalized = normalizePathname(pathname);\n if (matchingRules && !matchingRules.every((rule) => rule.test(pathname))) {\n const errorMessage = `Pathname \"${pathnameNormalized}\" doesn't pass matcher rules check`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const { pages } = await structureParsedPromise;\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n const errorMessage = `Can not find data for \"${pathnameNormalized}\". Please check structure`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const title = pageInstruction.title;\n const { data } = await loadContent(pageInstruction.uri, pageInstruction.configuration.provider);\n\n return { title, raw: data };\n };\n\n const getPageInstruction = async (pathname: string) => {\n const pathnameNormalized = normalizePathname(pathname);\n if (matchingRules && !matchingRules.every((rule) => rule.test(pathname))) {\n const errorMessage = `Pathname \"${pathnameNormalized}\" doesn't pass matcher rules check`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const { pages } = await structureParsedPromise;\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n const errorMessage = `Can not find data for \"${pathnameNormalized}\". Please check structure`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n return pageInstruction;\n };\n\n return { Page, Sidebar, getStaticParams, getMetadata, getPageData, getPageInstruction };\n};\n"],"names":["initializeRobindoc","structureTemplate","options","structureParsedPromise","async","structure","configuration","getConfiguration","parseStructure","items","loadStructure","matchingRules","matcher","map","rule","RegExp","replace","Page","pathname","props","pathnameNormalized","normalizePathname","every","test","errorMessage","processError","Error","pages","pageInstruction","paths","Object","keys","targetPageIndex","indexOf","prevPagePathname","nextPagePathname","length","prev","title","next","breadcrumbs","crumbs","crumb","clientPages","entries","reduce","acc","clientPath","origPath","push","React","ArticleBase","provider","uri","undefined","Sidebar","tree","createElement","SidebarBase","getStaticParams","prefix","segmentsParamKey","pagesArr","prefixWithoutTrailingSlash","removeTrailingSlash","cur","startsWith","substring","split","getMetadata","getMetadataBase","getPageData","data","loadContent","raw","getPageInstruction"],"mappings":"4bAkBA,MAaaA,EAAqB,CAACC,EAAsCC,EAAmB,MACxF,MAAMC,EAdYC,OAAOH,IACzB,IAAII,EAEAA,EAD6B,mBAAtBJ,QACWA,IAENA,EAGhB,MAAMK,EAAgBC,EAAiBF,EAAUC,eAAiB,CAAA,GAElE,OAAOE,EAAeH,EAAUI,OAAS,GAAIH,IAIdI,CAAcT,GACvCU,EAAgBT,EAAQU,SAASC,IAAKC,GAAS,IAAIC,OAAO,IAAID,EAAKE,QAAQ,WAAY,SA8I7F,MAAO,CAAEC,KA5IyBb,OAASc,cAAaC,MACpD,MAAMC,EAAqBC,EAAkBH,GAC7C,GAAIP,IAAkBA,EAAcW,MAAOR,GAASA,EAAKS,KAAKL,IAAY,CACtE,MAAMM,EAAe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F,EACpB,CAEA,MAAMc,EAAQV,EAAgBU,OACxBkC,KAAEA,SAAeC,EAAY7C,EAAgByB,IAAKzB,EAAgBtB,cAAc8C,UAEtF,MAAO,CAAEd,QAAOoC,IAAKF,IAuB0CG,mBApBxCvE,MAAOc,IAC9B,MAAME,EAAqBC,EAAkBH,GAC7C,GAAIP,IAAkBA,EAAcW,MAAOR,GAASA,EAAKS,KAAKL,IAAY,CACtE,MAAMM,EAAe,aAAaJ,sCAClC,GAAIlB,EAAQuB,aAAc,OAAOvB,EAAQuB,aAAa,IAAKD,IAAiB,KAC5E,MAAM,IAAIE,MAAMF,EACpB,CAEA,MAAMG,MAAEA,SAAgBxB,EAClByB,EAAkBD,EAAMP,GAE9B,IAAKQ,EAAiB,CAClB,MAAMJ,EAAe,0BAA0BJ,6BAC/C,GAAIlB,EAAQuB,aAAc,OAAOvB,EAAQuB,aAAa,IAAKD,IAAiB,KAC5E,MAAM,IAAIE,MAAMF,EACpB,CAEA,OAAOI"}
|
package/lib/global.css
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
html, body {
|
|
2
|
+
margin: 0;
|
|
3
|
+
padding: 0;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
*,
|
|
7
|
+
*:before,
|
|
8
|
+
*:after {
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@media (prefers-reduced-motion: reduce) {
|
|
13
|
+
*,
|
|
14
|
+
::before,
|
|
15
|
+
::after {
|
|
16
|
+
animation-delay: -1ms !important;
|
|
17
|
+
animation-duration: 1ms !important;
|
|
18
|
+
animation-iteration-count: 1 !important;
|
|
19
|
+
background-attachment: initial !important;
|
|
20
|
+
scroll-behavior: auto !important;
|
|
21
|
+
transition-duration: 1ms !important;
|
|
22
|
+
transition-delay: -1ms !important;
|
|
23
|
+
}
|
|
24
|
+
}
|