robindoc 3.4.0 → 3.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/blocks/contents/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,iBAAiB,CAAC;AAEzB,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,iBAAiB;IAC1D,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;KAAE,EAAE,CAAC;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE;QACX,mBAAmB;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,wBAAwB;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACL;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAoF5C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/blocks/contents/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAK9D,OAAO,iBAAiB,CAAC;AAEzB,MAAM,WAAW,aAAc,SAAQ,KAAK,CAAC,iBAAiB;IAC1D,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAA;KAAE,EAAE,CAAC;IAC7E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,CAAC,EAAE;QACX,mBAAmB;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,wBAAwB;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACL;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA2F5C,CAAC"}
@@ -1,3 +1,3 @@
1
1
  'use client';
2
- import e,{useRef as t,useEffect as n}from"react";import r from"clsx";import{useHeadingIndex as s}from"../../contexts/contents/use-heading-index.js";import{detectGitType as c}from"../../../core/utils/git-tools.js";const o=({headings:o,hideContents:a,editUri:l,translations:i})=>{const m=t(null),d=t(null),h=t(null),{from:p,to:f}=s(),{onThisPage:u="On this page",editOnService:g="Edit on {service}"}=i||{};return n(()=>{h.current&&d.current&&d.current.style.setProperty("--drop-height",h.current.offsetHeight+"px")},[]),e.createElement("div",{className:"r-contents"},e.createElement("div",{className:"r-contents-sticky",ref:m},o.length>0&&!a&&e.createElement(e.Fragment,null,e.createElement("input",{type:"checkbox",className:"r-contents-control",id:"r-contents"}),e.createElement("div",{className:"r-contents-details"},e.createElement("label",{className:"r-contents-title",htmlFor:"r-contents"},u,e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"r-contents-chevron"},e.createElement("path",{d:"m6 9 6 6 6-6"}))),e.createElement("div",{className:"r-contents-list",ref:d},e.createElement("div",{className:"r-contents-list-content",ref:h},o.map((t,n)=>e.createElement("a",{href:`#${t.id}`,key:t.id,className:r("r-contents-link",t.nested&&"_nested",n<=p&&"_passed",n<=f&&"_visited",n>=p&&n<=f&&"_active"),ref:e=>{e?.offsetTop&&m.current&&m.current.scrollHeight>m.current.clientHeight&&p===n&&m.current.scrollTo({top:Math.max(e.offsetTop-Math.ceil(window.innerHeight/2),0)})}},t.title)))))),l?.match(/^https?:\/\//)&&e.createElement("div",{className:"r-contents-actions"},e.createElement("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"r-contents-git"},g.replace("{service}",c(l).name)))))};export{o as Contents};
2
+ import e,{useRef as t,useCallback as n,useEffect as r}from"react";import s from"clsx";import{useHeadingIndex as c}from"../../contexts/contents/use-heading-index.js";import{detectGitType as o}from"../../../core/utils/git-tools.js";const a=({headings:a,hideContents:l,editUri:i,translations:m})=>{const d=t(null),h=t(null),p=t(null),{from:f,to:u}=c(),{onThisPage:g="On this page",editOnService:v="Edit on {service}"}=m||{},E=n(()=>{p.current&&h.current&&h.current.style.setProperty("--drop-height",p.current.offsetHeight+"px")},[]);return r(E,[]),e.createElement("div",{className:"r-contents"},e.createElement("div",{className:"r-contents-sticky",ref:d},a.length>0&&!l&&e.createElement(e.Fragment,null,e.createElement("input",{type:"checkbox",className:"r-contents-control",id:"r-contents",onClick:E}),e.createElement("div",{className:"r-contents-details"},e.createElement("label",{className:"r-contents-title",htmlFor:"r-contents"},g,e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"r-contents-chevron"},e.createElement("path",{d:"m6 9 6 6 6-6"}))),e.createElement("div",{className:"r-contents-list",ref:h},e.createElement("div",{className:"r-contents-list-content",ref:p},a.map((t,n)=>e.createElement("a",{href:`#${t.id}`,key:t.id,className:s("r-contents-link",t.nested&&"_nested",n<=f&&"_passed",n<=u&&"_visited",n>=f&&n<=u&&"_active"),ref:e=>{e?.offsetTop&&d.current&&d.current.scrollHeight>d.current.clientHeight&&f===n&&d.current.scrollTo({top:Math.max(e.offsetTop-Math.ceil(window.innerHeight/2),0)})}},t.title)))))),i?.match(/^https?:\/\//)&&e.createElement("div",{className:"r-contents-actions"},e.createElement("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"r-contents-git"},v.replace("{service}",o(i).name)))))};export{a as Contents};
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/blocks/contents/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useEffect, useRef } from \"react\";\nimport clsx from \"clsx\";\nimport { useHeadingIndex } from \"@src/components/contexts/contents/use-heading-index\";\nimport { detectGitType } from \"@src/core/utils/git-tools\";\n\nimport \"./contents.scss\";\n\nexport interface ContentsProps extends React.PropsWithChildren {\n headings: { id: string; nested: boolean; title: string | React.ReactNode }[];\n hideContents?: boolean;\n editUri?: string | null;\n translations?: {\n /** On this page */\n onThisPage?: string;\n /** Edit on {service} */\n editOnService?: string;\n };\n}\n\nexport const Contents: React.FC<ContentsProps> = ({ headings, hideContents, editUri, translations }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const dropdownContentRef = useRef<HTMLDivElement>(null);\n const { from, to } = useHeadingIndex();\n const { onThisPage = \"On this page\", editOnService = \"Edit on {service}\" } = translations || {};\n\n useEffect(() => {\n if (dropdownContentRef.current && dropdownRef.current) {\n dropdownRef.current.style.setProperty(\"--drop-height\", dropdownContentRef.current.offsetHeight + \"px\");\n }\n }, []);\n\n return (\n <div className=\"r-contents\">\n <div className=\"r-contents-sticky\" ref={containerRef}>\n {headings.length > 0 && !hideContents && (\n <>\n <input type=\"checkbox\" className=\"r-contents-control\" id=\"r-contents\" />\n <div className=\"r-contents-details\">\n <label className=\"r-contents-title\" htmlFor=\"r-contents\">\n {onThisPage}\n <svg\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 className=\"r-contents-chevron\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </label>\n <div className=\"r-contents-list\" ref={dropdownRef}>\n <div className=\"r-contents-list-content\" ref={dropdownContentRef}>\n {headings.map((heading, index) => (\n <a\n href={`#${heading.id}`}\n key={heading.id}\n className={clsx(\n \"r-contents-link\",\n heading.nested && \"_nested\",\n index <= from && \"_passed\",\n index <= to && \"_visited\",\n index >= from && index <= to && \"_active\",\n )}\n ref={(node) => {\n if (\n node?.offsetTop &&\n containerRef.current &&\n containerRef.current.scrollHeight >\n containerRef.current.clientHeight &&\n from === index\n ) {\n containerRef.current.scrollTo({\n top: Math.max(\n node.offsetTop - Math.ceil(window.innerHeight / 2),\n 0,\n ),\n });\n }\n }}\n >\n {heading.title}\n </a>\n ))}\n </div>\n </div>\n </div>\n </>\n )}\n {editUri?.match(/^https?:\\/\\//) && (\n <div className=\"r-contents-actions\">\n <a href={editUri} target=\"_blank\" rel=\"noopener noreferrer\" className=\"r-contents-git\">\n {editOnService.replace(\"{service}\", detectGitType(editUri).name)}\n </a>\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"names":["Contents","headings","hideContents","editUri","translations","containerRef","useRef","dropdownRef","dropdownContentRef","from","to","useHeadingIndex","onThisPage","editOnService","useEffect","current","style","setProperty","offsetHeight","React","createElement","className","ref","length","Fragment","type","id","htmlFor","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d","map","heading","index","href","key","clsx","nested","node","offsetTop","scrollHeight","clientHeight","scrollTo","top","Math","max","ceil","window","innerHeight","title","match","target","rel","replace","detectGitType","name"],"mappings":";qNAqBO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMA,CAAAA,CAAoC,CAAA,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAUC,eAAcC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAASC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CACjF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMC,CAAAA,CAAeC,CAAAA,CAAuB,CAAA,CAAA,CAAA,CAAA,CA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AS0D,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/blocks/contents/index.tsx"],"sourcesContent":["\"use client\";\n\nimport React, { useCallback, useEffect, useRef } from \"react\";\nimport clsx from \"clsx\";\nimport { useHeadingIndex } from \"@src/components/contexts/contents/use-heading-index\";\nimport { detectGitType } from \"@src/core/utils/git-tools\";\n\nimport \"./contents.scss\";\n\nexport interface ContentsProps extends React.PropsWithChildren {\n headings: { id: string; nested: boolean; title: string | React.ReactNode }[];\n hideContents?: boolean;\n editUri?: string | null;\n translations?: {\n /** On this page */\n onThisPage?: string;\n /** Edit on {service} */\n editOnService?: string;\n };\n}\n\nexport const Contents: React.FC<ContentsProps> = ({ headings, hideContents, editUri, translations }) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const dropdownContentRef = useRef<HTMLDivElement>(null);\n const { from, to } = useHeadingIndex();\n const { onThisPage = \"On this page\", editOnService = \"Edit on {service}\" } = translations || {};\n\n const recalculateOffset = useCallback(() => {\n if (dropdownContentRef.current && dropdownRef.current) {\n dropdownRef.current.style.setProperty(\"--drop-height\", dropdownContentRef.current.offsetHeight + \"px\");\n }\n }, []);\n\n useEffect(recalculateOffset, []);\n\n return (\n <div className=\"r-contents\">\n <div className=\"r-contents-sticky\" ref={containerRef}>\n {headings.length > 0 && !hideContents && (\n <>\n <input\n type=\"checkbox\"\n className=\"r-contents-control\"\n id=\"r-contents\"\n onClick={recalculateOffset}\n />\n <div className=\"r-contents-details\">\n <label className=\"r-contents-title\" htmlFor=\"r-contents\">\n {onThisPage}\n <svg\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 className=\"r-contents-chevron\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n </label>\n <div className=\"r-contents-list\" ref={dropdownRef}>\n <div className=\"r-contents-list-content\" ref={dropdownContentRef}>\n {headings.map((heading, index) => (\n <a\n href={`#${heading.id}`}\n key={heading.id}\n className={clsx(\n \"r-contents-link\",\n heading.nested && \"_nested\",\n index <= from && \"_passed\",\n index <= to && \"_visited\",\n index >= from && index <= to && \"_active\",\n )}\n ref={(node) => {\n if (\n node?.offsetTop &&\n containerRef.current &&\n containerRef.current.scrollHeight >\n containerRef.current.clientHeight &&\n from === index\n ) {\n containerRef.current.scrollTo({\n top: Math.max(\n node.offsetTop - Math.ceil(window.innerHeight / 2),\n 0,\n ),\n });\n }\n }}\n >\n {heading.title}\n </a>\n ))}\n </div>\n </div>\n </div>\n </>\n )}\n {editUri?.match(/^https?:\\/\\//) && (\n <div className=\"r-contents-actions\">\n <a href={editUri} target=\"_blank\" rel=\"noopener noreferrer\" className=\"r-contents-git\">\n {editOnService.replace(\"{service}\", detectGitType(editUri).name)}\n </a>\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"names":["Contents","headings","hideContents","editUri","translations","containerRef","useRef","dropdownRef","dropdownContentRef","from","to","useHeadingIndex","onThisPage","editOnService","recalculateOffset","useCallback","current","style","setProperty","offsetHeight","useEffect","React","createElement","className","ref","length","Fragment","type","id","onClick","htmlFor","width","height","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","d","map","heading","index","href","key","clsx","nested","node","offsetTop","scrollHeight","clientHeight","scrollTo","top","Math","max","ceil","window","innerHeight","title","match","target","rel","replace","detectGitType","name"],"mappings":";sOAqBO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAMA,CAAAA,CAAoC,CAAA,CAAGC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAUC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA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AA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAGqB,CAAAA,CAAAA,CAAAA,CAAAA,CAAMxC,CAAAA,CAASyD,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAASC,CAAAA,CAAAA,CAAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAsBtC,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACjEV,CAAAA,CAAciD,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAQ,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAaC,CAAAA,CAAc5D,CAAAA,CAAAA,CAAS6D,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
@@ -0,0 +1,7 @@
1
+ import { type Structure } from "./structure";
2
+ export type StructureTemplate = Structure | (() => Structure | Promise<Structure>);
3
+ export type Options = {
4
+ processError?: (status: number, statusText: string) => void | null | never;
5
+ matcher?: string[];
6
+ };
7
+ //# sourceMappingURL=initialize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../../src/core/types/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,CAAC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;AAEnF,MAAM,MAAM,OAAO,GAAG;IAClB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC"}
@@ -1,21 +1,21 @@
1
1
  import React from "react";
2
2
  import { type ArticleProps as ArticlePropsBase } from "../../components/elements/article";
3
3
  import { type SidebarProps as SidebarPropsBase } from "../../components/elements/sidebar";
4
- import { type Structure } from "../types/structure";
4
+ import { type StructureTemplate, type Options } from "../types/initialize";
5
5
  type PageProps = Omit<Partial<ArticlePropsBase>, "uri" | "content" | "provider" | "pathname" | "pages"> & {
6
6
  pathname: string;
7
7
  };
8
8
  type SidebarProps = Omit<SidebarPropsBase, "tree">;
9
- export declare const initializeRobindoc: (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {
9
+ export declare const initializeRobindoc: (structureTemplate: StructureTemplate, options?: Options) => {
10
10
  Page: React.FC<PageProps>;
11
11
  Sidebar: React.FC<SidebarProps>;
12
12
  getStaticParams: <T extends string = "segments">(prefix?: string, segmentsParamKey?: T) => Promise<Record<T, string[]>[]>;
13
- getMetadata: (pathname: string) => Promise<Record<string, string>>;
13
+ getMetadata: (pathname: string) => Promise<Record<string, string> | null>;
14
14
  getPageData: (pathname: string) => Promise<{
15
15
  title: string;
16
16
  raw: string;
17
- }>;
18
- getPageInstruction: (pathname: string) => Promise<import("../types/content").Page>;
17
+ } | null>;
18
+ getPageInstruction: (pathname: string) => Promise<import("../types/content").Page | null>;
19
19
  };
20
20
  export {};
21
21
  //# sourceMappingURL=initialize-robindoc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize-robindoc.d.ts","sourceRoot":"","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AACjH,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AAEjH,OAAO,EAAE,KAAK,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
+ {"version":3,"file":"initialize-robindoc.d.ts","sourceRoot":"","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AACjH,OAAO,EAA0B,KAAK,YAAY,IAAI,gBAAgB,EAAE,0CAAyC;AAEjH,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAO3E,KAAK,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IACtG,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,KAAK,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAenD,eAAO,MAAM,kBAAkB,GAAI,mBAAmB,iBAAiB,EAAE,UAAS,OAAY;;;sBA0D3D,CAAC,SAAS,MAAM,wBACnC,MAAM,qBACI,CAAC;4BAiBc,MAAM;4BAwBN,MAAM;;;;mCAuBC,MAAM;CAqBrD,CAAC"}
@@ -1,2 +1,2 @@
1
- import 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};
1
+ import r from"react";import{Article as t}from"../../components/elements/article/index.js";import{Sidebar as e}from"../../components/elements/sidebar/index.js";import{parseStructure as o}from"./parse-structure.js";import{getConfiguration as s}from"./get-configuration.js";import{getMetadata as n}from"./get-metadata.js";import{normalizePathname as a,removeTrailingSlash as c}from"./path-tools.js";import{loadContent as i}from"./load-content.js";const p=(p,u={})=>{const l=(async r=>{let t;t="function"==typeof r?await r():r;const e=s(t.configuration||{});return o(t.items||[],e)})(p),m=u.matcher?.map(r=>new RegExp(`^${r.replace(/^\^|\$$/g,"")}$`));return{Page:async({pathname:e,...o})=>{const s=a(e);if(m&&!m.every(r=>r.test(e))){const r=`Pathname "${s}" doesn't pass matcher rules check`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const{pages:n}=await l,c=n[s];if(!c){const r=`Can not find data for "${s}". Please check structure`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const i=Object.keys(n),p=i.indexOf(s),f=i[p-1],h=p<i.length-1&&i[p+1],d=f&&{pathname:f,title:n[f].title},g=h&&{pathname:h,title:n[h].title},w=c.crumbs.map(r=>({title:n[r].title,pathname:r})),E=Object.entries(n).reduce((r,[t,{origPath:e}])=>(e&&r.push({clientPath:t,origPath:e}),r),[]);return r.createElement(t,{pathname:s,provider:c.configuration.provider,uri:c.uri,title:c.title,breadcrumbs:w,prev:d||void 0,next:g||void 0,pages:E,...o})},Sidebar:async t=>{const{tree:o}=await l;return r.createElement(e,{tree:o,...t})},getStaticParams:async(r="",t="segments")=>{const{pages:e}=await l,o=Object.keys(e),s=c(r);return o.reduce((r,e)=>e.startsWith(s)?(r.push({[t]:e.substring(s.length+1).split("/")}),r):r,[])},getMetadata:async r=>{const t=a(r);if(m&&!m.every(t=>t.test(r))){const r=`Pathname "${t}" doesn't pass matcher rules check`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const{pages:e}=await l,o=e[t];if(!o){const r=`Can not find data for "${t}". Please check structure`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}return await n({uri:o.uri,provider:o.configuration.provider})},getPageData:async r=>{const t=a(r);if(m&&!m.every(t=>t.test(r))){const r=`Pathname "${t}" doesn't pass matcher rules check`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const{pages:e}=await l,o=e[t];if(!o){const r=`Can not find data for "${t}". Please check structure`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const s=o.title,{data:n}=await i(o.uri,o.configuration.provider);return{title:s,raw:n}},getPageInstruction:async r=>{const t=a(r);if(m&&!m.every(t=>t.test(r))){const r=`Pathname "${t}" doesn't pass matcher rules check`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}const{pages:e}=await l,o=e[t];if(!o){const r=`Can not find data for "${t}". Please check structure`;if(u.processError)return u.processError(404,r)||null;throw new Error(r)}return o}}};export{p as initializeRobindoc};
2
2
  //# sourceMappingURL=initialize-robindoc.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize-robindoc.js","sources":["../../../src/core/utils/initialize-robindoc.tsx"],"sourcesContent":["import React from \"react\";\n\nimport { Article as ArticleBase, type ArticleProps as ArticlePropsBase } from \"@src/components/elements/article\";\nimport { Sidebar as SidebarBase, type SidebarProps as SidebarPropsBase } from \"@src/components/elements/sidebar\";\n\nimport { type Structure } from \"../types/structure\";\nimport { parseStructure } from \"./parse-structure\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMetadata as getMetadataBase } from \"./get-metadata\";\nimport { normalizePathname, removeTrailingSlash } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\ntype PageProps = Omit<Partial<ArticlePropsBase>, \"uri\" | \"content\" | \"provider\" | \"pathname\" | \"pages\"> & {\n pathname: string;\n};\n\ntype SidebarProps = Omit<SidebarPropsBase, \"tree\">;\n\nconst loadStructure = async (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {\n if (typeof structureTemplate === \"function\") {\n return structureTemplate();\n } else {\n return structureTemplate;\n }\n};\n\nexport const initializeRobindoc = (structureTemplate: Structure | (() => Structure | Promise<Structure>)) => {\n const structureParsedPromise = loadStructure(structureTemplate).then((structure) =>\n parseStructure(structure.items || [], getConfiguration(structure.configuration || {})),\n );\n\n const Page: React.FC<PageProps> = async ({ pathname, ...props }) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const paths = Object.keys(pages);\n const targetPageIndex = paths.indexOf(pathnameNormalized);\n const prevPagePathname = paths[targetPageIndex - 1];\n const nextPagePathname = targetPageIndex < paths.length - 1 && paths[targetPageIndex + 1];\n const prev = prevPagePathname && { pathname: prevPagePathname, title: pages[prevPagePathname].title };\n const next = nextPagePathname && { pathname: nextPagePathname, title: pages[nextPagePathname].title };\n\n const breadcrumbs = pageInstruction.crumbs.map((crumb) => ({ title: pages[crumb].title, pathname: crumb }));\n const clientPages = Object.entries(pages).reduce<{ clientPath: string; origPath: string }[]>(\n (acc, [clientPath, { origPath }]) => {\n if (origPath) acc.push({ clientPath, origPath });\n return acc;\n },\n [],\n );\n\n return (\n <ArticleBase\n pathname={pathnameNormalized}\n provider={pageInstruction.configuration.provider}\n uri={pageInstruction.uri}\n title={pageInstruction.title}\n breadcrumbs={breadcrumbs}\n prev={prev || undefined}\n next={next || undefined}\n pages={clientPages}\n {...props}\n />\n );\n };\n\n const Sidebar: React.FC<SidebarProps> = async (props) => {\n const { tree } = await structureParsedPromise;\n\n return <SidebarBase tree={tree} {...props} />;\n };\n\n const getStaticParams = async <T extends string = \"segments\">(\n prefix: string = \"\",\n segmentsParamKey: T = \"segments\" as T,\n ) => {\n const { pages } = await structureParsedPromise;\n const pagesArr = Object.keys(pages);\n const prefixWithoutTrailingSlash = removeTrailingSlash(prefix);\n\n return pagesArr.reduce<Record<T, string[]>[]>((acc, cur) => {\n if (!cur.startsWith(prefixWithoutTrailingSlash)) return acc;\n\n acc.push({\n [segmentsParamKey]: cur.substring(prefixWithoutTrailingSlash.length + 1).split(\"/\"),\n } as Record<T, string[]>);\n\n return acc;\n }, []);\n };\n\n const getMetadata = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const metadata = await getMetadataBase({\n uri: pageInstruction.uri,\n provider: pageInstruction.configuration.provider,\n });\n return metadata;\n };\n\n const getPageData = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n const title = pageInstruction.title;\n const { data } = await loadContent(pageInstruction.uri, pageInstruction.configuration.provider);\n\n return { title, raw: data };\n };\n\n const getPageInstruction = async (pathname: string) => {\n const { pages } = await structureParsedPromise;\n const pathnameNormalized = normalizePathname(pathname);\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n throw new Error(`Can not find data for \"${pathnameNormalized}\". Please check structure`);\n }\n\n return pageInstruction;\n };\n\n return { Page, Sidebar, getStaticParams, getMetadata, getPageData, getPageInstruction };\n};\n"],"names":["initializeRobindoc","structureTemplate","structureParsedPromise","async","loadStructure","then","structure","parseStructure","items","getConfiguration","configuration","Page","pathname","props","pages","pathnameNormalized","normalizePathname","pageInstruction","Error","paths","Object","keys","targetPageIndex","indexOf","prevPagePathname","nextPagePathname","length","prev","title","next","breadcrumbs","crumbs","map","crumb","clientPages","entries","reduce","acc","clientPath","origPath","push","React","ArticleBase","provider","uri","undefined","Sidebar","tree","createElement","SidebarBase","getStaticParams","prefix","segmentsParamKey","pagesArr","prefixWithoutTrailingSlash","removeTrailingSlash","cur","startsWith","substring","split","getMetadata","getMetadataBase","getPageData","data","loadContent","raw","getPageInstruction"],"mappings":"4bAkBA,MAQaA,EAAsBC,IAC/B,MAAMC,EATYC,OAAOF,GACQ,mBAAtBA,EACAA,IAEAA,EAKoBG,CAAcH,GAAmBI,KAAMC,GAClEC,EAAeD,EAAUE,OAAS,GAAIC,EAAiBH,EAAUI,eAAiB,CAAA,KA+GtF,MAAO,CAAEC,KA5GyBR,OAASS,cAAaC,MACpD,MAAMC,MAAEA,SAAgBZ,EAClBa,EAAqBC,EAAkBJ,GACvCK,EAAkBH,EAAMC,GAE9B,IAAKE,EACD,MAAM,IAAIC,MAAM,0BAA0BH,8BAG9C,MAAMI,EAAQC,OAAOC,KAAKP,GACpBQ,EAAkBH,EAAMI,QAAQR,GAChCS,EAAmBL,EAAMG,EAAkB,GAC3CG,EAAmBH,EAAkBH,EAAMO,OAAS,GAAKP,EAAMG,EAAkB,GACjFK,EAAOH,GAAoB,CAAEZ,SAAUY,EAAkBI,MAAOd,EAAMU,GAAkBI,OACxFC,EAAOJ,GAAoB,CAAEb,SAAUa,EAAkBG,MAAOd,EAAMW,GAAkBG,OAExFE,EAAcb,EAAgBc,OAAOC,IAAKC,IAAK,CAAQL,MAAOd,EAAMmB,GAAOL,MAAOhB,SAAUqB,KAC5FC,EAAcd,OAAOe,QAAQrB,GAAOsB,OACtC,CAACC,GAAMC,GAAcC,gBACbA,GAAUF,EAAIG,KAAK,CAAEF,aAAYC,aAC9BF,GAEX,IAGJ,OACII,gBAACC,EAAW,CACR9B,SAAUG,EACV4B,SAAU1B,EAAgBP,cAAciC,SACxCC,IAAK3B,EAAgB2B,IACrBhB,MAAOX,EAAgBW,MACvBE,YAAaA,EACbH,KAAMA,QAAQkB,EACd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"],"sourcesContent":["import React from \"react\";\n\nimport { Article as ArticleBase, type ArticleProps as ArticlePropsBase } from \"@src/components/elements/article\";\nimport { Sidebar as SidebarBase, type SidebarProps as SidebarPropsBase } from \"@src/components/elements/sidebar\";\n\nimport { type StructureTemplate, type Options } from \"../types/initialize\";\nimport { parseStructure } from \"./parse-structure\";\nimport { getConfiguration } from \"./get-configuration\";\nimport { getMetadata as getMetadataBase } from \"./get-metadata\";\nimport { normalizePathname, removeTrailingSlash } from \"./path-tools\";\nimport { loadContent } from \"./load-content\";\n\ntype PageProps = Omit<Partial<ArticlePropsBase>, \"uri\" | \"content\" | \"provider\" | \"pathname\" | \"pages\"> & {\n pathname: string;\n};\n\ntype SidebarProps = Omit<SidebarPropsBase, \"tree\">;\n\nconst loadStructure = async (structureTemplate: StructureTemplate) => {\n let structure;\n if (typeof structureTemplate === \"function\") {\n structure = await structureTemplate();\n } else {\n structure = structureTemplate;\n }\n\n const configuration = getConfiguration(structure.configuration || {});\n\n return parseStructure(structure.items || [], configuration);\n};\n\nexport const initializeRobindoc = (structureTemplate: StructureTemplate, options: Options = {}) => {\n const structureParsedPromise = loadStructure(structureTemplate);\n const matchingRules = options.matcher?.map((rule) => new RegExp(`^${rule.replace(/^\\^|\\$$/g, \"\")}$`));\n\n const Page: React.FC<PageProps> = async ({ pathname, ...props }) => {\n const pathnameNormalized = normalizePathname(pathname);\n if (matchingRules && !matchingRules.every((rule) => rule.test(pathname))) {\n const errorMessage = `Pathname \"${pathnameNormalized}\" doesn't pass matcher rules check`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const { pages } = await structureParsedPromise;\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n const errorMessage = `Can not find data for \"${pathnameNormalized}\". Please check structure`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const paths = Object.keys(pages);\n const targetPageIndex = paths.indexOf(pathnameNormalized);\n const prevPagePathname = paths[targetPageIndex - 1];\n const nextPagePathname = targetPageIndex < paths.length - 1 && paths[targetPageIndex + 1];\n const prev = prevPagePathname && { pathname: prevPagePathname, title: pages[prevPagePathname].title };\n const next = nextPagePathname && { pathname: nextPagePathname, title: pages[nextPagePathname].title };\n\n const breadcrumbs = pageInstruction.crumbs.map((crumb) => ({ title: pages[crumb].title, pathname: crumb }));\n const clientPages = Object.entries(pages).reduce<{ clientPath: string; origPath: string }[]>(\n (acc, [clientPath, { origPath }]) => {\n if (origPath) acc.push({ clientPath, origPath });\n return acc;\n },\n [],\n );\n\n return (\n <ArticleBase\n pathname={pathnameNormalized}\n provider={pageInstruction.configuration.provider}\n uri={pageInstruction.uri}\n title={pageInstruction.title}\n breadcrumbs={breadcrumbs}\n prev={prev || undefined}\n next={next || undefined}\n pages={clientPages}\n {...props}\n />\n );\n };\n\n const Sidebar: React.FC<SidebarProps> = async (props) => {\n const { tree } = await structureParsedPromise;\n\n return <SidebarBase tree={tree} {...props} />;\n };\n\n const getStaticParams = async <T extends string = \"segments\">(\n prefix: string = \"\",\n segmentsParamKey: T = \"segments\" as T,\n ) => {\n const { pages } = await structureParsedPromise;\n const pagesArr = Object.keys(pages);\n const prefixWithoutTrailingSlash = removeTrailingSlash(prefix);\n\n return pagesArr.reduce<Record<T, string[]>[]>((acc, cur) => {\n if (!cur.startsWith(prefixWithoutTrailingSlash)) return acc;\n\n acc.push({\n [segmentsParamKey]: cur.substring(prefixWithoutTrailingSlash.length + 1).split(\"/\"),\n } as Record<T, string[]>);\n\n return acc;\n }, []);\n };\n\n const getMetadata = async (pathname: string) => {\n const pathnameNormalized = normalizePathname(pathname);\n if (matchingRules && !matchingRules.every((rule) => rule.test(pathname))) {\n const errorMessage = `Pathname \"${pathnameNormalized}\" doesn't pass matcher rules check`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const { pages } = await structureParsedPromise;\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n const errorMessage = `Can not find data for \"${pathnameNormalized}\". Please check structure`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const metadata = await getMetadataBase({\n uri: pageInstruction.uri,\n provider: pageInstruction.configuration.provider,\n });\n return metadata;\n };\n\n const getPageData = async (pathname: string) => {\n const pathnameNormalized = normalizePathname(pathname);\n if (matchingRules && !matchingRules.every((rule) => rule.test(pathname))) {\n const errorMessage = `Pathname \"${pathnameNormalized}\" doesn't pass matcher rules check`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const { pages } = await structureParsedPromise;\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n const errorMessage = `Can not find data for \"${pathnameNormalized}\". Please check structure`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const title = pageInstruction.title;\n const { data } = await loadContent(pageInstruction.uri, pageInstruction.configuration.provider);\n\n return { title, raw: data };\n };\n\n const getPageInstruction = async (pathname: string) => {\n const pathnameNormalized = normalizePathname(pathname);\n if (matchingRules && !matchingRules.every((rule) => rule.test(pathname))) {\n const errorMessage = `Pathname \"${pathnameNormalized}\" doesn't pass matcher rules check`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n const { pages } = await structureParsedPromise;\n const pageInstruction = pages[pathnameNormalized];\n\n if (!pageInstruction) {\n const errorMessage = `Can not find data for \"${pathnameNormalized}\". Please check structure`;\n if (options.processError) return options.processError(404, errorMessage) || null;\n throw new Error(errorMessage);\n }\n\n return pageInstruction;\n };\n\n return { Page, Sidebar, getStaticParams, getMetadata, getPageData, getPageInstruction };\n};\n"],"names":["initializeRobindoc","structureTemplate","options","structureParsedPromise","async","structure","configuration","getConfiguration","parseStructure","items","loadStructure","matchingRules","matcher","map","rule","RegExp","replace","Page","pathname","props","pathnameNormalized","normalizePathname","every","test","errorMessage","processError","Error","pages","pageInstruction","paths","Object","keys","targetPageIndex","indexOf","prevPagePathname","nextPagePathname","length","prev","title","next","breadcrumbs","crumbs","crumb","clientPages","entries","reduce","acc","clientPath","origPath","push","React","ArticleBase","provider","uri","undefined","Sidebar","tree","createElement","SidebarBase","getStaticParams","prefix","segmentsParamKey","pagesArr","prefixWithoutTrailingSlash","removeTrailingSlash","cur","startsWith","substring","split","getMetadata","getMetadataBase","getPageData","data","loadContent","raw","getPageInstruction"],"mappings":"4bAkBA,MAaaA,EAAqB,CAACC,EAAsCC,EAAmB,MACxF,MAAMC,EAdYC,OAAOH,IACzB,IAAII,EAEAA,EAD6B,mBAAtBJ,QACWA,IAENA,EAGhB,MAAMK,EAAgBC,EAAiBF,EAAUC,eAAiB,CAAA,GAElE,OAAOE,EAAeH,EAAUI,OAAS,GAAIH,IAIdI,CAAcT,GACvCU,EAAgBT,EAAQU,SAASC,IAAKC,GAAS,IAAIC,OAAO,IAAID,EAAKE,QAAQ,WAAY,SA8I7F,MAAO,CAAEC,KA5IyBb,OAASc,cAAaC,MACpD,MAAMC,EAAqBC,EAAkBH,GAC7C,GAAIP,IAAkBA,EAAcW,MAAOR,GAASA,EAAKS,KAAKL,IAAY,CACtE,MAAMM,EAAe,aAAaJ,sCAClC,GAAIlB,EAAQuB,aAAc,OAAOvB,EAAQuB,aAAa,IAAKD,IAAiB,KAC5E,MAAM,IAAIE,MAAMF,EACpB,CAEA,MAAMG,MAAEA,SAAgBxB,EAClByB,EAAkBD,EAAMP,GAE9B,IAAKQ,EAAiB,CAClB,MAAMJ,EAAe,0BAA0BJ,6BAC/C,GAAIlB,EAAQuB,aAAc,OAAOvB,EAAQuB,aAAa,IAAKD,IAAiB,KAC5E,MAAM,IAAIE,MAAMF,EACpB,CAEA,MAAMK,EAAQC,OAAOC,KAAKJ,GACpBK,EAAkBH,EAAMI,QAAQb,GAChCc,EAAmBL,EAAMG,EAAkB,GAC3CG,EAAmBH,EAAkBH,EAAMO,OAAS,GAAKP,EAAMG,EAAkB,GACjFK,EAAOH,GAAoB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6BAC/C,GAAIlB,EAAQuB,aAAc,OAAOvB,EAAQuB,aAAa,IAAKD,IAAiB,KAC5E,MAAM,IAAIE,MAAMF,EACpB,CAEA,OAAOI"}
package/lib/styles.css CHANGED
@@ -1,4 +1,39 @@
1
- .r-header {
1
+ .r-footer {
2
+ border-top: 1px solid var(--r-main-300);
3
+ padding-top: 16px;
4
+ padding-bottom: 16px;
5
+ }
6
+
7
+ .r-footer-row {
8
+ display: flex;
9
+ justify-content: space-between;
10
+ align-items: center;
11
+ gap: 32px;
12
+ }
13
+
14
+ .r-footer-additional {
15
+ margin-top: 20px;
16
+ justify-content: flex-end;
17
+ }
18
+
19
+ .r-copyright {
20
+ color: var(--r-main-800);
21
+ }
22
+
23
+ .r-powered {
24
+ font-size: 14px;
25
+ display: block;
26
+ color: var(--r-main-600);
27
+ }
28
+
29
+ .r-powered-link {
30
+ font-weight: 600;
31
+ text-decoration: none;
32
+ color: var(--r-main-950);
33
+ }
34
+ .r-powered-link:hover {
35
+ color: var(--r-primary-900);
36
+ }.r-header {
2
37
  position: sticky;
3
38
  background-color: var(--r-main-50);
4
39
  top: 0;
@@ -87,41 +122,6 @@
87
122
  width: 100%;
88
123
  left: 0;
89
124
  }
90
- }.r-footer {
91
- border-top: 1px solid var(--r-main-300);
92
- padding-top: 16px;
93
- padding-bottom: 16px;
94
- }
95
-
96
- .r-footer-row {
97
- display: flex;
98
- justify-content: space-between;
99
- align-items: center;
100
- gap: 32px;
101
- }
102
-
103
- .r-footer-additional {
104
- margin-top: 20px;
105
- justify-content: flex-end;
106
- }
107
-
108
- .r-copyright {
109
- color: var(--r-main-800);
110
- }
111
-
112
- .r-powered {
113
- font-size: 14px;
114
- display: block;
115
- color: var(--r-main-600);
116
- }
117
-
118
- .r-powered-link {
119
- font-weight: 600;
120
- text-decoration: none;
121
- color: var(--r-main-950);
122
- }
123
- .r-powered-link:hover {
124
- color: var(--r-primary-900);
125
125
  }.r-root {
126
126
  --r-header-height: 60px;
127
127
  position: relative;
@@ -373,7 +373,7 @@
373
373
  .r-docs-container {
374
374
  column-gap: 40px;
375
375
  grid-template-areas: "sidebar breadcrumbs contents" "sidebar content contents" "sidebar pagination contents";
376
- grid-template-columns: 1fr 640px 1fr;
376
+ grid-template-columns: 200px 640px 1fr;
377
377
  grid-template-rows: auto 1fr auto;
378
378
  }
379
379
  }.r-blog-container {
@@ -725,6 +725,84 @@
725
725
 
726
726
  .r-sidebar-drop[open] > .r-sidebar-drop-btn > .r-sidebar-drop-icon {
727
727
  transform: rotate(90deg);
728
+ }.r-container {
729
+ max-width: 1180px;
730
+ padding-right: 12px;
731
+ padding-left: 12px;
732
+ margin-right: auto;
733
+ margin-left: auto;
734
+ box-sizing: border-box;
735
+ }.r-theme-switcher {
736
+ position: relative;
737
+ display: flex;
738
+ gap: 4px;
739
+ width: 108px;
740
+ height: 36px;
741
+ padding: 2px;
742
+ background-color: var(--r-main-950);
743
+ border-radius: 14px;
744
+ box-sizing: border-box;
745
+ }
746
+ .r-theme-switcher::before {
747
+ content: "";
748
+ position: absolute;
749
+ display: block;
750
+ height: 32px;
751
+ width: 32px;
752
+ top: 2px;
753
+ left: 2px;
754
+ background-color: var(--r-main-50);
755
+ border-radius: 12px;
756
+ transition: left 0.2s;
757
+ box-sizing: border-box;
758
+ }
759
+
760
+ .r-theme-switcher-btn {
761
+ padding: 8px;
762
+ background: none;
763
+ border: 0;
764
+ border-radius: 12px;
765
+ cursor: pointer;
766
+ color: var(--r-main-50);
767
+ fill: var(--r-main-950);
768
+ z-index: 1;
769
+ transition: color 0.2s 0.1s, fill 0.2s;
770
+ }
771
+ .r-theme-switcher-btn:hover {
772
+ color: var(--r-main-50);
773
+ fill: var(--r-main-50);
774
+ }
775
+
776
+ .r-theme-dark:not(.r-theme-system) .r-theme-switcher::before {
777
+ left: 2px;
778
+ }
779
+
780
+ .r-theme-dark:not(.r-theme-system) .r-theme-switcher-btn__dark {
781
+ color: var(--r-main-950);
782
+ pointer-events: none;
783
+ }
784
+
785
+ .r-theme-switcher::before,
786
+ .r-theme-system .r-theme-switcher::before {
787
+ left: 38px;
788
+ }
789
+
790
+ .r-theme-system .r-theme-switcher-btn__system {
791
+ color: var(--r-main-950);
792
+ pointer-events: none;
793
+ }
794
+
795
+ .r-theme-light:not(.r-theme-system) .r-theme-switcher::before {
796
+ left: 74px;
797
+ }
798
+
799
+ .r-theme-light:not(.r-theme-system) .r-theme-switcher-btn__light {
800
+ color: var(--r-main-950);
801
+ pointer-events: none;
802
+ }
803
+
804
+ .r-theme-switcher-svg {
805
+ display: block;
728
806
  }.r-header-menu {
729
807
  display: flex;
730
808
  justify-content: flex-end;
@@ -929,24 +1007,6 @@
929
1007
  font-size: 14px;
930
1008
  color: var(--r-main-600);
931
1009
  margin: 12px 0 0;
932
- }.r-header-social {
933
- display: flex;
934
- flex: 1;
935
- justify-content: flex-end;
936
- }
937
- @media screen and (width >= 1024px) {
938
- .r-header-social {
939
- flex: none;
940
- justify-content: unset;
941
- }
942
- }
943
-
944
- .r-header-social-git {
945
- color: var(--r-main-700);
946
- transition: color 0.2s;
947
- }
948
- .r-header-social-git:hover, .r-header-social-git:focus {
949
- color: var(--r-main-950);
950
1010
  }.r-dropdown {
951
1011
  position: relative;
952
1012
  color: var(--r-main-600);
@@ -1026,84 +1086,24 @@
1026
1086
 
1027
1087
  .r-dropdown-link._active {
1028
1088
  color: var(--r-primary-700);
1029
- }.r-container {
1030
- max-width: 1180px;
1031
- padding-right: 12px;
1032
- padding-left: 12px;
1033
- margin-right: auto;
1034
- margin-left: auto;
1035
- box-sizing: border-box;
1036
- }.r-theme-switcher {
1037
- position: relative;
1089
+ }.r-header-social {
1038
1090
  display: flex;
1039
- gap: 4px;
1040
- width: 108px;
1041
- height: 36px;
1042
- padding: 2px;
1043
- background-color: var(--r-main-950);
1044
- border-radius: 14px;
1045
- box-sizing: border-box;
1046
- }
1047
- .r-theme-switcher::before {
1048
- content: "";
1049
- position: absolute;
1050
- display: block;
1051
- height: 32px;
1052
- width: 32px;
1053
- top: 2px;
1054
- left: 2px;
1055
- background-color: var(--r-main-50);
1056
- border-radius: 12px;
1057
- transition: left 0.2s;
1058
- box-sizing: border-box;
1059
- }
1060
-
1061
- .r-theme-switcher-btn {
1062
- padding: 8px;
1063
- background: none;
1064
- border: 0;
1065
- border-radius: 12px;
1066
- cursor: pointer;
1067
- color: var(--r-main-50);
1068
- fill: var(--r-main-950);
1069
- z-index: 1;
1070
- transition: color 0.2s 0.1s, fill 0.2s;
1071
- }
1072
- .r-theme-switcher-btn:hover {
1073
- color: var(--r-main-50);
1074
- fill: var(--r-main-50);
1075
- }
1076
-
1077
- .r-theme-dark:not(.r-theme-system) .r-theme-switcher::before {
1078
- left: 2px;
1079
- }
1080
-
1081
- .r-theme-dark:not(.r-theme-system) .r-theme-switcher-btn__dark {
1082
- color: var(--r-main-950);
1083
- pointer-events: none;
1084
- }
1085
-
1086
- .r-theme-switcher::before,
1087
- .r-theme-system .r-theme-switcher::before {
1088
- left: 38px;
1091
+ flex: 1;
1092
+ justify-content: flex-end;
1089
1093
  }
1090
-
1091
- .r-theme-system .r-theme-switcher-btn__system {
1092
- color: var(--r-main-950);
1093
- pointer-events: none;
1094
+ @media screen and (width >= 1024px) {
1095
+ .r-header-social {
1096
+ flex: none;
1097
+ justify-content: unset;
1098
+ }
1094
1099
  }
1095
1100
 
1096
- .r-theme-light:not(.r-theme-system) .r-theme-switcher::before {
1097
- left: 74px;
1101
+ .r-header-social-git {
1102
+ color: var(--r-main-700);
1103
+ transition: color 0.2s;
1098
1104
  }
1099
-
1100
- .r-theme-light:not(.r-theme-system) .r-theme-switcher-btn__light {
1105
+ .r-header-social-git:hover, .r-header-social-git:focus {
1101
1106
  color: var(--r-main-950);
1102
- pointer-events: none;
1103
- }
1104
-
1105
- .r-theme-switcher-svg {
1106
- display: block;
1107
1107
  }.r-keylink {
1108
1108
  display: block;
1109
1109
  position: relative;
@@ -1124,47 +1124,6 @@
1124
1124
  user-select: none;
1125
1125
  pointer-events: none;
1126
1126
  box-sizing: border-box;
1127
- }.r-breadcrumbs {
1128
- grid-area: breadcrumbs;
1129
- list-style: none;
1130
- margin: 0;
1131
- padding: 20px 0 0;
1132
- line-height: 2;
1133
- }
1134
- @media screen and (width >= 768px) {
1135
- .r-breadcrumbs {
1136
- padding: 32px 0 0;
1137
- }
1138
- }
1139
-
1140
- .r-breadcrumb {
1141
- display: inline;
1142
- }
1143
-
1144
- .r-breadcrumb._previous::after {
1145
- content: "/";
1146
- font-weight: 600;
1147
- margin-inline: 8px;
1148
- }
1149
-
1150
- .r-breadcrumb-link {
1151
- color: var(--r-main-700);
1152
- text-decoration: none;
1153
- }
1154
- .r-breadcrumb-link:hover {
1155
- color: var(--r-primary-800);
1156
- }
1157
-
1158
- .r-breadcrumb-link,
1159
- .r-breadcrumb-title {
1160
- display: inline;
1161
- padding: 6px 0;
1162
- margin: 0;
1163
- }
1164
-
1165
- .r-breadcrumb-title {
1166
- color: var(--r-main-950);
1167
- font-weight: 600;
1168
1127
  }.r-contents {
1169
1128
  grid-area: contents;
1170
1129
  }
@@ -1398,6 +1357,47 @@
1398
1357
  }
1399
1358
  .r-contents-git:hover {
1400
1359
  color: var(--r-main-900);
1360
+ }.r-breadcrumbs {
1361
+ grid-area: breadcrumbs;
1362
+ list-style: none;
1363
+ margin: 0;
1364
+ padding: 20px 0 0;
1365
+ line-height: 2;
1366
+ }
1367
+ @media screen and (width >= 768px) {
1368
+ .r-breadcrumbs {
1369
+ padding: 32px 0 0;
1370
+ }
1371
+ }
1372
+
1373
+ .r-breadcrumb {
1374
+ display: inline;
1375
+ }
1376
+
1377
+ .r-breadcrumb._previous::after {
1378
+ content: "/";
1379
+ font-weight: 600;
1380
+ margin-inline: 8px;
1381
+ }
1382
+
1383
+ .r-breadcrumb-link {
1384
+ color: var(--r-main-700);
1385
+ text-decoration: none;
1386
+ }
1387
+ .r-breadcrumb-link:hover {
1388
+ color: var(--r-primary-800);
1389
+ }
1390
+
1391
+ .r-breadcrumb-link,
1392
+ .r-breadcrumb-title {
1393
+ display: inline;
1394
+ padding: 6px 0;
1395
+ margin: 0;
1396
+ }
1397
+
1398
+ .r-breadcrumb-title {
1399
+ color: var(--r-main-950);
1400
+ font-weight: 600;
1401
1401
  }.r-pagination {
1402
1402
  grid-area: pagination;
1403
1403
  display: grid;
@@ -1525,6 +1525,14 @@
1525
1525
  }
1526
1526
  .r-anchor-heading-link::after {
1527
1527
  content: "#";
1528
+ }.r-block {
1529
+ width: 100%;
1530
+ overflow: auto;
1531
+ margin-block-start: 12px;
1532
+ margin-block-end: 12px;
1533
+ scrollbar-width: thin;
1534
+ scrollbar-color: var(--r-main-200) transparent;
1535
+ box-sizing: border-box;
1528
1536
  }.r-code-section {
1529
1537
  position: relative;
1530
1538
  margin-block-start: 1.5em;
@@ -1576,14 +1584,6 @@
1576
1584
 
1577
1585
  .r-code-section-filename {
1578
1586
  font-family: var(--monospace-font, monospace, monospace);
1579
- }.r-block {
1580
- width: 100%;
1581
- overflow: auto;
1582
- margin-block-start: 12px;
1583
- margin-block-end: 12px;
1584
- scrollbar-width: thin;
1585
- scrollbar-color: var(--r-main-200) transparent;
1586
- box-sizing: border-box;
1587
1587
  }.r-blockquote {
1588
1588
  background-color: var(--r-main-100);
1589
1589
  padding: 8px 12px 8px 20px;
@@ -1755,22 +1755,6 @@
1755
1755
 
1756
1756
  .r-tab-header-code {
1757
1757
  font-family: var(--monospace-font, monospace, monospace);
1758
- }.r-kbd-container {
1759
- display: flex;
1760
- gap: 4px;
1761
- font-size: 14px;
1762
- cursor: pointer;
1763
- }
1764
- .r-kbd-container:hover {
1765
- color: var(--r-main-950);
1766
- }.r-kbd-key {
1767
- background-color: var(--r-main-200);
1768
- font-size: 12px;
1769
- border-radius: 4px;
1770
- padding: 5px 8px;
1771
- min-width: 24px;
1772
- text-align: center;
1773
- box-sizing: border-box;
1774
1758
  }.r-modal {
1775
1759
  position: fixed;
1776
1760
  left: 0;
@@ -1806,6 +1790,71 @@
1806
1790
  .r-modal._visible {
1807
1791
  transform: translateX(-50%) scale(1);
1808
1792
  }
1793
+ }.r-kbd-container {
1794
+ display: flex;
1795
+ gap: 4px;
1796
+ font-size: 14px;
1797
+ cursor: pointer;
1798
+ }
1799
+ .r-kbd-container:hover {
1800
+ color: var(--r-main-950);
1801
+ }.r-kbd-key {
1802
+ background-color: var(--r-main-200);
1803
+ font-size: 12px;
1804
+ border-radius: 4px;
1805
+ padding: 5px 8px;
1806
+ min-width: 24px;
1807
+ text-align: center;
1808
+ box-sizing: border-box;
1809
+ }.r-content-link {
1810
+ text-decoration: none;
1811
+ color: inherit;
1812
+ text-decoration: underline;
1813
+ text-decoration-color: var(--r-primary-500);
1814
+ text-underline-offset: 3px;
1815
+ transition: text-decoration-offset 0.2s ease;
1816
+ }
1817
+ .r-content-link:hover {
1818
+ color: var(--r-main-700);
1819
+ text-decoration-color: var(--r-primary-400);
1820
+ text-underline-offset: 2px;
1821
+ text-decoration-thickness: 2px;
1822
+ }
1823
+ .r-content-link:active {
1824
+ color: var(--r-primary-600);
1825
+ }
1826
+
1827
+ .r-content-link-external {
1828
+ position: relative;
1829
+ vertical-align: text-top;
1830
+ display: inline-block;
1831
+ margin-left: -4px;
1832
+ margin-right: 2px;
1833
+ width: 6px;
1834
+ height: 6px;
1835
+ box-sizing: border-box;
1836
+ }
1837
+ .r-content-link-external::after {
1838
+ content: "";
1839
+ position: absolute;
1840
+ top: 0;
1841
+ right: 0;
1842
+ width: 100%;
1843
+ height: 100%;
1844
+ border-top: 1px solid currentColor;
1845
+ border-right: 1px solid currentColor;
1846
+ box-sizing: border-box;
1847
+ }
1848
+ .r-content-link-external::before {
1849
+ content: "";
1850
+ position: absolute;
1851
+ top: 0;
1852
+ right: 0;
1853
+ width: 3px;
1854
+ height: 3px;
1855
+ background-color: currentColor;
1856
+ border-radius: 0 0 0 4px;
1857
+ box-sizing: border-box;
1809
1858
  }.r-copy-button {
1810
1859
  position: relative;
1811
1860
  padding: 6px;
@@ -1877,55 +1926,6 @@
1877
1926
  .r-copy-text:active,
1878
1927
  .r-copy-text._active {
1879
1928
  color: var(--r-success);
1880
- }.r-content-link {
1881
- text-decoration: none;
1882
- color: inherit;
1883
- text-decoration: underline;
1884
- text-decoration-color: var(--r-primary-500);
1885
- text-underline-offset: 3px;
1886
- transition: text-decoration-offset 0.2s ease;
1887
- }
1888
- .r-content-link:hover {
1889
- color: var(--r-main-700);
1890
- text-decoration-color: var(--r-primary-400);
1891
- text-underline-offset: 2px;
1892
- text-decoration-thickness: 2px;
1893
- }
1894
- .r-content-link:active {
1895
- color: var(--r-primary-600);
1896
- }
1897
-
1898
- .r-content-link-external {
1899
- position: relative;
1900
- vertical-align: text-top;
1901
- display: inline-block;
1902
- margin-left: -4px;
1903
- margin-right: 2px;
1904
- width: 6px;
1905
- height: 6px;
1906
- box-sizing: border-box;
1907
- }
1908
- .r-content-link-external::after {
1909
- content: "";
1910
- position: absolute;
1911
- top: 0;
1912
- right: 0;
1913
- width: 100%;
1914
- height: 100%;
1915
- border-top: 1px solid currentColor;
1916
- border-right: 1px solid currentColor;
1917
- box-sizing: border-box;
1918
- }
1919
- .r-content-link-external::before {
1920
- content: "";
1921
- position: absolute;
1922
- top: 0;
1923
- right: 0;
1924
- width: 3px;
1925
- height: 3px;
1926
- background-color: currentColor;
1927
- border-radius: 0 0 0 4px;
1928
- box-sizing: border-box;
1929
1929
  }.r-li {
1930
1930
  line-height: 1.8;
1931
1931
  margin-block-start: 6px;
@@ -1954,13 +1954,13 @@
1954
1954
  padding: 6px 12px;
1955
1955
  border-bottom: 1px solid var(--r-main-400);
1956
1956
  border-collapse: collapse;
1957
+ }.r-thead {
1958
+ background-color: var(--r-main-100);
1957
1959
  }.r-th {
1958
1960
  padding: 6px 12px;
1959
1961
  border-top: 1px solid var(--r-main-500);
1960
1962
  border-bottom: 1px solid var(--r-main-500);
1961
1963
  border-collapse: collapse;
1962
- }.r-thead {
1963
- background-color: var(--r-main-100);
1964
1964
  }.r-task-li.r-task-li {
1965
1965
  margin-block-start: 2px;
1966
1966
  margin-block-end: 2px;
@@ -1990,10 +1990,10 @@
1990
1990
 
1991
1991
  .r-task-label-text {
1992
1992
  vertical-align: middle;
1993
- }.r-task-ol {
1994
- list-style: none;
1995
1993
  }.r-task-ul {
1996
1994
  list-style: none;
1995
+ }.r-task-ol {
1996
+ list-style: none;
1997
1997
  }.r-backdrop {
1998
1998
  position: fixed;
1999
1999
  top: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "robindoc",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
4
4
  "description": "Robindoc is a framework for automatically creating documentation websites based on markdown files, built on React.js Server Components",
5
5
  "main": "./lib/index.js",
6
6
  "scripts": {