robindoc 3.2.1 → 3.3.1
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 +2 -1
- package/lib/components/blocks/anchor-heading/index.js.map +1 -1
- package/lib/components/blocks/breadcrumbs/index.js +1 -1
- package/lib/components/blocks/breadcrumbs/index.js.map +1 -1
- package/lib/components/blocks/code-section/index.js.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/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/last-modified/index.js +1 -1
- package/lib/components/blocks/last-modified/index.js.map +1 -1
- package/lib/components/blocks/nav-content-link/index.js +1 -1
- package/lib/components/blocks/nav-content-link/index.js.map +1 -1
- package/lib/components/blocks/nav-link/index.d.ts +5 -18
- package/lib/components/blocks/nav-link/index.d.ts.map +1 -1
- package/lib/components/blocks/nav-link/index.js +1 -1
- package/lib/components/blocks/nav-link/index.js.map +1 -1
- package/lib/components/blocks/no-js/index.d.ts.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.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/blocks/search/index.js +1 -1
- package/lib/components/blocks/search/index.js.map +1 -1
- package/lib/components/blocks/search/search-modal/index.js +1 -1
- package/lib/components/blocks/search/search-modal/index.js.map +1 -1
- package/lib/components/blocks/section-dropdown/index.js +1 -1
- package/lib/components/blocks/section-dropdown/index.js.map +1 -1
- package/lib/components/blocks/theme-detector/index.d.ts.map +1 -1
- package/lib/components/blocks/theme-detector/index.js +1 -1
- package/lib/components/blocks/theme-detector/index.js.map +1 -1
- package/lib/components/blocks/theme-styles/index.js +1 -1
- package/lib/components/blocks/theme-styles/index.js.map +1 -1
- package/lib/components/blocks/theme-switcher/index.d.ts.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/contexts/contents/context.d.ts +0 -1
- package/lib/components/contexts/contents/context.d.ts.map +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.js.map +1 -1
- package/lib/components/contexts/contents/use-heading-register.js +1 -1
- package/lib/components/contexts/contents/use-heading-register.js.map +1 -1
- package/lib/components/contexts/navigate/context.d.ts +0 -1
- package/lib/components/contexts/navigate/context.d.ts.map +1 -1
- package/lib/components/contexts/navigate/context.js.map +1 -1
- package/lib/components/contexts/navigate/provider.js +1 -1
- package/lib/components/contexts/navigate/provider.js.map +1 -1
- package/lib/components/contexts/navigate/use-navigate.js +1 -1
- package/lib/components/contexts/navigate/use-navigate.js.map +1 -1
- package/lib/components/contexts/reference/context.d.ts +0 -1
- package/lib/components/contexts/reference/context.d.ts.map +1 -1
- package/lib/components/contexts/reference/context.js.map +1 -1
- package/lib/components/contexts/reference/provider.js.map +1 -1
- package/lib/components/contexts/reference/use-reference.js.map +1 -1
- package/lib/components/elements/article/document.d.ts.map +1 -1
- package/lib/components/elements/article/document.js +1 -1
- package/lib/components/elements/article/document.js.map +1 -1
- package/lib/components/elements/article/index.js.map +1 -1
- package/lib/components/elements/article/utils.d.ts +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/footer/index.js.map +1 -1
- package/lib/components/elements/header/index.js +1 -1
- package/lib/components/elements/header/index.js.map +1 -1
- package/lib/components/elements/keylink-to-content/index.js.map +1 -1
- package/lib/components/elements/keylink-to-navigation/index.js.map +1 -1
- package/lib/components/elements/robin-provider/index.d.ts +2 -0
- 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/index.js +1 -1
- package/lib/components/elements/sidebar/index.js.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/elements/sidebar/sidebar-link/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/elements/sidebar/tools.d.ts.map +1 -1
- package/lib/components/elements/sidebar/tools.js +1 -1
- package/lib/components/elements/sidebar/tools.js.map +1 -1
- package/lib/components/ui/backdrop/index.js.map +1 -1
- package/lib/components/ui/block/index.js.map +1 -1
- package/lib/components/ui/blockquote/data.d.ts +0 -1
- package/lib/components/ui/blockquote/data.d.ts.map +1 -1
- package/lib/components/ui/blockquote/data.js +1 -1
- package/lib/components/ui/blockquote/data.js.map +1 -1
- package/lib/components/ui/blockquote/icons.js.map +1 -1
- package/lib/components/ui/blockquote/index.js.map +1 -1
- package/lib/components/ui/code-block/index.d.ts.map +1 -1
- package/lib/components/ui/code-block/index.js +1 -1
- package/lib/components/ui/code-block/index.js.map +1 -1
- package/lib/components/ui/code-block/theme.js.map +1 -1
- package/lib/components/ui/code-span/index.js.map +1 -1
- package/lib/components/ui/container/index.js.map +1 -1
- package/lib/components/ui/content-link/index.d.ts.map +1 -1
- package/lib/components/ui/content-link/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.js +1 -1
- package/lib/components/ui/copy-text/index.js.map +1 -1
- package/lib/components/ui/del/index.js.map +1 -1
- package/lib/components/ui/em/index.js.map +1 -1
- package/lib/components/ui/external-mark/index.js.map +1 -1
- package/lib/components/ui/git-logos/index.d.ts +1 -0
- package/lib/components/ui/git-logos/index.d.ts.map +1 -1
- package/lib/components/ui/git-logos/index.js +1 -1
- package/lib/components/ui/git-logos/index.js.map +1 -1
- package/lib/components/ui/heading/index.js +1 -1
- package/lib/components/ui/heading/index.js.map +1 -1
- package/lib/components/ui/hr/index.js.map +1 -1
- package/lib/components/ui/img/index.js.map +1 -1
- package/lib/components/ui/list/list-item/index.js.map +1 -1
- package/lib/components/ui/list/ordered-list/index.js.map +1 -1
- package/lib/components/ui/list/unordered-list/index.js.map +1 -1
- package/lib/components/ui/modal/index.js.map +1 -1
- package/lib/components/ui/modal/use-modal.js +1 -1
- package/lib/components/ui/modal/use-modal.js.map +1 -1
- package/lib/components/ui/paragraph/index.js.map +1 -1
- package/lib/components/ui/strong/index.js.map +1 -1
- package/lib/components/ui/table/table/index.js.map +1 -1
- package/lib/components/ui/table/tbody/index.js.map +1 -1
- package/lib/components/ui/table/td/index.js.map +1 -1
- package/lib/components/ui/table/th/index.js.map +1 -1
- package/lib/components/ui/table/thead/index.js.map +1 -1
- package/lib/components/ui/table/tr/index.js.map +1 -1
- package/lib/components/ui/tabs/index.js +1 -1
- package/lib/components/ui/tabs/index.js.map +1 -1
- package/lib/components/ui/tabs/tabs-header/index.d.ts.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/components/ui/tabs/tabs-styles/index.js +1 -1
- package/lib/components/ui/tabs/tabs-styles/index.js.map +1 -1
- package/lib/components/ui/task-list/task-list-item/index.js.map +1 -1
- package/lib/components/ui/task-list/task-unordered-list/index.js.map +1 -1
- package/lib/components/ui/tooltip/index.js.map +1 -1
- package/lib/core/data/contents.js.map +1 -1
- package/lib/core/hooks/use-debouncer.d.ts.map +1 -1
- package/lib/core/hooks/use-debouncer.js +1 -1
- package/lib/core/hooks/use-debouncer.js.map +1 -1
- package/lib/core/hooks/use-system-type.js +1 -1
- package/lib/core/hooks/use-system-type.js.map +1 -1
- package/lib/core/providers/base.js +1 -1
- package/lib/core/providers/base.js.map +1 -1
- package/lib/core/providers/file-system.js +1 -1
- package/lib/core/providers/file-system.js.map +1 -1
- package/lib/core/providers/github.js +1 -1
- package/lib/core/providers/github.js.map +1 -1
- package/lib/core/types/content.d.ts +0 -1
- package/lib/core/types/content.d.ts.map +1 -1
- package/lib/core/utils/content-tools.d.ts.map +1 -1
- package/lib/core/utils/content-tools.js +1 -1
- package/lib/core/utils/content-tools.js.map +1 -1
- package/lib/core/utils/create-base-searcher.d.ts.map +1 -1
- package/lib/core/utils/create-base-searcher.js +1 -1
- package/lib/core/utils/create-base-searcher.js.map +1 -1
- package/lib/core/utils/detect-provider.d.ts.map +1 -1
- package/lib/core/utils/detect-provider.js.map +1 -1
- package/lib/core/utils/get-configuration.d.ts.map +1 -1
- package/lib/core/utils/get-configuration.js.map +1 -1
- package/lib/core/utils/get-metadata.d.ts.map +1 -1
- package/lib/core/utils/get-metadata.js +1 -1
- package/lib/core/utils/get-metadata.js.map +1 -1
- package/lib/core/utils/git-tools.d.ts.map +1 -1
- package/lib/core/utils/git-tools.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib/core/utils/parse-structure.js.map +1 -1
- 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-tools.d.ts.map +1 -1
- package/lib/core/utils/tabs-tools.js +1 -1
- package/lib/core/utils/tabs-tools.js.map +1 -1
- package/lib/styles.css +2103 -2
- package/package.json +28 -28
- package/lib/assets/index.d.ts +0 -2
- package/lib/assets/index.d.ts.map +0 -1
- package/lib/assets/index.js +0 -2
- package/lib/assets/index.js.map +0 -1
- package/lib/styles.css.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-configuration.js","sources":["../../../src/core/utils/get-configuration.ts"],"sourcesContent":["import { type Configuration } from \"../types/content\";\nimport { detectProvider } from \"./detect-provider\";\n\nexport const getConfiguration = (currentConfiguration: Configuration, previousConfiguration: Configuration = {}) => {\n let basePath = previousConfiguration.basePath;\n let gitToken = previousConfiguration.gitToken;\n let spreadedLevel = previousConfiguration.spreadedLevel;\n let sourceRoot = previousConfiguration.sourceRoot;\n let fetcher = previousConfiguration.fetcher || fetch;\n let provider = previousConfiguration.provider;\n\n if (currentConfiguration.basePath) {\n basePath = currentConfiguration.basePath;\n }\n if (currentConfiguration.gitToken) {\n gitToken = currentConfiguration.gitToken;\n }\n if (currentConfiguration.spreadedLevel !== undefined) {\n spreadedLevel = currentConfiguration.spreadedLevel;\n }\n if (currentConfiguration.sourceRoot !== undefined) {\n sourceRoot = currentConfiguration.sourceRoot;\n }\n if (currentConfiguration.fetcher !== undefined) {\n fetcher = currentConfiguration.fetcher || fetch;\n }\n if (currentConfiguration.provider) {\n provider = currentConfiguration.provider;\n } else if (\n (currentConfiguration.sourceRoot && currentConfiguration.sourceRoot !== previousConfiguration.sourceRoot) ||\n !provider\n ) {\n if (sourceRoot) {\n const Provider = currentConfiguration.provider || detectProvider(sourceRoot);\n provider = new Provider(sourceRoot, fetcher, gitToken);\n }\n }\n return { sourceRoot, provider, basePath, gitToken, fetcher, spreadedLevel };\n};\n"],"names":["getConfiguration","currentConfiguration","previousConfiguration","basePath","gitToken","spreadedLevel","sourceRoot","fetcher","fetch","provider","undefined","detectProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-configuration.js","sources":["../../../src/core/utils/get-configuration.ts"],"sourcesContent":["import { type Configuration } from \"../types/content\";\nimport { detectProvider } from \"./detect-provider\";\n\nexport const getConfiguration = (currentConfiguration: Configuration, previousConfiguration: Configuration = {}) => {\n let basePath = previousConfiguration.basePath;\n let gitToken = previousConfiguration.gitToken;\n let spreadedLevel = previousConfiguration.spreadedLevel;\n let sourceRoot = previousConfiguration.sourceRoot;\n let fetcher = previousConfiguration.fetcher || fetch;\n let provider = previousConfiguration.provider;\n\n if (currentConfiguration.basePath) {\n basePath = currentConfiguration.basePath;\n }\n if (currentConfiguration.gitToken) {\n gitToken = currentConfiguration.gitToken;\n }\n if (currentConfiguration.spreadedLevel !== undefined) {\n spreadedLevel = currentConfiguration.spreadedLevel;\n }\n if (currentConfiguration.sourceRoot !== undefined) {\n sourceRoot = currentConfiguration.sourceRoot;\n }\n if (currentConfiguration.fetcher !== undefined) {\n fetcher = currentConfiguration.fetcher || fetch;\n }\n if (currentConfiguration.provider) {\n provider = currentConfiguration.provider;\n } else if (\n (currentConfiguration.sourceRoot && currentConfiguration.sourceRoot !== previousConfiguration.sourceRoot) ||\n !provider\n ) {\n if (sourceRoot) {\n const Provider = currentConfiguration.provider || detectProvider(sourceRoot);\n provider = new Provider(sourceRoot, fetcher, gitToken);\n }\n }\n return { sourceRoot, provider, basePath, gitToken, fetcher, spreadedLevel };\n};\n"],"names":["getConfiguration","currentConfiguration","previousConfiguration","basePath","gitToken","spreadedLevel","sourceRoot","fetcher","fetch","provider","undefined","detectProvider"],"mappings":"sDAGO,MAAMA,EAAmB,CAACC,EAAqCC,EAAuC,MACzG,IAAIC,EAAWD,EAAsBC,SACjCC,EAAWF,EAAsBE,SACjCC,EAAgBH,EAAsBG,cACtCC,EAAaJ,EAAsBI,WACnCC,EAAUL,EAAsBK,SAAWC,MAC3CC,EAAWP,EAAsBO,SAiBrC,GAfIR,EAAqBE,WACrBA,EAAWF,EAAqBE,UAEhCF,EAAqBG,WACrBA,EAAWH,EAAqBG,eAEOM,IAAvCT,EAAqBI,gBACrBA,EAAgBJ,EAAqBI,oBAEDK,IAApCT,EAAqBK,aACrBA,EAAaL,EAAqBK,iBAEDI,IAAjCT,EAAqBM,UACrBA,EAAUN,EAAqBM,SAAWC,OAE1CP,EAAqBQ,SACrBA,EAAWR,EAAqBQ,cAC7B,IACFR,EAAqBK,YAAcL,EAAqBK,aAAeJ,EAAsBI,aAC7FG,IAEGH,EAAY,CAEZG,EAAW,IADMR,EAAqBQ,UAAYE,EAAeL,IACzCA,EAAYC,EAASH,EACjD,CAEJ,MAAO,CAAEE,aAAYG,WAAUN,WAAUC,WAAUG,UAASF"}
|
|
@@ -1 +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,
|
|
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,GAAU,MAAM,kBAAkB,oCAsCzD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"gray-matter";import{lexer as o}from"marked";import{
|
|
1
|
+
import t from"gray-matter";import{lexer as o}from"marked";import{setProperty 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
2
|
//# sourceMappingURL=get-metadata.js.map
|
|
@@ -1 +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 {
|
|
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 { setProperty } 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 setProperty(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","setProperty","pageHeading","find","el","type","depth","text","parseTokenText","description","firstParagraph"],"mappings":"2MAYaA,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,OAA+B,CAACC,EAAKC,KAC9E,MAAOC,EAAKC,GAASF,EACff,EAAUiB,EAAMC,MAChBC,EAAUH,EAAII,WAAW,WAAaJ,EAAIK,UAAU,GAM1D,OAJIrB,GAAWmB,GACXG,EAAYR,EAAKK,EAASnB,GAGvBc,GACRT,GAEH,IAAKI,EAAUS,MAAO,CAClB,MAAMK,EAAchB,EAAKiB,KAAMC,GAAmB,YAAZA,EAAGC,MAAmC,IAAbD,EAAGE,OAC9DJ,GAAaK,OACbnB,EAAUS,MAAQW,EAAeN,GAEzC,CAEA,IAAKd,EAAUqB,YAAa,CACxB,MAAMC,EAAiBxB,EAAKiB,KAAMC,GAAmB,cAAZA,EAAGC,MACxCK,GAAgBH,OAChBnB,EAAUqB,YAAcD,EAAeE,GAE/C,CAEA,OAAOtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/git-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"git-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/git-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM;;;;;;;;;CAQxC,CAAC"}
|
|
@@ -1 +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":"
|
|
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":"AAAO,MAAMA,EAAiBC,GACtBA,EAAIC,MAAM,0BACH,CAAEC,KAAM,SAAUC,IAAK,UACvBH,EAAIC,MAAM,0BACV,CAAEC,KAAM,SAAUC,IAAK,UAEvB,CAAED,KAAM,MAAOC,IAAK"}
|
|
@@ -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,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,
|
|
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,GAAI,mBAAmB,SAAS,GAAG,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;;;sBAmDrE,CAAC,SAAS,MAAM,wBACnC,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{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(
|
|
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\";\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,
|
|
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,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C,EAAgB,CACnCjB,IAAK3B,EAAgB2B,IACrBD,SAAU1B,EAAgBP,cAAciC,YAgCMmB,YA3BlC3D,MAAOS,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 +1 @@
|
|
|
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,
|
|
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,GAAU,KAAK,MAAM,EAAE,cAAc,YAAY,EAAE,OAAO,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\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,
|
|
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,EAC9D,CAEA,GAAID,EAAIO,WAAW,uBAAwB,CACvC,MAAMD,EAAW,IAAIE,EAAeR,GACpC,GAAIM,EAASG,SAAU,CAEnB,MAAO,CAAEN,WADaG,EAASF,KAAKE,EAASG,UACrBJ,KAAM,SAAUC,WAC5C,CACI,MAAM,IAAII,MAAM,uBAExB,CAEA,GAAIV,EAAIW,MAAM,eAAgB,CAC1B,MAAMC,QAAaC,MAAMb,GACzB,IAAKY,EAAKE,GACN,MAAM,IAAIJ,MAAM,wBAGpB,MAAO,CAAEP,WADaS,EAAKG,OACHV,KAAM,SAAUC,SAAU,KACtD,CAEA,MAAMA,EAAW,IAAIU,EAAmBd,GAExC,MAAO,CAAEC,WADaG,EAASF,KAAKJ,GACZK,KAAM,QAASC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-structure.d.ts","sourceRoot":"","sources":["../../../src/core/utils/parse-structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAgPxE,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"parse-structure.d.ts","sourceRoot":"","sources":["../../../src/core/utils/parse-structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAgPxE,eAAO,MAAM,cAAc,GACvB,OAAO,OAAO,EAAE,GAAG,MAAM,EACzB,sBAAqB,aAAkB,EACvC,SAAQ,MAAW,EACnB,WAAU,MAAW,EACrB,eAAc,MAAU;WAjFjB,KAAK;UACN,QAAQ,EAAE;EAyFnB,CAAC"}
|
|
@@ -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 { 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,M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,MAAO,CAAElC,QAAOC,OAAM,EAeQwD,CAAqBxB,EAAOrC,EAAqBC,EAAQoB,EAAUlB,GACjG,OAAOoD,CAAe"}
|
|
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,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,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aqC,EAAKpB,KAClBf,EAAWC,EAAcQ,EAAcP,SAAUJ,GACjDK,EAAqBJ,EAAkBC,GAE7C,IAAKI,EAAoBD,IAAuBL,EAAY,CACxD,MAAMO,QAAiBI,EAAcxB,UAAUqB,sBAAsBR,EAAYK,IAE7EE,IACAtB,EAAMoB,GAAsB,CACxBI,MAAO4B,EAAK5B,OAAS,GACrBC,IAAKV,EACLW,gBACAJ,WACAzB,UAEJwD,EAAY,IAAIxD,EAAQuB,GAEhC,CAEA,IAAIO,EAAsB,GAC1B,GAAIyB,EAAKnB,MAAO,CACZ,MAAML,QAAqBsB,EACvBE,EAAKnB,MACLP,EACA2B,EACAD,EAAKpB,KACLjC,EAAe,GAEnB4B,EAAUC,EAAa3B,KACvB4B,OAAOC,OAAO9B,EAAO4B,EAAa5B,MACtC,CAEKoD,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,OAI3B,CAEA,MAAO,CAAElC,QAAOC,SAecwD,CAAqBxB,EAAOrC,EAAqBC,EAAQoB,EAAUlB,GACjG,OAAOoD"}
|
|
@@ -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,GAAI,UAAU,MAAM,WAS1C,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,GAAG,IAAI,WAIzD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,WAAW,MAAM,GAAG,IAAI,WAI3D,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,WAAW,MAAM,GAAG,IAAI,WAIxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,WAAW,MAAM,GAAG,IAAI,WAS3D,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,YAG/C,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,WAAW,MAAM,EAAE,OAAO,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=>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(
|
|
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 = (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":"
|
|
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":"AAAO,MAAMA,EAAcC,IACvB,MAAM,CAAGC,EAAUC,GAAOF,EAASG,MAAM,6BAA+B,GAOxE,OALmBH,EAASI,QACxB,IAAIC,OAAO,8BAA+BJ,KAAYA,OAAcC,MACpE,KAMKI,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,IAAKC,GAASA,EAAK,GAAGC,cAAgBD,EAAKR,UAAU,IAAIU,KAAK,MAG7EC,EAAuBC,GAEZ,MADR,IAAIC,IAAID,EAAM,YACfE,KAGFC,EAAgB,CAACC,EAAmBJ,KACrCA,GAAQD,EAAoBC,GAAQA,GAAQI,GAAY,IAAMJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/tabs-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"tabs-tools.d.ts","sourceRoot":"","sources":["../../../src/core/utils/tabs-tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,EAAE,KAAK,MAAM,SAKnD,CAAC;AAEF,eAAO,MAAM,SAAS,YAErB,CAAC;AAEF,eAAO,MAAM,MAAM,GAAI,SAAS,MAAM,kBAIrC,CAAC;AAEF,eAAO,MAAM,OAAO,kBAInB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t=(t,s)=>{const e=localStorage.getItem("r-tabs"),o=e?.split(";").filter(
|
|
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
2
|
//# sourceMappingURL=tabs-tools.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs-tools.js","sources":["../../../src/core/utils/tabs-tools.ts"],"sourcesContent":["export const saveTab = (tabsKey: string, tab: string) => {\n const store = localStorage.getItem(\"r-tabs\");\n const items = store?.split(\";\").filter((item) => item && !item.startsWith(`${tabsKey}=`)) || [];\n items.push(`${tabsKey}=${tab}`);\n localStorage.setItem(\"r-tabs\", items.join(\";\"));\n};\n\nexport const clearTabs = () => {\n localStorage.removeItem(\"r-tabs\");\n};\n\nexport const getTab = (tabsKey: string) => {\n const store = localStorage.getItem(\"r-tabs\");\n const tab = store?.split(\";\").find((item) => item && item.startsWith(`${tabsKey}=`));\n return tab?.substring(tabsKey.length) || null;\n};\n\nexport const getTabs = () => {\n const store = localStorage.getItem(\"r-tabs\");\n const items = store?.split(\";\").filter((item) => item && /[\\w-]+=[\\w]+/.test(item)) || [];\n return items.map((item) => item.split(\"=\"));\n};\n"],"names":["saveTab","tabsKey","tab","store","localStorage","getItem","items","split","filter","item","startsWith","push","setItem","join"],"mappings":"MAAaA,EAAU,CAACC,EAAiBC,KACrC,MAAMC,EAAQC,aAAaC,QAAQ,UAC7BC,EAAQH,GAAOI,MAAM,KAAKC,
|
|
1
|
+
{"version":3,"file":"tabs-tools.js","sources":["../../../src/core/utils/tabs-tools.ts"],"sourcesContent":["export const saveTab = (tabsKey: string, tab: string) => {\n const store = localStorage.getItem(\"r-tabs\");\n const items = store?.split(\";\").filter((item) => item && !item.startsWith(`${tabsKey}=`)) || [];\n items.push(`${tabsKey}=${tab}`);\n localStorage.setItem(\"r-tabs\", items.join(\";\"));\n};\n\nexport const clearTabs = () => {\n localStorage.removeItem(\"r-tabs\");\n};\n\nexport const getTab = (tabsKey: string) => {\n const store = localStorage.getItem(\"r-tabs\");\n const tab = store?.split(\";\").find((item) => item && item.startsWith(`${tabsKey}=`));\n return tab?.substring(tabsKey.length) || null;\n};\n\nexport const getTabs = () => {\n const store = localStorage.getItem(\"r-tabs\");\n const items = store?.split(\";\").filter((item) => item && /[\\w-]+=[\\w]+/.test(item)) || [];\n return items.map((item) => item.split(\"=\"));\n};\n"],"names":["saveTab","tabsKey","tab","store","localStorage","getItem","items","split","filter","item","startsWith","push","setItem","join"],"mappings":"MAAaA,EAAU,CAACC,EAAiBC,KACrC,MAAMC,EAAQC,aAAaC,QAAQ,UAC7BC,EAAQH,GAAOI,MAAM,KAAKC,OAAQC,GAASA,IAASA,EAAKC,WAAW,GAAGT,QAAgB,GAC7FK,EAAMK,KAAK,GAAGV,KAAWC,KACzBE,aAAaQ,QAAQ,SAAUN,EAAMO,KAAK"}
|