robindoc 2.5.1 → 3.1.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/lib/components/blocks/contents/index.js +1 -1
- package/lib/components/blocks/contents/index.js.map +1 -1
- package/lib/components/blocks/header-menu/index.d.ts.map +1 -1
- package/lib/components/blocks/header-menu/index.js +1 -1
- package/lib/components/blocks/header-menu/index.js.map +1 -1
- package/lib/components/blocks/header-social/index.js +1 -1
- package/lib/components/blocks/header-social/index.js.map +1 -1
- package/lib/components/blocks/no-js/index.d.ts +3 -0
- package/lib/components/blocks/no-js/index.d.ts.map +1 -0
- package/lib/components/blocks/no-js/index.js +2 -0
- package/lib/components/blocks/no-js/index.js.map +1 -0
- package/lib/components/blocks/search/index.js +1 -1
- package/lib/components/blocks/search/index.js.map +1 -1
- package/lib/components/blocks/theme-switcher/index.js +1 -1
- package/lib/components/blocks/theme-switcher/index.js.map +1 -1
- package/lib/components/elements/article/utils.d.ts +0 -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/header/index.d.ts +1 -1
- package/lib/components/elements/header/index.d.ts.map +1 -1
- package/lib/components/elements/header/index.js.map +1 -1
- 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-menu/index.d.ts.map +1 -1
- package/lib/components/elements/sidebar/sidebar-menu/index.js +1 -1
- package/lib/components/elements/sidebar/sidebar-menu/index.js.map +1 -1
- package/lib/components/ui/blockquote/index.d.ts.map +1 -1
- package/lib/components/ui/blockquote/index.js.map +1 -1
- package/lib/components/ui/copy-button/index.d.ts.map +1 -1
- package/lib/components/ui/copy-button/index.js +1 -1
- package/lib/components/ui/copy-button/index.js.map +1 -1
- 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-header/index.js +1 -1
- package/lib/components/ui/tabs/tabs-header/index.js.map +1 -1
- package/lib/core/utils/content-tools.d.ts +3 -0
- package/lib/core/utils/content-tools.d.ts.map +1 -0
- package/lib/core/utils/content-tools.js +2 -0
- package/lib/core/utils/content-tools.js.map +1 -0
- package/lib/core/utils/{get-meta.d.ts → get-metadata.d.ts} +3 -3
- package/lib/core/utils/get-metadata.d.ts.map +1 -0
- package/lib/core/utils/get-metadata.js +2 -0
- package/lib/core/utils/get-metadata.js.map +1 -0
- package/lib/core/utils/{git-data.d.ts → git-tools.d.ts} +1 -1
- package/lib/core/utils/git-tools.d.ts.map +1 -0
- package/lib/core/utils/{git-data.js → git-tools.js} +1 -1
- package/lib/core/utils/git-tools.js.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/core/utils/load-content.d.ts.map +1 -1
- package/lib/core/utils/load-content.js.map +1 -1
- package/lib/core/utils/parse-structure.js +1 -1
- package/lib/core/utils/parse-structure.js.map +1 -1
- package/lib/core/utils/path-tools.d.ts +5 -3
- package/lib/core/utils/path-tools.d.ts.map +1 -1
- package/lib/core/utils/path-tools.js +1 -1
- package/lib/core/utils/path-tools.js.map +1 -1
- package/lib/core/utils/{tabs-store.d.ts → tabs-tools.d.ts} +1 -1
- package/lib/core/utils/tabs-tools.d.ts.map +1 -0
- package/lib/core/utils/{tabs-store.js → tabs-tools.js} +1 -1
- package/lib/core/utils/{tabs-store.js.map → tabs-tools.js.map} +1 -1
- package/lib/styles.css +1 -1
- package/lib/styles.css.map +1 -1
- package/package.json +8 -2
- package/lib/core/utils/get-meta.d.ts.map +0 -1
- package/lib/core/utils/get-meta.js +0 -2
- package/lib/core/utils/get-meta.js.map +0 -1
- package/lib/core/utils/git-data.d.ts.map +0 -1
- package/lib/core/utils/git-data.js.map +0 -1
- package/lib/core/utils/tabs-store.d.ts.map +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import e,{useState as t,useEffect as
|
|
2
|
+
import e,{useState as t,useEffect as n}from"react";import{useNavigate as r}from"../../../contexts/navigate/use-navigate.js";const o=({children:o,translations:a})=>{const{menu:s="Menu"}=a||{},{addListener:i,removeListener:c}=r(),[d,l]=t(!1),m=()=>{document.body.classList.remove("body-mobile-lock"),l(!1),c("closeSidebarMenu")};return n((()=>()=>{m()}),[]),e.createElement("div",{className:"r-sidebar"},e.createElement("input",{type:"checkbox",id:"sidebar-input",className:"r-sidebar-input",hidden:!0,onChange:()=>{d?m():(document.body.classList.add("body-mobile-lock"),l(!0),i("closeSidebarMenu",m))},checked:d}),e.createElement("label",{htmlFor:"sidebar-input",className:"r-sidebar-btn",role:"button",tabIndex:0},e.createElement("svg",{className:"r-sidebar-chevron",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("span",null,s)),o)};export{o as SidebarMenu};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/elements/sidebar/sidebar-menu/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useState } from \"react\";\nimport { useNavigate } from \"@src/components/contexts/navigate/use-navigate\";\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/elements/sidebar/sidebar-menu/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useState } from \"react\";\nimport { useNavigate } from \"@src/components/contexts/navigate/use-navigate\";\n\nexport type SidebarMenuProps = React.PropsWithChildren<{\n translations?: {\n menu?: string;\n };\n}>;\n\nexport const SidebarMenu: React.FC<SidebarMenuProps> = ({ children, translations }) => {\n const { menu = \"Menu\" } = translations || {};\n const { addListener, removeListener } = useNavigate();\n const [opened, setOpened] = useState(false);\n\n const openHandler = () => {\n document.body.classList.add(\"body-mobile-lock\");\n setOpened(true);\n addListener(\"closeSidebarMenu\", closeHandler);\n };\n\n const closeHandler = () => {\n document.body.classList.remove(\"body-mobile-lock\");\n setOpened(false);\n removeListener(\"closeSidebarMenu\");\n };\n\n const toggleHandler = () => {\n if (opened) {\n closeHandler();\n } else {\n openHandler();\n }\n };\n\n useEffect(\n () => () => {\n closeHandler();\n },\n [],\n );\n\n return (\n <div className=\"r-sidebar\">\n <input\n type=\"checkbox\"\n id=\"sidebar-input\"\n className=\"r-sidebar-input\"\n hidden\n onChange={toggleHandler}\n checked={opened}\n />\n <label htmlFor=\"sidebar-input\" className=\"r-sidebar-btn\" role=\"button\" tabIndex={0}>\n <svg\n className=\"r-sidebar-chevron\"\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 <span>{menu}</span>\n </label>\n {children}\n </div>\n );\n};\n"],"names":["SidebarMenu","children","translations","menu","addListener","removeListener","useNavigate","opened","setOpened","useState","closeHandler","document","body","classList","remove","useEffect","React","createElement","className","type","id","hidden","onChange","add","checked","htmlFor","role","tabIndex","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d"],"mappings":";gFAWa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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C;CAChC;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/blockquote/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,mBAAmB,CAAC;AAE3B,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAElF,UAAU,eAAe;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;CAChC;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CA2BzE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/blockquote/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport { TYPES_DATA } from \"./data\";\n\nimport \"./blockquote.scss\";\n\nexport type BlockquoteType = \"note\" | \"tip\" | \"important\" | \"warning\" | \"caution\";\n\ninterface BlockquoteProps {\n className?: string;\n type?: BlockquoteType | null;\n}\n\nexport const Blockquote: React.FC<React.PropsWithChildren<BlockquoteProps>> = ({ className, type, children }) => {\n const { icon: Icon, title }
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/ui/blockquote/index.tsx"],"sourcesContent":["import React from \"react\";\nimport clsx from \"clsx\";\n\nimport { TYPES_DATA } from \"./data\";\n\nimport \"./blockquote.scss\";\n\nexport type BlockquoteType = \"note\" | \"tip\" | \"important\" | \"warning\" | \"caution\";\n\ninterface BlockquoteProps {\n className?: string;\n type?: BlockquoteType | null;\n}\n\nexport const Blockquote: React.FC<React.PropsWithChildren<BlockquoteProps>> = ({ className, type, children }) => {\n const { icon: Icon, title } =\n type && type in TYPES_DATA ? TYPES_DATA[type] : ({} as { icon: undefined; title: undefined });\n\n return (\n <blockquote className={clsx(\"r-blockquote\", type && `r-blockquote-${type}`, className)}>\n {title && Icon && (\n <p className=\"r-blockquote-title\">\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-blockquote-icon\"\n >\n <Icon />\n </svg>\n {title}\n </p>\n )}\n {children}\n </blockquote>\n );\n};\n"],"names":["Blockquote","className","type","children","icon","Icon","title","TYPES_DATA","React","createElement","clsx","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin"],"mappings":"gFAcO,MAAMA,EAAiE,EAAGC,YAAWC,OAAMC,eAC9F,MAAQC,KAAMC,EAAIC,MAAEA,GAChBJ,GAAQA,KAAQK,EAAaA,EAAWL,GAAS,CAAA,EAErD,OACIM,EAAAC,cAAA,aAAA,CAAYR,UAAWS,EAAK,eAAgBR,GAAQ,gBAAgBA,IAAQD,IACvEK,GAASD,GACNG,EAAGC,cAAA,IAAA,CAAAR,UAAU,sBACTO,EAAAC,cAAA,MAAA,CACIE,MAAM,KACNC,OAAO,KACPC,QAAQ,YACRC,KAAK,OACLC,OAAO,eACPC,YAAY,IACZC,cAAc,QACdC,eAAe,QACfjB,UAAU,qBAEVO,EAACC,cAAAJ,SAEJC,GAGRH,EAEP"}
|
|
@@ -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;
|
|
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,UAAU,eAAe;IACrB,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,CA2ChD,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import e,{useState as t}from"react";import o from"clsx";import{Tooltip as r}from"../tooltip/index.js";const n=({translations:n,raw:c,className:a})=>{const{copy:l="Copy",codeCopied:i="Code Copied"}=n||{},[s,m]=t(null);return e.createElement("button",{tabIndex:-1,onClick:()=>{s&&clearTimeout(s),m(setTimeout((()=>{m(null)}),1500)),navigator.clipboard.writeText(c)},className:o("copy-button",s&&"_active",a)},e.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("title",null,l),e.createElement("g",{className:"copy-button-success"},e.createElement("path",{d:"M20 6 9 17l-5-5"})),e.createElement("g",{className:"copy-button-base"},e.createElement("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}),e.createElement("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}))),e.createElement(r,{position:"bottom-end",visible:Boolean(s)},i))};export{n as CopyButton};
|
|
2
|
+
import e,{useState as t}from"react";import o from"clsx";import{Tooltip as r}from"../tooltip/index.js";const n=({translations:n,raw:c,className:a})=>{const{copy:l="Copy",codeCopied:i="Code Copied"}=n||{},[s,m]=t(null);return e.createElement("button",{tabIndex:-1,onClick:()=>{s&&clearTimeout(s),m(setTimeout((()=>{m(null)}),1500)),navigator.clipboard.writeText(c)},className:o("r-copy-button r-no-js",s&&"_active",a)},e.createElement("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("title",null,l),e.createElement("g",{className:"r-copy-button-success"},e.createElement("path",{d:"M20 6 9 17l-5-5"})),e.createElement("g",{className:"r-copy-button-base"},e.createElement("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}),e.createElement("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}))),e.createElement(r,{position:"bottom-end",visible:Boolean(s)},i))};export{n as CopyButton};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -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
|
|
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\ninterface 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 >\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,CAAMA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAwC,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAcC,CAAKC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CACvE,CAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAEA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMC,CAAEA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAa,CAAkBJ,C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A,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAASC,CAAQ7B,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAC3CD,GAGZ"}
|
|
@@ -1 +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;KAC3B,CAAC;CACL;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,
|
|
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;KAC3B,CAAC;CACL;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAyB5C,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
|
|
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:n})=>{const{filenameCopied:l="Filename Copied"}=r||{},[m,s]=e(null);return t.createElement("button",{tabIndex:-1,onClick:()=>{m&&clearTimeout(m),s(setTimeout((()=>{s(null)}),1500)),navigator.clipboard.writeText(a)},className:o("r-copy-text r-no-js _to-right",m&&"_active",n)},a,t.createElement(i,{position:"bottom-start",visible:Boolean(m)},l))};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
|
|
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","createElement","Tooltip","position","visible","Boolean"],"mappings":";sGAkBO,CAAMA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAoC,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAcC,CAAMC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CACpE,MAAMC,CAAEA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAiB,CAAsBH,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAgB,CAAA,CAAA,CAAA,CACxDI,CAAaC,CAAAA,CAAAA,CAAAA,CAAkBC,CAAgC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAWtE,CACIC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,yBACIC,CAAAA,CAAAA,CAAAA,CAAAA,CAAA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,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAQ,CAAAC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAS,CAAeC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAASC,CAAQhB,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAC7CD,GAGZ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import e from"react";import t from"clsx";import{saveTab as a}from"../../../../core/utils/tabs-
|
|
2
|
+
import e from"react";import t from"clsx";import{saveTab as a}from"../../../../core/utils/tabs-tools.js";const r={code:"r-tab-header-code"},s=({tabs:s,tabsTypeId:o,type:m})=>e.createElement("div",{className:"r-tabs-header"},s.map((s=>e.createElement("div",{key:s.id,className:t(`r-tab-header r-tab-header_${s.id} r-no-js`,m&&r[m]),onClick:()=>(e=>{Array.from(document.documentElement.classList).forEach((e=>{e.startsWith(`r-tabs-global__${o}`)&&document.documentElement.classList.remove(e)})),document.documentElement.classList.add(`r-tabs-global__${o}`,`r-tabs-global__${o}_${e}`),a(o,e)})(s.id)},s.name))));export{s as TabsHeader};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/components/ui/tabs/tabs-header/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport clsx from \"clsx\";\nimport { saveTab } from \"@src/core/utils/tabs-
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/ui/tabs/tabs-header/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport clsx from \"clsx\";\nimport { saveTab } from \"@src/core/utils/tabs-tools\";\n\nexport interface TabsHeaderProps {\n tabs: { name: string; id: string }[];\n tabsTypeId: string;\n type?: \"code\";\n}\n\nconst typeClassNames = {\n code: \"r-tab-header-code\",\n};\n\nexport const TabsHeader: React.FC<TabsHeaderProps> = ({ tabs, tabsTypeId, type }) => {\n const changeTabHandler = (tab: string) => {\n const classNames = Array.from(document.documentElement.classList);\n classNames.forEach((className) => {\n if (className.startsWith(`r-tabs-global__${tabsTypeId}`)) {\n document.documentElement.classList.remove(className);\n }\n });\n document.documentElement.classList.add(`r-tabs-global__${tabsTypeId}`, `r-tabs-global__${tabsTypeId}_${tab}`);\n saveTab(tabsTypeId, tab);\n };\n\n return (\n <div className=\"r-tabs-header\">\n {tabs.map((tab) => (\n <div\n key={tab.id}\n className={clsx(`r-tab-header r-tab-header_${tab.id} r-no-js`, type && typeClassNames[type])}\n onClick={() => changeTabHandler(tab.id)}\n >\n {tab.name}\n </div>\n ))}\n </div>\n );\n};\n"],"names":["typeClassNames","code","TabsHeader","tabs","tabsTypeId","type","React","createElement","className","map","tab","key","id","clsx","onClick","Array","from","document","documentElement","classList","forEach","startsWith","remove","add","saveTab","changeTabHandler","name"],"mappings":";wGAYA,MAAMA,CAAiB,CAAA,CACnBC,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAGGC,EAAwC,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAMC,CAAYC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAalEC,EAAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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E,MAAM,QAAQ,CAAC;AAEpC,eAAO,MAAM,cAAc,UAAW,KAAK,KAAG,MAgB7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-tools.js","sources":["../../../src/core/utils/content-tools.ts"],"sourcesContent":["import { type Token } from \"marked\";\n\nexport const parseTokenText = (token: Token): string => {\n if (!token) return \"\";\n\n if (\"tokens\" in token) {\n return token.tokens?.map((el) => parseTokenText(el)).join(\"\") || \"\";\n }\n\n if (\"text\" in token) {\n return token.text;\n }\n\n if (\"raw\" in token) {\n return token.raw;\n }\n\n return \"\";\n};\n"],"names":["parseTokenText","token","tokens","map","el","join","text","raw"],"mappings":"AAEa,MAAAA,EAAkBC,GACtBA,EAED,WAAYA,EACLA,EAAMC,QAAQC,KAAKC,GAAOJ,EAAeI,KAAKC,KAAK,KAAO,GAGjE,SAAUJ,EACHA,EAAMK,KAGb,QAASL,EACFA,EAAMM,IAGV,GAdY"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BaseProvider } from "../providers/base";
|
|
2
|
-
type
|
|
2
|
+
type GetMetadataOptions = {
|
|
3
3
|
uri: string;
|
|
4
4
|
provider?: BaseProvider;
|
|
5
5
|
content?: undefined;
|
|
@@ -8,6 +8,6 @@ type GetMetaOptions = {
|
|
|
8
8
|
provider?: undefined;
|
|
9
9
|
content: string;
|
|
10
10
|
};
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const getMetadata: (opts: GetMetadataOptions) => Promise<Record<string, string>>;
|
|
12
12
|
export {};
|
|
13
|
-
//# sourceMappingURL=get-
|
|
13
|
+
//# sourceMappingURL=get-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-metadata.d.ts","sourceRoot":"","sources":["../../../src/core/utils/get-metadata.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,KAAK,kBAAkB,GACjB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,YAAY,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GAC7D;IAAE,GAAG,CAAC,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,eAAO,MAAM,WAAW,SAAgB,kBAAkB,oCAsCzD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import t from"gray-matter";import{lexer as o}from"marked";import{set as r}from"dot-prop";import{loadContent as e}from"./load-content.js";import{parseTokenText as n}from"./content-tools.js";const i=async i=>{const{uri:a,provider:s,content:c}=i,{data:d}=a?await e(a,s):{data:c};if(!d)throw new Error("Robindoc: Please provide content or valid URI");const{content:p,data:m}=t(d),f=o(p),l=Object.entries(f.links).reduce(((t,o)=>{const[e,n]=o,i=n.title,a=e.startsWith("robin.")&&e.substring(6);return i&&a&&r(t,a,i),t}),m);if(!l.title){const t=f.find((t=>"heading"===t.type&&1===t.depth));t?.text&&(l.title=n(t))}if(!l.description){const t=f.find((t=>"paragraph"===t.type));t?.text&&(l.description=n(t))}return l};export{i as getMetadata};
|
|
2
|
+
//# sourceMappingURL=get-metadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-metadata.js","sources":["../../../src/core/utils/get-metadata.ts"],"sourcesContent":["import matter from \"gray-matter\";\nimport { lexer, Tokens } from \"marked\";\nimport { set } from \"dot-prop\";\n\nimport { type BaseProvider } from \"../providers/base\";\nimport { loadContent } from \"./load-content\";\nimport { parseTokenText } from \"./content-tools\";\n\ntype GetMetadataOptions =\n | { uri: string; provider?: BaseProvider; content?: undefined }\n | { uri?: undefined; provider?: undefined; content: string };\n\nexport const getMetadata = async (opts: GetMetadataOptions) => {\n const { uri, provider, content } = opts;\n const { data } = uri ? await loadContent(uri, provider) : { data: content };\n\n if (!data) {\n throw new Error(\"Robindoc: Please provide content or valid URI\");\n }\n\n const { content: matterContent, data: matterData } = matter(data);\n const tree = lexer(matterContent);\n\n const robinData = Object.entries(tree.links).reduce<Record<string, string>>((acc, cur) => {\n const [key, value] = cur;\n const content = value.title;\n const metaKey = key.startsWith(\"robin.\") && key.substring(6);\n\n if (content && metaKey) {\n set(acc, metaKey, content);\n }\n\n return acc;\n }, matterData);\n\n if (!robinData.title) {\n const pageHeading = tree.find((el) => el.type === \"heading\" && el.depth === 1) as Tokens.Heading | undefined;\n if (pageHeading?.text) {\n robinData.title = parseTokenText(pageHeading);\n }\n }\n\n if (!robinData.description) {\n const firstParagraph = tree.find((el) => el.type === \"paragraph\") as Tokens.Heading | undefined;\n if (firstParagraph?.text) {\n robinData.description = parseTokenText(firstParagraph);\n }\n }\n\n return robinData;\n};\n"],"names":["getMetadata","async","opts","uri","provider","content","data","loadContent","Error","matterContent","matterData","matter","tree","lexer","robinData","Object","entries","links","reduce","acc","cur","key","value","title","metaKey","startsWith","substring","set","pageHeading","find","el","type","depth","text","parseTokenText","description","firstParagraph"],"mappings":"mMAYaA,EAAcC,MAAOC,IAC9B,MAAMC,IAAEA,EAAGC,SAAEA,EAAQC,QAAEA,GAAYH,GAC7BI,KAAEA,GAASH,QAAYI,EAAYJ,EAAKC,GAAY,CAAEE,KAAMD,GAElE,IAAKC,EACD,MAAM,IAAIE,MAAM,iDAGpB,MAAQH,QAASI,EAAeH,KAAMI,GAAeC,EAAOL,GACtDM,EAAOC,EAAMJ,GAEbK,EAAYC,OAAOC,QAAQJ,EAAKK,OAAOC,QAA+B,CAACC,EAAKC,KAC9E,MAAOC,EAAKC,GAASF,EACff,EAAUiB,EAAMC,MAChBC,EAAUH,EAAII,WAAW,WAAaJ,EAAIK,UAAU,GAM1D,OAJIrB,GAAWmB,GACXG,EAAIR,EAAKK,EAASnB,GAGfc,CAAG,GACXT,GAEH,IAAKI,EAAUS,MAAO,CAClB,MAAMK,EAAchB,EAAKiB,MAAMC,GAAmB,YAAZA,EAAGC,MAAmC,IAAbD,EAAGE,QAC9DJ,GAAaK,OACbnB,EAAUS,MAAQW,EAAeN,GAExC,CAED,IAAKd,EAAUqB,YAAa,CACxB,MAAMC,EAAiBxB,EAAKiB,MAAMC,GAAmB,cAAZA,EAAGC,OACxCK,GAAgBH,OAChBnB,EAAUqB,YAAcD,EAAeE,GAE9C,CAED,OAAOtB,CAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/git-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,QAAS,MAAM;;;;;;;;;CAQxC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const t=t=>t.match(/^https?:\/\/github.com/)?{name:"GitHub",key:"github"}:t.match(/^https?:\/\/gitlab.com/)?{name:"GitLab",key:"gitlab"}:{name:"Git",key:"git"};export{t as detectGitType};
|
|
2
|
-
//# sourceMappingURL=git-
|
|
2
|
+
//# sourceMappingURL=git-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-tools.js","sources":["../../../src/core/utils/git-tools.ts"],"sourcesContent":["export const detectGitType = (uri: string) => {\n if (uri.match(/^https?:\\/\\/github.com/)) {\n return { name: \"GitHub\", key: \"github\" } as const;\n } else if (uri.match(/^https?:\\/\\/gitlab.com/)) {\n return { name: \"GitLab\", key: \"gitlab\" } as const;\n } else {\n return { name: \"Git\", key: \"git\" } as const;\n }\n};\n"],"names":["detectGitType","uri","match","name","key"],"mappings":"AAAa,MAAAA,EAAiBC,GACtBA,EAAIC,MAAM,0BACH,CAAEC,KAAM,SAAUC,IAAK,UACvBH,EAAIC,MAAM,0BACV,CAAEC,KAAM,SAAUC,IAAK,UAEvB,CAAED,KAAM,MAAOC,IAAK"}
|
|
@@ -9,13 +9,13 @@ type SidebarProps = Omit<SidebarPropsBase, "tree">;
|
|
|
9
9
|
export declare const initializeRobindoc: (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {
|
|
10
10
|
Page: React.FC<PageProps>;
|
|
11
11
|
Sidebar: React.FC<SidebarProps>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
getStaticParams: <T extends string = "segments">(prefix?: string, segmentsParamKey?: T) => Promise<Record<T, string[]>[]>;
|
|
13
|
+
getMetadata: (pathname: string) => Promise<Record<string, string>>;
|
|
14
|
+
getPageData: (pathname: string) => Promise<{
|
|
15
15
|
title: string;
|
|
16
|
-
|
|
16
|
+
raw: string;
|
|
17
17
|
}>;
|
|
18
|
-
|
|
18
|
+
getPageInstruction: (pathname: string) => Promise<import("../types/content").Page>;
|
|
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;
|
|
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,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAOpD,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;AAUnD,eAAO,MAAM,kBAAkB,sBAAuB,SAAS,GAAG,CAAC,MAAM,SAAS,GAAG,QAAQ,SAAS,CAAC,CAAC;;;8DAoDxF,MAAM,qBACI,CAAC;4BAiBc,MAAM;4BAgBN,MAAM;;;;mCAeC,MAAM;CAarD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"react";import{Article as e}from"../../components/elements/article/index.js";import{Sidebar as r}from"../../components/elements/sidebar/index.js";import{parseStructure as a}from"./parse-structure.js";import{getConfiguration as n}from"./get-configuration.js";import{
|
|
1
|
+
import t from"react";import{Article as e}from"../../components/elements/article/index.js";import{Sidebar as r}from"../../components/elements/sidebar/index.js";import{parseStructure as a}from"./parse-structure.js";import{getConfiguration as n}from"./get-configuration.js";import{getMetadata as i}from"./get-metadata.js";import{normalizePathname as o,removeTrailingSlash as s}from"./path-tools.js";import{loadContent as c}from"./load-content.js";const u=u=>{const p=(async t=>"function"==typeof t?t():t)(u).then((t=>a(t.items||[],n(t.configuration||{}))));return{Page:async({pathname:r,...a})=>{const{pages:n}=await p,i=o(r),s=n[i];if(!s)throw new Error(`Can not find data for "${i}". Please check structure`);const c=Object.keys(n),u=c.indexOf(i),m=c[u-1],f=u<c.length-1&&c[u+1],d=m&&{pathname:m,title:n[m].title},g=f&&{pathname:f,title:n[f].title},l=s.crumbs.map((t=>({title:n[t].title,pathname:t}))),h=Object.entries(n).reduce(((t,[e,{origPath:r}])=>(r&&t.push({clientPath:e,origPath:r}),t)),[]);return t.createElement(e,{pathname:i,provider:s.configuration.provider,uri:s.uri,title:s.title,breadcrumbs:l,prev:d||void 0,next:g||void 0,pages:h,...a})},Sidebar:async e=>{const{tree:a}=await p;return t.createElement(r,{tree:a,...e})},getStaticParams:async(t="",e="segments")=>{const{pages:r}=await p,a=Object.keys(r),n=s(t);return a.reduce(((t,r)=>r.startsWith(n)?(t.push({[e]:r.substring(n.length+1).split("/")}),t):t),[])},getMetadata:async t=>{const{pages:e}=await p,r=o(t),a=e[r];if(!a)throw new Error(`Can not find data for "${r}". Please check structure`);return await i({uri:a.uri,provider:a.configuration.provider})},getPageData:async t=>{const{pages:e}=await p,r=o(t),a=e[r];if(!a)throw new Error(`Can not find data for "${r}". Please check structure`);const n=a.title,{data:i}=await c(a.uri,a.configuration.provider);return{title:n,raw:i}},getPageInstruction:async t=>{const{pages:e}=await p,r=o(t),a=e[r];if(!a)throw new Error(`Can not find data for "${r}". Please check structure`);return a}}};export{u 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\";\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\";\nimport { type Structure } from \"../types/structure\";\nimport { parseStructure } from \"./parse-structure\";\nimport { getConfiguration } from \"./get-configuration\";\nimport {
|
|
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,MAAMC,GAClEC,EAAeD,EAAUE,OAAS,GAAIC,EAAiBH,EAAUI,eAAiB,CAAA,MA+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,CAAEZ,SAAUY,EAAkBI,MAAOd,EAAMU,GAAkBI,OACxFC,EAAOJ,GAAoB,CAAEb,SAAUa,EAAkBG,MAAOd,EAAMW,GAAkBG,OAExFE,EAAcb,EAAgBc,OAAOC,KAAKC,IAAK,CAAQL,MAAOd,EAAMmB,GAAOL,MAAOhB,SAAUqB,MAC5FC,EAAcd,OAAOe,QAAQrB,GAAOsB,QACtC,CAACC,GAAMC,GAAcC,gBACbA,GAAUF,EAAIG,KAAK,CAAEF,aAAYC,aAC9BF,IAEX,IAGJ,OACII,gBAACC,EAAW,CACR9B,SAAUG,EACV4B,SAAU1B,EAAgBP,cAAciC,SACxCC,IAAK3B,EAAgB2B,IACrBhB,MAAOX,EAAgBW,MACvBE,YAAaA,EACbH,KAAMA,QAAQkB,EACdhB,KAAMA,QAAQgB,EACd/B,MAAOoB,KACHrB,GAEV,EAuEOiC,QApE2B3C,MAAOU,IAC3C,MAAMkC,KAAEA,SAAe7C,EAEvB,OAAOuC,EAAAO,c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AAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,WAAW,QAAe,MAAM,gBAAgB,YAAY,SAAS,MAAM;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"load-content.d.ts","sourceRoot":"","sources":["../../../src/core/utils/load-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,eAAO,MAAM,WAAW,QAAe,MAAM,gBAAgB,YAAY,SAAS,MAAM;;;;;;;;;;;;;;;;EA4BvF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-content.js","sources":["../../../src/core/utils/load-content.ts"],"sourcesContent":["import { type BaseProvider } from \"../providers/base\";\nimport { GithubProvider } from \"../providers/github\";\nimport { FileSystemProvider } from \"../providers\";\n\nexport const loadContent = async (uri: string, providerArg?: BaseProvider, root?: string) => {\n if (providerArg) {\n const content = await providerArg.load(uri);\n return { data: content, type: providerArg.type, provider: providerArg };\n }\n if (uri.startsWith(\"https://github.com/\")) {\n const provider = new GithubProvider(uri);\n if (provider.pathname) {\n const content = await provider.load(provider.pathname);\n return { data: content, type: \"remote\", provider };\n } else {\n throw new Error(\"Can not load content\");\n }\n }\n if (uri.match(/https?:\\/\\//)) {\n const resp = await fetch(uri);\n if (!resp.ok) {\n throw new Error(\"Can not load content\");\n }\n const content = await resp.text();\n return { data: content, type: \"remote\", provider: null };\n }\n\n const provider = new FileSystemProvider(root);\n const content = await provider.load(uri);\n return { data: content, type: \"local\", provider };\n};\n"],"names":["loadContent","async","uri","providerArg","root","data","load","type","provider","startsWith","GithubProvider","pathname","Error","match","resp","fetch","ok","text","FileSystemProvider"],"mappings":"yHAIO,MAAMA,EAAcC,MAAOC,EAAaC,EAA4BC,KACvE,GAAID,EAAa,CAEb,MAAO,CAAEE,WADaF,EAAYG,KAAKJ,GACfK,KAAMJ,EAAYI,KAAMC,SAAUL,EAC7D,
|
|
1
|
+
{"version":3,"file":"load-content.js","sources":["../../../src/core/utils/load-content.ts"],"sourcesContent":["import { type BaseProvider } from \"../providers/base\";\nimport { GithubProvider } from \"../providers/github\";\nimport { FileSystemProvider } from \"../providers\";\n\nexport const loadContent = async (uri: string, providerArg?: BaseProvider, root?: string) => {\n if (providerArg) {\n const content = await providerArg.load(uri);\n return { data: content, type: providerArg.type, provider: providerArg };\n }\n\n if (uri.startsWith(\"https://github.com/\")) {\n const provider = new GithubProvider(uri);\n if (provider.pathname) {\n const content = await provider.load(provider.pathname);\n return { data: content, type: \"remote\", provider };\n } else {\n throw new Error(\"Can not load content\");\n }\n }\n\n if (uri.match(/https?:\\/\\//)) {\n const resp = await fetch(uri);\n if (!resp.ok) {\n throw new Error(\"Can not load content\");\n }\n const content = await resp.text();\n return { data: content, type: \"remote\", provider: null };\n }\n\n const provider = new FileSystemProvider(root);\n const content = await provider.load(uri);\n return { data: content, type: \"local\", provider };\n};\n"],"names":["loadContent","async","uri","providerArg","root","data","load","type","provider","startsWith","GithubProvider","pathname","Error","match","resp","fetch","ok","text","FileSystemProvider"],"mappings":"yHAIO,MAAMA,EAAcC,MAAOC,EAAaC,EAA4BC,KACvE,GAAID,EAAa,CAEb,MAAO,CAAEE,WADaF,EAAYG,KAAKJ,GACfK,KAAMJ,EAAYI,KAAMC,SAAUL,EAC7D,CAED,GAAID,EAAIO,WAAW,uBAAwB,CACvC,MAAMD,EAAW,IAAIE,EAAeR,GACpC,GAAIM,EAASG,SAAU,CAEnB,MAAO,CAAEN,WADaG,EAASF,KAAKE,EAASG,UACrBJ,KAAM,SAAUC,WAC3C,CACG,MAAM,IAAII,MAAM,uBAEvB,CAED,GAAIV,EAAIW,MAAM,eAAgB,CAC1B,MAAMC,QAAaC,MAAMb,GACzB,IAAKY,EAAKE,GACN,MAAM,IAAIJ,MAAM,wBAGpB,MAAO,CAAEP,WADaS,EAAKG,OACHV,KAAM,SAAUC,SAAU,KACrD,CAED,MAAMA,EAAW,IAAIU,EAAmBd,GAExC,MAAO,CAAEC,WADaG,EAASF,KAAKJ,GACZK,KAAM,QAASC,WAAU"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{getConfiguration as t}from"./get-configuration.js";import{
|
|
1
|
+
import{getConfiguration as t}from"./get-configuration.js";import{getMetadata as e}from"./get-metadata.js";import{mergePathname as r,normalizePathname as i,generatePseudoTitle as a,checkIsLinkExternal as s}from"./path-tools.js";import{loadContent as o}from"./load-content.js";const n=async(t={},c=[],p="",u)=>{const f={},h=[];if(!t.provider)return{pages:f,tree:h};const g=await t.provider.filesPromise;if(g.structures.includes(`${p}/structure.json`)){const e=await(async(t={},e="",a=[],c)=>{const p={},u=[];if(!t.provider)return{pages:p,tree:u};if((await t.provider.filesPromise).structures.includes(`${e}/structure.json`)){const f=await o(`${e}/structure.json`,t.provider);try{const o=JSON.parse(f.data);for(const f in o){const h=o[f],g=i("index"===f?e:e+"/"+f),l=r(t.basePath,g),d=i(l);if(!s(d)){const e=await(t.provider?.getPageSourcePathname(g,d));e&&(p[d]={title:h.title,uri:g,configuration:t,origPath:e,crumbs:a})}let m;if("index"!==f){const e=await n(t,[...a,d],g,c+1);m=e.tree,Object.assign(p,e.pages)}u.push({title:h.title,href:d,items:m,type:"row"})}}catch{throw new Error(`Can't parse structure "${e}/structure.json"`)}return{pages:p,tree:u}}})(t,p,c,u+1);if(e)return e}for await(const s of g.docs){const o=s.clientPath.split("/").filter(Boolean).length;if(!p&&!(o<2)||p&&!s.clientPath.match(new RegExp(`^${p.replace(/\/$/,"")}/[^/]+$`)))continue;const{clientPath:g}=s,l=r(t.basePath,g),d=i(l),m=(await e({provider:t.provider,uri:g})).title||a(d),w=await(t.provider?.getPageSourcePathname(g,d));w&&(f[d]={title:m,uri:g,configuration:t,origPath:w,crumbs:c});const P=await n(t,[...c,d],g,u+1);Object.assign(f,P.pages),u<(t.spreadedLevel||1)?h.push({title:m,href:d,type:0===u?"heading":"row"},...P.tree):h.push({title:m,href:d,items:P.tree,type:0===u?"heading":"row"})}return{pages:f,tree:h}},c=async(e,o={},p=[],u="",f=0)=>{if("auto"===e){return await n(o,p,u,f)}const h=await(async(e,o={},n=[],p,u)=>{const f={},h=[];for await(const g of e){if("string"==typeof g){const t=await c(g,o,n,p,u);Object.assign(f,t.pages),h.push(...t.tree);continue}if("separator"===g.type){h.push({type:"separator"});continue}let e=n;const l=t(g.configuration||{},o),d=g.href,m=r(l.basePath,d),w=i(m);if(!s(w)&&d){const t=await(l.provider?.getPageSourcePathname(d,w));t&&(f[w]={title:g.title||"",uri:d,configuration:l,origPath:t,crumbs:n},e=[...n,w])}let P=[];if(g.items){const t=await c(g.items,l,e,g.href,u+1);P=t.tree,Object.assign(f,t.pages)}g.hidden||(u<(o.spreadedLevel||1)?h.push({title:g.title||a(w),href:g.href?w:void 0,type:g.type},...P):h.push({title:g.title||a(w),href:g.href?w:void 0,items:P,type:g.type}))}return{pages:f,tree:h}})(e,o,p,u,f);return h};export{c as parseStructure};
|
|
2
2
|
//# sourceMappingURL=parse-structure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-structure.js","sources":["../../../src/core/utils/parse-structure.ts"],"sourcesContent":["import { type DocItem } from \"../types/structure\";\nimport { type Pages, type Crumbs, type Configuration } from \"../types/content\";\nimport { type TreeItem } from \"../../components/elements/sidebar/types\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMeta } from \"./get-meta\";\nimport { generatePseudoTitle, checkIsLinkExternal, mergePathname, normalizePathname } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\nconst parseJSONStructure = async (\n parentConfiguration: Configuration = {},\n parentPathname = \"\",\n crumbs: Crumbs = [],\n nestingLevel: number,\n) => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n if (!parentConfiguration.provider) return { pages, tree };\n\n const branchFiles = await parentConfiguration.provider.filesPromise;\n\n if (branchFiles.structures.includes(`${parentPathname}/structure.json`)) {\n const content = await loadContent(`${parentPathname}/structure.json`, parentConfiguration.provider);\n try {\n const structure: { [segment: string]: { title: string } } = JSON.parse(content.data);\n for (const segment in structure) {\n const data = structure[segment];\n const clientPath = normalizePathname(\n segment === \"index\" ? parentPathname : parentPathname + \"/\" + segment,\n );\n const pathname = mergePathname(parentConfiguration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n if (!checkIsLinkExternal(pathnameNormalized)) {\n const origPath = await parentConfiguration.provider?.getPageSourcePathname(\n clientPath,\n pathnameNormalized,\n );\n if (origPath) {\n pages[pathnameNormalized] = {\n title: data.title,\n uri: clientPath,\n configuration: parentConfiguration,\n origPath,\n crumbs,\n };\n }\n }\n\n let subTree: TreeItem[] | undefined;\n if (segment !== \"index\") {\n const subItemsData = await parseAutoStructure(\n parentConfiguration,\n [...crumbs, pathnameNormalized],\n clientPath,\n nestingLevel + 1,\n );\n subTree = subItemsData.tree;\n Object.assign(pages, subItemsData.pages);\n }\n\n tree.push({\n title: data.title,\n href: pathnameNormalized,\n items: subTree,\n type: \"row\",\n });\n }\n } catch {\n throw new Error(`Can't parse structure \"${parentPathname}/structure.json\"`);\n }\n return { pages, tree };\n }\n};\n\nconst parseAutoStructure = async (\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n parentPathname = \"\",\n nestingLevel: number,\n) => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n if (!parentConfiguration.provider) return { pages, tree };\n\n const branchFiles = await parentConfiguration.provider.filesPromise;\n\n if (branchFiles.structures.includes(`${parentPathname}/structure.json`)) {\n const jsonStructureData = await parseJSONStructure(\n parentConfiguration,\n parentPathname,\n crumbs,\n nestingLevel + 1,\n );\n if (jsonStructureData) {\n return jsonStructureData;\n }\n }\n\n for await (const generatedItem of branchFiles.docs) {\n const linkLevel = generatedItem.clientPath.split(\"/\").filter(Boolean).length;\n const topLevelLink = linkLevel < 2;\n\n if (\n (!parentPathname && !topLevelLink) ||\n (parentPathname &&\n !generatedItem.clientPath.match(new RegExp(`^${parentPathname.replace(/\\/$/, \"\")}/[^/]+$`)))\n ) {\n continue;\n }\n\n const { clientPath } = generatedItem;\n const pathname = mergePathname(parentConfiguration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n const meta = await getMeta({ provider: parentConfiguration.provider, uri: clientPath });\n const title = meta.title || generatePseudoTitle(pathnameNormalized);\n const origPath = await parentConfiguration.provider?.getPageSourcePathname(clientPath, pathnameNormalized);\n if (origPath) {\n pages[pathnameNormalized] = {\n title,\n uri: clientPath,\n configuration: parentConfiguration,\n origPath,\n crumbs,\n };\n }\n\n const subItemsData = await parseAutoStructure(\n parentConfiguration,\n [...crumbs, pathnameNormalized],\n clientPath,\n nestingLevel + 1,\n );\n Object.assign(pages, subItemsData.pages);\n\n if (nestingLevel < (parentConfiguration.spreadedLevel || 1)) {\n tree.push(\n {\n title,\n href: pathnameNormalized,\n type: nestingLevel === 0 ? \"heading\" : \"row\",\n },\n ...subItemsData.tree,\n );\n } else {\n tree.push({\n title,\n href: pathnameNormalized,\n items: subItemsData.tree,\n type: nestingLevel === 0 ? \"heading\" : \"row\",\n });\n }\n }\n\n return { pages, tree };\n};\n\nconst parseStaticStructure = async (\n items: DocItem[],\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n parentPathname: string,\n nestingLevel: number,\n): Promise<{\n pages: Pages;\n tree: TreeItem[];\n}> => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n for await (const item of items) {\n if (typeof item === \"string\") {\n const subItemsData = await parseStructure(item, parentConfiguration, crumbs, parentPathname, nestingLevel);\n Object.assign(pages, subItemsData.pages);\n tree.push(...subItemsData.tree);\n continue;\n }\n if (item.type === \"separator\") {\n tree.push({ type: \"separator\" });\n\n continue;\n }\n let subCrumbs = crumbs;\n const configuration = getConfiguration(item.configuration || {}, parentConfiguration);\n const clientPath = item.href;\n const pathname = mergePathname(configuration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n if (!checkIsLinkExternal(pathnameNormalized) && clientPath) {\n const origPath = await configuration.provider?.getPageSourcePathname(clientPath, pathnameNormalized);\n\n if (origPath) {\n pages[pathnameNormalized] = {\n title: item.title || \"\",\n uri: clientPath,\n configuration,\n origPath,\n crumbs,\n };\n subCrumbs = [...crumbs, pathnameNormalized];\n }\n }\n\n let subTree: TreeItem[] = [];\n if (item.items) {\n const subItemsData = await parseStructure(\n item.items,\n configuration,\n subCrumbs,\n item.href,\n nestingLevel + 1,\n );\n subTree = subItemsData.tree;\n Object.assign(pages, subItemsData.pages);\n }\n\n if (!item.hidden) {\n if (nestingLevel < (parentConfiguration.spreadedLevel || 1)) {\n tree.push(\n {\n title: item.title || generatePseudoTitle(pathnameNormalized),\n href: item.href ? pathnameNormalized : undefined,\n type: item.type,\n },\n ...subTree,\n );\n } else {\n tree.push({\n title: item.title || generatePseudoTitle(pathnameNormalized),\n href: item.href ? pathnameNormalized : undefined,\n items: subTree,\n type: item.type,\n });\n }\n }\n }\n\n return { pages, tree };\n};\n\nexport const parseStructure = async (\n items: DocItem[] | \"auto\",\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n pathname: string = \"\",\n nestingLevel: number = 0,\n) => {\n if (items === \"auto\") {\n const structureData = await parseAutoStructure(parentConfiguration, crumbs, pathname, nestingLevel);\n return structureData;\n }\n\n const structureData = await parseStaticStructure(items, parentConfiguration, crumbs, pathname, nestingLevel);\n return structureData;\n};\n"],"names":["parseAutoStructure","async","parentConfiguration","crumbs","parentPathname","nestingLevel","pages","tree","provider","branchFiles","filesPromise","structures","includes","jsonStructureData","content","loadContent","structure","JSON","parse","data","segment","clientPath","normalizePathname","pathname","mergePathname","basePath","pathnameNormalized","checkIsLinkExternal","origPath","getPageSourcePathname","title","uri","configuration","subTree","subItemsData","Object","assign","push","href","items","type","Error","parseJSONStructure","generatedItem","docs","linkLevel","split","filter","Boolean","length","match","RegExp","replace","getMeta","generatePseudoTitle","spreadedLevel","parseStructure","structureData","item","subCrumbs","getConfiguration","hidden","undefined","parseStaticStructure"],"mappings":"2QAQA,MAmEMA,EAAqBC,MACvBC,EAAqC,GACrCC,EAAiB,GACjBC,EAAiB,GACjBC,KAEA,MAAMC,EAAe,CAAA,EACfC,EAAmB,GAEzB,IAAKL,EAAoBM,SAAU,MAAO,CAAEF,QAAOC,QAEnD,MAAME,QAAoBP,EAAoBM,SAASE,aAEvD,GAAID,EAAYE,WAAWC,SAAS,GAAGR,oBAAkC,CACrE,MAAMS,OAjFaZ,OACvBC,EAAqC,GACrCE,EAAiB,GACjBD,EAAiB,GACjBE,KAEA,MAAMC,EAAe,CAAA,EACfC,EAAmB,GAEzB,IAAKL,EAAoBM,SAAU,MAAO,CAAEF,QAAOC,QAInD,UAF0BL,EAAoBM,SAASE,cAEvCC,WAAWC,SAAS,GAAGR,oBAAkC,CACrE,MAAMU,QAAgBC,EAAY,GAAGX,mBAAiCF,EAAoBM,UAC1F,IACI,MAAMQ,EAAsDC,KAAKC,MAAMJ,EAAQK,MAC/E,IAAK,MAAMC,KAAWJ,EAAW,CAC7B,MAAMG,EAAOH,EAAUI,GACjBC,EAAaC,EACH,UAAZF,EAAsBhB,EAAiBA,EAAiB,IAAMgB,GAE5DG,EAAWC,EAActB,EAAoBuB,SAAUJ,GACvDK,EAAqBJ,EAAkBC,GAE7C,IAAKI,EAAoBD,GAAqB,CAC1C,MAAME,QAAiB1B,EAAoBM,UAAUqB,sBACjDR,EACAK,IAEAE,IACAtB,EAAMoB,GAAsB,CACxBI,MAAOX,EAAKW,MACZC,IAAKV,EACLW,cAAe9B,EACf0B,WACAzB,UAGX,CAED,IAAI8B,EACJ,GAAgB,UAAZb,EAAqB,CACrB,MAAMc,QAAqBlC,EACvBE,EACA,IAAIC,EAAQuB,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EAAKG,SACFxD,GAAgBH,EAAoBqD,eAAiB,GACrDhD,EAAK8B,KACD,CACIP,MAAO4B,EAAK5B,OAASwB,EAAoB5B,GACzCY,KAAMoB,EAAKpB,KAAOZ,OAAqBoC,EACvCtB,KAAMkB,EAAKlB,SAEZP,GAGP1B,EAAK8B,KAAK,CACNP,MAAO4B,EAAK5B,OAASwB,EAAoB5B,GACzCY,KAAMoB,EAAKpB,KAAOZ,OAAqBoC,EACvCvB,MAAON,EACPO,KAAMkB,EAAKlB,OAI1B,CAED,MAAO,CAAElC,QAAOC,OAAM,EAeMwD,CAAqBxB,EAAOrC,EAAqBC,EAAQoB,EAAUlB,GAC/F,OAAOoD,CAAa"}
|
|
1
|
+
{"version":3,"file":"parse-structure.js","sources":["../../../src/core/utils/parse-structure.ts"],"sourcesContent":["import { type DocItem } from \"../types/structure\";\nimport { type Pages, type Crumbs, type Configuration } from \"../types/content\";\nimport { type TreeItem } from \"../../components/elements/sidebar/types\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMetadata } from \"./get-metadata\";\nimport { generatePseudoTitle, checkIsLinkExternal, mergePathname, normalizePathname } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\nconst parseJSONStructure = async (\n parentConfiguration: Configuration = {},\n parentPathname = \"\",\n crumbs: Crumbs = [],\n nestingLevel: number,\n) => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n if (!parentConfiguration.provider) return { pages, tree };\n\n const branchFiles = await parentConfiguration.provider.filesPromise;\n\n if (branchFiles.structures.includes(`${parentPathname}/structure.json`)) {\n const content = await loadContent(`${parentPathname}/structure.json`, parentConfiguration.provider);\n try {\n const structure: { [segment: string]: { title: string } } = JSON.parse(content.data);\n for (const segment in structure) {\n const data = structure[segment];\n const clientPath = normalizePathname(\n segment === \"index\" ? parentPathname : parentPathname + \"/\" + segment,\n );\n const pathname = mergePathname(parentConfiguration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n if (!checkIsLinkExternal(pathnameNormalized)) {\n const origPath = await parentConfiguration.provider?.getPageSourcePathname(\n clientPath,\n pathnameNormalized,\n );\n if (origPath) {\n pages[pathnameNormalized] = {\n title: data.title,\n uri: clientPath,\n configuration: parentConfiguration,\n origPath,\n crumbs,\n };\n }\n }\n\n let subTree: TreeItem[] | undefined;\n if (segment !== \"index\") {\n const subItemsData = await parseAutoStructure(\n parentConfiguration,\n [...crumbs, pathnameNormalized],\n clientPath,\n nestingLevel + 1,\n );\n subTree = subItemsData.tree;\n Object.assign(pages, subItemsData.pages);\n }\n\n tree.push({\n title: data.title,\n href: pathnameNormalized,\n items: subTree,\n type: \"row\",\n });\n }\n } catch {\n throw new Error(`Can't parse structure \"${parentPathname}/structure.json\"`);\n }\n return { pages, tree };\n }\n};\n\nconst parseAutoStructure = async (\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n parentPathname = \"\",\n nestingLevel: number,\n) => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n if (!parentConfiguration.provider) return { pages, tree };\n\n const branchFiles = await parentConfiguration.provider.filesPromise;\n\n if (branchFiles.structures.includes(`${parentPathname}/structure.json`)) {\n const jsonStructureData = await parseJSONStructure(\n parentConfiguration,\n parentPathname,\n crumbs,\n nestingLevel + 1,\n );\n if (jsonStructureData) {\n return jsonStructureData;\n }\n }\n\n for await (const generatedItem of branchFiles.docs) {\n const linkLevel = generatedItem.clientPath.split(\"/\").filter(Boolean).length;\n const topLevelLink = linkLevel < 2;\n\n if (\n (!parentPathname && !topLevelLink) ||\n (parentPathname &&\n !generatedItem.clientPath.match(new RegExp(`^${parentPathname.replace(/\\/$/, \"\")}/[^/]+$`)))\n ) {\n continue;\n }\n\n const { clientPath } = generatedItem;\n const pathname = mergePathname(parentConfiguration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n const metadata = await getMetadata({ provider: parentConfiguration.provider, uri: clientPath });\n const title = metadata.title || generatePseudoTitle(pathnameNormalized);\n const origPath = await parentConfiguration.provider?.getPageSourcePathname(clientPath, pathnameNormalized);\n if (origPath) {\n pages[pathnameNormalized] = {\n title,\n uri: clientPath,\n configuration: parentConfiguration,\n origPath,\n crumbs,\n };\n }\n\n const subItemsData = await parseAutoStructure(\n parentConfiguration,\n [...crumbs, pathnameNormalized],\n clientPath,\n nestingLevel + 1,\n );\n Object.assign(pages, subItemsData.pages);\n\n if (nestingLevel < (parentConfiguration.spreadedLevel || 1)) {\n tree.push(\n {\n title,\n href: pathnameNormalized,\n type: nestingLevel === 0 ? \"heading\" : \"row\",\n },\n ...subItemsData.tree,\n );\n } else {\n tree.push({\n title,\n href: pathnameNormalized,\n items: subItemsData.tree,\n type: nestingLevel === 0 ? \"heading\" : \"row\",\n });\n }\n }\n\n return { pages, tree };\n};\n\nconst parseStaticStructure = async (\n items: DocItem[],\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n parentPathname: string,\n nestingLevel: number,\n): Promise<{\n pages: Pages;\n tree: TreeItem[];\n}> => {\n const pages: Pages = {};\n const tree: TreeItem[] = [];\n\n for await (const item of items) {\n if (typeof item === \"string\") {\n const subItemsData = await parseStructure(item, parentConfiguration, crumbs, parentPathname, nestingLevel);\n Object.assign(pages, subItemsData.pages);\n tree.push(...subItemsData.tree);\n continue;\n }\n if (item.type === \"separator\") {\n tree.push({ type: \"separator\" });\n\n continue;\n }\n let subCrumbs = crumbs;\n const configuration = getConfiguration(item.configuration || {}, parentConfiguration);\n const clientPath = item.href;\n const pathname = mergePathname(configuration.basePath, clientPath);\n const pathnameNormalized = normalizePathname(pathname);\n\n if (!checkIsLinkExternal(pathnameNormalized) && clientPath) {\n const origPath = await configuration.provider?.getPageSourcePathname(clientPath, pathnameNormalized);\n\n if (origPath) {\n pages[pathnameNormalized] = {\n title: item.title || \"\",\n uri: clientPath,\n configuration,\n origPath,\n crumbs,\n };\n subCrumbs = [...crumbs, pathnameNormalized];\n }\n }\n\n let subTree: TreeItem[] = [];\n if (item.items) {\n const subItemsData = await parseStructure(\n item.items,\n configuration,\n subCrumbs,\n item.href,\n nestingLevel + 1,\n );\n subTree = subItemsData.tree;\n Object.assign(pages, subItemsData.pages);\n }\n\n if (!item.hidden) {\n if (nestingLevel < (parentConfiguration.spreadedLevel || 1)) {\n tree.push(\n {\n title: item.title || generatePseudoTitle(pathnameNormalized),\n href: item.href ? pathnameNormalized : undefined,\n type: item.type,\n },\n ...subTree,\n );\n } else {\n tree.push({\n title: item.title || generatePseudoTitle(pathnameNormalized),\n href: item.href ? pathnameNormalized : undefined,\n items: subTree,\n type: item.type,\n });\n }\n }\n }\n\n return { pages, tree };\n};\n\nexport const parseStructure = async (\n items: DocItem[] | \"auto\",\n parentConfiguration: Configuration = {},\n crumbs: Crumbs = [],\n pathname: string = \"\",\n nestingLevel: number = 0,\n) => {\n if (items === \"auto\") {\n const structureParsed = await parseAutoStructure(parentConfiguration, crumbs, pathname, nestingLevel);\n return structureParsed;\n }\n\n const structureParsed = await parseStaticStructure(items, parentConfiguration, crumbs, pathname, nestingLevel);\n return structureParsed;\n};\n"],"names":["parseAutoStructure","async","parentConfiguration","crumbs","parentPathname","nestingLevel","pages","tree","provider","branchFiles","filesPromise","structures","includes","jsonStructureData","content","loadContent","structure","JSON","parse","data","segment","clientPath","normalizePathname","pathname","mergePathname","basePath","pathnameNormalized","checkIsLinkExternal","origPath","getPageSourcePathname","title","uri","configuration","subTree","subItemsData","Object","assign","push","href","items","type","Error","parseJSONStructure","generatedItem","docs","linkLevel","split","filter","Boolean","length","match","RegExp","replace","getMetadata","generatePseudoTitle","spreadedLevel","parseStructure","structureParsed","item","subCrumbs","getConfiguration","hidden","undefined","parseStaticStructure"],"mappings":"mRAQA,MAmEMA,EAAqBC,MACvBC,EAAqC,GACrCC,EAAiB,GACjBC,EAAiB,GACjBC,KAEA,MAAMC,EAAe,CAAA,EACfC,EAAmB,GAEzB,IAAKL,EAAoBM,SAAU,MAAO,CAAEF,QAAOC,QAEnD,MAAME,QAAoBP,EAAoBM,SAASE,aAEvD,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EAAQoB,EAAUlB,GACjG,OAAOoD,CAAe"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export declare const getFileUrl: (
|
|
2
|
-
export declare const normalizePathname: (
|
|
3
|
-
export declare const
|
|
1
|
+
export declare const getFileUrl: (pathname: string) => string;
|
|
2
|
+
export declare const normalizePathname: (pathname?: string | null) => string;
|
|
3
|
+
export declare const removeTrailingSlash: (pathname?: string | null) => string;
|
|
4
|
+
export declare const addTrailingSlash: (pathname?: string | null) => string;
|
|
5
|
+
export declare const generatePseudoTitle: (pathname?: string | null) => string;
|
|
4
6
|
export declare const checkIsLinkExternal: (href: string) => boolean;
|
|
5
7
|
export declare const mergePathname: (basePath?: string, href?: string) => string | undefined;
|
|
6
8
|
//# sourceMappingURL=path-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/path-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"path-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/path-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,aAAc,MAAM,WAS1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,cAAe,MAAM,GAAG,IAAI,WAIzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,cAAe,MAAM,GAAG,IAAI,WAI3D,CAAC;AAEF,eAAO,MAAM,gBAAgB,cAAe,MAAM,GAAG,IAAI,WAIxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,cAAe,MAAM,GAAG,IAAI,WAS3D,CAAC;AAEF,eAAO,MAAM,mBAAmB,SAAU,MAAM,YAG/C,CAAC;AAEF,eAAO,MAAM,aAAa,cAAe,MAAM,SAAS,MAAM,uBAE7D,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=e=>{const[,t,n]=e.match(/(?:^|\/)([^/]+)(\.mdx?)$/)||[];return e.replace(new RegExp(`((/|^)(readme|README|index|${t}/${t}))?${n}$`),"")},t=e=>e&&e.replace(/\/$/,"")||"/",n=e=>{const n=t(e).split("/").filter(Boolean);if(0===n.length)return"Index";return n[n.length-1].split("-").map((e=>e[0].toUpperCase()+e.substring(1))).join(" ")},
|
|
1
|
+
const e=e=>{const[,t,n]=e.match(/(?:^|\/)([^/]+)(\.mdx?)$/)||[];return e.replace(new RegExp(`((/|^)(readme|README|index|${t}/${t}))?${n}$`),"")},t=e=>e&&e.replace(/\/$/,"")||"/",n=e=>e?e.endsWith("/")?e.substring(0,e.length-1):e:"",r=e=>{const n=t(e).split("/").filter(Boolean);if(0===n.length)return"Index";return n[n.length-1].split("-").map((e=>e[0].toUpperCase()+e.substring(1))).join(" ")},s=e=>"r"!==new URL(e,"http://r").host,p=(e,t)=>!t||s(t)?t:(e||"")+t;export{s as checkIsLinkExternal,r as generatePseudoTitle,e as getFileUrl,p as mergePathname,t as normalizePathname,n as removeTrailingSlash};
|
|
2
2
|
//# sourceMappingURL=path-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-tools.js","sources":["../../../src/core/utils/path-tools.ts"],"sourcesContent":["export const getFileUrl = (
|
|
1
|
+
{"version":3,"file":"path-tools.js","sources":["../../../src/core/utils/path-tools.ts"],"sourcesContent":["export const getFileUrl = (pathname: string) => {\n const [, filename, ext] = pathname.match(/(?:^|\\/)([^/]+)(\\.mdx?)$/) || [];\n\n const clientPath = pathname.replace(\n new RegExp(`((\\/|^)(readme|README|index|${filename}/${filename}))?${ext}$`),\n \"\",\n );\n\n return clientPath;\n};\n\nexport const normalizePathname = (pathname?: string | null) => {\n if (!pathname) return \"/\";\n\n return pathname.replace(/\\/$/, \"\") || \"/\";\n};\n\nexport const removeTrailingSlash = (pathname?: string | null) => {\n if (!pathname) return \"\";\n\n return pathname.endsWith(\"/\") ? pathname.substring(0, pathname.length - 1) : pathname;\n};\n\nexport const addTrailingSlash = (pathname?: string | null) => {\n if (!pathname) return \"\";\n\n return pathname.endsWith(\"/\") ? pathname : pathname + \"/\";\n};\n\nexport const generatePseudoTitle = (pathname?: string | null) => {\n const pathnamename = normalizePathname(pathname);\n const pathnamenameSegments = pathnamename.split(\"/\").filter(Boolean);\n\n if (pathnamenameSegments.length === 0) return \"Index\";\n\n const lastSegment = pathnamenameSegments[pathnamenameSegments.length - 1];\n const lastSegmentWords = lastSegment.split(\"-\");\n return lastSegmentWords.map((word) => word[0].toUpperCase() + word.substring(1)).join(\" \");\n};\n\nexport const checkIsLinkExternal = (href: string) => {\n const url = new URL(href, \"http://r\");\n return url.host !== \"r\";\n};\n\nexport const mergePathname = (basePath?: string, href?: string) => {\n return !href || checkIsLinkExternal(href) ? href : (basePath || \"\") + href;\n};\n"],"names":["getFileUrl","pathname","filename","ext","match","replace","RegExp","normalizePathname","removeTrailingSlash","endsWith","substring","length","generatePseudoTitle","pathnamenameSegments","split","filter","Boolean","map","word","toUpperCase","join","checkIsLinkExternal","href","URL","host","mergePathname","basePath"],"mappings":"AAAa,MAAAA,EAAcC,IACvB,MAAM,CAAGC,EAAUC,GAAOF,EAASG,MAAM,6BAA+B,GAOxE,OALmBH,EAASI,QACxB,IAAIC,OAAO,8BAA+BJ,KAAYA,OAAcC,MACpE,GAGa,EAGRI,EAAqBN,GACzBA,GAEEA,EAASI,QAAQ,MAAO,KAFT,IAKbG,EAAuBP,GAC3BA,EAEEA,EAASQ,SAAS,KAAOR,EAASS,UAAU,EAAGT,EAASU,OAAS,GAAKV,EAFvD,GAWbW,EAAuBX,IAChC,MACMY,EADeN,EAAkBN,GACGa,MAAM,KAAKC,OAAOC,SAE5D,GAAoC,IAAhCH,EAAqBF,OAAc,MAAO,QAI9C,OAFoBE,EAAqBA,EAAqBF,OAAS,GAClCG,MAAM,KACnBG,KAAKC,GAASA,EAAK,GAAGC,cAAgBD,EAAKR,UAAU,KAAIU,KAAK,IAAI,EAGjFC,EAAuBC,GAEZ,MADR,IAAIC,IAAID,EAAM,YACfE,KAGFC,EAAgB,CAACC,EAAmBJ,KACrCA,GAAQD,EAAoBC,GAAQA,GAAQI,GAAY,IAAMJ"}
|
|
@@ -2,4 +2,4 @@ export declare const saveTab: (tabsKey: string, tab: string) => void;
|
|
|
2
2
|
export declare const clearTabs: () => void;
|
|
3
3
|
export declare const getTab: (tabsKey: string) => string | null;
|
|
4
4
|
export declare const getTabs: () => string[][];
|
|
5
|
-
//# sourceMappingURL=tabs-
|
|
5
|
+
//# sourceMappingURL=tabs-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/tabs-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,YAAa,MAAM,OAAO,MAAM,SAKnD,CAAC;AAEF,eAAO,MAAM,SAAS,YAErB,CAAC;AAEF,eAAO,MAAM,MAAM,YAAa,MAAM,kBAIrC,CAAC;AAEF,eAAO,MAAM,OAAO,kBAInB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const t=(t,s)=>{const e=localStorage.getItem("r-tabs"),o=e?.split(";").filter((s=>s&&!s.startsWith(`${t}=`)))||[];o.push(`${t}=${s}`),localStorage.setItem("r-tabs",o.join(";"))};export{t as saveTab};
|
|
2
|
-
//# sourceMappingURL=tabs-
|
|
2
|
+
//# sourceMappingURL=tabs-tools.js.map
|