@umami/shiso 0.29.0 → 0.31.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/dist/index.css +93 -91
- package/dist/index.d.ts +56 -48
- package/dist/index.js +206 -183
- package/dist/index.mjs +209 -186
- package/package.json +3 -3
- package/server/index.d.ts +29 -45
- package/server/index.js +35 -13
- package/dist/server.d.ts +0 -45
- package/dist/server.js +0 -159
package/dist/index.js
CHANGED
|
@@ -40,133 +40,22 @@ var import_styles = require("@umami/react-zen/styles.css");
|
|
|
40
40
|
var import_github_dark = require("highlight.js/styles/github-dark.css");
|
|
41
41
|
|
|
42
42
|
// src/components/Blog.tsx
|
|
43
|
-
var import_react_zen2 = require("@umami/react-zen");
|
|
44
|
-
|
|
45
|
-
// css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/Blog.module.css
|
|
46
|
-
var Blog_default = {};
|
|
47
|
-
|
|
48
|
-
// src/components/Markdown.tsx
|
|
49
|
-
var import_mdx = require("@mdx-js/mdx");
|
|
50
|
-
var import_react = require("@mdx-js/react");
|
|
51
|
-
var runtime = __toESM(require("react/jsx-runtime"));
|
|
52
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
53
|
-
var import_meta = {};
|
|
54
|
-
var parseMdx = (code) => {
|
|
55
|
-
try {
|
|
56
|
-
const result = (0, import_mdx.runSync)(code, {
|
|
57
|
-
...runtime,
|
|
58
|
-
baseUrl: import_meta.url
|
|
59
|
-
});
|
|
60
|
-
return { Component: result.default };
|
|
61
|
-
} catch (err) {
|
|
62
|
-
return { error: err.message };
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
function Markdown({ code }) {
|
|
66
|
-
const components = (0, import_react.useMDXComponents)();
|
|
67
|
-
const { Component, error } = parseMdx(code);
|
|
68
|
-
if (error) {
|
|
69
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h1", { children: [
|
|
70
|
-
"Error rendering MDX: ",
|
|
71
|
-
error
|
|
72
|
-
] });
|
|
73
|
-
}
|
|
74
|
-
if (!Component) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { components });
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// src/components/Blogs.tsx
|
|
81
|
-
var import_react_zen = require("@umami/react-zen");
|
|
82
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
83
|
-
function Blogs() {
|
|
84
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_zen.Column, { flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h1", { children: "All the blogs!" }) });
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// src/components/Blog.tsx
|
|
88
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
89
|
-
function Blog({ content }) {
|
|
90
|
-
if (!content) {
|
|
91
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Blogs, {});
|
|
92
|
-
}
|
|
93
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen2.Column, { className: Blog_default.blog, flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: Blog_default.main, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Blog_default.content, children: [
|
|
94
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { children: content?.meta?.title }),
|
|
95
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: Blog_default.description, children: content?.meta?.description }),
|
|
96
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Markdown, { code: content?.code })
|
|
97
|
-
] }) }) });
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// src/components/Docs.tsx
|
|
101
|
-
var import_react_zen9 = require("@umami/react-zen");
|
|
102
|
-
|
|
103
|
-
// src/components/hooks/useShiso.ts
|
|
104
|
-
var import_react5 = require("react");
|
|
105
|
-
|
|
106
|
-
// src/components/Shiso.tsx
|
|
107
|
-
var import_react3 = require("react");
|
|
108
|
-
var import_react4 = require("@mdx-js/react");
|
|
109
|
-
var import_react_zen4 = require("@umami/react-zen");
|
|
110
|
-
|
|
111
|
-
// src/components/CodeBlock.tsx
|
|
112
|
-
var import_react2 = require("react");
|
|
113
43
|
var import_react_zen3 = require("@umami/react-zen");
|
|
114
|
-
|
|
115
|
-
// css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/CodeBlock.module.css
|
|
116
|
-
var CodeBlock_default = { "container": "CodeBlock_container__YmFmN", "button": "CodeBlock_button__NDg0Y", "copy": "CodeBlock_copy__MmQzM", "check": "CodeBlock_check__YmI0Z" };
|
|
117
|
-
|
|
118
|
-
// src/components/CodeBlock.tsx
|
|
119
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
120
|
-
function CodeBlock(props) {
|
|
121
|
-
const textInput = (0, import_react2.useRef)(null);
|
|
122
|
-
const [copied, setCopied] = (0, import_react2.useState)(false);
|
|
123
|
-
const handleCopy = () => {
|
|
124
|
-
setCopied(true);
|
|
125
|
-
navigator?.clipboard?.writeText(textInput?.current?.textContent);
|
|
126
|
-
setTimeout(() => {
|
|
127
|
-
setCopied(false);
|
|
128
|
-
}, 1e3);
|
|
129
|
-
};
|
|
130
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("pre", { ref: textInput, className: CodeBlock_default.container, children: [
|
|
131
|
-
props.children,
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { "aria-label": "Copy code", className: CodeBlock_default.button, onClick: handleCopy, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen3.Icon, { size: "sm", className: copied ? CodeBlock_default.check : CodeBlock_default.copy, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen3.Icons.Check, {}) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen3.Icons.Copy, {}) }) })
|
|
133
|
-
] });
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// src/components/Shiso.tsx
|
|
137
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
138
|
-
var defaultTemplates = {
|
|
139
|
-
docs: Docs,
|
|
140
|
-
blog: Blog
|
|
141
|
-
};
|
|
142
|
-
var ShisoContext = (0, import_react3.createContext)(null);
|
|
143
|
-
function Shiso({ content, type, config, components, templates }) {
|
|
144
|
-
const Component = { ...defaultTemplates, ...templates }[type];
|
|
145
|
-
if (!Component) {
|
|
146
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { children: `Component not found for type: ${type}` });
|
|
147
|
-
}
|
|
148
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ShisoContext.Provider, { value: { content, type, config }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react4.MDXProvider, { components: { ...components, pre: CodeBlock, code: import_react_zen4.Code }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Component, { content, config }) }) });
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// src/components/hooks/useShiso.ts
|
|
152
|
-
function useShiso() {
|
|
153
|
-
const { content, config } = (0, import_react5.useContext)(ShisoContext);
|
|
154
|
-
return { content, config };
|
|
155
|
-
}
|
|
44
|
+
var import_date_fns = require("date-fns");
|
|
156
45
|
|
|
157
46
|
// src/components/PageLinks.tsx
|
|
158
|
-
var
|
|
159
|
-
var
|
|
47
|
+
var import_react = require("react");
|
|
48
|
+
var import_react_zen = require("@umami/react-zen");
|
|
160
49
|
var import_classnames = __toESM(require("classnames"));
|
|
161
50
|
|
|
162
|
-
// css-modules
|
|
163
|
-
var PageLinks_default = { "links": "
|
|
51
|
+
// css-modules:E:\dev\umami-shiso\src\components\PageLinks.module.css
|
|
52
|
+
var PageLinks_default = { "links": "PageLinks_links__YmMzM", "link": "PageLinks_link__MjIyN", "indent-1": "PageLinks_indent-1__MDg5M", "indent-2": "PageLinks_indent-2__YTU4M", "indent-3": "PageLinks_indent-3__NTYxY", "indent-4": "PageLinks_indent-4__NjhmY", "indent-5": "PageLinks_indent-5__ZmFiY", "indent-6": "PageLinks_indent-6__MmRkN", "selected": "PageLinks_selected__NDQxY" };
|
|
164
53
|
|
|
165
54
|
// src/components/PageLinks.tsx
|
|
166
|
-
var
|
|
55
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
167
56
|
function PageLinks({ items = [], className, ...props }) {
|
|
168
|
-
const [hash, setHash] = (0,
|
|
169
|
-
(0,
|
|
57
|
+
const [hash, setHash] = (0, import_react.useState)(items?.[0]?.id);
|
|
58
|
+
(0, import_react.useEffect)(() => {
|
|
170
59
|
const callback = () => {
|
|
171
60
|
const x = [...items].reverse().find(({ id }) => {
|
|
172
61
|
const rect = document.getElementById(id)?.getBoundingClientRect();
|
|
@@ -182,10 +71,10 @@ function PageLinks({ items = [], className, ...props }) {
|
|
|
182
71
|
if (!items?.length) {
|
|
183
72
|
return null;
|
|
184
73
|
}
|
|
185
|
-
return /* @__PURE__ */ (0,
|
|
186
|
-
/* @__PURE__ */ (0,
|
|
74
|
+
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: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_zen.Text, { size: "2", weight: "bold", children: "On this page" }),
|
|
187
76
|
items.map(({ name, id, size }) => {
|
|
188
|
-
return /* @__PURE__ */ (0,
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
189
78
|
"a",
|
|
190
79
|
{
|
|
191
80
|
href: `#${id}`,
|
|
@@ -200,18 +89,76 @@ function PageLinks({ items = [], className, ...props }) {
|
|
|
200
89
|
] }) });
|
|
201
90
|
}
|
|
202
91
|
|
|
92
|
+
// src/components/Markdown.tsx
|
|
93
|
+
var import_react_zen2 = require("@umami/react-zen");
|
|
94
|
+
var import_mdx = require("@mdx-js/mdx");
|
|
95
|
+
var import_react2 = require("@mdx-js/react");
|
|
96
|
+
var runtime = __toESM(require("react/jsx-runtime"));
|
|
97
|
+
|
|
98
|
+
// css-modules:E:\dev\umami-shiso\src\components\Markdown.module.css
|
|
99
|
+
var Markdown_default = { "content": "Markdown_content__ZDlhO" };
|
|
100
|
+
|
|
101
|
+
// src/components/Markdown.tsx
|
|
102
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
103
|
+
var import_meta = {};
|
|
104
|
+
var parseMdx = (code) => {
|
|
105
|
+
try {
|
|
106
|
+
const result = (0, import_mdx.runSync)(code, {
|
|
107
|
+
...runtime,
|
|
108
|
+
baseUrl: import_meta.url
|
|
109
|
+
});
|
|
110
|
+
return { Component: result.default };
|
|
111
|
+
} catch (err) {
|
|
112
|
+
return { error: err.message };
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
function Markdown({ code }) {
|
|
116
|
+
const components = (0, import_react2.useMDXComponents)();
|
|
117
|
+
const { Component, error } = parseMdx(code);
|
|
118
|
+
if (error) {
|
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("h1", { children: [
|
|
120
|
+
"Error rendering MDX: ",
|
|
121
|
+
error
|
|
122
|
+
] });
|
|
123
|
+
}
|
|
124
|
+
if (!Component) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_zen2.Box, { className: Markdown_default.content, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, { components }) });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// src/components/Blog.tsx
|
|
131
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
132
|
+
function Blog({ title, description, code, author, date, image, anchors }) {
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_zen3.Column, { gap: "8", maxWidth: "900px", style: { margin: "0 auto" }, children: [
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Box, { flexGrow: 1, children: title && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Heading, { size: "1", as: "h1", align: "center", children: title }) }),
|
|
135
|
+
image && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Box, { height: "480px", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Image, { src: image, alt: title, objectFit: "cover", borderRadius: "3" }) }),
|
|
136
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_zen3.Row, { justifyContent: "space-between", children: [
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Text, { children: author }),
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Text, { children: date && (0, import_date_fns.format)(new Date(date), "PP") })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_zen3.Grid, { columns: "1fr 240px", gap: "5", children: [
|
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Markdown, { code }),
|
|
142
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PageLinks, { items: anchors })
|
|
143
|
+
] })
|
|
144
|
+
] });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/components/Docs.tsx
|
|
148
|
+
var import_react_zen7 = require("@umami/react-zen");
|
|
149
|
+
|
|
203
150
|
// src/components/SideNav.tsx
|
|
204
|
-
var
|
|
205
|
-
var
|
|
151
|
+
var import_react3 = require("react");
|
|
152
|
+
var import_react_zen4 = require("@umami/react-zen");
|
|
206
153
|
var import_classnames2 = __toESM(require("classnames"));
|
|
207
154
|
var import_navigation = require("next/navigation");
|
|
208
155
|
var import_link = __toESM(require("next/link"));
|
|
209
156
|
|
|
210
|
-
// css-modules
|
|
211
|
-
var SideNav_default = { "nav": "
|
|
157
|
+
// css-modules:E:\dev\umami-shiso\src\components\SideNav.module.css
|
|
158
|
+
var SideNav_default = { "nav": "SideNav_nav__YjU1O", "sticky": "SideNav_sticky__NjhmY", "item": "SideNav_item__ZGRlM", "selected": "SideNav_selected__NTMzY", "items": "SideNav_items__MWI3O" };
|
|
212
159
|
|
|
213
160
|
// src/components/SideNav.tsx
|
|
214
|
-
var
|
|
161
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
215
162
|
function SideNav({
|
|
216
163
|
tabs,
|
|
217
164
|
navigation,
|
|
@@ -224,8 +171,8 @@ function SideNav({
|
|
|
224
171
|
const pathname = (0, import_navigation.usePathname)();
|
|
225
172
|
const tab = tabs?.find(({ url, id }) => id !== "docs" ? pathname.startsWith(url) : false);
|
|
226
173
|
const menu = navigation[tab?.id || "docs"];
|
|
227
|
-
const [height, setHeight] = (0,
|
|
228
|
-
(0,
|
|
174
|
+
const [height, setHeight] = (0, import_react3.useState)();
|
|
175
|
+
(0, import_react3.useEffect)(() => {
|
|
229
176
|
if (autoHeight) {
|
|
230
177
|
const rect = document.getElementById("shiso_docs_sidenav")?.getBoundingClientRect();
|
|
231
178
|
if (rect) {
|
|
@@ -233,22 +180,22 @@ function SideNav({
|
|
|
233
180
|
}
|
|
234
181
|
}
|
|
235
182
|
}, [autoHeight]);
|
|
236
|
-
return /* @__PURE__ */ (0,
|
|
237
|
-
|
|
183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
184
|
+
import_react_zen4.Box,
|
|
238
185
|
{
|
|
239
186
|
...props,
|
|
240
187
|
id: "shiso_docs_sidenav",
|
|
241
188
|
className: (0, import_classnames2.default)(SideNav_default.nav, isSticky && SideNav_default.sticky, className),
|
|
242
189
|
style: { ...style, height },
|
|
243
|
-
children: /* @__PURE__ */ (0,
|
|
244
|
-
return /* @__PURE__ */ (0,
|
|
245
|
-
return /* @__PURE__ */ (0,
|
|
246
|
-
|
|
190
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen4.List, { items: navigation, "aria-label": "nav", children: menu.map(({ section, pages }) => {
|
|
191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen4.ListSection, { title: section, className: SideNav_default.items, children: pages.map(({ label: text, url }, index) => {
|
|
192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
193
|
+
import_react_zen4.ListItem,
|
|
247
194
|
{
|
|
248
195
|
className: (0, import_classnames2.default)(SideNav_default.item, {
|
|
249
196
|
[SideNav_default.selected]: url === pathname
|
|
250
197
|
}),
|
|
251
|
-
children: /* @__PURE__ */ (0,
|
|
198
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_link.default, { href: url, prefetch: false, children: text })
|
|
252
199
|
},
|
|
253
200
|
index
|
|
254
201
|
);
|
|
@@ -261,35 +208,30 @@ function SideNav({
|
|
|
261
208
|
// src/components/TopNav.tsx
|
|
262
209
|
var import_link2 = __toESM(require("next/link"));
|
|
263
210
|
var import_navigation2 = require("next/navigation");
|
|
264
|
-
var
|
|
265
|
-
var
|
|
211
|
+
var import_react_zen5 = require("@umami/react-zen");
|
|
212
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
266
213
|
function TopNav({ tabs }) {
|
|
267
214
|
const pathname = (0, import_navigation2.usePathname)();
|
|
268
215
|
const tab = tabs?.find(({ id, url }) => id !== "docs" ? pathname.startsWith(url) : false);
|
|
269
216
|
const selected = tab?.id || "docs";
|
|
270
|
-
return /* @__PURE__ */ (0,
|
|
271
|
-
return /* @__PURE__ */ (0,
|
|
217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_zen5.Tabs, { selectedKey: selected, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_zen5.TabList, { items: tabs, children: ({ id, label, url }) => {
|
|
218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_zen5.Tab, { id, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_link2.default, { href: url, children: label }) });
|
|
272
219
|
} }) });
|
|
273
220
|
}
|
|
274
221
|
|
|
275
|
-
// src/components/
|
|
276
|
-
var
|
|
277
|
-
|
|
278
|
-
// css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/ContentArea.module.css
|
|
279
|
-
var ContentArea_default = { "content": "ContentArea_content__NGFkN" };
|
|
280
|
-
|
|
281
|
-
// src/components/ContentArea.tsx
|
|
222
|
+
// src/components/DocContent.tsx
|
|
223
|
+
var import_react_zen6 = require("@umami/react-zen");
|
|
282
224
|
var import_link3 = __toESM(require("next/link"));
|
|
283
|
-
var
|
|
284
|
-
function
|
|
285
|
-
return /* @__PURE__ */ (0,
|
|
286
|
-
section && /* @__PURE__ */ (0,
|
|
287
|
-
title && /* @__PURE__ */ (0,
|
|
288
|
-
description && /* @__PURE__ */ (0,
|
|
289
|
-
/* @__PURE__ */ (0,
|
|
290
|
-
/* @__PURE__ */ (0,
|
|
291
|
-
/* @__PURE__ */ (0,
|
|
292
|
-
/* @__PURE__ */ (0,
|
|
225
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
226
|
+
function DocContent({ section, title, description, code, next, prev }) {
|
|
227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_zen6.Box, { flexGrow: 1, children: [
|
|
228
|
+
section && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Text, { color: "primary", weight: "bold", children: section }),
|
|
229
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Heading, { size: "2", as: "h1", marginY: "3", children: title }),
|
|
230
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Text, { color: "muted", size: "3", children: description }),
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Markdown, { code }),
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_zen6.Row, { justifyContent: "space-between", children: [
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NavigationButton, { ...prev, isPrev: true }),
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NavigationButton, { ...next })
|
|
293
235
|
] })
|
|
294
236
|
] });
|
|
295
237
|
}
|
|
@@ -299,17 +241,17 @@ var NavigationButton = ({
|
|
|
299
241
|
isPrev
|
|
300
242
|
}) => {
|
|
301
243
|
if (!url || !label) {
|
|
302
|
-
return /* @__PURE__ */ (0,
|
|
244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Box, {});
|
|
303
245
|
}
|
|
304
|
-
return /* @__PURE__ */ (0,
|
|
305
|
-
isPrev && /* @__PURE__ */ (0,
|
|
306
|
-
/* @__PURE__ */ (0,
|
|
307
|
-
!isPrev && /* @__PURE__ */ (0,
|
|
246
|
+
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: [
|
|
247
|
+
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, {}) }),
|
|
248
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Text, { size: "3", weight: "bold", children: label }),
|
|
249
|
+
!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, {}) })
|
|
308
250
|
] }) });
|
|
309
251
|
};
|
|
310
252
|
|
|
311
253
|
// src/components/Docs.tsx
|
|
312
|
-
var
|
|
254
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
313
255
|
function parseContent(content, config = {}) {
|
|
314
256
|
const { tabs, navigation } = config;
|
|
315
257
|
const keys = Object.keys(navigation);
|
|
@@ -334,10 +276,9 @@ function parseContent(content, config = {}) {
|
|
|
334
276
|
});
|
|
335
277
|
return { ...content, tabs, navigation, section, next, prev };
|
|
336
278
|
}
|
|
337
|
-
function Docs() {
|
|
338
|
-
const { content, config } = useShiso();
|
|
279
|
+
function Docs({ content, config }) {
|
|
339
280
|
if (!content) {
|
|
340
|
-
return /* @__PURE__ */ (0,
|
|
281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Heading, { children: "Page not found" });
|
|
341
282
|
}
|
|
342
283
|
const { tabs, navigation, code, meta, section, next, prev, anchors } = parseContent(
|
|
343
284
|
content,
|
|
@@ -364,28 +305,28 @@ function Docs() {
|
|
|
364
305
|
lg: "none",
|
|
365
306
|
xl: "none"
|
|
366
307
|
};
|
|
367
|
-
const MobileMenuButton = () => /* @__PURE__ */ (0,
|
|
368
|
-
/* @__PURE__ */ (0,
|
|
369
|
-
/* @__PURE__ */ (0,
|
|
370
|
-
/* @__PURE__ */ (0,
|
|
308
|
+
const MobileMenuButton = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.DialogTrigger, { children: [
|
|
309
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.Button, { children: [
|
|
310
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Icons.Menu, {}) }),
|
|
311
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Text, { children: "Menu" })
|
|
371
312
|
] }),
|
|
372
|
-
/* @__PURE__ */ (0,
|
|
373
|
-
return /* @__PURE__ */ (0,
|
|
374
|
-
/* @__PURE__ */ (0,
|
|
375
|
-
/* @__PURE__ */ (0,
|
|
313
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Modal, { position: "bottom", offset: "40px", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Dialog, { variant: "sheet", children: ({ close }) => {
|
|
314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
315
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Row, { justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Button, { onPress: () => close(), variant: "quiet", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Icons.Close, {}) }) }) }),
|
|
316
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Box, { height: "100%", overflow: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SideNav, { tabs, navigation }) })
|
|
376
317
|
] });
|
|
377
318
|
} }) })
|
|
378
319
|
] });
|
|
379
|
-
return /* @__PURE__ */ (0,
|
|
380
|
-
/* @__PURE__ */ (0,
|
|
381
|
-
tabs && /* @__PURE__ */ (0,
|
|
382
|
-
/* @__PURE__ */ (0,
|
|
383
|
-
|
|
320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.Box, { flexGrow: "1", children: [
|
|
321
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Row, { display: menuDisplay, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MobileMenuButton, {}) }),
|
|
322
|
+
tabs && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TopNav, { tabs }),
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
324
|
+
import_react_zen7.Grid,
|
|
384
325
|
{
|
|
385
326
|
gap: "6",
|
|
386
327
|
columns: { xs: "1fr", sm: "1fr", md: "1fr", lg: "240px 1fr 240px", xl: "240px 1fr 240px" },
|
|
387
328
|
children: [
|
|
388
|
-
/* @__PURE__ */ (0,
|
|
329
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
389
330
|
SideNav,
|
|
390
331
|
{
|
|
391
332
|
display: navDisplay,
|
|
@@ -396,8 +337,8 @@ function Docs() {
|
|
|
396
337
|
autoHeight: true
|
|
397
338
|
}
|
|
398
339
|
),
|
|
399
|
-
/* @__PURE__ */ (0,
|
|
400
|
-
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
341
|
+
DocContent,
|
|
401
342
|
{
|
|
402
343
|
section,
|
|
403
344
|
title: meta?.title,
|
|
@@ -407,12 +348,94 @@ function Docs() {
|
|
|
407
348
|
prev
|
|
408
349
|
}
|
|
409
350
|
),
|
|
410
|
-
/* @__PURE__ */ (0,
|
|
351
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageLinks, { display: linksDisplay, items: anchors, style: { top } })
|
|
411
352
|
]
|
|
412
353
|
}
|
|
413
354
|
)
|
|
414
355
|
] });
|
|
415
356
|
}
|
|
357
|
+
|
|
358
|
+
// src/components/Shiso.tsx
|
|
359
|
+
var import_react5 = require("react");
|
|
360
|
+
var import_react6 = require("@mdx-js/react");
|
|
361
|
+
var import_react_zen11 = require("@umami/react-zen");
|
|
362
|
+
|
|
363
|
+
// src/components/CodeBlock.tsx
|
|
364
|
+
var import_react4 = require("react");
|
|
365
|
+
var import_react_zen8 = require("@umami/react-zen");
|
|
366
|
+
|
|
367
|
+
// css-modules:E:\dev\umami-shiso\src\components\CodeBlock.module.css
|
|
368
|
+
var CodeBlock_default = { "container": "CodeBlock_container__ZTkxY", "button": "CodeBlock_button__MmZkO", "copy": "CodeBlock_copy__M2I0N", "check": "CodeBlock_check__MjkzY" };
|
|
369
|
+
|
|
370
|
+
// src/components/CodeBlock.tsx
|
|
371
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
372
|
+
function CodeBlock(props) {
|
|
373
|
+
const textInput = (0, import_react4.useRef)(null);
|
|
374
|
+
const [copied, setCopied] = (0, import_react4.useState)(false);
|
|
375
|
+
const handleCopy = () => {
|
|
376
|
+
setCopied(true);
|
|
377
|
+
navigator?.clipboard?.writeText(textInput?.current?.textContent);
|
|
378
|
+
setTimeout(() => {
|
|
379
|
+
setCopied(false);
|
|
380
|
+
}, 1e3);
|
|
381
|
+
};
|
|
382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("pre", { ref: textInput, className: CodeBlock_default.container, children: [
|
|
383
|
+
props.children,
|
|
384
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { "aria-label": "Copy code", className: CodeBlock_default.button, onClick: handleCopy, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Icon, { size: "sm", className: copied ? CodeBlock_default.check : CodeBlock_default.copy, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Icons.Check, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen8.Icons.Copy, {}) }) })
|
|
385
|
+
] });
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// src/components/Blogs.tsx
|
|
389
|
+
var import_react_zen10 = require("@umami/react-zen");
|
|
390
|
+
|
|
391
|
+
// src/components/Card.tsx
|
|
392
|
+
var import_react_zen9 = require("@umami/react-zen");
|
|
393
|
+
var import_link4 = __toESM(require("next/link"));
|
|
394
|
+
var import_date_fns2 = require("date-fns");
|
|
395
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
396
|
+
function Card({ title, description, date, author, url, image }) {
|
|
397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_zen9.Column, { borderSize: "1", borderRadius: "3", overflow: "hidden", children: [
|
|
398
|
+
image && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Box, { height: "240px", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Image, { src: image, alt: title, objectFit: "cover" }) }),
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_zen9.Column, { padding: "6", gap: "4", children: [
|
|
400
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Heading, { size: "4", as: "header", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_link4.default, { href: url, children: title }) }),
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Text, { as: "p", children: description }),
|
|
402
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_zen9.Row, { justifyContent: "space-between", marginTop: "5", children: [
|
|
403
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Text, { color: "muted", children: date && (0, import_date_fns2.format)(new Date(date), "PP") }),
|
|
404
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Text, { color: "muted", children: author })
|
|
405
|
+
] }),
|
|
406
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Button, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_link4.default, { href: url, children: [
|
|
407
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Text, { children: "Read more" }),
|
|
408
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Icons.Arrow, {}) })
|
|
409
|
+
] }) })
|
|
410
|
+
] })
|
|
411
|
+
] });
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// src/components/Blogs.tsx
|
|
415
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
416
|
+
function Blogs({ content, config }) {
|
|
417
|
+
if (!Array.isArray(content)) {
|
|
418
|
+
const { meta, code, anchors, slug } = content;
|
|
419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Blog, { ...meta, code, anchors });
|
|
420
|
+
}
|
|
421
|
+
console.log({ content });
|
|
422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen10.Grid, { gap: "5", columns: "repeat(auto-fit, minmax(400px, 1fr)", children: content?.sort((a, b) => new Date(b.meta.date).getTime() - new Date(a.meta.date).getTime()).map(({ meta, slug }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Card, { url: `/blog/${slug}`, ...meta }, slug)) });
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// src/components/Shiso.tsx
|
|
426
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
427
|
+
var defaultTemplates = {
|
|
428
|
+
docs: Docs,
|
|
429
|
+
blog: Blogs
|
|
430
|
+
};
|
|
431
|
+
var ShisoContext = (0, import_react5.createContext)(null);
|
|
432
|
+
function Shiso({ type, config, content, components, templates }) {
|
|
433
|
+
const Component = { ...defaultTemplates, ...templates }[type];
|
|
434
|
+
if (!Component) {
|
|
435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { children: `Component not found for type: ${type}` });
|
|
436
|
+
}
|
|
437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ShisoContext.Provider, { value: { type, config, content, components, templates }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react6.MDXProvider, { components: { ...components, pre: CodeBlock, code: import_react_zen11.Code }, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Component, { config, content }) }) });
|
|
438
|
+
}
|
|
416
439
|
// Annotate the CommonJS export names for ESM import in node:
|
|
417
440
|
0 && (module.exports = {
|
|
418
441
|
Blog,
|