@umami/shiso 0.55.0 → 0.61.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/CHANGELOG.md +12 -0
- package/README.md +9 -49
- package/bin/shiso.mjs +132 -0
- package/docs.schema.json +835 -0
- package/mdx.config.ts +143 -0
- package/package.json +73 -83
- package/scripts/check-package.mjs +18 -0
- package/scripts/generate-icon-registry.mjs +196 -0
- package/scripts/generate-last-modified.mjs +128 -0
- package/scripts/generate-search-index.mjs +252 -0
- package/scripts/load-docs-config.mjs +244 -0
- package/scripts/prerender.mjs +187 -0
- package/scripts/validate-config.mjs +104 -0
- package/scripts/vite-docs-config.mjs +60 -0
- package/src/App.tsx +39 -0
- package/src/components/Banner.tsx +69 -0
- package/src/components/CodeBlock.tsx +46 -0
- package/src/components/ConfiguredIcon.tsx +15 -0
- package/src/components/ContextualMenu.tsx +93 -0
- package/src/components/DocContent.tsx +100 -0
- package/src/components/Docs.tsx +126 -0
- package/src/components/Footer.tsx +84 -0
- package/src/components/Header.tsx +72 -0
- package/src/components/Layout.tsx +16 -0
- package/src/components/PageLinks.tsx +71 -0
- package/src/components/Search.tsx +208 -0
- package/src/components/SideNav.tsx +347 -0
- package/src/components/SocialIcon.tsx +88 -0
- package/src/components/ThemeToggle.tsx +34 -0
- package/src/components/TopNav.tsx +127 -0
- package/src/components/docs/Accordion.tsx +68 -0
- package/src/components/docs/Badge.tsx +171 -0
- package/src/components/docs/Callout.tsx +73 -0
- package/src/components/docs/Card.tsx +158 -0
- package/src/components/docs/CodeGroup.tsx +73 -0
- package/src/components/docs/Columns.tsx +20 -0
- package/src/components/docs/Expandable.tsx +28 -0
- package/src/components/docs/Frame.tsx +56 -0
- package/src/components/docs/Icon.tsx +30 -0
- package/src/components/docs/ParamField.tsx +45 -0
- package/src/components/docs/PropertiesTable.tsx +84 -0
- package/src/components/docs/ResponseField.tsx +36 -0
- package/src/components/docs/Steps.tsx +47 -0
- package/src/components/docs/Tabs.tsx +116 -0
- package/src/components/docs/Tooltip.tsx +21 -0
- package/src/components/docs/index.ts +15 -0
- package/src/components/docs/styles.ts +82 -0
- package/src/components/docs/utils.ts +118 -0
- package/src/components/icons/index.ts +17 -0
- package/src/components/ui/accordion.tsx +69 -0
- package/src/components/ui/alert.tsx +69 -0
- package/src/components/ui/badge.tsx +49 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +88 -0
- package/src/components/ui/collapsible.tsx +15 -0
- package/src/components/ui/command.tsx +173 -0
- package/src/components/ui/dialog.tsx +137 -0
- package/src/components/ui/dropdown-menu.tsx +257 -0
- package/src/components/ui/scroll-area.tsx +71 -0
- package/src/components/ui/sheet.tsx +124 -0
- package/src/components/ui/tabs.tsx +73 -0
- package/src/components/ui/tooltip.tsx +52 -0
- package/src/declarations.d.ts +9 -0
- package/src/entry-client.tsx +17 -0
- package/src/entry-server.tsx +77 -0
- package/src/generated/last-modified.ts +2 -0
- package/src/lib/content.ts +44 -0
- package/src/lib/docs-config.ts +682 -0
- package/src/lib/head.ts +220 -0
- package/src/lib/icon-registry.generated.ts +4 -0
- package/src/lib/icons.ts +29 -0
- package/src/lib/inline-markdown.tsx +86 -0
- package/src/lib/mdast.ts +56 -0
- package/src/lib/paths.ts +86 -0
- package/src/lib/remark-toc.ts +71 -0
- package/src/lib/search/config.ts +43 -0
- package/src/lib/search/provider.ts +80 -0
- package/src/lib/search/providers/local.ts +15 -0
- package/src/lib/search-index.generated.ts +4 -0
- package/src/lib/search.ts +100 -0
- package/src/lib/site-config.ts +104 -0
- package/src/lib/site-model.ts +221 -0
- package/src/lib/slug.ts +38 -0
- package/src/lib/types.ts +478 -0
- package/src/lib/utils.ts +6 -0
- package/src/pages/DocPage.tsx +33 -0
- package/src/styles/global.css +268 -0
- package/src/styles/tokens.css +114 -0
- package/types/client.d.ts +3 -0
- package/types/search.d.ts +17 -0
- package/vite.config.ts +342 -0
- package/LICENSE +0 -21
- package/dist/index.css +0 -189
- package/dist/index.d.ts +0 -57
- package/dist/index.js +0 -464
- package/dist/index.mjs +0 -437
- package/server/index.d.ts +0 -30
- package/server/index.js +0 -189
- package/styles.css +0 -4766
package/dist/index.js
DELETED
|
@@ -1,464 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __export = (target, all) => {
|
|
10
|
-
for (var name in all)
|
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
-
|
|
31
|
-
// src/index.ts
|
|
32
|
-
var index_exports = {};
|
|
33
|
-
__export(index_exports, {
|
|
34
|
-
Blog: () => Blog,
|
|
35
|
-
Docs: () => Docs,
|
|
36
|
-
Shiso: () => Shiso
|
|
37
|
-
});
|
|
38
|
-
module.exports = __toCommonJS(index_exports);
|
|
39
|
-
|
|
40
|
-
// src/components/Blog.tsx
|
|
41
|
-
var import_react_zen11 = require("@umami/react-zen");
|
|
42
|
-
var import_date_fns2 = require("date-fns");
|
|
43
|
-
|
|
44
|
-
// src/components/PageLinks.tsx
|
|
45
|
-
var import_react = require("react");
|
|
46
|
-
var import_react_zen = require("@umami/react-zen");
|
|
47
|
-
var import_classnames = __toESM(require("classnames"));
|
|
48
|
-
|
|
49
|
-
// css-modules:E:\dev\umami-shiso\src\components\PageLinks.module.css
|
|
50
|
-
var PageLinks_default = { "links": "PageLinks_links__NmJhO", "link": "PageLinks_link__OGI3M", "indent-1": "PageLinks_indent-1__M2IxZ", "indent-2": "PageLinks_indent-2__YTBlM", "indent-3": "PageLinks_indent-3__YzJlZ", "indent-4": "PageLinks_indent-4__NDg3Z", "indent-5": "PageLinks_indent-5__ZTE4M", "indent-6": "PageLinks_indent-6__NTRjM", "selected": "PageLinks_selected__ZjhkN" };
|
|
51
|
-
|
|
52
|
-
// src/components/PageLinks.tsx
|
|
53
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
54
|
-
function PageLinks({ items = [], className, ...props }) {
|
|
55
|
-
const [hash, setHash] = (0, import_react.useState)(items?.[0]?.id);
|
|
56
|
-
(0, import_react.useEffect)(() => {
|
|
57
|
-
const callback = () => {
|
|
58
|
-
const x = [...items].reverse().find(({ id }) => {
|
|
59
|
-
const rect = document.getElementById(id)?.getBoundingClientRect();
|
|
60
|
-
return rect && rect.top <= 0;
|
|
61
|
-
});
|
|
62
|
-
if (x) setHash(x.id);
|
|
63
|
-
};
|
|
64
|
-
window.addEventListener("scroll", callback, false);
|
|
65
|
-
return () => {
|
|
66
|
-
window.removeEventListener("scroll", callback, false);
|
|
67
|
-
};
|
|
68
|
-
}, []);
|
|
69
|
-
if (!items?.length) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_zen.Box, { ...props, className: (0, import_classnames.default)(PageLinks_default.links, className), children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_zen.Column, { gap: "3", minWidth: "240px", children: [
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_zen.Text, { size: "2", weight: "bold", children: "On this page" }),
|
|
74
|
-
items.map(({ name, id, size }) => {
|
|
75
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
76
|
-
"a",
|
|
77
|
-
{
|
|
78
|
-
href: `#${id}`,
|
|
79
|
-
className: (0, import_classnames.default)(PageLinks_default.link, PageLinks_default[`indent-${size}`], {
|
|
80
|
-
[PageLinks_default.selected]: hash === id
|
|
81
|
-
}),
|
|
82
|
-
children: name
|
|
83
|
-
},
|
|
84
|
-
id
|
|
85
|
-
);
|
|
86
|
-
})
|
|
87
|
-
] }) });
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// src/components/hooks/useShiso.ts
|
|
91
|
-
var import_react7 = require("react");
|
|
92
|
-
|
|
93
|
-
// src/components/Shiso.tsx
|
|
94
|
-
var import_react5 = require("react");
|
|
95
|
-
var import_react6 = require("@mdx-js/react");
|
|
96
|
-
var import_react_zen10 = require("@umami/react-zen");
|
|
97
|
-
|
|
98
|
-
// src/components/CodeBlock.tsx
|
|
99
|
-
var import_react2 = require("react");
|
|
100
|
-
var import_classnames2 = __toESM(require("classnames"));
|
|
101
|
-
var import_react_zen2 = require("@umami/react-zen");
|
|
102
|
-
|
|
103
|
-
// css-modules:E:\dev\umami-shiso\src\components\CodeBlock.module.css
|
|
104
|
-
var CodeBlock_default = { "container": "CodeBlock_container__OGZlM", "button": "CodeBlock_button__Y2Y2Z", "copy": "CodeBlock_copy__NWI2Y", "check": "CodeBlock_check__YzQzO" };
|
|
105
|
-
|
|
106
|
-
// src/components/CodeBlock.tsx
|
|
107
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
108
|
-
function CodeBlock(props) {
|
|
109
|
-
const textInput = (0, import_react2.useRef)(null);
|
|
110
|
-
const [copied, setCopied] = (0, import_react2.useState)(false);
|
|
111
|
-
const handleCopy = () => {
|
|
112
|
-
setCopied(true);
|
|
113
|
-
navigator?.clipboard?.writeText(textInput?.current?.textContent);
|
|
114
|
-
setTimeout(() => {
|
|
115
|
-
setCopied(false);
|
|
116
|
-
}, 1e3);
|
|
117
|
-
};
|
|
118
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("pre", { ref: textInput, className: (0, import_classnames2.default)(CodeBlock_default.container, "dark-theme"), children: [
|
|
119
|
-
props.children,
|
|
120
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { "aria-label": "Copy code", className: CodeBlock_default.button, onClick: handleCopy, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_zen2.Icon, { size: "sm", className: copied ? CodeBlock_default.check : CodeBlock_default.copy, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_zen2.Icons.Check, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_zen2.Icons.Copy, {}) }) })
|
|
121
|
-
] });
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// src/components/Docs.tsx
|
|
125
|
-
var import_react_zen7 = require("@umami/react-zen");
|
|
126
|
-
|
|
127
|
-
// src/components/SideNav.tsx
|
|
128
|
-
var import_react3 = require("react");
|
|
129
|
-
var import_react_zen3 = require("@umami/react-zen");
|
|
130
|
-
var import_classnames3 = __toESM(require("classnames"));
|
|
131
|
-
var import_navigation = require("next/navigation");
|
|
132
|
-
var import_link = __toESM(require("next/link"));
|
|
133
|
-
|
|
134
|
-
// css-modules:E:\dev\umami-shiso\src\components\SideNav.module.css
|
|
135
|
-
var SideNav_default = { "nav": "SideNav_nav__YjQxN", "sticky": "SideNav_sticky__ZTI5N", "item": "SideNav_item__NWU0N", "selected": "SideNav_selected__OTY3O", "header": "SideNav_header__NDZjN" };
|
|
136
|
-
|
|
137
|
-
// src/components/SideNav.tsx
|
|
138
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
139
|
-
function SideNav({
|
|
140
|
-
tabs,
|
|
141
|
-
navigation,
|
|
142
|
-
isSticky,
|
|
143
|
-
autoHeight,
|
|
144
|
-
className,
|
|
145
|
-
style,
|
|
146
|
-
...props
|
|
147
|
-
}) {
|
|
148
|
-
const pathname = (0, import_navigation.usePathname)();
|
|
149
|
-
const tab = tabs?.find(({ url, id }) => id !== "docs" ? pathname.startsWith(url) : false);
|
|
150
|
-
const menu = navigation[tab?.id || "docs"];
|
|
151
|
-
const [height, setHeight] = (0, import_react3.useState)();
|
|
152
|
-
(0, import_react3.useEffect)(() => {
|
|
153
|
-
if (autoHeight) {
|
|
154
|
-
const rect = document.getElementById("shiso_docs_sidenav")?.getBoundingClientRect();
|
|
155
|
-
if (rect) {
|
|
156
|
-
setHeight(`${window.innerHeight - rect.top - 10}px`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}, [autoHeight]);
|
|
160
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
161
|
-
import_react_zen3.Column,
|
|
162
|
-
{
|
|
163
|
-
...props,
|
|
164
|
-
id: "shiso_docs_sidenav",
|
|
165
|
-
className: (0, import_classnames3.default)(SideNav_default.nav, isSticky && SideNav_default.sticky, className),
|
|
166
|
-
style: { ...style, height },
|
|
167
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Column, { "aria-label": "nav", gap: "6", children: menu.map(({ section, pages }) => {
|
|
168
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_zen3.Column, { title: section, className: SideNav_default.items, children: [
|
|
169
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Text, { weight: "bold", className: SideNav_default.header, children: section }),
|
|
170
|
-
pages.map(({ label: text, url }, index) => {
|
|
171
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
172
|
-
import_link.default,
|
|
173
|
-
{
|
|
174
|
-
className: (0, import_classnames3.default)(SideNav_default.item, {
|
|
175
|
-
[SideNav_default.selected]: url === pathname
|
|
176
|
-
}),
|
|
177
|
-
href: url,
|
|
178
|
-
children: text
|
|
179
|
-
},
|
|
180
|
-
index
|
|
181
|
-
);
|
|
182
|
-
})
|
|
183
|
-
] }, section);
|
|
184
|
-
}) })
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// src/components/TopNav.tsx
|
|
190
|
-
var import_navigation2 = require("next/navigation");
|
|
191
|
-
var import_react_zen4 = require("@umami/react-zen");
|
|
192
|
-
var import_link2 = __toESM(require("next/link"));
|
|
193
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
194
|
-
function TopNav({ tabs }) {
|
|
195
|
-
const pathname = (0, import_navigation2.usePathname)();
|
|
196
|
-
const tab = tabs?.find(({ id, url }) => id !== "docs" ? pathname.startsWith(url) : false);
|
|
197
|
-
const selected = tab?.id || "docs";
|
|
198
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen4.Box, { maxWidth: "100vw", overflowX: "auto", overflowY: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen4.Tabs, { selectedKey: selected, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen4.TabList, { items: tabs, children: ({ id, label, url }) => {
|
|
199
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen4.Tab, { id, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_link2.default, { href: url, children: label }) });
|
|
200
|
-
} }) }) });
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// src/components/DocContent.tsx
|
|
204
|
-
var import_react_zen6 = require("@umami/react-zen");
|
|
205
|
-
var import_link3 = __toESM(require("next/link"));
|
|
206
|
-
|
|
207
|
-
// src/components/Markdown.tsx
|
|
208
|
-
var import_react_zen5 = require("@umami/react-zen");
|
|
209
|
-
var import_mdx = require("@mdx-js/mdx");
|
|
210
|
-
var import_react4 = require("@mdx-js/react");
|
|
211
|
-
var runtime = __toESM(require("react/jsx-runtime"));
|
|
212
|
-
|
|
213
|
-
// css-modules:E:\dev\umami-shiso\src\components\Markdown.module.css
|
|
214
|
-
var Markdown_default = { "content": "Markdown_content__YzRmN" };
|
|
215
|
-
|
|
216
|
-
// src/components/Markdown.tsx
|
|
217
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
218
|
-
var import_meta = {};
|
|
219
|
-
var parseMdx = (code) => {
|
|
220
|
-
try {
|
|
221
|
-
const result = (0, import_mdx.runSync)(code, {
|
|
222
|
-
...runtime,
|
|
223
|
-
baseUrl: import_meta.url
|
|
224
|
-
});
|
|
225
|
-
return { Component: result.default };
|
|
226
|
-
} catch (err) {
|
|
227
|
-
return { error: err.message };
|
|
228
|
-
}
|
|
229
|
-
};
|
|
230
|
-
function Markdown({ code }) {
|
|
231
|
-
const components = (0, import_react4.useMDXComponents)();
|
|
232
|
-
const { Component, error } = parseMdx(code);
|
|
233
|
-
if (error) {
|
|
234
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h1", { children: [
|
|
235
|
-
"Error rendering MDX: ",
|
|
236
|
-
error
|
|
237
|
-
] });
|
|
238
|
-
}
|
|
239
|
-
if (!Component) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_zen5.Box, { className: Markdown_default.content, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Component, { components }) });
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
// src/components/DocContent.tsx
|
|
246
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
247
|
-
function DocContent({ section, title, description, code, next, prev }) {
|
|
248
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_zen6.Box, { flexGrow: "1", children: [
|
|
249
|
-
section && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Text, { color: "primary", weight: "bold", children: section }),
|
|
250
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Heading, { size: "5", as: "h1", marginY: "3", children: title }),
|
|
251
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Text, { color: "muted", size: "3", children: description }),
|
|
252
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Markdown, { code }),
|
|
253
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_zen6.Row, { justifyContent: "space-between", children: [
|
|
254
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NavigationButton, { ...prev, isPrev: true }),
|
|
255
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NavigationButton, { ...next })
|
|
256
|
-
] })
|
|
257
|
-
] });
|
|
258
|
-
}
|
|
259
|
-
var NavigationButton = ({
|
|
260
|
-
label,
|
|
261
|
-
url,
|
|
262
|
-
isPrev
|
|
263
|
-
}) => {
|
|
264
|
-
if (!url || !label) {
|
|
265
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Box, {});
|
|
266
|
-
}
|
|
267
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_link3.default, { href: url, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_zen6.Row, { alignItems: "center", gap: "3", marginY: "3", children: [
|
|
268
|
-
isPrev && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Icon, { size: "sm", rotate: 180, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Icons.Chevron, {}) }),
|
|
269
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Text, { size: "3", weight: "bold", children: label }),
|
|
270
|
-
!isPrev && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Icons.Chevron, {}) })
|
|
271
|
-
] }) });
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
// src/components/Docs.tsx
|
|
275
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
276
|
-
function parseContent(content, config = {}) {
|
|
277
|
-
const { tabs, navigation } = config;
|
|
278
|
-
const keys = Object.keys(navigation);
|
|
279
|
-
let next, prev, section, found;
|
|
280
|
-
keys.forEach((key) => {
|
|
281
|
-
if (!found) {
|
|
282
|
-
const groups = navigation[key];
|
|
283
|
-
found = groups?.find((group, groupIndex) => {
|
|
284
|
-
return group.pages.find((page, pageIndex) => {
|
|
285
|
-
const match = page.url.endsWith(content.slug) || content.slug === "index" && content.path.endsWith("index.mdx");
|
|
286
|
-
if (match) {
|
|
287
|
-
const prevGroup = groups[groupIndex - 1];
|
|
288
|
-
const nextGroup = groups[groupIndex + 1];
|
|
289
|
-
prev = group.pages[pageIndex - 1] || prevGroup?.pages?.at(-1);
|
|
290
|
-
next = group.pages[pageIndex + 1] || nextGroup?.pages?.[0];
|
|
291
|
-
section = group.section;
|
|
292
|
-
}
|
|
293
|
-
return match;
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
return { ...content, tabs, navigation, section, next, prev };
|
|
299
|
-
}
|
|
300
|
-
function Docs({ content, config }) {
|
|
301
|
-
if (!content) {
|
|
302
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Heading, { children: "Page not found" });
|
|
303
|
-
}
|
|
304
|
-
const { tabs, navigation, code, meta, section, next, prev, anchors } = parseContent(
|
|
305
|
-
content,
|
|
306
|
-
config?.docs
|
|
307
|
-
);
|
|
308
|
-
const { top } = config?.docs || {};
|
|
309
|
-
const navDisplay = {
|
|
310
|
-
xs: "none",
|
|
311
|
-
lg: "block"
|
|
312
|
-
};
|
|
313
|
-
const linksDisplay = {
|
|
314
|
-
xs: "none",
|
|
315
|
-
lg: "block"
|
|
316
|
-
};
|
|
317
|
-
const menuDisplay = {
|
|
318
|
-
lg: "none"
|
|
319
|
-
};
|
|
320
|
-
const MobileMenuButton = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.DialogTrigger, { children: [
|
|
321
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.Button, { children: [
|
|
322
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Icons.Menu, {}) }),
|
|
323
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Text, { children: "Menu" })
|
|
324
|
-
] }),
|
|
325
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Modal, { position: "left", offset: "70px", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Dialog, { variant: "sheet", children: ({ close }) => {
|
|
326
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Box, { overflow: "auto", padding: "4", onClick: close, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SideNav, { tabs, navigation }) });
|
|
327
|
-
} }) })
|
|
328
|
-
] });
|
|
329
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.Column, { gap: "6", children: [
|
|
330
|
-
tabs && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TopNav, { tabs }),
|
|
331
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Row, { display: menuDisplay, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MobileMenuButton, {}) }),
|
|
332
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.Row, { gap: "6", children: [
|
|
333
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
334
|
-
SideNav,
|
|
335
|
-
{
|
|
336
|
-
display: navDisplay,
|
|
337
|
-
tabs,
|
|
338
|
-
navigation,
|
|
339
|
-
style: { top },
|
|
340
|
-
isSticky: true,
|
|
341
|
-
autoHeight: true
|
|
342
|
-
}
|
|
343
|
-
),
|
|
344
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
345
|
-
DocContent,
|
|
346
|
-
{
|
|
347
|
-
section,
|
|
348
|
-
title: meta?.title,
|
|
349
|
-
description: meta?.description,
|
|
350
|
-
code,
|
|
351
|
-
next,
|
|
352
|
-
prev
|
|
353
|
-
}
|
|
354
|
-
),
|
|
355
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageLinks, { display: linksDisplay, items: anchors, style: { top } })
|
|
356
|
-
] })
|
|
357
|
-
] });
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// src/components/Blogs.tsx
|
|
361
|
-
var import_react_zen9 = require("@umami/react-zen");
|
|
362
|
-
|
|
363
|
-
// src/components/Card.tsx
|
|
364
|
-
var import_react_zen8 = require("@umami/react-zen");
|
|
365
|
-
var import_link4 = __toESM(require("next/link"));
|
|
366
|
-
var import_date_fns = require("date-fns");
|
|
367
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
368
|
-
function Card({ title, description, date, author, url, image }) {
|
|
369
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_zen8.Column, { border: true, borderRadius: "3", overflow: "hidden", children: [
|
|
370
|
-
image && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Box, { height: "240px", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Image, { src: image, alt: title, objectFit: "cover" }) }),
|
|
371
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_zen8.Column, { padding: "6", gap: "4", flexGrow: "1", children: [
|
|
372
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_zen8.Row, { justifyContent: "space-between", children: [
|
|
373
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Text, { color: "muted", children: date && (0, import_date_fns.format)(new Date(date), "PP") }),
|
|
374
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_zen8.Text, { color: "muted", children: [
|
|
375
|
-
"Posted by ",
|
|
376
|
-
author
|
|
377
|
-
] })
|
|
378
|
-
] }),
|
|
379
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_zen8.Column, { gap: "4", flexGrow: "1", children: [
|
|
380
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Heading, { size: "3", as: "header", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_link4.default, { href: url, children: title }) }),
|
|
381
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Box, { marginY: "5", as: "p", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Text, { color: "muted", size: "3", children: description }) })
|
|
382
|
-
] }),
|
|
383
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Button, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_link4.default, { href: url, children: [
|
|
384
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Text, { children: "Read more" }),
|
|
385
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Icons.Arrow, {}) })
|
|
386
|
-
] }) })
|
|
387
|
-
] })
|
|
388
|
-
] });
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// src/components/Blogs.tsx
|
|
392
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
393
|
-
function Blogs({ content, config, ...props }) {
|
|
394
|
-
if (!Array.isArray(content)) {
|
|
395
|
-
const { meta, code, anchors, slug } = content;
|
|
396
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Blog, { ...props, ...meta, slug, code, anchors, backUrl: "/blog" });
|
|
397
|
-
}
|
|
398
|
-
const items = content.sort(
|
|
399
|
-
(a, b) => new Date(b?.meta?.date).getTime() - new Date(a?.meta?.date).getTime()
|
|
400
|
-
);
|
|
401
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Grid, { gap: "5", columns: { xs: "1fr", lg: "repeat(auto-fit, minmax(400px, 1fr))" }, children: items?.map(({ meta, slug }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Card, { url: `/blog/${slug}`, ...meta }, slug)) });
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
// src/components/Shiso.tsx
|
|
405
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
406
|
-
var defaultTemplates = {
|
|
407
|
-
docs: Docs,
|
|
408
|
-
blog: Blogs
|
|
409
|
-
};
|
|
410
|
-
var shisoComponents = {
|
|
411
|
-
pre: CodeBlock,
|
|
412
|
-
code: import_react_zen10.Code
|
|
413
|
-
};
|
|
414
|
-
var ShisoContext = (0, import_react5.createContext)(null);
|
|
415
|
-
function Shiso({ type, config, content, components, templates }) {
|
|
416
|
-
const Component = { ...defaultTemplates, ...templates }[type];
|
|
417
|
-
if (!Component) {
|
|
418
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { children: `Component not found for type: ${type}` });
|
|
419
|
-
}
|
|
420
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ShisoContext.Provider, { value: { type, config, content, components, templates }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react6.MDXProvider, { components: { ...shisoComponents, ...components }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, { config, content }) }) });
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// src/components/hooks/useShiso.ts
|
|
424
|
-
function useShiso() {
|
|
425
|
-
const { content, config } = (0, import_react7.useContext)(ShisoContext);
|
|
426
|
-
return { content, config };
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// src/components/Blog.tsx
|
|
430
|
-
var import_link5 = __toESM(require("next/link"));
|
|
431
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
432
|
-
function Blog({ title, code, author, date, image, anchors, backUrl }) {
|
|
433
|
-
const { config } = useShiso();
|
|
434
|
-
const { top } = config?.blog || {};
|
|
435
|
-
const linksDisplay = {
|
|
436
|
-
xs: "none",
|
|
437
|
-
lg: "block"
|
|
438
|
-
};
|
|
439
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_zen11.Column, { gap: "8", maxWidth: "960px", style: { margin: "0 auto" }, children: [
|
|
440
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Box, { flexGrow: "1", paddingY: "6", children: title && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Heading, { size: "6", as: "h1", align: "center", children: title }) }),
|
|
441
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_zen11.Row, { justifyContent: "space-between", children: [
|
|
442
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Text, { color: "muted", children: date && (0, import_date_fns2.format)(new Date(date), "PPP") }),
|
|
443
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_zen11.Text, { color: "muted", children: [
|
|
444
|
-
"Posted by ",
|
|
445
|
-
author
|
|
446
|
-
] })
|
|
447
|
-
] }),
|
|
448
|
-
image && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Box, { height: "480px", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Image, { src: image, alt: title, objectFit: "cover", borderRadius: "3" }) }),
|
|
449
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_zen11.Row, { gap: "6", children: [
|
|
450
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Markdown, { code }),
|
|
451
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PageLinks, { display: linksDisplay, items: anchors, style: { top } })
|
|
452
|
-
] }),
|
|
453
|
-
backUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Row, { justifyContent: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Button, { style: { width: "auto" }, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_link5.default, { href: backUrl, children: [
|
|
454
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Icon, { rotate: 180, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Icons.Arrow, {}) }),
|
|
455
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Text, { children: "Back" })
|
|
456
|
-
] }) }) })
|
|
457
|
-
] });
|
|
458
|
-
}
|
|
459
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
460
|
-
0 && (module.exports = {
|
|
461
|
-
Blog,
|
|
462
|
-
Docs,
|
|
463
|
-
Shiso
|
|
464
|
-
});
|