elseware-docs-engine 1.2.2 → 1.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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +175 -139
  3. package/dist/components/docs-page-renderer/DocsPageRenderer.d.ts +6 -0
  4. package/dist/components/docs-page-renderer/DocsPageRenderer.d.ts.map +1 -0
  5. package/dist/components/index.d.ts +3 -0
  6. package/dist/components/index.d.ts.map +1 -0
  7. package/dist/context/DocsContext.d.ts +7 -0
  8. package/dist/context/DocsContext.d.ts.map +1 -0
  9. package/dist/context/DocsProvider.d.ts +10 -0
  10. package/dist/context/DocsProvider.d.ts.map +1 -0
  11. package/dist/context/index.d.ts +3 -0
  12. package/dist/context/index.d.ts.map +1 -0
  13. package/dist/engine/DocsEngine.d.ts +10 -0
  14. package/dist/engine/DocsEngine.d.ts.map +1 -0
  15. package/dist/engine/index.d.ts +3 -0
  16. package/dist/engine/index.d.ts.map +1 -0
  17. package/dist/hooks/index.d.ts +6 -0
  18. package/dist/hooks/index.d.ts.map +1 -0
  19. package/dist/hooks/useCurrentDocsSection.d.ts +2 -0
  20. package/dist/hooks/useCurrentDocsSection.d.ts.map +1 -0
  21. package/dist/hooks/useCurrentPage.d.ts +6 -0
  22. package/dist/hooks/useCurrentPage.d.ts.map +1 -0
  23. package/dist/hooks/useDocs.d.ts +2 -0
  24. package/dist/hooks/useDocs.d.ts.map +1 -0
  25. package/dist/hooks/useScopedSidebar.d.ts +2 -0
  26. package/dist/hooks/useScopedSidebar.d.ts.map +1 -0
  27. package/dist/hooks/useSidebar.d.ts +2 -0
  28. package/dist/hooks/useSidebar.d.ts.map +1 -0
  29. package/dist/index.css +6 -1
  30. package/dist/index.css.map +1 -1
  31. package/dist/index.d.ts +10 -71
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +2 -2
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +2 -2
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/router/generateDocsRoutes.d.ts +9 -0
  38. package/dist/router/generateDocsRoutes.d.ts.map +1 -0
  39. package/dist/router/index.d.ts +2 -0
  40. package/dist/router/index.d.ts.map +1 -0
  41. package/dist/types/docs.d.ts +12 -0
  42. package/dist/types/docs.d.ts.map +1 -0
  43. package/dist/types/index.d.ts +2 -0
  44. package/dist/types/index.d.ts.map +1 -0
  45. package/dist/utils/docs.d.ts +10 -0
  46. package/dist/utils/docs.d.ts.map +1 -0
  47. package/dist/utils/index.d.ts +4 -0
  48. package/dist/utils/index.d.ts.map +1 -0
  49. package/dist/utils/path.d.ts +5 -0
  50. package/dist/utils/path.d.ts.map +1 -0
  51. package/dist/utils/sidebar.d.ts +4 -0
  52. package/dist/utils/sidebar.d.ts.map +1 -0
  53. package/package.json +90 -60
  54. package/dist/index.d.mts +0 -71
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 elseware Technology
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,139 +1,175 @@
1
- # elseware Docs Engine
2
-
3
- A modern React documentation engine built for structured Markdown-based documentation websites with nested routing, sidebar generation, dark mode support, and responsive layouts.
4
-
5
- Built with:
6
- - React
7
- - TypeScript
8
- - Vite
9
- - React Router
10
- - elseware-ui
11
- - MDXEditor
12
-
13
- ---
14
-
15
- ## Features
16
-
17
- - Nested documentation structure
18
- - Automatic sidebar generation
19
- - Responsive mobile sidebar
20
- - Markdown rendering
21
- - Code block support
22
- - Dark mode support
23
- - Customizable base path
24
- - TypeScript support
25
- - Vite powered
26
- - Clean documentation layouts
27
-
28
- ---
29
-
30
- ## Installation
31
-
32
- ```bash
33
- npm install elseware-docs-engine
34
- ```
35
-
36
- ---
37
-
38
- ## Import Styles
39
-
40
- ```ts
41
- import "elseware-docs-engine/dist/index.css";
42
- ```
43
-
44
- ---
45
-
46
- ## Basic Usage
47
-
48
- ```tsx
49
- import React from "react";
50
-
51
- import ReactDOM from "react-dom/client";
52
-
53
- import { DocsEngine } from "elseware-docs-engine";
54
-
55
- import docs from "./docs";
56
-
57
- import "elseware-docs-engine/dist/index.css";
58
-
59
- ReactDOM.createRoot(document.getElementById("root")!).render(
60
- <React.StrictMode>
61
- <DocsEngine
62
- docs={docs}
63
- basePath="/docs"
64
- />
65
- </React.StrictMode>,
66
- );
67
- ```
68
-
69
- ---
70
-
71
- ## Docs Structure Example
72
-
73
- ```ts
74
- import intro from "./getting-started/intro.md?raw";
75
-
76
- import { DocsCategory } from "elseware-docs-engine";
77
-
78
- const docs: DocsCategory[] = [
79
- {
80
- title: "Getting Started",
81
-
82
- path: "/getting-started",
83
-
84
- children: [
85
- {
86
- title: "Introduction",
87
-
88
- path: "/intro",
89
-
90
- content: intro,
91
- },
92
- ],
93
- },
94
- ];
95
-
96
- export default docs;
97
- ```
98
-
99
- ---
100
-
101
- ## Markdown Features
102
-
103
- - Headings
104
- - Tables
105
- - Lists
106
- - Images
107
- - Links
108
- - Quotes
109
- - Code blocks
110
- - Syntax highlighting
111
- - Nested navigation
112
-
113
- ---
114
-
115
- ## Development
116
-
117
- ```bash
118
- npm run dev
119
- ```
120
-
121
- ---
122
-
123
- ## Build
124
-
125
- ```bash
126
- npm run build
127
- ```
128
-
129
- ---
130
-
131
- ## License
132
-
133
- MIT License
134
-
135
- ---
136
-
137
- ## Author
138
-
139
- elseware Technology
1
+ # elseware Docs Engine
2
+
3
+ A modern React documentation engine built for structured Markdown-based documentation websites with nested routing, sidebar generation, dark mode support, and responsive layouts.
4
+
5
+ Built with:
6
+
7
+ - React
8
+ - TypeScript 7
9
+ - Vite
10
+ - React Router
11
+ - elseware-ui
12
+ - MDXEditor
13
+
14
+ ---
15
+
16
+ ## Features
17
+
18
+ - Nested documentation structure
19
+ - Automatic sidebar generation
20
+ - Responsive mobile sidebar
21
+ - Markdown rendering
22
+ - Code block support
23
+ - Dark mode support
24
+ - Customizable base path
25
+ - TypeScript support
26
+ - Vite powered
27
+ - Clean documentation layouts
28
+
29
+ ---
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ npm install elseware-docs-engine
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Import Styles
40
+
41
+ ```ts
42
+ import "elseware-docs-engine/dist/index.css";
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Basic Usage
48
+
49
+ ```tsx
50
+ import React from "react";
51
+
52
+ import ReactDOM from "react-dom/client";
53
+
54
+ import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";
55
+
56
+ import {
57
+ DocsEngine,
58
+ DocsPageRenderer,
59
+ useCurrentPage,
60
+ } from "elseware-docs-engine";
61
+
62
+ import docs from "./docs";
63
+
64
+ import "elseware-docs-engine/dist/index.css";
65
+
66
+ function Documentation() {
67
+ const page = useCurrentPage();
68
+
69
+ return page ? (
70
+ <DocsPageRenderer content={page.content} />
71
+ ) : (
72
+ <Navigate to="/docs/getting-started/intro" replace />
73
+ );
74
+ }
75
+
76
+ ReactDOM.createRoot(document.getElementById("root")!).render(
77
+ <React.StrictMode>
78
+ <BrowserRouter>
79
+ <DocsEngine docs={docs} basePath="/docs">
80
+ <Routes>
81
+ <Route path="/docs/*" element={<Documentation />} />
82
+ </Routes>
83
+ </DocsEngine>
84
+ </BrowserRouter>
85
+ </React.StrictMode>,
86
+ );
87
+ ```
88
+
89
+ When deploying this as a single-page application, configure the host to
90
+ rewrite document requests to `index.html` so direct links and browser reloads
91
+ reach React Router.
92
+
93
+ ---
94
+
95
+ ## Docs Structure Example
96
+
97
+ ```ts
98
+ import intro from "./getting-started/intro.md?raw";
99
+
100
+ import { DocsCategory } from "elseware-docs-engine";
101
+
102
+ const docs: DocsCategory[] = [
103
+ {
104
+ title: "Getting Started",
105
+
106
+ path: "/getting-started",
107
+
108
+ children: [
109
+ {
110
+ title: "Introduction",
111
+
112
+ path: "/intro",
113
+
114
+ content: intro,
115
+ },
116
+ ],
117
+ },
118
+ ];
119
+
120
+ export default docs;
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Markdown Features
126
+
127
+ - Headings
128
+ - Tables
129
+ - Lists
130
+ - Images
131
+ - Links
132
+ - Quotes
133
+ - Code blocks
134
+ - Syntax highlighting
135
+ - Nested navigation
136
+
137
+ ---
138
+
139
+ ## Development
140
+
141
+ ```bash
142
+ npm install
143
+ npm run dev
144
+ ```
145
+
146
+ ### Code quality
147
+
148
+ ```bash
149
+ npm run typecheck # TypeScript 7 project check
150
+ npm run lint # TypeScript and React rules with Oxlint
151
+ npm run format:check
152
+ npm run deadcode
153
+ npm run build # ESM, CommonJS, CSS, and declarations
154
+ npm run validate # Every quality gate and the production build
155
+ ```
156
+
157
+ TypeScript 7 is the only compiler dependency. `tsup` bundles JavaScript and
158
+ CSS, then the TypeScript 7 CLI emits the declaration files. Oxlint provides
159
+ TypeScript and React linting without relying on the removed legacy compiler
160
+ API.
161
+
162
+ Staged source files are linted and formatted automatically by the Husky
163
+ pre-commit hook.
164
+
165
+ ---
166
+
167
+ ## License
168
+
169
+ MIT License
170
+
171
+ ---
172
+
173
+ ## Author
174
+
175
+ elseware Technology
@@ -0,0 +1,6 @@
1
+ interface DocsPageRendererProps {
2
+ content: string;
3
+ }
4
+ declare function DocsPageRenderer({ content }: DocsPageRendererProps): import("react").JSX.Element;
5
+ export default DocsPageRenderer;
6
+ //# sourceMappingURL=DocsPageRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocsPageRenderer.d.ts","sourceRoot":"","sources":["../../../src/components/docs-page-renderer/DocsPageRenderer.tsx"],"names":[],"mappings":"AAEA,UAAU,qBAAqB;IAC7B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,iBAAS,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE,qBAAqB,+BAE3D;eAEc,gBAAgB"}
@@ -0,0 +1,3 @@
1
+ import DocsPageRenderer from "./docs-page-renderer/DocsPageRenderer";
2
+ export { DocsPageRenderer };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,uCAAuC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type DocsCategory } from "../types";
2
+ export interface DocsContextType {
3
+ docs: DocsCategory[];
4
+ basePath: string;
5
+ }
6
+ export declare const DocsContext: import("react").Context<DocsContextType | undefined>;
7
+ //# sourceMappingURL=DocsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocsContext.d.ts","sourceRoot":"","sources":["../../src/context/DocsContext.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,sDAEvB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ import { type DocsCategory } from "../types";
3
+ interface DocsProviderProps {
4
+ docs: DocsCategory[];
5
+ basePath: string;
6
+ children: ReactNode;
7
+ }
8
+ declare function DocsProvider({ docs, basePath, children }: DocsProviderProps): import("react").JSX.Element;
9
+ export default DocsProvider;
10
+ //# sourceMappingURL=DocsProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocsProvider.d.ts","sourceRoot":"","sources":["../../src/context/DocsProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,UAAU,iBAAiB;IACzB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,iBAAS,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,iBAAiB,+BAMpE;eAEc,YAAY"}
@@ -0,0 +1,3 @@
1
+ export * from "./DocsContext";
2
+ export * from "./DocsProvider";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ import { type DocsCategory } from "../types";
3
+ interface DocsEngineProps {
4
+ docs: DocsCategory[];
5
+ basePath?: string;
6
+ children: ReactNode;
7
+ }
8
+ declare function DocsEngine({ docs, basePath, children }: DocsEngineProps): import("react").JSX.Element;
9
+ export default DocsEngine;
10
+ //# sourceMappingURL=DocsEngine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocsEngine.d.ts","sourceRoot":"","sources":["../../src/engine/DocsEngine.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAG7C,UAAU,eAAe;IACvB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,iBAAS,UAAU,CAAC,EAAE,IAAI,EAAE,QAAc,EAAE,QAAQ,EAAE,EAAE,eAAe,+BAQtE;eAEc,UAAU"}
@@ -0,0 +1,3 @@
1
+ import DocsEngine from "./DocsEngine";
2
+ export { DocsEngine };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./useCurrentDocsSection";
2
+ export * from "./useCurrentPage";
3
+ export * from "./useDocs";
4
+ export * from "./useScopedSidebar";
5
+ export * from "./useSidebar";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function useCurrentDocsSection(): import("..").DocsCategory | undefined;
2
+ //# sourceMappingURL=useCurrentDocsSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrentDocsSection.d.ts","sourceRoot":"","sources":["../../src/hooks/useCurrentDocsSection.ts"],"names":[],"mappings":"AAMA,wBAAgB,qBAAqB,0CAYpC"}
@@ -0,0 +1,6 @@
1
+ interface UseCurrentPageProps {
2
+ debug?: boolean;
3
+ }
4
+ export declare function useCurrentPage({ debug }?: UseCurrentPageProps): import("..").DocsPage | null;
5
+ export {};
6
+ //# sourceMappingURL=useCurrentPage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCurrentPage.d.ts","sourceRoot":"","sources":["../../src/hooks/useCurrentPage.ts"],"names":[],"mappings":"AAMA,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,cAAc,CAAC,EAAE,KAAa,EAAE,GAAE,mBAAwB,gCAkBzE"}
@@ -0,0 +1,2 @@
1
+ export declare function useDocs(): import("..").DocsContextType;
2
+ //# sourceMappingURL=useDocs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDocs.d.ts","sourceRoot":"","sources":["../../src/hooks/useDocs.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,iCAQtB"}
@@ -0,0 +1,2 @@
1
+ export declare function useScopedSidebar(): import("elseware-ui").MenuNode[];
2
+ //# sourceMappingURL=useScopedSidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScopedSidebar.d.ts","sourceRoot":"","sources":["../../src/hooks/useScopedSidebar.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,qCAU/B"}
@@ -0,0 +1,2 @@
1
+ export declare function useSidebar(): import("elseware-ui").MenuNode[];
2
+ //# sourceMappingURL=useSidebar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSidebar.d.ts","sourceRoot":"","sources":["../../src/hooks/useSidebar.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,qCAIzB"}