@umami/shiso 0.30.0 → 0.32.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.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:E:\dev\umami-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:E:\dev\umami-shiso\src\components\CodeBlock.module.css
116
- var CodeBlock_default = { "container": "CodeBlock_container__ZTkxY", "button": "CodeBlock_button__MmZkO", "copy": "CodeBlock_copy__M2I0N", "check": "CodeBlock_check__MjkzY" };
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 import_react6 = require("react");
159
- var import_react_zen5 = require("@umami/react-zen");
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
51
  // css-modules:E:\dev\umami-shiso\src\components\PageLinks.module.css
163
- 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" };
52
+ var PageLinks_default = { "links": "PageLinks_links__ZWUxN", "link": "PageLinks_link__MTJmN", "indent-1": "PageLinks_indent-1__MGExM", "indent-2": "PageLinks_indent-2__NDM3O", "indent-3": "PageLinks_indent-3__YmJlN", "indent-4": "PageLinks_indent-4__OTNjM", "indent-5": "PageLinks_indent-5__YTIwM", "indent-6": "PageLinks_indent-6__MjQwY", "selected": "PageLinks_selected__NDA0Y" };
164
53
 
165
54
  // src/components/PageLinks.tsx
166
- var import_jsx_runtime6 = require("react/jsx-runtime");
55
+ var import_jsx_runtime = require("react/jsx-runtime");
167
56
  function PageLinks({ items = [], className, ...props }) {
168
- const [hash, setHash] = (0, import_react6.useState)(items?.[0]?.id);
169
- (0, import_react6.useEffect)(() => {
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, import_jsx_runtime6.jsx)(import_react_zen5.Box, { ...props, className: (0, import_classnames.default)(PageLinks_default.links, className), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_zen5.Column, { gap: "3", minWidth: "240px", children: [
186
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen5.Text, { size: "2", weight: "bold", children: "On this page" }),
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, import_jsx_runtime6.jsx)(
77
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
189
78
  "a",
190
79
  {
191
80
  href: `#${id}`,
@@ -200,18 +89,84 @@ 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
+ const linksDisplay = {
134
+ default: "none",
135
+ xs: "none",
136
+ sm: "none",
137
+ md: "none",
138
+ lg: "block",
139
+ xl: "block"
140
+ };
141
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_zen3.Column, { gap: "8", maxWidth: "900px", style: { margin: "0 auto" }, children: [
142
+ /* @__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 }) }),
143
+ 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" }) }),
144
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_zen3.Row, { justifyContent: "space-between", children: [
145
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Text, { children: author }),
146
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Text, { children: date && (0, import_date_fns.format)(new Date(date), "PP") })
147
+ ] }),
148
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_zen3.Row, { gap: "6", children: [
149
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Markdown, { code }),
150
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PageLinks, { display: linksDisplay, items: anchors })
151
+ ] })
152
+ ] });
153
+ }
154
+
155
+ // src/components/Docs.tsx
156
+ var import_react_zen7 = require("@umami/react-zen");
157
+
203
158
  // src/components/SideNav.tsx
204
- var import_react7 = require("react");
205
- var import_react_zen6 = require("@umami/react-zen");
159
+ var import_react3 = require("react");
160
+ var import_react_zen4 = require("@umami/react-zen");
206
161
  var import_classnames2 = __toESM(require("classnames"));
207
162
  var import_navigation = require("next/navigation");
208
163
  var import_link = __toESM(require("next/link"));
209
164
 
210
165
  // css-modules:E:\dev\umami-shiso\src\components\SideNav.module.css
211
- var SideNav_default = { "nav": "SideNav_nav__YjU1O", "sticky": "SideNav_sticky__NjhmY", "item": "SideNav_item__ZGRlM", "selected": "SideNav_selected__NTMzY", "items": "SideNav_items__MWI3O" };
166
+ var SideNav_default = { "nav": "SideNav_nav__ZDkzM", "sticky": "SideNav_sticky__YzM2M", "item": "SideNav_item__ZWQwY", "selected": "SideNav_selected__OGVhZ", "items": "SideNav_items__OWFkN" };
212
167
 
213
168
  // src/components/SideNav.tsx
214
- var import_jsx_runtime7 = require("react/jsx-runtime");
169
+ var import_jsx_runtime4 = require("react/jsx-runtime");
215
170
  function SideNav({
216
171
  tabs,
217
172
  navigation,
@@ -224,8 +179,8 @@ function SideNav({
224
179
  const pathname = (0, import_navigation.usePathname)();
225
180
  const tab = tabs?.find(({ url, id }) => id !== "docs" ? pathname.startsWith(url) : false);
226
181
  const menu = navigation[tab?.id || "docs"];
227
- const [height, setHeight] = (0, import_react7.useState)();
228
- (0, import_react7.useEffect)(() => {
182
+ const [height, setHeight] = (0, import_react3.useState)();
183
+ (0, import_react3.useEffect)(() => {
229
184
  if (autoHeight) {
230
185
  const rect = document.getElementById("shiso_docs_sidenav")?.getBoundingClientRect();
231
186
  if (rect) {
@@ -233,22 +188,22 @@ function SideNav({
233
188
  }
234
189
  }
235
190
  }, [autoHeight]);
236
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
237
- import_react_zen6.Box,
191
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
192
+ import_react_zen4.Box,
238
193
  {
239
194
  ...props,
240
195
  id: "shiso_docs_sidenav",
241
196
  className: (0, import_classnames2.default)(SideNav_default.nav, isSticky && SideNav_default.sticky, className),
242
197
  style: { ...style, height },
243
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen6.List, { items: navigation, "aria-label": "nav", children: menu.map(({ section, pages }) => {
244
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen6.ListSection, { title: section, className: SideNav_default.items, children: pages.map(({ label: text, url }, index) => {
245
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
246
- import_react_zen6.ListItem,
198
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen4.List, { items: navigation, "aria-label": "nav", children: menu.map(({ section, pages }) => {
199
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen4.ListSection, { title: section, className: SideNav_default.items, children: pages.map(({ label: text, url }, index) => {
200
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
201
+ import_react_zen4.ListItem,
247
202
  {
248
203
  className: (0, import_classnames2.default)(SideNav_default.item, {
249
204
  [SideNav_default.selected]: url === pathname
250
205
  }),
251
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_link.default, { href: url, prefetch: false, children: text })
206
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_link.default, { href: url, prefetch: false, children: text })
252
207
  },
253
208
  index
254
209
  );
@@ -261,35 +216,30 @@ function SideNav({
261
216
  // src/components/TopNav.tsx
262
217
  var import_link2 = __toESM(require("next/link"));
263
218
  var import_navigation2 = require("next/navigation");
264
- var import_react_zen7 = require("@umami/react-zen");
265
- var import_jsx_runtime8 = require("react/jsx-runtime");
219
+ var import_react_zen5 = require("@umami/react-zen");
220
+ var import_jsx_runtime5 = require("react/jsx-runtime");
266
221
  function TopNav({ tabs }) {
267
222
  const pathname = (0, import_navigation2.usePathname)();
268
223
  const tab = tabs?.find(({ id, url }) => id !== "docs" ? pathname.startsWith(url) : false);
269
224
  const selected = tab?.id || "docs";
270
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen7.Tabs, { selectedKey: selected, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen7.TabList, { items: tabs, children: ({ id, label, url }) => {
271
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen7.Tab, { id, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_link2.default, { href: url, children: label }) });
225
+ 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 }) => {
226
+ 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
227
  } }) });
273
228
  }
274
229
 
275
- // src/components/ContentArea.tsx
276
- var import_react_zen8 = require("@umami/react-zen");
277
-
278
- // css-modules:E:\dev\umami-shiso\src\components\ContentArea.module.css
279
- var ContentArea_default = { "content": "ContentArea_content__MTM4Z" };
280
-
281
- // src/components/ContentArea.tsx
230
+ // src/components/DocContent.tsx
231
+ var import_react_zen6 = require("@umami/react-zen");
282
232
  var import_link3 = __toESM(require("next/link"));
283
- var import_jsx_runtime9 = require("react/jsx-runtime");
284
- function ContentArea({ section, title, description, code, next, prev }) {
285
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_zen8.Box, { flexGrow: 1, children: [
286
- section && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Text, { color: "primary", weight: "bold", children: section }),
287
- title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Heading, { size: "2", as: "h1", marginY: "3", children: title }),
288
- description && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Text, { color: "muted", size: "3", children: description }),
289
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Box, { className: ContentArea_default.content, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Markdown, { code }) }),
290
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_zen8.Row, { justifyContent: "space-between", children: [
291
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(NavigationButton, { ...prev, isPrev: true }),
292
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(NavigationButton, { ...next })
233
+ var import_jsx_runtime6 = require("react/jsx-runtime");
234
+ function DocContent({ section, title, description, code, next, prev }) {
235
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_zen6.Box, { flexGrow: 1, children: [
236
+ section && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Text, { color: "primary", weight: "bold", children: section }),
237
+ title && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Heading, { size: "2", as: "h1", marginY: "3", children: title }),
238
+ description && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Text, { color: "muted", size: "3", children: description }),
239
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Markdown, { code }),
240
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react_zen6.Row, { justifyContent: "space-between", children: [
241
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NavigationButton, { ...prev, isPrev: true }),
242
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(NavigationButton, { ...next })
293
243
  ] })
294
244
  ] });
295
245
  }
@@ -299,17 +249,17 @@ var NavigationButton = ({
299
249
  isPrev
300
250
  }) => {
301
251
  if (!url || !label) {
302
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Box, {});
252
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Box, {});
303
253
  }
304
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_link3.default, { href: url, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_zen8.Row, { alignItems: "center", gap: "3", marginY: "3", children: [
305
- isPrev && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Icon, { size: "sm", rotate: 180, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Icons.Chevron, {}) }),
306
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Text, { size: "3", weight: "bold", children: label }),
307
- !isPrev && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen8.Icons.Chevron, {}) })
254
+ 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: [
255
+ 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, {}) }),
256
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen6.Text, { size: "3", weight: "bold", children: label }),
257
+ !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
258
  ] }) });
309
259
  };
310
260
 
311
261
  // src/components/Docs.tsx
312
- var import_jsx_runtime10 = require("react/jsx-runtime");
262
+ var import_jsx_runtime7 = require("react/jsx-runtime");
313
263
  function parseContent(content, config = {}) {
314
264
  const { tabs, navigation } = config;
315
265
  const keys = Object.keys(navigation);
@@ -334,10 +284,9 @@ function parseContent(content, config = {}) {
334
284
  });
335
285
  return { ...content, tabs, navigation, section, next, prev };
336
286
  }
337
- function Docs() {
338
- const { content, config } = useShiso();
287
+ function Docs({ content, config }) {
339
288
  if (!content) {
340
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Heading, { children: "Page not found" });
289
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Heading, { children: "Page not found" });
341
290
  }
342
291
  const { tabs, navigation, code, meta, section, next, prev, anchors } = parseContent(
343
292
  content,
@@ -364,55 +313,130 @@ function Docs() {
364
313
  lg: "none",
365
314
  xl: "none"
366
315
  };
367
- const MobileMenuButton = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_zen9.DialogTrigger, { children: [
368
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_zen9.Button, { children: [
369
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Icons.Menu, {}) }),
370
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Text, { children: "Menu" })
316
+ const MobileMenuButton = () => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.DialogTrigger, { children: [
317
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.Button, { children: [
318
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Icons.Menu, {}) }),
319
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Text, { children: "Menu" })
371
320
  ] }),
372
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Modal, { position: "bottom", offset: "40px", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Dialog, { variant: "sheet", children: ({ close }) => {
373
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
374
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Row, { justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Button, { onPress: () => close(), variant: "quiet", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Icon, { size: "sm", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Icons.Close, {}) }) }) }),
375
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Box, { height: "100%", overflow: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SideNav, { tabs, navigation }) })
321
+ /* @__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 }) => {
322
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
323
+ /* @__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, {}) }) }) }),
324
+ /* @__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
325
  ] });
377
326
  } }) })
378
327
  ] });
379
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react_zen9.Box, { flexGrow: "1", children: [
380
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_zen9.Row, { display: menuDisplay, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(MobileMenuButton, {}) }),
381
- tabs && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TopNav, { tabs }),
382
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
383
- import_react_zen9.Grid,
384
- {
385
- gap: "6",
386
- columns: { xs: "1fr", sm: "1fr", md: "1fr", lg: "240px 1fr 240px", xl: "240px 1fr 240px" },
387
- children: [
388
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
389
- SideNav,
390
- {
391
- display: navDisplay,
392
- tabs,
393
- navigation,
394
- style: { top },
395
- isSticky: true,
396
- autoHeight: true
397
- }
398
- ),
399
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
400
- ContentArea,
401
- {
402
- section,
403
- title: meta?.title,
404
- description: meta?.description,
405
- code,
406
- next,
407
- prev
408
- }
409
- ),
410
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PageLinks, { display: linksDisplay, items: anchors, style: { top } })
411
- ]
412
- }
413
- )
328
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.Box, { flexGrow: "1", children: [
329
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen7.Row, { display: menuDisplay, justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MobileMenuButton, {}) }),
330
+ tabs && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TopNav, { tabs }),
331
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen7.Row, { gap: "6", children: [
332
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
333
+ SideNav,
334
+ {
335
+ display: navDisplay,
336
+ tabs,
337
+ navigation,
338
+ style: { top },
339
+ isSticky: true,
340
+ autoHeight: true
341
+ }
342
+ ),
343
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
344
+ DocContent,
345
+ {
346
+ section,
347
+ title: meta?.title,
348
+ description: meta?.description,
349
+ code,
350
+ next,
351
+ prev
352
+ }
353
+ ),
354
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(PageLinks, { display: linksDisplay, items: anchors, style: { top } })
355
+ ] })
356
+ ] });
357
+ }
358
+
359
+ // src/components/Shiso.tsx
360
+ var import_react5 = require("react");
361
+ var import_react6 = require("@mdx-js/react");
362
+ var import_react_zen11 = require("@umami/react-zen");
363
+
364
+ // src/components/CodeBlock.tsx
365
+ var import_react4 = require("react");
366
+ var import_react_zen8 = require("@umami/react-zen");
367
+
368
+ // css-modules:E:\dev\umami-shiso\src\components\CodeBlock.module.css
369
+ var CodeBlock_default = { "container": "CodeBlock_container__ZTkxY", "button": "CodeBlock_button__MmZkO", "copy": "CodeBlock_copy__M2I0N", "check": "CodeBlock_check__MjkzY" };
370
+
371
+ // src/components/CodeBlock.tsx
372
+ var import_jsx_runtime8 = require("react/jsx-runtime");
373
+ function CodeBlock(props) {
374
+ const textInput = (0, import_react4.useRef)(null);
375
+ const [copied, setCopied] = (0, import_react4.useState)(false);
376
+ const handleCopy = () => {
377
+ setCopied(true);
378
+ navigator?.clipboard?.writeText(textInput?.current?.textContent);
379
+ setTimeout(() => {
380
+ setCopied(false);
381
+ }, 1e3);
382
+ };
383
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("pre", { ref: textInput, className: CodeBlock_default.container, children: [
384
+ props.children,
385
+ /* @__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, {}) }) })
414
386
  ] });
415
387
  }
388
+
389
+ // src/components/Blogs.tsx
390
+ var import_react_zen10 = require("@umami/react-zen");
391
+
392
+ // src/components/Card.tsx
393
+ var import_react_zen9 = require("@umami/react-zen");
394
+ var import_link4 = __toESM(require("next/link"));
395
+ var import_date_fns2 = require("date-fns");
396
+ var import_jsx_runtime9 = require("react/jsx-runtime");
397
+ function Card({ title, description, date, author, url, image }) {
398
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_zen9.Column, { borderSize: "1", borderRadius: "3", overflow: "hidden", children: [
399
+ 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" }) }),
400
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_zen9.Column, { padding: "6", gap: "4", children: [
401
+ /* @__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 }) }),
402
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_react_zen9.Row, { justifyContent: "space-between", 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.Box, { marginY: "5", as: "p", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Text, { size: "3", children: description }) }),
407
+ /* @__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: [
408
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Text, { children: "Read more" }),
409
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Icon, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Icons.Arrow, {}) })
410
+ ] }) })
411
+ ] })
412
+ ] });
413
+ }
414
+
415
+ // src/components/Blogs.tsx
416
+ var import_jsx_runtime10 = require("react/jsx-runtime");
417
+ function Blogs({ content, config }) {
418
+ if (!Array.isArray(content)) {
419
+ const { meta, code, anchors, slug } = content;
420
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Blog, { ...meta, code, anchors });
421
+ }
422
+ console.log({ content });
423
+ 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)) });
424
+ }
425
+
426
+ // src/components/Shiso.tsx
427
+ var import_jsx_runtime11 = require("react/jsx-runtime");
428
+ var defaultTemplates = {
429
+ docs: Docs,
430
+ blog: Blogs
431
+ };
432
+ var ShisoContext = (0, import_react5.createContext)(null);
433
+ function Shiso({ type, config, content, components, templates }) {
434
+ const Component = { ...defaultTemplates, ...templates }[type];
435
+ if (!Component) {
436
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h1", { children: `Component not found for type: ${type}` });
437
+ }
438
+ 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 }) }) });
439
+ }
416
440
  // Annotate the CommonJS export names for ESM import in node:
417
441
  0 && (module.exports = {
418
442
  Blog,