elseware-docs-engine 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,139 +1,174 @@
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 native compiler
150
+ npm run typecheck:compat # TypeScript 6 compatibility check
151
+ npm run lint
152
+ npm run format:check
153
+ npm run deadcode
154
+ npm run validate # Every quality gate and the production build
155
+ ```
156
+
157
+ TypeScript 7 supplies the native `tsc` executable. The TypeScript 6
158
+ compatibility package is installed alongside it for tools that still require
159
+ the compiler API, including `typescript-eslint` and declaration generation.
160
+
161
+ Staged source files are linted and formatted automatically by the Husky
162
+ pre-commit hook.
163
+
164
+ ---
165
+
166
+ ## License
167
+
168
+ MIT License
169
+
170
+ ---
171
+
172
+ ## Author
173
+
174
+ elseware Technology
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/styles/index.css"],"sourcesContent":["*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}/*\n! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden]:where(:not([hidden=\"until-found\"])) {\n display: none;\n}\r\n.fixed {\n position: fixed;\n}\r\n.mb-3 {\n margin-bottom: 0.75rem;\n}\r\n.mb-4 {\n margin-bottom: 1rem;\n}\r\n.mb-8 {\n margin-bottom: 2rem;\n}\r\n.flex {\n display: flex;\n}\r\n.inline-flex {\n display: inline-flex;\n}\r\n.h-10 {\n height: 2.5rem;\n}\r\n.min-h-screen {\n min-height: 100vh;\n}\r\n.w-full {\n width: 100%;\n}\r\n.max-w-lg {\n max-width: 32rem;\n}\r\n.flex-row {\n flex-direction: row;\n}\r\n.flex-col {\n flex-direction: column;\n}\r\n.items-center {\n align-items: center;\n}\r\n.justify-center {\n justify-content: center;\n}\r\n.justify-between {\n justify-content: space-between;\n}\r\n.gap-3 {\n gap: 0.75rem;\n}\r\n.gap-4 {\n gap: 1rem;\n}\r\n.rounded-2xl {\n border-radius: 1rem;\n}\r\n.rounded-lg {\n border-radius: 0.5rem;\n}\r\n.border {\n border-width: 1px;\n}\r\n.border-gray-800 {\n --tw-border-opacity: 1;\n border-color: rgb(31 41 55 / var(--tw-border-opacity, 1));\n}\r\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\r\n.bg-neutral-950 {\n --tw-bg-opacity: 1;\n background-color: rgb(10 10 10 / var(--tw-bg-opacity, 1));\n}\r\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\r\n.p-10 {\n padding: 2.5rem;\n}\r\n.p-4 {\n padding: 1rem;\n}\r\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\r\n.px-5 {\n padding-left: 1.25rem;\n padding-right: 1.25rem;\n}\r\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\r\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\r\n.py-2\\.5 {\n padding-top: 0.625rem;\n padding-bottom: 0.625rem;\n}\r\n.pt-\\[54px\\] {\n padding-top: 54px;\n}\r\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\r\n.text-6xl {\n font-size: 3.75rem;\n line-height: 1;\n}\r\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\r\n.font-bold {\n font-weight: 700;\n}\r\n.font-medium {\n font-weight: 500;\n}\r\n.font-semibold {\n font-weight: 600;\n}\r\n.leading-relaxed {\n line-height: 1.625;\n}\r\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity, 1));\n}\r\n.text-gray-400 {\n --tw-text-opacity: 1;\n color: rgb(156 163 175 / var(--tw-text-opacity, 1));\n}\r\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\r\n.shadow-2xl {\n --tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\r\n.transition-all {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\r\n.hover\\:cursor-pointer:hover {\n cursor: pointer;\n}\r\n.hover\\:opacity-90:hover {\n opacity: 0.9;\n}"],"mappings":"AAAA,EAAG,QAAU,OACX,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,aACA,aACA,kBACA,6BAA6B,UAC7B,8BACA,6BACA,4BACA,eACA,oBACA,sBACA,uBACA,wBACA,kBACA,wBAAwB,IACxB,wBAAwB,KACxB,iBAAiB,IAAI,GAAG,IAAI,IAAI,EAAE,IAClC,yBAAyB,EAAE,EAAE,MAC7B,kBAAkB,EAAE,EAAE,MACtB,aAAa,EAAE,EAAE,MACjB,qBAAqB,EAAE,EAAE,MACzB,YACA,kBACA,gBACA,iBACA,kBACA,cACA,gBACA,aACA,mBACA,qBACA,2BACA,yBACA,0BACA,2BACA,uBACA,wBACA,yBACA,sBACA,oBACA,sBACA,qBACA,oBACF,CAEA,WACE,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,aACA,aACA,kBACA,6BAA6B,UAC7B,8BACA,6BACA,4BACA,eACA,oBACA,sBACA,uBACA,wBACA,kBACA,wBAAwB,IACxB,wBAAwB,KACxB,iBAAiB,IAAI,GAAG,IAAI,IAAI,EAAE,IAClC,yBAAyB,EAAE,EAAE,MAC7B,kBAAkB,EAAE,EAAE,MACtB,aAAa,EAAE,E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E,EAAE,EAAE,IAAI,iBAAiB,EAAE,GAC5C,CACA,CAAC,cACC,mBAAmB,EACnB,MAAO,IAAI,IAAI,IAAI,IAAI,EAAE,IAAI,iBAAiB,EAAE,GAClD,CACA,CAAC,WACC,mBAAmB,EACnB,MAAO,IAAI,IAAI,IAAI,IAAI,EAAE,IAAI,iBAAiB,EAAE,GAClD,CACA,CAAC,WACC,aAAa,EAAE,KAAK,KAAK,MAAM,IAAI,EAAE,EAAE,EAAE,EAAE,KAC3C,qBAAqB,EAAE,KAAK,KAAK,MAAM,IAAI,mBAC3C,WAAY,IAAI,uBAAuB,EAAE,EAAE,EAAE,MAAM,CAAE,IAAI,gBAAgB,EAAE,EAAE,EAAE,MAAM,CAAE,IAAI,YAC7F,CACA,CAAC,eACC,oBAAqB,IACrB,2BAA4B,aAAa,EAAG,CAAE,CAAC,CAAE,EAAG,CAAE,GACtD,oBAAqB,IACvB,CACA,CAAC,qBAAqB,OACpB,OAAQ,OACV,CACA,CAAC,iBAAiB,OAChB,QAAS,EACX","names":[]}
1
+ {"version":3,"sources":["../src/styles/index.css"],"sourcesContent":["*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}/*\n! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden]:where(:not([hidden=\"until-found\"])) {\n display: none;\n}\n.fixed {\n position: fixed;\n}\n.mb-3 {\n margin-bottom: 0.75rem;\n}\n.mb-4 {\n margin-bottom: 1rem;\n}\n.mb-8 {\n margin-bottom: 2rem;\n}\n.flex {\n display: flex;\n}\n.inline-flex {\n display: inline-flex;\n}\n.h-10 {\n height: 2.5rem;\n}\n.min-h-screen {\n min-height: 100vh;\n}\n.w-full {\n width: 100%;\n}\n.max-w-lg {\n max-width: 32rem;\n}\n.flex-row {\n flex-direction: row;\n}\n.flex-col {\n flex-direction: column;\n}\n.items-center {\n align-items: center;\n}\n.justify-center {\n justify-content: center;\n}\n.justify-between {\n justify-content: space-between;\n}\n.gap-3 {\n gap: 0.75rem;\n}\n.gap-4 {\n gap: 1rem;\n}\n.rounded-2xl {\n border-radius: 1rem;\n}\n.rounded-lg {\n border-radius: 0.5rem;\n}\n.border {\n border-width: 1px;\n}\n.border-gray-800 {\n --tw-border-opacity: 1;\n border-color: rgb(31 41 55 / var(--tw-border-opacity, 1));\n}\n.bg-black {\n --tw-bg-opacity: 1;\n background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));\n}\n.bg-neutral-950 {\n --tw-bg-opacity: 1;\n background-color: rgb(10 10 10 / var(--tw-bg-opacity, 1));\n}\n.bg-white {\n --tw-bg-opacity: 1;\n background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.p-10 {\n padding: 2.5rem;\n}\n.p-4 {\n padding: 1rem;\n}\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n.px-5 {\n padding-left: 1.25rem;\n padding-right: 1.25rem;\n}\n.px-6 {\n padding-left: 1.5rem;\n padding-right: 1.5rem;\n}\n.py-1 {\n padding-top: 0.25rem;\n padding-bottom: 0.25rem;\n}\n.py-2\\.5 {\n padding-top: 0.625rem;\n padding-bottom: 0.625rem;\n}\n.pt-\\[54px\\] {\n padding-top: 54px;\n}\n.text-2xl {\n font-size: 1.5rem;\n line-height: 2rem;\n}\n.text-6xl {\n font-size: 3.75rem;\n line-height: 1;\n}\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.font-bold {\n font-weight: 700;\n}\n.font-medium {\n font-weight: 500;\n}\n.font-semibold {\n font-weight: 600;\n}\n.leading-relaxed {\n line-height: 1.625;\n}\n.text-black {\n --tw-text-opacity: 1;\n color: rgb(0 0 0 / var(--tw-text-opacity, 1));\n}\n.text-gray-400 {\n --tw-text-opacity: 1;\n color: rgb(156 163 175 / var(--tw-text-opacity, 1));\n}\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.shadow-2xl {\n --tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);\n --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.transition-all {\n transition-property: all;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n.hover\\:cursor-pointer:hover {\n cursor: pointer;\n}\n.hover\\:opacity-90:hover {\n opacity: 0.9;\n}\n"],"mappings":"AAAA,EAAG,QAAU,OACX,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,aACA,aACA,kBACA,6BAA6B,UAC7B,8BACA,6BACA,4BACA,eACA,oBACA,sBACA,uBACA,wBACA,kBACA,wBAAwB,IACxB,wBAAwB,KACxB,iBAAiB,IAAI,GAAG,IAAI,IAAI,EAAE,IAClC,yBAAyB,EAAE,EAAE,MAC7B,kBAAkB,EAAE,EAAE,MACtB,aAAa,EAAE,EAAE,MACjB,qBAAqB,EAAE,EAAE,MACzB,YACA,kBACA,gBACA,iBACA,kBACA,cACA,gBACA,aACA,mBACA,qBACA,2BACA,yBACA,0BACA,2BACA,uBACA,wBACA,yBACA,sBACA,oBACA,sBACA,qBACA,oBACF,CAEA,WACE,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACd,aACA,aACA,kBACA,6BAA6B,UAC7B,8BACA,6BACA,4BACA,eACA,oBACA,sBACA,uBACA,wBACA,kBACA,wBAAwB,IACxB,wBAAwB,KACxB,iBAAiB,IAAI,GAAG,IAAI,IAAI,EAAE,IAClC,yBAAyB,EAAE,EAAE,MAC7B,kBAAkB,EAAE,EAAE,MACtB,aAAa,EAAE,EAAE,MACjB,qBAAqB,EAAE,EAAE,MACzB,YACA,kBACA,gBACA,iBACA,kBACA,cACA,gBACA,aACA,mBACA,qBACA,2BACA,yBACA,0BACA,2BACA,uBACA,wBACA,yBACA,sBACA,oBACA,sBACA,qBACA,oBACF,CAOA,EACA,QACA,OACE,WAAY,WACZ,aAAc,EACd,aAAc,MACd,aAAc,OAChB,CAEA,QACA,OACE,cAAc,EAChB,CAYA,KACA,MACE,YAAa,IACb,yBAA0B,KAC1B,cAAe,EACf,YAAa,EACV,SAAU,EACb,YAAa,aAAa,CAAE,SAAS,CAAE,UAAU,CAAE,mBAAmB,CAAE,gBAAgB,CAAE,eAAiB,CAAE,mBAC7G,sBAAuB,OACvB,wBAAyB,OACzB,4BAA6B,WAC/B,CAOA,KA3JA,OA4JU,EACR,YAAa,OACf,CAQA,GACE,OAAQ,EACR,MAAO,QACP,iBAAkB,GACpB,CAMA,IAAI,OAAO,CAAC,QACV,wBAAyB,UAAU,OAC3B,gBAAiB,UAAU,MACrC,CAMA,GACA,GACA,GACA,GACA,GACA,GACE,UAAW,QACX,YAAa,OACf,CAMA,EACE,MAAO,QACP,gBAAiB,OACnB,CAMA,EACA,OACE,YAAa,MACf,CASA,KACA,IACA,KACA,IACE,YAAa,YAAY,CAAE,cAAc,CAAE,KAAK,CA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e,OACjB,CACA,CAAC,KACC,aAAc,OACd,cAAe,MACjB,CACA,CAAC,KACC,YAAa,OACb,eAAgB,MAClB,CACA,CAAC,QACC,YAAa,QACb,eAAgB,OAClB,CACA,CAAC,YACC,YAAa,IACf,CACA,CAAC,SACC,UAAW,OACX,YAAa,IACf,CACA,CAAC,SACC,UAAW,QACX,YAAa,CACf,CACA,CAAC,QACC,UAAW,QACX,YAAa,OACf,CACA,CAAC,UACC,YAAa,GACf,CACA,CAAC,YACC,YAAa,GACf,CACA,CAAC,cACC,YAAa,GACf,CACA,CAAC,gBACC,YAAa,KACf,CACA,CAAC,WACC,mBAAmB,EACnB,MAAO,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,iBAAiB,EAAE,GAC5C,CACA,CAAC,cACC,mBAAmB,EACnB,MAAO,IAAI,IAAI,IAAI,IAAI,EAAE,IAAI,iBAAiB,EAAE,GAClD,CACA,CAAC,WACC,mBAAmB,EACnB,MAAO,IAAI,IAAI,IAAI,IAAI,EAAE,IAAI,iBAAiB,EAAE,GAClD,CACA,CAAC,WACC,aAAa,EAAE,KAAK,KAAK,MAAM,IAAI,EAAE,EAAE,EAAE,EAAE,KAC3C,qBAAqB,EAAE,KAAK,KAAK,MAAM,IAAI,mBAC3C,WAAY,IAAI,uBAAuB,EAAE,EAAE,EAAE,MAAM,CAAE,IAAI,gBAAgB,EAAE,EAAE,EAAE,MAAM,CAAE,IAAI,YAC7F,CACA,CAAC,eACC,oBAAqB,IACrB,2BAA4B,aAAa,EAAG,CAAE,CAAC,CAAE,EAAG,CAAE,GACtD,oBAAqB,IACvB,CACA,CAAC,qBAAqB,OACpB,OAAQ,OACV,CACA,CAAC,iBAAiB,OAChB,QAAS,EACX","names":[]}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as React from 'react';
3
- import React__default from 'react';
2
+ import * as react from 'react';
3
+ import { ReactNode } from 'react';
4
4
  import * as elseware_ui from 'elseware-ui';
5
5
  import { MenuNode } from 'elseware-ui';
6
6
  import { RouteObject } from 'react-router-dom';
@@ -8,7 +8,7 @@ import { RouteObject } from 'react-router-dom';
8
8
  interface DocsPageRendererProps {
9
9
  content: string;
10
10
  }
11
- declare function DocsPageRenderer({ content, }: DocsPageRendererProps): react_jsx_runtime.JSX.Element;
11
+ declare function DocsPageRenderer({ content }: DocsPageRendererProps): react_jsx_runtime.JSX.Element;
12
12
 
13
13
  interface DocsPage {
14
14
  title: string;
@@ -26,12 +26,12 @@ interface DocsContextType {
26
26
  docs: DocsCategory[];
27
27
  basePath: string;
28
28
  }
29
- declare const DocsContext: React.Context<DocsContextType | undefined>;
29
+ declare const DocsContext: react.Context<DocsContextType | undefined>;
30
30
 
31
31
  interface DocsEngineProps {
32
32
  docs: DocsCategory[];
33
33
  basePath?: string;
34
- children: React__default.ReactNode;
34
+ children: ReactNode;
35
35
  }
36
36
  declare function DocsEngine({ docs, basePath, children }: DocsEngineProps): react_jsx_runtime.JSX.Element;
37
37
 
@@ -50,7 +50,7 @@ declare function useSidebar(): elseware_ui.MenuNode[];
50
50
 
51
51
  interface GenerateDocsRoutesProps {
52
52
  basePath?: string;
53
- element: React__default.ReactNode;
53
+ element: ReactNode;
54
54
  }
55
55
  declare function generateDocsRoutes({ basePath, element, }: GenerateDocsRoutesProps): RouteObject[];
56
56
 
@@ -65,7 +65,9 @@ declare function findFirstPage(nodes: DocsNode[], parentPath?: string): string |
65
65
 
66
66
  declare function normalizePath(path: string): string;
67
67
  declare function normalizeRoutePath(path: string): string;
68
+ declare function isPathWithin(path: string, parentPath: string): boolean;
69
+ declare function stripBasePath(path: string, basePath: string): string | null;
68
70
 
69
71
  declare function generateSidebar(docs: DocsCategory[], basePath: string): MenuNode[];
70
72
 
71
- export { type DocsCategory, DocsContext, type DocsContextType, DocsEngine, type DocsNode, type DocsPage, DocsPageRenderer, type ResolvedDocsPage, findFirstPage, findPageByPath, generateDocsRoutes, generateSidebar, isPage, normalizePath, normalizeRoutePath, resolveDocs, useCurrentDocsSection, useCurrentPage, useDocs, useScopedSidebar, useSidebar };
73
+ export { type DocsCategory, DocsContext, type DocsContextType, DocsEngine, type DocsNode, type DocsPage, DocsPageRenderer, type ResolvedDocsPage, findFirstPage, findPageByPath, generateDocsRoutes, generateSidebar, isPage, isPathWithin, normalizePath, normalizeRoutePath, resolveDocs, stripBasePath, useCurrentDocsSection, useCurrentPage, useDocs, useScopedSidebar, useSidebar };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as React from 'react';
3
- import React__default from 'react';
2
+ import * as react from 'react';
3
+ import { ReactNode } from 'react';
4
4
  import * as elseware_ui from 'elseware-ui';
5
5
  import { MenuNode } from 'elseware-ui';
6
6
  import { RouteObject } from 'react-router-dom';
@@ -8,7 +8,7 @@ import { RouteObject } from 'react-router-dom';
8
8
  interface DocsPageRendererProps {
9
9
  content: string;
10
10
  }
11
- declare function DocsPageRenderer({ content, }: DocsPageRendererProps): react_jsx_runtime.JSX.Element;
11
+ declare function DocsPageRenderer({ content }: DocsPageRendererProps): react_jsx_runtime.JSX.Element;
12
12
 
13
13
  interface DocsPage {
14
14
  title: string;
@@ -26,12 +26,12 @@ interface DocsContextType {
26
26
  docs: DocsCategory[];
27
27
  basePath: string;
28
28
  }
29
- declare const DocsContext: React.Context<DocsContextType | undefined>;
29
+ declare const DocsContext: react.Context<DocsContextType | undefined>;
30
30
 
31
31
  interface DocsEngineProps {
32
32
  docs: DocsCategory[];
33
33
  basePath?: string;
34
- children: React__default.ReactNode;
34
+ children: ReactNode;
35
35
  }
36
36
  declare function DocsEngine({ docs, basePath, children }: DocsEngineProps): react_jsx_runtime.JSX.Element;
37
37
 
@@ -50,7 +50,7 @@ declare function useSidebar(): elseware_ui.MenuNode[];
50
50
 
51
51
  interface GenerateDocsRoutesProps {
52
52
  basePath?: string;
53
- element: React__default.ReactNode;
53
+ element: ReactNode;
54
54
  }
55
55
  declare function generateDocsRoutes({ basePath, element, }: GenerateDocsRoutesProps): RouteObject[];
56
56
 
@@ -65,7 +65,9 @@ declare function findFirstPage(nodes: DocsNode[], parentPath?: string): string |
65
65
 
66
66
  declare function normalizePath(path: string): string;
67
67
  declare function normalizeRoutePath(path: string): string;
68
+ declare function isPathWithin(path: string, parentPath: string): boolean;
69
+ declare function stripBasePath(path: string, basePath: string): string | null;
68
70
 
69
71
  declare function generateSidebar(docs: DocsCategory[], basePath: string): MenuNode[];
70
72
 
71
- export { type DocsCategory, DocsContext, type DocsContextType, DocsEngine, type DocsNode, type DocsPage, DocsPageRenderer, type ResolvedDocsPage, findFirstPage, findPageByPath, generateDocsRoutes, generateSidebar, isPage, normalizePath, normalizeRoutePath, resolveDocs, useCurrentDocsSection, useCurrentPage, useDocs, useScopedSidebar, useSidebar };
73
+ export { type DocsCategory, DocsContext, type DocsContextType, DocsEngine, type DocsNode, type DocsPage, DocsPageRenderer, type ResolvedDocsPage, findFirstPage, findPageByPath, generateDocsRoutes, generateSidebar, isPage, isPathWithin, normalizePath, normalizeRoutePath, resolveDocs, stripBasePath, useCurrentDocsSection, useCurrentPage, useDocs, useScopedSidebar, useSidebar };
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';require('elseware-ui/styles.css');var elsewareUi=require('elseware-ui'),jsxRuntime=require('react/jsx-runtime'),react=require('react'),reactRouterDom=require('react-router-dom');function w({content:e}){return jsxRuntime.jsx(elsewareUi.DocumentationPanel,{value:e})}var y=w;var c=react.createContext(void 0);function P({docs:e,basePath:t,children:o}){return jsxRuntime.jsx(c.Provider,{value:{docs:e,basePath:t},children:o})}var g=P;function k({docs:e,basePath:t="/",children:o}){let r=t.startsWith("/")?t:`/${t}`;return jsxRuntime.jsx(g,{docs:e,basePath:r,children:o})}var z=k;function a(){let e=react.useContext(c);if(!e)throw new Error("useDocs must be used within DocsProvider");return e}function h(){let{docs:e}=a(),t=reactRouterDom.useLocation();return e.find(o=>t.pathname.startsWith(o.path))}function n(e){return "/"+e.replace(/\/+/g,"/").replace(/^\/|\/$/g,"")}function f(e){return e.replace(/^\/+/,"").replace(/\/+$/,"")}function s(e){return "content"in e}function l(e,t,o=""){let r=n(t);for(let i of e){let p=n(`${o}/${i.path}`);if(s(i)){if(p===r)return i}else {let m=l(i.children,t,p);if(m)return m}}return null}function N(e,t=""){let o=[];return e.forEach(r=>{let i=n(`${t}/${r.path}`);if(s(r)){o.push({...r,id:i.replace(/\//g,"-").replace(/^-/,""),fullPath:i});return}o.push(...N(r.children,i));}),o}function $(e,t=""){for(let o of e){let r=n(`${t}/${o.path}`);if(s(o))return r;let i=$(o.children,r);if(i)return i}return null}function u(e,t,o=""){return e.map(r=>{let i=n(`${o}/${r.path}`);return s(r)?{type:"item",name:r.title,to:n(`${t}/${i}`)}:{type:"group",name:r.title,items:u(r.children,t,i)}})}function d(e,t){return u(e,t)}function le({debug:e=false}={}){let{docs:t,basePath:o}=a(),r=reactRouterDom.useLocation(),i=n(r.pathname.replace(new RegExp(`^${o}`),""));return e&&(console.log("location.pathname",r.pathname),console.log("basePath",o),console.log("pagePath",i)),l(t,i)}function he(){let e=h();return e?d([e],"/"):[]}function we(){let{docs:e,basePath:t}=a();return d(e,t)}function ve({basePath:e="/docs",element:t}){return [{path:`${f(e)}/*`,element:t}]}
2
- exports.DocsContext=c;exports.DocsEngine=z;exports.DocsPageRenderer=y;exports.findFirstPage=$;exports.findPageByPath=l;exports.generateDocsRoutes=ve;exports.generateSidebar=d;exports.isPage=s;exports.normalizePath=n;exports.normalizeRoutePath=f;exports.resolveDocs=N;exports.useCurrentDocsSection=h;exports.useCurrentPage=le;exports.useDocs=a;exports.useScopedSidebar=he;exports.useSidebar=we;//# sourceMappingURL=index.js.map
1
+ 'use strict';require('elseware-ui/styles.css');var elsewareUi=require('elseware-ui'),jsxRuntime=require('react/jsx-runtime'),react=require('react'),reactRouterDom=require('react-router-dom');function x({content:t}){return jsxRuntime.jsx(elsewareUi.DocumentationPanel,{value:t})}var v=x;var c=react.createContext(void 0);function z({docs:t,basePath:o,children:r}){return jsxRuntime.jsx(c.Provider,{value:{docs:t,basePath:o},children:r})}var f=z;function n(t){return "/"+t.replace(/\/+/g,"/").replace(/^\/|\/$/g,"")}function g(t){return t.replace(/^\/+/,"").replace(/\/+$/,"")}function p(t,o){let r=n(t),e=n(o);return e==="/"||r===e||r.startsWith(`${e}/`)}function d(t,o){let r=n(t),e=n(o);return p(r,e)?e==="/"?r:n(r.slice(e.length)):null}function s(t){return "content"in t}function h(t,o,r=""){let e=n(o);for(let i of t){let m=n(`${r}/${i.path}`);if(s(i)){if(m===e)return i}else {let u=h(i.children,o,m);if(u)return u}}return null}function C(t,o=""){let r=[];return t.forEach(e=>{let i=n(`${o}/${e.path}`);if(s(e)){r.push({...e,id:i.replace(/\//g,"-").replace(/^-/,""),fullPath:i});return}r.push(...C(e.children,i));}),r}function R(t,o=""){for(let r of t){let e=n(`${o}/${r.path}`);if(s(r))return e;let i=R(r.children,e);if(i)return i}return null}function b(t,o,r=""){return t.map(e=>{let i=n(`${r}/${e.path}`);return s(e)?{type:"item",name:e.title,to:n(`${o}/${i}`)}:{type:"group",name:e.title,items:b(e.children,o,i)}})}function l(t,o){return b(t,o)}function S({docs:t,basePath:o="/",children:r}){let e=n(o);return jsxRuntime.jsx(f,{docs:t,basePath:e,children:r})}var N=S;function a(){let t=react.useContext(c);if(!t)throw new Error("useDocs must be used within DocsProvider");return t}function w(){let{docs:t,basePath:o}=a(),r=reactRouterDom.useLocation(),e=d(r.pathname,o);if(e)return t.find(i=>p(e,i.path))}function ft({debug:t=false}={}){let{docs:o,basePath:r}=a(),e=reactRouterDom.useLocation(),i=d(e.pathname,r);return t&&(console.log("location.pathname",e.pathname),console.log("basePath",r),console.log("pagePath",i)),i?h(o,i):null}function xt(){let{basePath:t}=a(),o=w();return o?l([o],t):[]}function zt(){let{docs:t,basePath:o}=a();return l(t,o)}function St({basePath:t="/docs",element:o}){return [{path:`${g(t)}/*`,element:o}]}
2
+ exports.DocsContext=c;exports.DocsEngine=N;exports.DocsPageRenderer=v;exports.findFirstPage=R;exports.findPageByPath=h;exports.generateDocsRoutes=St;exports.generateSidebar=l;exports.isPage=s;exports.isPathWithin=p;exports.normalizePath=n;exports.normalizeRoutePath=g;exports.resolveDocs=C;exports.stripBasePath=d;exports.useCurrentDocsSection=w;exports.useCurrentPage=ft;exports.useDocs=a;exports.useScopedSidebar=xt;exports.useSidebar=zt;//# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/docs-page-renderer/DocsPageRenderer.tsx","../src/context/DocsContext.ts","../src/context/DocsProvider.tsx","../src/engine/DocsEngine.tsx","../src/hooks/useDocs.ts","../src/hooks/useCurrentDocsSection.ts","../src/utils/path.ts","../src/utils/docs.ts","../src/utils/sidebar.ts","../src/hooks/useCurrentPage.ts","../src/hooks/useScopedSidebar.ts","../src/hooks/useSidebar.ts","../src/router/generateDocsRoutes.tsx"],"names":["DocsPageRenderer","content","jsx","DocumentationPanel","DocsPageRenderer_default","DocsContext","createContext","DocsProvider","docs","basePath","children","DocsProvider_default","DocsEngine","normalizedBasePath","DocsEngine_default","useDocs","context","useContext","useCurrentDocsSection","location","useLocation","doc","normalizePath","path","normalizeRoutePath","isPage","node","findPageByPath","nodes","targetPath","parentPath","normalizedTarget","currentPath","result","resolveDocs","pages","findFirstPage","child","mapNodes","fullPath","generateSidebar","useCurrentPage","debug","pagePath","useScopedSidebar","section","useSidebar","generateDocsRoutes","element"],"mappings":"+LAQA,SAASA,CAAAA,CAAiB,CACxB,OAAA,CAAAC,CACF,CAAA,CAA0B,CACxB,OAAOC,cAAAA,CAACC,6BAAAA,CAAA,CAAmB,KAAA,CAAOF,CAAAA,CAAS,CAC7C,CAEA,IAAOG,CAAAA,CAAQJ,ECLR,IAAMK,CAAAA,CAAcC,mBAAAA,CACzB,MACF,ECCA,SAASC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E,IAAA,CAAM,CAAA,EAJaxB,CAAAA,CAAmBf,CAAQ,CAIvB,CAAA,EAAA,CAAA,CACvB,OAAA,CAAAuC,CACF,CACF,CACF","file":"index.js","sourcesContent":["import React from \"react\";\r\n\r\nimport { DocumentationPanel } from \"elseware-ui\";\r\n\r\ninterface DocsPageRendererProps {\r\n content: string;\r\n}\r\n\r\nfunction DocsPageRenderer({\r\n content,\r\n}: DocsPageRendererProps) {\r\n return <DocumentationPanel value={content} />;\r\n}\r\n\r\nexport default DocsPageRenderer;","import { createContext } from \"react\";\r\n\r\nimport { DocsCategory } from \"../types\";\r\n\r\nexport interface DocsContextType {\r\n docs: DocsCategory[];\r\n basePath: string;\r\n}\r\n\r\nexport const DocsContext = createContext<DocsContextType | undefined>(\r\n undefined,\r\n);\r\n","import React from \"react\";\r\n\r\nimport { DocsContext } from \"./DocsContext\";\r\n\r\nimport { DocsCategory } from \"../types\";\r\n\r\ninterface DocsProviderProps {\r\n docs: DocsCategory[];\r\n basePath: string;\r\n children: React.ReactNode;\r\n}\r\n\r\nfunction DocsProvider({ docs, basePath, children }: DocsProviderProps) {\r\n return (\r\n <DocsContext.Provider value={{ docs, basePath }}>\r\n {children}\r\n </DocsContext.Provider>\r\n );\r\n}\r\n\r\nexport default DocsProvider;\r\n","import React from \"react\";\r\n\r\nimport DocsProvider from \"../context/DocsProvider\";\r\n\r\nimport { DocsCategory } from \"../types\";\r\n\r\ninterface DocsEngineProps {\r\n docs: DocsCategory[];\r\n basePath?: string;\r\n children: React.ReactNode;\r\n}\r\n\r\nfunction DocsEngine({ docs, basePath = \"/\", children }: DocsEngineProps) {\r\n const normalizedBasePath = basePath.startsWith(\"/\")\r\n ? basePath\r\n : `/${basePath}`;\r\n\r\n return (\r\n <DocsProvider docs={docs} basePath={normalizedBasePath}>\r\n {children}\r\n </DocsProvider>\r\n );\r\n}\r\n\r\nexport default DocsEngine;\r\n","import { useContext } from \"react\";\r\n\r\nimport { DocsContext } from \"../context\";\r\n\r\nexport function useDocs() {\r\n const context = useContext(DocsContext);\r\n\r\n if (!context) {\r\n throw new Error(\"useDocs must be used within DocsProvider\");\r\n }\r\n\r\n return context;\r\n}\r\n","import { useLocation } from \"react-router-dom\";\r\n\r\nimport { useDocs } from \"./useDocs\";\r\n\r\nexport function useCurrentDocsSection() {\r\n const { docs } = useDocs();\r\n\r\n const location = useLocation();\r\n\r\n return docs.find((doc) => location.pathname.startsWith(doc.path));\r\n}\r\n","export function normalizePath(path: string): string {\r\n return \"/\" + path.replace(/\\/+/g, \"/\").replace(/^\\/|\\/$/g, \"\");\r\n}\r\n\r\nexport function normalizeRoutePath(path: string): string {\r\n return path.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\r\n}\r\n","import { DocsNode, DocsPage } from \"../types\";\r\n\r\nimport { normalizePath } from \"./path\";\r\n\r\nexport interface ResolvedDocsPage extends DocsPage {\r\n id: string;\r\n fullPath: string;\r\n}\r\n\r\nexport function isPage(node: DocsNode): node is DocsPage {\r\n return \"content\" in node;\r\n}\r\n\r\nexport function findPageByPath(\r\n nodes: DocsNode[],\r\n targetPath: string,\r\n parentPath = \"\",\r\n): DocsPage | null {\r\n const normalizedTarget = normalizePath(targetPath);\r\n\r\n for (const node of nodes) {\r\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\r\n\r\n if (isPage(node)) {\r\n if (currentPath === normalizedTarget) {\r\n return node;\r\n }\r\n } else {\r\n const result = findPageByPath(node.children, targetPath, currentPath);\r\n\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport function resolveDocs(\r\n nodes: DocsNode[],\r\n parentPath = \"\",\r\n): ResolvedDocsPage[] {\r\n const pages: ResolvedDocsPage[] = [];\r\n\r\n nodes.forEach((node) => {\r\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\r\n\r\n if (isPage(node)) {\r\n pages.push({\r\n ...node,\r\n id: currentPath.replace(/\\//g, \"-\").replace(/^-/, \"\"),\r\n fullPath: currentPath,\r\n });\r\n\r\n return;\r\n }\r\n\r\n pages.push(...resolveDocs(node.children, currentPath));\r\n });\r\n\r\n return pages;\r\n}\r\n\r\nexport function findFirstPage(\r\n nodes: DocsNode[],\r\n parentPath = \"\",\r\n): string | null {\r\n for (const node of nodes) {\r\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\r\n\r\n if (isPage(node)) {\r\n return currentPath;\r\n }\r\n\r\n const child = findFirstPage(node.children, currentPath);\r\n\r\n if (child) {\r\n return child;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n","import { MenuNode } from \"elseware-ui\";\r\n\r\nimport { DocsCategory, DocsNode } from \"../types\";\r\n\r\nimport { normalizePath } from \"./path\";\r\n\r\nimport { isPage } from \"./docs\";\r\n\r\nfunction mapNodes(\r\n nodes: DocsNode[],\r\n basePath: string,\r\n parentPath = \"\",\r\n): MenuNode[] {\r\n return nodes.map((node) => {\r\n const fullPath = normalizePath(`${parentPath}/${node.path}`);\r\n\r\n if (isPage(node)) {\r\n return {\r\n type: \"item\",\r\n name: node.title,\r\n to: normalizePath(`${basePath}/${fullPath}`),\r\n };\r\n }\r\n\r\n return {\r\n type: \"group\",\r\n name: node.title,\r\n items: mapNodes(node.children, basePath, fullPath),\r\n };\r\n });\r\n}\r\n\r\nexport function generateSidebar(\r\n docs: DocsCategory[],\r\n basePath: string,\r\n): MenuNode[] {\r\n return mapNodes(docs, basePath);\r\n}\r\n","import { useLocation } from \"react-router-dom\";\r\n\r\nimport { useDocs } from \"./useDocs\";\r\n\r\nimport { findPageByPath, normalizePath } from \"../utils\";\r\n\r\ninterface UseCurrentPageProps {\r\n debug?: boolean;\r\n}\r\n\r\nexport function useCurrentPage({ debug = false }: UseCurrentPageProps = {}) {\r\n const { docs, basePath } = useDocs();\r\n\r\n const location = useLocation();\r\n\r\n // Remove docs base path\r\n const pagePath = normalizePath(\r\n location.pathname.replace(new RegExp(`^${basePath}`), \"\"),\r\n );\r\n\r\n if (debug) {\r\n console.log(\"location.pathname\", location.pathname);\r\n console.log(\"basePath\", basePath);\r\n console.log(\"pagePath\", pagePath);\r\n }\r\n\r\n return findPageByPath(docs, pagePath);\r\n}\r\n","import { generateSidebar } from \"../utils\";\r\n\r\nimport { useCurrentDocsSection } from \"./useCurrentDocsSection\";\r\n\r\nexport function useScopedSidebar() {\r\n const section = useCurrentDocsSection();\r\n\r\n if (!section) {\r\n return [];\r\n }\r\n\r\n return generateSidebar([section], \"/\");\r\n}\r\n","import { generateSidebar } from \"../utils\";\r\n\r\nimport { useDocs } from \"./useDocs\";\r\n\r\nexport function useSidebar() {\r\n const { docs, basePath } = useDocs();\r\n\r\n return generateSidebar(docs, basePath);\r\n}","import React from \"react\";\r\n\r\nimport { RouteObject } from \"react-router-dom\";\r\n\r\nimport { normalizeRoutePath } from \"../utils\";\r\n\r\ninterface GenerateDocsRoutesProps {\r\n basePath?: string;\r\n element: React.ReactNode;\r\n}\r\n\r\nexport function generateDocsRoutes({\r\n basePath = \"/docs\",\r\n element,\r\n}: GenerateDocsRoutesProps): RouteObject[] {\r\n const normalizedBase = normalizeRoutePath(basePath);\r\n\r\n return [\r\n {\r\n path: `${normalizedBase}/*`,\r\n element,\r\n },\r\n ];\r\n}\r\n"]}
1
+ {"version":3,"sources":["../src/components/docs-page-renderer/DocsPageRenderer.tsx","../src/context/DocsContext.ts","../src/context/DocsProvider.tsx","../src/utils/path.ts","../src/utils/docs.ts","../src/utils/sidebar.ts","../src/engine/DocsEngine.tsx","../src/hooks/useDocs.ts","../src/hooks/useCurrentDocsSection.ts","../src/hooks/useCurrentPage.ts","../src/hooks/useScopedSidebar.ts","../src/hooks/useSidebar.ts","../src/router/generateDocsRoutes.tsx"],"names":["DocsPageRenderer","content","jsx","DocumentationPanel","DocsPageRenderer_default","DocsContext","createContext","DocsProvider","docs","basePath","children","DocsProvider_default","normalizePath","path","normalizeRoutePath","isPathWithin","parentPath","normalizedPath","normalizedParent","stripBasePath","normalizedBase","isPage","node","findPageByPath","nodes","targetPath","normalizedTarget","currentPath","result","resolveDocs","pages","findFirstPage","child","mapNodes","fullPath","generateSidebar","DocsEngine","normalizedBasePath","DocsEngine_default","useDocs","context","useContext","useCurrentDocsSection","location","useLocation","pagePath","doc","useCurrentPage","debug","useScopedSidebar","section","useSidebar","generateDocsRoutes","element"],"mappings":"+LAMA,SAASA,EAAiB,CAAE,OAAA,CAAAC,CAAQ,CAAA,CAA0B,CAC5D,OAAOC,cAAAA,CAACC,6BAAAA,CAAA,CAAmB,KAAA,CAAOF,CAAAA,CAAS,CAC7C,KAEOG,CAAAA,CAAQJ,ECDR,IAAMK,CAAAA,CAAcC,mBAAAA,CACzB,MACF,ECCA,SAASC,CAAAA,CAAa,CAAE,IAAA,CAAAC,EAAM,QAAA,CAAAC,CAAAA,CAAU,QAAA,CAAAC,CAAS,EAAsB,CACrE,OACER,cAAAA,CAACG,CAAAA,CAAY,SAAZ,CAAqB,KAAA,CAAO,CAAE,IAAA,CAAAG,EAAM,QAAA,CAAAC,CAAS,CAAA,CAC3C,QAAA,CAAAC,EACH,CAEJ,CAEA,IAAOC,CAAAA,CAAQJ,ECpBR,SAASK,CAAAA,CAAcC,CAAAA,CAAsB,CAClD,OAAO,GAAA,CAAMA,CAAAA,CAAK,OAAA,CAAQ,MAAA,CAAQ,GAAG,CAAA,CAAE,OAAA,CAAQ,UAAA,CAAY,EAAE,CAC/D,CAEO,SAASC,CAAAA,CAAmBD,EAAsB,CACvD,OAAOA,CAAAA,CAAK,OAAA,CAAQ,OAAQ,EAAE,CAAA,CAAE,OAAA,CAAQ,MAAA,CAAQ,EAAE,CACpD,CAEO,SAASE,EAAaF,CAAAA,CAAcG,CAAAA,CAA6B,CACtE,IAAMC,EAAiBL,CAAAA,CAAcC,CAAI,CAAA,CACnCK,CAAAA,CAAmBN,EAAcI,CAAU,CAAA,CAEjD,OACEE,CAAAA,GAAqB,GAAA,EACrBD,CAAAA,GAAmBC,CAAAA,EACnBD,CAAAA,CAAe,WAAW,CAAA,EAAGC,CAA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BI,CAAAA,CAAWC,0BAAAA,GAEXC,CAAAA,CAAW1B,CAAAA,CAAcwB,CAAAA,CAAS,QAAA,CAAUlC,CAAQ,CAAA,CAQ1D,OANIuC,CAAAA,GACF,OAAA,CAAQ,IAAI,mBAAA,CAAqBL,CAAAA,CAAS,QAAQ,CAAA,CAClD,QAAQ,GAAA,CAAI,UAAA,CAAYlC,CAAQ,CAAA,CAChC,QAAQ,GAAA,CAAI,UAAA,CAAYoC,CAAQ,CAAA,CAAA,CAG7BA,CAAAA,CAIEtB,CAAAA,CAAef,CAAAA,CAAMqC,CAAQ,EAH3B,IAIX,CCvBO,SAASI,EAAAA,EAAmB,CACjC,GAAM,CAAE,QAAA,CAAAxC,CAAS,EAAI8B,CAAAA,EAAQ,CAEvBW,CAAAA,CAAUR,CAAAA,EAAsB,CAEtC,OAAKQ,CAAAA,CAIEf,CAAAA,CAAgB,CAACe,CAAO,CAAA,CAAGzC,CAAQ,CAAA,CAHjC,EAIX,CCXO,SAAS0C,EAAAA,EAAa,CAC3B,GAAM,CAAE,IAAA,CAAA3C,CAAAA,CAAM,QAAA,CAAAC,CAAS,CAAA,CAAI8B,CAAAA,GAE3B,OAAOJ,CAAAA,CAAgB3B,CAAAA,CAAMC,CAAQ,CACvC,CCGO,SAAS2C,GAAmB,CACjC,QAAA,CAAA3C,CAAAA,CAAW,OAAA,CACX,QAAA4C,CACF,CAAA,CAA2C,CAGzC,OAAO,CACL,CACE,IAAA,CAAM,CAAA,EAJavC,CAAAA,CAAmBL,CAAQ,CAIvB,CAAA,EAAA,CAAA,CACvB,OAAA,CAAA4C,CACF,CACF,CACF","file":"index.js","sourcesContent":["import { DocumentationPanel } from \"elseware-ui\";\n\ninterface DocsPageRendererProps {\n content: string;\n}\n\nfunction DocsPageRenderer({ content }: DocsPageRendererProps) {\n return <DocumentationPanel value={content} />;\n}\n\nexport default DocsPageRenderer;\n","import { createContext } from \"react\";\n\nimport { type DocsCategory } from \"../types\";\n\nexport interface DocsContextType {\n docs: DocsCategory[];\n basePath: string;\n}\n\nexport const DocsContext = createContext<DocsContextType | undefined>(\n undefined,\n);\n","import type { ReactNode } from \"react\";\n\nimport { DocsContext } from \"./DocsContext\";\n\nimport { type DocsCategory } from \"../types\";\n\ninterface DocsProviderProps {\n docs: DocsCategory[];\n basePath: string;\n children: ReactNode;\n}\n\nfunction DocsProvider({ docs, basePath, children }: DocsProviderProps) {\n return (\n <DocsContext.Provider value={{ docs, basePath }}>\n {children}\n </DocsContext.Provider>\n );\n}\n\nexport default DocsProvider;\n","export function normalizePath(path: string): string {\n return \"/\" + path.replace(/\\/+/g, \"/\").replace(/^\\/|\\/$/g, \"\");\n}\n\nexport function normalizeRoutePath(path: string): string {\n return path.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n}\n\nexport function isPathWithin(path: string, parentPath: string): boolean {\n const normalizedPath = normalizePath(path);\n const normalizedParent = normalizePath(parentPath);\n\n return (\n normalizedParent === \"/\" ||\n normalizedPath === normalizedParent ||\n normalizedPath.startsWith(`${normalizedParent}/`)\n );\n}\n\nexport function stripBasePath(path: string, basePath: string): string | null {\n const normalizedPath = normalizePath(path);\n const normalizedBase = normalizePath(basePath);\n\n if (!isPathWithin(normalizedPath, normalizedBase)) {\n return null;\n }\n\n if (normalizedBase === \"/\") {\n return normalizedPath;\n }\n\n return normalizePath(normalizedPath.slice(normalizedBase.length));\n}\n","import { type DocsNode, type DocsPage } from \"../types\";\n\nimport { normalizePath } from \"./path\";\n\nexport interface ResolvedDocsPage extends DocsPage {\n id: string;\n fullPath: string;\n}\n\nexport function isPage(node: DocsNode): node is DocsPage {\n return \"content\" in node;\n}\n\nexport function findPageByPath(\n nodes: DocsNode[],\n targetPath: string,\n parentPath = \"\",\n): DocsPage | null {\n const normalizedTarget = normalizePath(targetPath);\n\n for (const node of nodes) {\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\n\n if (isPage(node)) {\n if (currentPath === normalizedTarget) {\n return node;\n }\n } else {\n const result = findPageByPath(node.children, targetPath, currentPath);\n\n if (result) {\n return result;\n }\n }\n }\n\n return null;\n}\n\nexport function resolveDocs(\n nodes: DocsNode[],\n parentPath = \"\",\n): ResolvedDocsPage[] {\n const pages: ResolvedDocsPage[] = [];\n\n nodes.forEach((node) => {\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\n\n if (isPage(node)) {\n pages.push({\n ...node,\n id: currentPath.replace(/\\//g, \"-\").replace(/^-/, \"\"),\n fullPath: currentPath,\n });\n\n return;\n }\n\n pages.push(...resolveDocs(node.children, currentPath));\n });\n\n return pages;\n}\n\nexport function findFirstPage(\n nodes: DocsNode[],\n parentPath = \"\",\n): string | null {\n for (const node of nodes) {\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\n\n if (isPage(node)) {\n return currentPath;\n }\n\n const child = findFirstPage(node.children, currentPath);\n\n if (child) {\n return child;\n }\n }\n\n return null;\n}\n","import { type MenuNode } from \"elseware-ui\";\n\nimport { type DocsCategory, type DocsNode } from \"../types\";\n\nimport { normalizePath } from \"./path\";\n\nimport { isPage } from \"./docs\";\n\nfunction mapNodes(\n nodes: DocsNode[],\n basePath: string,\n parentPath = \"\",\n): MenuNode[] {\n return nodes.map((node) => {\n const fullPath = normalizePath(`${parentPath}/${node.path}`);\n\n if (isPage(node)) {\n return {\n type: \"item\",\n name: node.title,\n to: normalizePath(`${basePath}/${fullPath}`),\n };\n }\n\n return {\n type: \"group\",\n name: node.title,\n items: mapNodes(node.children, basePath, fullPath),\n };\n });\n}\n\nexport function generateSidebar(\n docs: DocsCategory[],\n basePath: string,\n): MenuNode[] {\n return mapNodes(docs, basePath);\n}\n","import type { ReactNode } from \"react\";\n\nimport DocsProvider from \"../context/DocsProvider\";\n\nimport { type DocsCategory } from \"../types\";\nimport { normalizePath } from \"../utils\";\n\ninterface DocsEngineProps {\n docs: DocsCategory[];\n basePath?: string;\n children: ReactNode;\n}\n\nfunction DocsEngine({ docs, basePath = \"/\", children }: DocsEngineProps) {\n const normalizedBasePath = normalizePath(basePath);\n\n return (\n <DocsProvider docs={docs} basePath={normalizedBasePath}>\n {children}\n </DocsProvider>\n );\n}\n\nexport default DocsEngine;\n","import { useContext } from \"react\";\n\nimport { DocsContext } from \"../context\";\n\nexport function useDocs() {\n const context = useContext(DocsContext);\n\n if (!context) {\n throw new Error(\"useDocs must be used within DocsProvider\");\n }\n\n return context;\n}\n","import { useLocation } from \"react-router-dom\";\n\nimport { useDocs } from \"./useDocs\";\n\nimport { isPathWithin, stripBasePath } from \"../utils\";\n\nexport function useCurrentDocsSection() {\n const { docs, basePath } = useDocs();\n\n const location = useLocation();\n\n const pagePath = stripBasePath(location.pathname, basePath);\n\n if (!pagePath) {\n return undefined;\n }\n\n return docs.find((doc) => isPathWithin(pagePath, doc.path));\n}\n","import { useLocation } from \"react-router-dom\";\n\nimport { useDocs } from \"./useDocs\";\n\nimport { findPageByPath, stripBasePath } from \"../utils\";\n\ninterface UseCurrentPageProps {\n debug?: boolean;\n}\n\nexport function useCurrentPage({ debug = false }: UseCurrentPageProps = {}) {\n const { docs, basePath } = useDocs();\n\n const location = useLocation();\n\n const pagePath = stripBasePath(location.pathname, basePath);\n\n if (debug) {\n console.log(\"location.pathname\", location.pathname);\n console.log(\"basePath\", basePath);\n console.log(\"pagePath\", pagePath);\n }\n\n if (!pagePath) {\n return null;\n }\n\n return findPageByPath(docs, pagePath);\n}\n","import { generateSidebar } from \"../utils\";\n\nimport { useCurrentDocsSection } from \"./useCurrentDocsSection\";\nimport { useDocs } from \"./useDocs\";\n\nexport function useScopedSidebar() {\n const { basePath } = useDocs();\n\n const section = useCurrentDocsSection();\n\n if (!section) {\n return [];\n }\n\n return generateSidebar([section], basePath);\n}\n","import { generateSidebar } from \"../utils\";\n\nimport { useDocs } from \"./useDocs\";\n\nexport function useSidebar() {\n const { docs, basePath } = useDocs();\n\n return generateSidebar(docs, basePath);\n}\n","import type { ReactNode } from \"react\";\n\nimport { type RouteObject } from \"react-router-dom\";\n\nimport { normalizeRoutePath } from \"../utils\";\n\ninterface GenerateDocsRoutesProps {\n basePath?: string;\n element: ReactNode;\n}\n\nexport function generateDocsRoutes({\n basePath = \"/docs\",\n element,\n}: GenerateDocsRoutesProps): RouteObject[] {\n const normalizedBase = normalizeRoutePath(basePath);\n\n return [\n {\n path: `${normalizedBase}/*`,\n element,\n },\n ];\n}\n"]}
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import'elseware-ui/styles.css';import {DocumentationPanel}from'elseware-ui';import {jsx}from'react/jsx-runtime';import {createContext,useContext}from'react';import {useLocation}from'react-router-dom';function w({content:e}){return jsx(DocumentationPanel,{value:e})}var y=w;var c=createContext(void 0);function P({docs:e,basePath:t,children:o}){return jsx(c.Provider,{value:{docs:e,basePath:t},children:o})}var g=P;function k({docs:e,basePath:t="/",children:o}){let r=t.startsWith("/")?t:`/${t}`;return jsx(g,{docs:e,basePath:r,children:o})}var z=k;function a(){let e=useContext(c);if(!e)throw new Error("useDocs must be used within DocsProvider");return e}function h(){let{docs:e}=a(),t=useLocation();return e.find(o=>t.pathname.startsWith(o.path))}function n(e){return "/"+e.replace(/\/+/g,"/").replace(/^\/|\/$/g,"")}function f(e){return e.replace(/^\/+/,"").replace(/\/+$/,"")}function s(e){return "content"in e}function l(e,t,o=""){let r=n(t);for(let i of e){let p=n(`${o}/${i.path}`);if(s(i)){if(p===r)return i}else {let m=l(i.children,t,p);if(m)return m}}return null}function N(e,t=""){let o=[];return e.forEach(r=>{let i=n(`${t}/${r.path}`);if(s(r)){o.push({...r,id:i.replace(/\//g,"-").replace(/^-/,""),fullPath:i});return}o.push(...N(r.children,i));}),o}function $(e,t=""){for(let o of e){let r=n(`${t}/${o.path}`);if(s(o))return r;let i=$(o.children,r);if(i)return i}return null}function u(e,t,o=""){return e.map(r=>{let i=n(`${o}/${r.path}`);return s(r)?{type:"item",name:r.title,to:n(`${t}/${i}`)}:{type:"group",name:r.title,items:u(r.children,t,i)}})}function d(e,t){return u(e,t)}function le({debug:e=false}={}){let{docs:t,basePath:o}=a(),r=useLocation(),i=n(r.pathname.replace(new RegExp(`^${o}`),""));return e&&(console.log("location.pathname",r.pathname),console.log("basePath",o),console.log("pagePath",i)),l(t,i)}function he(){let e=h();return e?d([e],"/"):[]}function we(){let{docs:e,basePath:t}=a();return d(e,t)}function ve({basePath:e="/docs",element:t}){return [{path:`${f(e)}/*`,element:t}]}
2
- export{c as DocsContext,z as DocsEngine,y as DocsPageRenderer,$ as findFirstPage,l as findPageByPath,ve as generateDocsRoutes,d as generateSidebar,s as isPage,n as normalizePath,f as normalizeRoutePath,N as resolveDocs,h as useCurrentDocsSection,le as useCurrentPage,a as useDocs,he as useScopedSidebar,we as useSidebar};//# sourceMappingURL=index.mjs.map
1
+ import'elseware-ui/styles.css';import {DocumentationPanel}from'elseware-ui';import {jsx}from'react/jsx-runtime';import {createContext,useContext}from'react';import {useLocation}from'react-router-dom';function x({content:t}){return jsx(DocumentationPanel,{value:t})}var v=x;var c=createContext(void 0);function z({docs:t,basePath:o,children:r}){return jsx(c.Provider,{value:{docs:t,basePath:o},children:r})}var f=z;function n(t){return "/"+t.replace(/\/+/g,"/").replace(/^\/|\/$/g,"")}function g(t){return t.replace(/^\/+/,"").replace(/\/+$/,"")}function p(t,o){let r=n(t),e=n(o);return e==="/"||r===e||r.startsWith(`${e}/`)}function d(t,o){let r=n(t),e=n(o);return p(r,e)?e==="/"?r:n(r.slice(e.length)):null}function s(t){return "content"in t}function h(t,o,r=""){let e=n(o);for(let i of t){let m=n(`${r}/${i.path}`);if(s(i)){if(m===e)return i}else {let u=h(i.children,o,m);if(u)return u}}return null}function C(t,o=""){let r=[];return t.forEach(e=>{let i=n(`${o}/${e.path}`);if(s(e)){r.push({...e,id:i.replace(/\//g,"-").replace(/^-/,""),fullPath:i});return}r.push(...C(e.children,i));}),r}function R(t,o=""){for(let r of t){let e=n(`${o}/${r.path}`);if(s(r))return e;let i=R(r.children,e);if(i)return i}return null}function b(t,o,r=""){return t.map(e=>{let i=n(`${r}/${e.path}`);return s(e)?{type:"item",name:e.title,to:n(`${o}/${i}`)}:{type:"group",name:e.title,items:b(e.children,o,i)}})}function l(t,o){return b(t,o)}function S({docs:t,basePath:o="/",children:r}){let e=n(o);return jsx(f,{docs:t,basePath:e,children:r})}var N=S;function a(){let t=useContext(c);if(!t)throw new Error("useDocs must be used within DocsProvider");return t}function w(){let{docs:t,basePath:o}=a(),r=useLocation(),e=d(r.pathname,o);if(e)return t.find(i=>p(e,i.path))}function ft({debug:t=false}={}){let{docs:o,basePath:r}=a(),e=useLocation(),i=d(e.pathname,r);return t&&(console.log("location.pathname",e.pathname),console.log("basePath",r),console.log("pagePath",i)),i?h(o,i):null}function xt(){let{basePath:t}=a(),o=w();return o?l([o],t):[]}function zt(){let{docs:t,basePath:o}=a();return l(t,o)}function St({basePath:t="/docs",element:o}){return [{path:`${g(t)}/*`,element:o}]}
2
+ export{c as DocsContext,N as DocsEngine,v as DocsPageRenderer,R as findFirstPage,h as findPageByPath,St as generateDocsRoutes,l as generateSidebar,s as isPage,p as isPathWithin,n as normalizePath,g as normalizeRoutePath,C as resolveDocs,d as stripBasePath,w as useCurrentDocsSection,ft as useCurrentPage,a as useDocs,xt as useScopedSidebar,zt as useSidebar};//# sourceMappingURL=index.mjs.map
3
3
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/docs-page-renderer/DocsPageRenderer.tsx","../src/context/DocsContext.ts","../src/context/DocsProvider.tsx","../src/engine/DocsEngine.tsx","../src/hooks/useDocs.ts","../src/hooks/useCurrentDocsSection.ts","../src/utils/path.ts","../src/utils/docs.ts","../src/utils/sidebar.ts","../src/hooks/useCurrentPage.ts","../src/hooks/useScopedSidebar.ts","../src/hooks/useSidebar.ts","../src/router/generateDocsRoutes.tsx"],"names":["DocsPageRenderer","content","jsx","DocumentationPanel","DocsPageRenderer_default","DocsContext","createContext","DocsProvider","docs","basePath","children","DocsProvider_default","DocsEngine","normalizedBasePath","DocsEngine_default","useDocs","context","useContext","useCurrentDocsSection","location","useLocation","doc","normalizePath","path","normalizeRoutePath","isPage","node","findPageByPath","nodes","targetPath","parentPath","normalizedTarget","currentPath","result","resolveDocs","pages","findFirstPage","child","mapNodes","fullPath","generateSidebar","useCurrentPage","debug","pagePath","useScopedSidebar","section","useSidebar","generateDocsRoutes","element"],"mappings":"wMAQA,SAASA,CAAAA,CAAiB,CACxB,OAAA,CAAAC,CACF,CAAA,CAA0B,CACxB,OAAOC,GAAAA,CAACC,kBAAAA,CAAA,CAAmB,KAAA,CAAOF,CAAAA,CAAS,CAC7C,CAEA,IAAOG,CAAAA,CAAQJ,ECLR,IAAMK,CAAAA,CAAcC,aAAAA,CACzB,MACF,ECCA,SAASC,CAAAA,CAAa,CAAE,IAAA,CAAAC,CAAAA,CAAM,QAAA,CAAAC,CAAAA,CAAU,QAAA,CAAAC,CAAS,CAAA,CAAsB,CACrE,OACER,GAAAA,CAACG,CAAAA,CAAY,QAAA,CAAZ,CAAqB,KAAA,CAAO,CAAE,IAAA,CAAAG,CAAAA,CAAM,QAAA,CAAAC,CAAS,CAAA,CAC3C,QAAA,CAAAC,CAAAA,CACH,CAEJ,CAEA,IAAOC,CAAAA,CAAQJ,CAAAA,CCRf,SAASK,CAAAA,CAAW,CAAE,IAAA,CAAAJ,CAAAA,CAAM,QAAA,CAAAC,CAAAA,CAAW,GAAA,CAAK,QAAA,CAAAC,CAAS,CAAA,CAAoB,CACvE,IAAMG,CAAAA,CAAqBJ,CAAAA,CAAS,UAAA,CAAW,GAAG,CAAA,CAC9CA,CAAAA,CACA,CAAA,CAAA,EAAIA,CAAQ,CAAA,CAAA,CAEhB,OACEP,GAAAA,CAACS,CAAAA,CAAA,CAAa,KAAMH,CAAAA,CAAM,QAAA,CAAUK,CAAAA,CACjC,QAAA,CAAAH,CAAAA,CACH,CAEJ,CAEA,IAAOI,CAAAA,CAAQF,ECpBR,SAASG,CAAAA,EAAU,CACxB,IAAMC,CAAAA,CAAUC,UAAAA,CAAWZ,CA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A,EAAmB,CACjC,IAAMC,CAAAA,CAAU3B,GAAsB,CAEtC,OAAK2B,CAAAA,CAIEL,CAAAA,CAAgB,CAACK,CAAO,CAAA,CAAG,GAAG,CAAA,CAH5B,EAIX,CCRO,SAASC,EAAAA,EAAa,CAC3B,GAAM,CAAE,IAAA,CAAAtC,CAAAA,CAAM,QAAA,CAAAC,CAAS,CAAA,CAAIM,CAAAA,EAAQ,CAEnC,OAAOyB,CAAAA,CAAgBhC,CAAAA,CAAMC,CAAQ,CACvC,CCGO,SAASsC,EAAAA,CAAmB,CACjC,SAAAtC,CAAAA,CAAW,OAAA,CACX,OAAA,CAAAuC,CACF,CAAA,CAA2C,CAGzC,OAAO,CACL,CACE,IAAA,CAAM,CAAA,EAJaxB,CAAAA,CAAmBf,CAAQ,CAIvB,CAAA,EAAA,CAAA,CACvB,OAAA,CAAAuC,CACF,CACF,CACF","file":"index.mjs","sourcesContent":["import React from \"react\";\r\n\r\nimport { DocumentationPanel } from \"elseware-ui\";\r\n\r\ninterface DocsPageRendererProps {\r\n content: string;\r\n}\r\n\r\nfunction DocsPageRenderer({\r\n content,\r\n}: DocsPageRendererProps) {\r\n return <DocumentationPanel value={content} />;\r\n}\r\n\r\nexport default DocsPageRenderer;","import { createContext } from \"react\";\r\n\r\nimport { DocsCategory } from \"../types\";\r\n\r\nexport interface DocsContextType {\r\n docs: DocsCategory[];\r\n basePath: string;\r\n}\r\n\r\nexport const DocsContext = createContext<DocsContextType | undefined>(\r\n undefined,\r\n);\r\n","import React from \"react\";\r\n\r\nimport { DocsContext } from \"./DocsContext\";\r\n\r\nimport { DocsCategory } from \"../types\";\r\n\r\ninterface DocsProviderProps {\r\n docs: DocsCategory[];\r\n basePath: string;\r\n children: React.ReactNode;\r\n}\r\n\r\nfunction DocsProvider({ docs, basePath, children }: DocsProviderProps) {\r\n return (\r\n <DocsContext.Provider value={{ docs, basePath }}>\r\n {children}\r\n </DocsContext.Provider>\r\n );\r\n}\r\n\r\nexport default DocsProvider;\r\n","import React from \"react\";\r\n\r\nimport DocsProvider from \"../context/DocsProvider\";\r\n\r\nimport { DocsCategory } from \"../types\";\r\n\r\ninterface DocsEngineProps {\r\n docs: DocsCategory[];\r\n basePath?: string;\r\n children: React.ReactNode;\r\n}\r\n\r\nfunction DocsEngine({ docs, basePath = \"/\", children }: DocsEngineProps) {\r\n const normalizedBasePath = basePath.startsWith(\"/\")\r\n ? basePath\r\n : `/${basePath}`;\r\n\r\n return (\r\n <DocsProvider docs={docs} basePath={normalizedBasePath}>\r\n {children}\r\n </DocsProvider>\r\n );\r\n}\r\n\r\nexport default DocsEngine;\r\n","import { useContext } from \"react\";\r\n\r\nimport { DocsContext } from \"../context\";\r\n\r\nexport function useDocs() {\r\n const context = useContext(DocsContext);\r\n\r\n if (!context) {\r\n throw new Error(\"useDocs must be used within DocsProvider\");\r\n }\r\n\r\n return context;\r\n}\r\n","import { useLocation } from \"react-router-dom\";\r\n\r\nimport { useDocs } from \"./useDocs\";\r\n\r\nexport function useCurrentDocsSection() {\r\n const { docs } = useDocs();\r\n\r\n const location = useLocation();\r\n\r\n return docs.find((doc) => location.pathname.startsWith(doc.path));\r\n}\r\n","export function normalizePath(path: string): string {\r\n return \"/\" + path.replace(/\\/+/g, \"/\").replace(/^\\/|\\/$/g, \"\");\r\n}\r\n\r\nexport function normalizeRoutePath(path: string): string {\r\n return path.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\r\n}\r\n","import { DocsNode, DocsPage } from \"../types\";\r\n\r\nimport { normalizePath } from \"./path\";\r\n\r\nexport interface ResolvedDocsPage extends DocsPage {\r\n id: string;\r\n fullPath: string;\r\n}\r\n\r\nexport function isPage(node: DocsNode): node is DocsPage {\r\n return \"content\" in node;\r\n}\r\n\r\nexport function findPageByPath(\r\n nodes: DocsNode[],\r\n targetPath: string,\r\n parentPath = \"\",\r\n): DocsPage | null {\r\n const normalizedTarget = normalizePath(targetPath);\r\n\r\n for (const node of nodes) {\r\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\r\n\r\n if (isPage(node)) {\r\n if (currentPath === normalizedTarget) {\r\n return node;\r\n }\r\n } else {\r\n const result = findPageByPath(node.children, targetPath, currentPath);\r\n\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n\r\nexport function resolveDocs(\r\n nodes: DocsNode[],\r\n parentPath = \"\",\r\n): ResolvedDocsPage[] {\r\n const pages: ResolvedDocsPage[] = [];\r\n\r\n nodes.forEach((node) => {\r\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\r\n\r\n if (isPage(node)) {\r\n pages.push({\r\n ...node,\r\n id: currentPath.replace(/\\//g, \"-\").replace(/^-/, \"\"),\r\n fullPath: currentPath,\r\n });\r\n\r\n return;\r\n }\r\n\r\n pages.push(...resolveDocs(node.children, currentPath));\r\n });\r\n\r\n return pages;\r\n}\r\n\r\nexport function findFirstPage(\r\n nodes: DocsNode[],\r\n parentPath = \"\",\r\n): string | null {\r\n for (const node of nodes) {\r\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\r\n\r\n if (isPage(node)) {\r\n return currentPath;\r\n }\r\n\r\n const child = findFirstPage(node.children, currentPath);\r\n\r\n if (child) {\r\n return child;\r\n }\r\n }\r\n\r\n return null;\r\n}\r\n","import { MenuNode } from \"elseware-ui\";\r\n\r\nimport { DocsCategory, DocsNode } from \"../types\";\r\n\r\nimport { normalizePath } from \"./path\";\r\n\r\nimport { isPage } from \"./docs\";\r\n\r\nfunction mapNodes(\r\n nodes: DocsNode[],\r\n basePath: string,\r\n parentPath = \"\",\r\n): MenuNode[] {\r\n return nodes.map((node) => {\r\n const fullPath = normalizePath(`${parentPath}/${node.path}`);\r\n\r\n if (isPage(node)) {\r\n return {\r\n type: \"item\",\r\n name: node.title,\r\n to: normalizePath(`${basePath}/${fullPath}`),\r\n };\r\n }\r\n\r\n return {\r\n type: \"group\",\r\n name: node.title,\r\n items: mapNodes(node.children, basePath, fullPath),\r\n };\r\n });\r\n}\r\n\r\nexport function generateSidebar(\r\n docs: DocsCategory[],\r\n basePath: string,\r\n): MenuNode[] {\r\n return mapNodes(docs, basePath);\r\n}\r\n","import { useLocation } from \"react-router-dom\";\r\n\r\nimport { useDocs } from \"./useDocs\";\r\n\r\nimport { findPageByPath, normalizePath } from \"../utils\";\r\n\r\ninterface UseCurrentPageProps {\r\n debug?: boolean;\r\n}\r\n\r\nexport function useCurrentPage({ debug = false }: UseCurrentPageProps = {}) {\r\n const { docs, basePath } = useDocs();\r\n\r\n const location = useLocation();\r\n\r\n // Remove docs base path\r\n const pagePath = normalizePath(\r\n location.pathname.replace(new RegExp(`^${basePath}`), \"\"),\r\n );\r\n\r\n if (debug) {\r\n console.log(\"location.pathname\", location.pathname);\r\n console.log(\"basePath\", basePath);\r\n console.log(\"pagePath\", pagePath);\r\n }\r\n\r\n return findPageByPath(docs, pagePath);\r\n}\r\n","import { generateSidebar } from \"../utils\";\r\n\r\nimport { useCurrentDocsSection } from \"./useCurrentDocsSection\";\r\n\r\nexport function useScopedSidebar() {\r\n const section = useCurrentDocsSection();\r\n\r\n if (!section) {\r\n return [];\r\n }\r\n\r\n return generateSidebar([section], \"/\");\r\n}\r\n","import { generateSidebar } from \"../utils\";\r\n\r\nimport { useDocs } from \"./useDocs\";\r\n\r\nexport function useSidebar() {\r\n const { docs, basePath } = useDocs();\r\n\r\n return generateSidebar(docs, basePath);\r\n}","import React from \"react\";\r\n\r\nimport { RouteObject } from \"react-router-dom\";\r\n\r\nimport { normalizeRoutePath } from \"../utils\";\r\n\r\ninterface GenerateDocsRoutesProps {\r\n basePath?: string;\r\n element: React.ReactNode;\r\n}\r\n\r\nexport function generateDocsRoutes({\r\n basePath = \"/docs\",\r\n element,\r\n}: GenerateDocsRoutesProps): RouteObject[] {\r\n const normalizedBase = normalizeRoutePath(basePath);\r\n\r\n return [\r\n {\r\n path: `${normalizedBase}/*`,\r\n element,\r\n },\r\n ];\r\n}\r\n"]}
1
+ {"version":3,"sources":["../src/components/docs-page-renderer/DocsPageRenderer.tsx","../src/context/DocsContext.ts","../src/context/DocsProvider.tsx","../src/utils/path.ts","../src/utils/docs.ts","../src/utils/sidebar.ts","../src/engine/DocsEngine.tsx","../src/hooks/useDocs.ts","../src/hooks/useCurrentDocsSection.ts","../src/hooks/useCurrentPage.ts","../src/hooks/useScopedSidebar.ts","../src/hooks/useSidebar.ts","../src/router/generateDocsRoutes.tsx"],"names":["DocsPageRenderer","content","jsx","DocumentationPanel","DocsPageRenderer_default","DocsContext","createContext","DocsProvider","docs","basePath","children","DocsProvider_default","normalizePath","path","normalizeRoutePath","isPathWithin","parentPath","normalizedPath","normalizedParent","stripBasePath","normalizedBase","isPage","node","findPageByPath","nodes","targetPath","normalizedTarget","currentPath","result","resolveDocs","pages","findFirstPage","child","mapNodes","fullPath","generateSidebar","DocsEngine","normalizedBasePath","DocsEngine_default","useDocs","context","useContext","useCurrentDocsSection","location","useLocation","pagePath","doc","useCurrentPage","debug","useScopedSidebar","section","useSidebar","generateDocsRoutes","element"],"mappings":"wMAMA,SAASA,EAAiB,CAAE,OAAA,CAAAC,CAAQ,CAAA,CAA0B,CAC5D,OAAOC,GAAAA,CAACC,kBAAAA,CAAA,CAAmB,KAAA,CAAOF,CAAAA,CAAS,CAC7C,KAEOG,CAAAA,CAAQJ,ECDR,IAAMK,CAAAA,CAAcC,aAAAA,CACzB,MACF,ECCA,SAASC,CAAAA,CAAa,CAAE,IAAA,CAAAC,EAAM,QAAA,CAAAC,CAAAA,CAAU,QAAA,CAAAC,CAAS,EAAsB,CACrE,OACER,GAAAA,CAACG,CAAAA,CAAY,SAAZ,CAAqB,KAAA,CAAO,CAAE,IAAA,CAAAG,EAAM,QAAA,CAAAC,CAAS,CAAA,CAC3C,QAAA,CAAAC,EACH,CAEJ,CAEA,IAAOC,CAAAA,CAAQJ,ECpBR,SAASK,CAAAA,CAAcC,CAAAA,CAAsB,CAClD,OAAO,GAAA,CAAMA,CAAAA,CAAK,OAAA,CAAQ,MAAA,CAAQ,G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AmB,CACjC,QAAA,CAAA3C,CAAAA,CAAW,OAAA,CACX,QAAA4C,CACF,CAAA,CAA2C,CAGzC,OAAO,CACL,CACE,IAAA,CAAM,CAAA,EAJavC,CAAAA,CAAmBL,CAAQ,CAIvB,CAAA,EAAA,CAAA,CACvB,OAAA,CAAA4C,CACF,CACF,CACF","file":"index.mjs","sourcesContent":["import { DocumentationPanel } from \"elseware-ui\";\n\ninterface DocsPageRendererProps {\n content: string;\n}\n\nfunction DocsPageRenderer({ content }: DocsPageRendererProps) {\n return <DocumentationPanel value={content} />;\n}\n\nexport default DocsPageRenderer;\n","import { createContext } from \"react\";\n\nimport { type DocsCategory } from \"../types\";\n\nexport interface DocsContextType {\n docs: DocsCategory[];\n basePath: string;\n}\n\nexport const DocsContext = createContext<DocsContextType | undefined>(\n undefined,\n);\n","import type { ReactNode } from \"react\";\n\nimport { DocsContext } from \"./DocsContext\";\n\nimport { type DocsCategory } from \"../types\";\n\ninterface DocsProviderProps {\n docs: DocsCategory[];\n basePath: string;\n children: ReactNode;\n}\n\nfunction DocsProvider({ docs, basePath, children }: DocsProviderProps) {\n return (\n <DocsContext.Provider value={{ docs, basePath }}>\n {children}\n </DocsContext.Provider>\n );\n}\n\nexport default DocsProvider;\n","export function normalizePath(path: string): string {\n return \"/\" + path.replace(/\\/+/g, \"/\").replace(/^\\/|\\/$/g, \"\");\n}\n\nexport function normalizeRoutePath(path: string): string {\n return path.replace(/^\\/+/, \"\").replace(/\\/+$/, \"\");\n}\n\nexport function isPathWithin(path: string, parentPath: string): boolean {\n const normalizedPath = normalizePath(path);\n const normalizedParent = normalizePath(parentPath);\n\n return (\n normalizedParent === \"/\" ||\n normalizedPath === normalizedParent ||\n normalizedPath.startsWith(`${normalizedParent}/`)\n );\n}\n\nexport function stripBasePath(path: string, basePath: string): string | null {\n const normalizedPath = normalizePath(path);\n const normalizedBase = normalizePath(basePath);\n\n if (!isPathWithin(normalizedPath, normalizedBase)) {\n return null;\n }\n\n if (normalizedBase === \"/\") {\n return normalizedPath;\n }\n\n return normalizePath(normalizedPath.slice(normalizedBase.length));\n}\n","import { type DocsNode, type DocsPage } from \"../types\";\n\nimport { normalizePath } from \"./path\";\n\nexport interface ResolvedDocsPage extends DocsPage {\n id: string;\n fullPath: string;\n}\n\nexport function isPage(node: DocsNode): node is DocsPage {\n return \"content\" in node;\n}\n\nexport function findPageByPath(\n nodes: DocsNode[],\n targetPath: string,\n parentPath = \"\",\n): DocsPage | null {\n const normalizedTarget = normalizePath(targetPath);\n\n for (const node of nodes) {\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\n\n if (isPage(node)) {\n if (currentPath === normalizedTarget) {\n return node;\n }\n } else {\n const result = findPageByPath(node.children, targetPath, currentPath);\n\n if (result) {\n return result;\n }\n }\n }\n\n return null;\n}\n\nexport function resolveDocs(\n nodes: DocsNode[],\n parentPath = \"\",\n): ResolvedDocsPage[] {\n const pages: ResolvedDocsPage[] = [];\n\n nodes.forEach((node) => {\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\n\n if (isPage(node)) {\n pages.push({\n ...node,\n id: currentPath.replace(/\\//g, \"-\").replace(/^-/, \"\"),\n fullPath: currentPath,\n });\n\n return;\n }\n\n pages.push(...resolveDocs(node.children, currentPath));\n });\n\n return pages;\n}\n\nexport function findFirstPage(\n nodes: DocsNode[],\n parentPath = \"\",\n): string | null {\n for (const node of nodes) {\n const currentPath = normalizePath(`${parentPath}/${node.path}`);\n\n if (isPage(node)) {\n return currentPath;\n }\n\n const child = findFirstPage(node.children, currentPath);\n\n if (child) {\n return child;\n }\n }\n\n return null;\n}\n","import { type MenuNode } from \"elseware-ui\";\n\nimport { type DocsCategory, type DocsNode } from \"../types\";\n\nimport { normalizePath } from \"./path\";\n\nimport { isPage } from \"./docs\";\n\nfunction mapNodes(\n nodes: DocsNode[],\n basePath: string,\n parentPath = \"\",\n): MenuNode[] {\n return nodes.map((node) => {\n const fullPath = normalizePath(`${parentPath}/${node.path}`);\n\n if (isPage(node)) {\n return {\n type: \"item\",\n name: node.title,\n to: normalizePath(`${basePath}/${fullPath}`),\n };\n }\n\n return {\n type: \"group\",\n name: node.title,\n items: mapNodes(node.children, basePath, fullPath),\n };\n });\n}\n\nexport function generateSidebar(\n docs: DocsCategory[],\n basePath: string,\n): MenuNode[] {\n return mapNodes(docs, basePath);\n}\n","import type { ReactNode } from \"react\";\n\nimport DocsProvider from \"../context/DocsProvider\";\n\nimport { type DocsCategory } from \"../types\";\nimport { normalizePath } from \"../utils\";\n\ninterface DocsEngineProps {\n docs: DocsCategory[];\n basePath?: string;\n children: ReactNode;\n}\n\nfunction DocsEngine({ docs, basePath = \"/\", children }: DocsEngineProps) {\n const normalizedBasePath = normalizePath(basePath);\n\n return (\n <DocsProvider docs={docs} basePath={normalizedBasePath}>\n {children}\n </DocsProvider>\n );\n}\n\nexport default DocsEngine;\n","import { useContext } from \"react\";\n\nimport { DocsContext } from \"../context\";\n\nexport function useDocs() {\n const context = useContext(DocsContext);\n\n if (!context) {\n throw new Error(\"useDocs must be used within DocsProvider\");\n }\n\n return context;\n}\n","import { useLocation } from \"react-router-dom\";\n\nimport { useDocs } from \"./useDocs\";\n\nimport { isPathWithin, stripBasePath } from \"../utils\";\n\nexport function useCurrentDocsSection() {\n const { docs, basePath } = useDocs();\n\n const location = useLocation();\n\n const pagePath = stripBasePath(location.pathname, basePath);\n\n if (!pagePath) {\n return undefined;\n }\n\n return docs.find((doc) => isPathWithin(pagePath, doc.path));\n}\n","import { useLocation } from \"react-router-dom\";\n\nimport { useDocs } from \"./useDocs\";\n\nimport { findPageByPath, stripBasePath } from \"../utils\";\n\ninterface UseCurrentPageProps {\n debug?: boolean;\n}\n\nexport function useCurrentPage({ debug = false }: UseCurrentPageProps = {}) {\n const { docs, basePath } = useDocs();\n\n const location = useLocation();\n\n const pagePath = stripBasePath(location.pathname, basePath);\n\n if (debug) {\n console.log(\"location.pathname\", location.pathname);\n console.log(\"basePath\", basePath);\n console.log(\"pagePath\", pagePath);\n }\n\n if (!pagePath) {\n return null;\n }\n\n return findPageByPath(docs, pagePath);\n}\n","import { generateSidebar } from \"../utils\";\n\nimport { useCurrentDocsSection } from \"./useCurrentDocsSection\";\nimport { useDocs } from \"./useDocs\";\n\nexport function useScopedSidebar() {\n const { basePath } = useDocs();\n\n const section = useCurrentDocsSection();\n\n if (!section) {\n return [];\n }\n\n return generateSidebar([section], basePath);\n}\n","import { generateSidebar } from \"../utils\";\n\nimport { useDocs } from \"./useDocs\";\n\nexport function useSidebar() {\n const { docs, basePath } = useDocs();\n\n return generateSidebar(docs, basePath);\n}\n","import type { ReactNode } from \"react\";\n\nimport { type RouteObject } from \"react-router-dom\";\n\nimport { normalizeRoutePath } from \"../utils\";\n\ninterface GenerateDocsRoutesProps {\n basePath?: string;\n element: ReactNode;\n}\n\nexport function generateDocsRoutes({\n basePath = \"/docs\",\n element,\n}: GenerateDocsRoutesProps): RouteObject[] {\n const normalizedBase = normalizeRoutePath(basePath);\n\n return [\n {\n path: `${normalizedBase}/*`,\n element,\n },\n ];\n}\n"]}
package/package.json CHANGED
@@ -1,60 +1,90 @@
1
- {
2
- "name": "elseware-docs-engine",
3
- "version": "1.2.1",
4
- "private": false,
5
- "description": "React documentation engine by elseware Technology",
6
- "license": "MIT",
7
- "main": "./dist/index.js",
8
- "module": "./dist/index.mjs",
9
- "types": "./dist/index.d.ts",
10
- "files": [
11
- "dist"
12
- ],
13
- "exports": {
14
- ".": {
15
- "import": "./dist/index.mjs",
16
- "require": "./dist/index.js",
17
- "types": "./dist/index.d.ts"
18
- },
19
- "./dist/index.css": "./dist/index.css"
20
- },
21
- "sideEffects": [
22
- "*.css"
23
- ],
24
- "keywords": [
25
- "docs",
26
- "documentation",
27
- "react",
28
- "markdown",
29
- "mdx",
30
- "vite"
31
- ],
32
- "peerDependencies": {
33
- "react": "^18",
34
- "react-dom": "^18",
35
- "react-router-dom": "^6"
36
- },
37
- "dependencies": {
38
- "elseware-ui": "^2.38.1"
39
- },
40
- "devDependencies": {
41
- "@tailwindcss/postcss": "^4.1.16",
42
- "@types/react": "^18.2.66",
43
- "@types/react-dom": "^18.2.22",
44
- "@vitejs/plugin-react": "^4.2.1",
45
- "autoprefixer": "^10.4.21",
46
- "rimraf": "^6.1.3",
47
- "tailwindcss": "^3.4.0",
48
- "tsup": "^8.0.2",
49
- "typescript": "^5.4.5",
50
- "vite": "^5.2.0"
51
- },
52
- "scripts": {
53
- "dev": "vite",
54
- "build": "rimraf dist && tsup",
55
- "typecheck": "tsc --noEmit",
56
- "clean": "rimraf dist node_modules/.cache",
57
- "prepublishOnly": "npm run build",
58
- "release": "npm publish --access public"
59
- }
60
- }
1
+ {
2
+ "name": "elseware-docs-engine",
3
+ "version": "1.3.0",
4
+ "private": false,
5
+ "description": "React documentation engine by elseware Technology",
6
+ "license": "MIT",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.mjs",
9
+ "types": "./dist/index.d.ts",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.mjs",
17
+ "require": "./dist/index.js"
18
+ },
19
+ "./dist/index.css": "./dist/index.css"
20
+ },
21
+ "sideEffects": [
22
+ "*.css"
23
+ ],
24
+ "keywords": [
25
+ "docs",
26
+ "documentation",
27
+ "react",
28
+ "markdown",
29
+ "mdx",
30
+ "vite"
31
+ ],
32
+ "peerDependencies": {
33
+ "react": "^18",
34
+ "react-dom": "^18",
35
+ "react-router-dom": "^6"
36
+ },
37
+ "dependencies": {
38
+ "elseware-ui": "^2.39.2"
39
+ },
40
+ "devDependencies": {
41
+ "@eslint/js": "^9.39.4",
42
+ "@types/node": "^24.0.3",
43
+ "@types/react": "^18.3.12",
44
+ "@types/react-dom": "^18.3.1",
45
+ "@typescript/native": "npm:typescript@^7.0.2",
46
+ "@vitejs/plugin-react": "^4.2.1",
47
+ "autoprefixer": "^10.4.21",
48
+ "eslint": "^9.39.4",
49
+ "eslint-config-prettier": "^10.1.8",
50
+ "eslint-plugin-react": "^7.37.5",
51
+ "eslint-plugin-react-hooks": "^7.1.1",
52
+ "globals": "^16.5.0",
53
+ "husky": "^9.1.7",
54
+ "knip": "^6.15.0",
55
+ "lint-staged": "^17.0.7",
56
+ "prettier": "^3.8.3",
57
+ "rimraf": "^6.1.3",
58
+ "tailwindcss": "^3.4.0",
59
+ "tsup": "^8.5.1",
60
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
61
+ "typescript-eslint": "^8.61.1",
62
+ "vite": "^5.2.0"
63
+ },
64
+ "scripts": {
65
+ "dev": "vite",
66
+ "build": "tsup",
67
+ "clean": "rimraf dist node_modules/.cache",
68
+ "typecheck": "tsc --noEmit",
69
+ "typecheck:compat": "tsc6 --noEmit",
70
+ "lint": "eslint .",
71
+ "lint:fix": "eslint . --fix",
72
+ "format": "prettier . --write",
73
+ "format:check": "prettier . --check",
74
+ "deadcode": "knip",
75
+ "validate": "npm run typecheck && npm run typecheck:compat && npm run lint && npm run format:check && npm run deadcode && npm run build",
76
+ "full": "npm run lint:fix && npm run format && npm run validate",
77
+ "prepare": "husky",
78
+ "prepublishOnly": "npm run validate",
79
+ "release": "npm publish --access public"
80
+ },
81
+ "lint-staged": {
82
+ "*.{js,jsx,ts,tsx,mjs,cjs}": [
83
+ "eslint --fix",
84
+ "prettier --write"
85
+ ],
86
+ "*.{json,md,css,yml,yaml}": [
87
+ "prettier --write"
88
+ ]
89
+ }
90
+ }