@umami/shiso 0.15.0 → 0.17.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 CHANGED
@@ -34,44 +34,45 @@ pre.CodeBlock_container__YmFmN code {
34
34
  }
35
35
 
36
36
  /* virtual-css:css:0ed498f49b21d225f1b5a4e1685cf2e5 */
37
- .PageLinks_title__ZmQ4Z {
37
+ .PageLinks_title__YjEwN {
38
38
  position: sticky;
39
39
  top: 0;
40
40
  }
41
- .PageLinks_links__YTk1O {
41
+ .PageLinks_links__OWRlM {
42
42
  position: sticky;
43
43
  top: 30px;
44
44
  height: max-content;
45
45
  }
46
- .PageLinks_links__YTk1O a.PageLinks_link__ODEzZ {
46
+ .PageLinks_links__OWRlM a.PageLinks_link__NDJjM {
47
47
  display: block;
48
48
  color: var(--font-color-muted);
49
+ font-size: var(--font-size);
49
50
  text-wrap: nowrap;
50
51
  text-decoration: none;
51
52
  }
52
- .PageLinks_links__YTk1O a.PageLinks_link__ODEzZ:hover {
53
+ .PageLinks_links__OWRlM a.PageLinks_link__NDJjM:hover {
53
54
  color: var(--primary-color);
54
55
  text-decoration: none;
55
56
  }
56
- .PageLinks_indent-1__ZGRiM {
57
+ .PageLinks_indent-1__MDU1M {
57
58
  margin-left: 0;
58
59
  }
59
- .PageLinks_indent-2__ZjQwZ {
60
+ .PageLinks_indent-2__MDBmY {
60
61
  margin-left: 0;
61
62
  }
62
- .PageLinks_indent-3__YmEzZ {
63
+ .PageLinks_indent-3__ZmY2O {
63
64
  margin-left: 10px;
64
65
  }
65
- .PageLinks_indent-4__ZDFhM {
66
+ .PageLinks_indent-4__MDA4N {
66
67
  margin-left: 20px;
67
68
  }
68
- .PageLinks_indent-5__MjA2M {
69
+ .PageLinks_indent-5__MDBlM {
69
70
  margin-left: 30px;
70
71
  }
71
- .PageLinks_indent-6__ODk5N {
72
+ .PageLinks_indent-6__NjIwM {
72
73
  margin-left: 40px;
73
74
  }
74
- a.PageLinks_selected__YzJmZ {
75
+ a.PageLinks_selected__NjEyY {
75
76
  color: var(--primary-color);
76
77
  }
77
78
 
@@ -106,51 +107,52 @@ a.PageLinks_selected__YzJmZ {
106
107
  }
107
108
 
108
109
  /* virtual-css:css:7938c95522eda3e1f8244364ad70b38c */
109
- .ContentArea_content__MzE0M {
110
+ .ContentArea_content__OTBiZ {
110
111
  font-size: 16px;
111
112
  margin-bottom: 60px;
112
113
  }
113
- .ContentArea_content__MzE0M > p {
114
+ .ContentArea_content__OTBiZ > p {
114
115
  color: var(--font-color-muted);
115
116
  line-height: 1.8;
116
117
  }
117
- .ContentArea_content__MzE0M a {
118
+ .ContentArea_content__OTBiZ a {
118
119
  color: var(--font-color);
119
120
  font-weight: 600;
120
- text-decoration: underline var(--font-color-disabled);
121
+ text-decoration: underline var(--border-color);
121
122
  text-underline-offset: 4px;
122
123
  }
123
- .ContentArea_content__MzE0M a:hover {
124
+ .ContentArea_content__OTBiZ a:hover {
125
+ color: var(--font-color);
124
126
  text-decoration: underline var(--primary-color);
125
127
  }
126
- .ContentArea_content__MzE0M h1 {
128
+ .ContentArea_content__OTBiZ h1 {
127
129
  font-size: var(--font-size-8);
128
130
  letter-spacing: var(--letter-spacing-1);
129
131
  margin: 0 0 var(--spacing-4) 0;
130
132
  }
131
- .ContentArea_content__MzE0M h2 {
133
+ .ContentArea_content__OTBiZ h2 {
132
134
  font-size: var(--font-size-6);
133
135
  letter-spacing: var(--letter-spacing-1);
134
136
  margin: var(--spacing-8) 0 var(--spacing-4) 0;
135
137
  }
136
- .ContentArea_content__MzE0M h3 {
138
+ .ContentArea_content__OTBiZ h3 {
137
139
  font-size: var(--font-size-5);
138
140
  letter-spacing: var(--letter-spacing-1);
139
141
  margin: var(--spacing-7) 0 var(--spacing-4) 0;
140
142
  }
141
- .ContentArea_content__MzE0M ul {
143
+ .ContentArea_content__OTBiZ ul {
142
144
  list-style: disc;
143
145
  }
144
- .ContentArea_content__MzE0M ol {
146
+ .ContentArea_content__OTBiZ ol {
145
147
  list-style: decimal;
146
148
  }
147
- .ContentArea_content__MzE0M pre {
149
+ .ContentArea_content__OTBiZ pre {
148
150
  margin: var(--spacing-5) 0;
149
151
  }
150
- .ContentArea_content__MzE0M code {
152
+ .ContentArea_content__OTBiZ code {
151
153
  font-size: 14px;
152
154
  }
153
- .ContentArea_content__MzE0M code:not([class]) {
155
+ .ContentArea_content__OTBiZ code:not([class]) {
154
156
  font-family: var(--font-family-code);
155
157
  color: var(--font-color);
156
158
  padding: var(--spacing-1);
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  declare module '@umami/shiso' {
7
7
  import '@umami/react-zen/styles.css';
8
+ import 'highlight.js/styles/github-dark.css';
8
9
  import { Blog } from '@umami/shiso/Blog';
9
10
  import { Docs } from '@umami/shiso/Docs';
10
11
  import { Shiso } from '@umami/shiso/Shiso';
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ __export(index_exports, {
37
37
  });
38
38
  module.exports = __toCommonJS(index_exports);
39
39
  var import_styles = require("@umami/react-zen/styles.css");
40
+ var import_github_dark = require("highlight.js/styles/github-dark.css");
40
41
 
41
42
  // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/Blog.module.css
42
43
  var Blog_default = {};
@@ -145,7 +146,7 @@ var import_react_zen2 = require("@umami/react-zen");
145
146
  var import_classnames = __toESM(require("classnames"));
146
147
 
147
148
  // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/PageLinks.module.css
148
- var PageLinks_default = { "title": "PageLinks_title__ZmQ4Z", "links": "PageLinks_links__YTk1O", "link": "PageLinks_link__ODEzZ", "indent-1": "PageLinks_indent-1__ZGRiM", "indent-2": "PageLinks_indent-2__ZjQwZ", "indent-3": "PageLinks_indent-3__YmEzZ", "indent-4": "PageLinks_indent-4__ZDFhM", "indent-5": "PageLinks_indent-5__MjA2M", "indent-6": "PageLinks_indent-6__ODk5N", "selected": "PageLinks_selected__YzJmZ" };
149
+ var PageLinks_default = { "title": "PageLinks_title__YjEwN", "links": "PageLinks_links__OWRlM", "link": "PageLinks_link__NDJjM", "indent-1": "PageLinks_indent-1__MDU1M", "indent-2": "PageLinks_indent-2__MDBmY", "indent-3": "PageLinks_indent-3__ZmY2O", "indent-4": "PageLinks_indent-4__MDA4N", "indent-5": "PageLinks_indent-5__MDBlM", "indent-6": "PageLinks_indent-6__NjIwM", "selected": "PageLinks_selected__NjEyY" };
149
150
 
150
151
  // src/components/PageLinks.tsx
151
152
  var import_jsx_runtime5 = require("react/jsx-runtime");
@@ -234,7 +235,7 @@ function TopNav({ tabs }) {
234
235
  var import_react_zen5 = require("@umami/react-zen");
235
236
 
236
237
  // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/ContentArea.module.css
237
- var ContentArea_default = { "content": "ContentArea_content__MzE0M" };
238
+ var ContentArea_default = { "content": "ContentArea_content__OTBiZ" };
238
239
 
239
240
  // src/components/ContentArea.tsx
240
241
  var import_jsx_runtime8 = require("react/jsx-runtime");
package/dist/index.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  // src/components/index.ts
4
4
  import "@umami/react-zen/styles.css";
5
+ import "highlight.js/styles/github-dark.css";
5
6
 
6
7
  // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/Blog.module.css
7
8
  var Blog_default = {};
@@ -109,7 +110,7 @@ import { Column, Text } from "@umami/react-zen";
109
110
  import classNames from "classnames";
110
111
 
111
112
  // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/PageLinks.module.css
112
- var PageLinks_default = { "title": "PageLinks_title__ZmQ4Z", "links": "PageLinks_links__YTk1O", "link": "PageLinks_link__ODEzZ", "indent-1": "PageLinks_indent-1__ZGRiM", "indent-2": "PageLinks_indent-2__ZjQwZ", "indent-3": "PageLinks_indent-3__YmEzZ", "indent-4": "PageLinks_indent-4__ZDFhM", "indent-5": "PageLinks_indent-5__MjA2M", "indent-6": "PageLinks_indent-6__ODk5N", "selected": "PageLinks_selected__YzJmZ" };
113
+ var PageLinks_default = { "title": "PageLinks_title__YjEwN", "links": "PageLinks_links__OWRlM", "link": "PageLinks_link__NDJjM", "indent-1": "PageLinks_indent-1__MDU1M", "indent-2": "PageLinks_indent-2__MDBmY", "indent-3": "PageLinks_indent-3__ZmY2O", "indent-4": "PageLinks_indent-4__MDA4N", "indent-5": "PageLinks_indent-5__MDBlM", "indent-6": "PageLinks_indent-6__NjIwM", "selected": "PageLinks_selected__NjEyY" };
113
114
 
114
115
  // src/components/PageLinks.tsx
115
116
  import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
@@ -198,7 +199,7 @@ function TopNav({ tabs }) {
198
199
  import { Heading, Box as Box2, Text as Text2 } from "@umami/react-zen";
199
200
 
200
201
  // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/ContentArea.module.css
201
- var ContentArea_default = { "content": "ContentArea_content__MzE0M" };
202
+ var ContentArea_default = { "content": "ContentArea_content__OTBiZ" };
202
203
 
203
204
  // src/components/ContentArea.tsx
204
205
  import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
@@ -0,0 +1,34 @@
1
+ // Generated by dts-bundle v0.7.3
2
+ // Dependencies for this module:
3
+ // ../../react
4
+ // ../../@/lib/types
5
+
6
+ declare module '@umami/shiso/server' {
7
+ import { ReactElement } from 'react';
8
+ import type { ShisoConfig } from '@/lib/types';
9
+ export const getContent: (name: string | undefined, folder: string) => Promise<any>;
10
+ export const getContentIds: (folder: string) => Promise<any>;
11
+ export function next(type: string, config: ShisoConfig): {
12
+ generateMetadata: ({ params }: {
13
+ params: Promise<{
14
+ id: string[];
15
+ }>;
16
+ }) => Promise<{
17
+ title: {
18
+ absolute: string;
19
+ default: string;
20
+ };
21
+ }>;
22
+ generateStaticParams: () => Promise<any>;
23
+ renderPage: (render: ({ type, content, config, }: {
24
+ type: string;
25
+ content: any;
26
+ config: ShisoConfig;
27
+ }) => ReactElement) => ({ params }: {
28
+ params: Promise<{
29
+ id: string[];
30
+ }>;
31
+ }) => Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
32
+ };
33
+ }
34
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umami/shiso",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "A content layer for Next.js",
5
5
  "homepage": "https://umami.is/shiso",
6
6
  "repository": {
@@ -46,7 +46,7 @@
46
46
  "@mdx-js/loader": "^3.0.0",
47
47
  "@mdx-js/mdx": "^3.1.0",
48
48
  "@mdx-js/react": "^3.0.0",
49
- "@umami/react-zen": "^0.30.0",
49
+ "@umami/react-zen": "^0.31.0",
50
50
  "classnames": "^2.5.1",
51
51
  "glob": "^10.3.10",
52
52
  "gray-matter": "^4.0.3",
package/server/index.d.ts CHANGED
@@ -1,2 +1,29 @@
1
+ import { ReactElement } from 'react';
1
2
  export declare const getContent: (name: string | undefined, folder: string) => Promise<any>;
2
3
  export declare const getContentIds: (folder: string) => Promise<any>;
4
+ export declare function next(type: string, config: {
5
+ [key: string]: any;
6
+ }): {
7
+ generateMetadata: ({ params }: {
8
+ params: Promise<{
9
+ id: string[];
10
+ }>;
11
+ }) => Promise<{
12
+ title: {
13
+ absolute: string;
14
+ default: string;
15
+ };
16
+ }>;
17
+ generateStaticParams: () => Promise<any>;
18
+ renderPage: (render: ({ type, content, config, }: {
19
+ type: string;
20
+ content: any;
21
+ config: {
22
+ [key: string]: any;
23
+ };
24
+ }) => ReactElement) => ({ params }: {
25
+ params: Promise<{
26
+ id: string[];
27
+ }>;
28
+ }) => Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
29
+ };
package/server/index.js CHANGED
@@ -120,3 +120,64 @@ export var getContentIds = cache(function (folder) { return __awaiter(void 0, vo
120
120
  }
121
121
  });
122
122
  }); });
123
+ export function next(type, config) {
124
+ var dir = path.join(config.contentDir, type);
125
+ function generateMetadata(_a) {
126
+ return __awaiter(this, arguments, void 0, function (_b) {
127
+ var name, content;
128
+ var _c, _d, _e;
129
+ var params = _b.params;
130
+ return __generator(this, function (_f) {
131
+ switch (_f.label) {
132
+ case 0: return [4 /*yield*/, params];
133
+ case 1:
134
+ name = (_d = (_c = (_f.sent())) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.join('/');
135
+ return [4 /*yield*/, getContent(name, dir)];
136
+ case 2:
137
+ content = _f.sent();
138
+ return [2 /*return*/, {
139
+ title: {
140
+ absolute: "".concat((_e = content === null || content === void 0 ? void 0 : content.meta) === null || _e === void 0 ? void 0 : _e.title, " \u2013 Shiso"),
141
+ default: 'Shiso',
142
+ },
143
+ }];
144
+ }
145
+ });
146
+ });
147
+ }
148
+ function generateStaticParams() {
149
+ return __awaiter(this, void 0, void 0, function () {
150
+ var ids;
151
+ return __generator(this, function (_a) {
152
+ switch (_a.label) {
153
+ case 0: return [4 /*yield*/, getContentIds(dir)];
154
+ case 1:
155
+ ids = _a.sent();
156
+ return [2 /*return*/, ids.map(function (id) { return ({
157
+ id: id.split('/'),
158
+ }); })];
159
+ }
160
+ });
161
+ });
162
+ }
163
+ function renderPage(render) {
164
+ var _this = this;
165
+ return function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
166
+ var name, content;
167
+ var _c, _d;
168
+ var params = _b.params;
169
+ return __generator(this, function (_e) {
170
+ switch (_e.label) {
171
+ case 0: return [4 /*yield*/, params];
172
+ case 1:
173
+ name = (_d = (_c = (_e.sent())) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.join('/');
174
+ return [4 /*yield*/, getContent(name, dir)];
175
+ case 2:
176
+ content = _e.sent();
177
+ return [2 /*return*/, render({ type: type, content: content, config: config })];
178
+ }
179
+ });
180
+ }); };
181
+ }
182
+ return { generateMetadata: generateMetadata, generateStaticParams: generateStaticParams, renderPage: renderPage };
183
+ }
@@ -1,5 +0,0 @@
1
- export interface BlogProps {
2
- content: any;
3
- config: any;
4
- }
5
- export declare function Blog({ content }: BlogProps): import("react").JSX.Element;
@@ -1,16 +0,0 @@
1
- 'use client';
2
- import styles from './Blog.module.css';
3
- import { Markdown } from './Markdown';
4
- export function Blog(_a) {
5
- var _b, _c;
6
- var content = _a.content;
7
- return (<div className={styles.blog}>
8
- <div className={styles.main}>
9
- <div className={styles.content}>
10
- <h1>{(_b = content === null || content === void 0 ? void 0 : content.meta) === null || _b === void 0 ? void 0 : _b.title}</h1>
11
- <p className={styles.description}>{(_c = content === null || content === void 0 ? void 0 : content.meta) === null || _c === void 0 ? void 0 : _c.description}</p>
12
- <Markdown content={content}/>
13
- </div>
14
- </div>
15
- </div>);
16
- }
@@ -1 +0,0 @@
1
- export declare function CodeBlock(props: any): import("react").JSX.Element;
@@ -1,23 +0,0 @@
1
- import { useState, useRef } from 'react';
2
- import { Icon, Icons } from '@umami/react-zen';
3
- import styles from './CodeBlock.module.css';
4
- export function CodeBlock(props) {
5
- var textInput = useRef(null);
6
- var _a = useState(false), copied = _a[0], setCopied = _a[1];
7
- var handleCopy = function () {
8
- var _a, _b;
9
- setCopied(true);
10
- (_a = navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText((_b = textInput === null || textInput === void 0 ? void 0 : textInput.current) === null || _b === void 0 ? void 0 : _b.textContent);
11
- setTimeout(function () {
12
- setCopied(false);
13
- }, 1000);
14
- };
15
- return (<pre ref={textInput} className={styles.container}>
16
- {props.children}
17
- <button aria-label="Copy code" className={styles.button} onClick={handleCopy}>
18
- <Icon size="sm" className={copied ? styles.check : styles.copy}>
19
- {copied ? <Icons.Check /> : <Icons.Copy />}
20
- </Icon>
21
- </button>
22
- </pre>);
23
- }
@@ -1,6 +0,0 @@
1
- export interface ContentAreaProps {
2
- content: {
3
- [key: string]: any;
4
- };
5
- }
6
- export declare function ContentArea({ content }: ContentAreaProps): import("react").JSX.Element;
@@ -1,19 +0,0 @@
1
- import { Heading, Box, Text } from '@umami/react-zen';
2
- import { Markdown } from './Markdown';
3
- import styles from './ContentArea.module.css';
4
- export function ContentArea(_a) {
5
- var _b, _c;
6
- var content = _a.content;
7
- return (<Box flexGrow={1}>
8
- <Text color="primary" weight="bold">
9
- {content.group}
10
- </Text>
11
- <Heading size="8" as="h1">
12
- {(_b = content === null || content === void 0 ? void 0 : content.meta) === null || _b === void 0 ? void 0 : _b.title}
13
- </Heading>
14
- <Text color="muted">{(_c = content === null || content === void 0 ? void 0 : content.meta) === null || _c === void 0 ? void 0 : _c.description}</Text>
15
- <Box className={styles.content}>
16
- <Markdown content={content}/>
17
- </Box>
18
- </Box>);
19
- }
@@ -1 +0,0 @@
1
- export declare function Docs(): import("react").JSX.Element;
@@ -1,33 +0,0 @@
1
- 'use client';
2
- import { Grid, Box, Heading } from '@umami/react-zen';
3
- import { useShiso } from './hooks/useShiso';
4
- import { PageLinks } from './PageLinks';
5
- import { SideNav } from './SideNav';
6
- import { TopNav } from './TopNav';
7
- import { ContentArea } from './ContentArea';
8
- export function Docs() {
9
- var _a = useShiso(), content = _a.content, config = _a.config;
10
- if (!content) {
11
- return <Heading size="6">Page not found</Heading>;
12
- }
13
- var _b = (config === null || config === void 0 ? void 0 : config.docs) || {}, tabs = _b.tabs, navigation = _b.navigation;
14
- content.group = Object.keys(navigation).reduce(function (name, key) {
15
- var _a, _b;
16
- if (!name) {
17
- return (_b = (_a = navigation[key]) === null || _a === void 0 ? void 0 : _a.find(function (section) {
18
- return section.pages.find(function (page) {
19
- return page.url === "/docs/".concat(content.id) || (page.url === "/docs" && content.id === 'index');
20
- });
21
- })) === null || _b === void 0 ? void 0 : _b.group;
22
- }
23
- return name;
24
- }, null);
25
- return (<Box flexGrow="1">
26
- {tabs && <TopNav tabs={tabs}/>}
27
- <Grid gap="6" columns="240px 1fr 240px">
28
- <SideNav tabs={tabs} navigation={navigation}/>
29
- <ContentArea content={content}/>
30
- <PageLinks items={content === null || content === void 0 ? void 0 : content.anchors} offset={150}/>
31
- </Grid>
32
- </Box>);
33
- }
@@ -1,3 +0,0 @@
1
- export declare function Markdown({ content }: {
2
- content: any;
3
- }): import("react").JSX.Element | null;
@@ -1,35 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { runSync } from '@mdx-js/mdx';
13
- import { useMDXComponents } from '@mdx-js/react';
14
- import * as runtime from 'react/jsx-runtime';
15
- var parseMdx = function (code) {
16
- try {
17
- var result = runSync(code, __assign(__assign({}, runtime), { baseUrl: import.meta.url }));
18
- return { Component: result.default };
19
- }
20
- catch (err) {
21
- return { error: err.message };
22
- }
23
- };
24
- export function Markdown(_a) {
25
- var content = _a.content;
26
- var components = useMDXComponents();
27
- var _b = parseMdx(content.code), Component = _b.Component, error = _b.error;
28
- if (error) {
29
- return <h1>Error rendering MDX: {error}</h1>;
30
- }
31
- if (!Component) {
32
- return null;
33
- }
34
- return <Component components={components}/>;
35
- }
@@ -1,4 +0,0 @@
1
- export declare function PageLinks({ items, offset }: {
2
- items: any;
3
- offset?: number | undefined;
4
- }): import("react").JSX.Element | null;
@@ -1,51 +0,0 @@
1
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
- if (ar || !(i in from)) {
4
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
- ar[i] = from[i];
6
- }
7
- }
8
- return to.concat(ar || Array.prototype.slice.call(from));
9
- };
10
- import { useEffect, useState } from 'react';
11
- import { Column, Text } from '@umami/react-zen';
12
- import classNames from 'classnames';
13
- import styles from './PageLinks.module.css';
14
- export function PageLinks(_a) {
15
- var _b;
16
- var items = _a.items, _c = _a.offset, offset = _c === void 0 ? 0 : _c;
17
- var _d = useState((_b = items === null || items === void 0 ? void 0 : items[0]) === null || _b === void 0 ? void 0 : _b.id), hash = _d[0], setHash = _d[1];
18
- useEffect(function () {
19
- var callback = function () {
20
- var x = __spreadArray([], items, true).reverse().find(function (_a) {
21
- var _b;
22
- var id = _a.id;
23
- var rect = (_b = document.getElementById(id)) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
24
- return rect && rect.top <= offset;
25
- });
26
- if (x)
27
- setHash(x.id);
28
- };
29
- window.addEventListener('scroll', callback, false);
30
- return function () {
31
- window.removeEventListener('scroll', callback, false);
32
- };
33
- }, []);
34
- if (!(items === null || items === void 0 ? void 0 : items.length)) {
35
- return null;
36
- }
37
- return (<Column gap="3" minWidth="240px" className={styles.links}>
38
- <Text size="2" weight="bold">
39
- On this page
40
- </Text>
41
- {items.map(function (_a) {
42
- var _b;
43
- var name = _a.name, id = _a.id, size = _a.size;
44
- return (<a key={id} href={"#".concat(id)} className={classNames(styles.link, styles["indent-".concat(size)], (_b = {},
45
- _b[styles.selected] = hash === id,
46
- _b))}>
47
- {name}
48
- </a>);
49
- })}
50
- </Column>);
51
- }
@@ -1,19 +0,0 @@
1
- import { JSX } from 'react';
2
- import type { ShisoConfig } from '@/lib/types';
3
- export interface ShisoProps {
4
- content: any;
5
- type: string;
6
- config: ShisoConfig;
7
- components?: {
8
- [key: string]: any;
9
- };
10
- templates?: {
11
- [key: string]: any;
12
- };
13
- }
14
- export type ShisoTemplateComponent = ({ content, config, }: {
15
- content: any;
16
- config: ShisoConfig;
17
- }) => JSX.Element;
18
- export declare const ShisoContext: import("react").Context<any>;
19
- export declare function Shiso({ content, type, config, components, templates }: ShisoProps): JSX.Element;
@@ -1,34 +0,0 @@
1
- 'use client';
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- import { createContext } from 'react';
14
- import { MDXProvider } from '@mdx-js/react';
15
- import { CodeBlock } from '@/components/CodeBlock';
16
- import { Docs } from '@/components/Docs';
17
- import { Blog } from '@/components/Blog';
18
- var defaultTemplates = {
19
- docs: Docs,
20
- blog: Blog,
21
- };
22
- export var ShisoContext = createContext(null);
23
- export function Shiso(_a) {
24
- var content = _a.content, type = _a.type, config = _a.config, components = _a.components, templates = _a.templates;
25
- var Component = __assign(__assign({}, defaultTemplates), templates)[type];
26
- if (!Component) {
27
- return <h1>{"Component not found for type: ".concat(type)}</h1>;
28
- }
29
- return (<ShisoContext.Provider value={{ content: content, type: type, config: config }}>
30
- <MDXProvider components={__assign(__assign({}, components), { pre: CodeBlock })}>
31
- <Component content={content} config={config}/>
32
- </MDXProvider>
33
- </ShisoContext.Provider>);
34
- }
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- export interface SideNavProps {
3
- tabs: any;
4
- navigation: any;
5
- }
6
- export declare function SideNav({ tabs, navigation }: SideNavProps): React.JSX.Element;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { Box, List, ListItem, ListSection } from '@umami/react-zen';
3
- import classNames from 'classnames';
4
- import { usePathname } from 'next/navigation';
5
- import Link from 'next/link';
6
- import styles from './SideNav.module.css';
7
- export function SideNav(_a) {
8
- var tabs = _a.tabs, navigation = _a.navigation;
9
- var pathname = usePathname();
10
- var tab = tabs === null || tabs === void 0 ? void 0 : tabs.find(function (_a) {
11
- var url = _a.url, id = _a.id;
12
- return (id !== 'docs' ? pathname.startsWith(url) : false);
13
- });
14
- var menu = navigation[(tab === null || tab === void 0 ? void 0 : tab.id) || 'docs'];
15
- return (<Box className={styles.nav}>
16
- <List items={navigation} aria-label="nav">
17
- {menu.map(function (_a) {
18
- var group = _a.group, pages = _a.pages;
19
- return (<ListSection title={group} key={group} className={styles.items}>
20
- {pages.map(function (_a, index) {
21
- var _b;
22
- var text = _a.label, url = _a.url;
23
- return (<ListItem key={index} className={classNames(styles.item, (_b = {},
24
- _b[styles.selected] = url === pathname,
25
- _b))}>
26
- <Link href={url} prefetch={false}>
27
- {text}
28
- </Link>
29
- </ListItem>);
30
- })}
31
- </ListSection>);
32
- })}
33
- </List>
34
- </Box>);
35
- }
@@ -1,3 +0,0 @@
1
- export declare function TopNav({ tabs }: {
2
- tabs: any;
3
- }): import("react").JSX.Element;
@@ -1,22 +0,0 @@
1
- import Link from 'next/link';
2
- import { usePathname } from 'next/navigation';
3
- import { Tabs, TabList, Tab } from '@umami/react-zen';
4
- export function TopNav(_a) {
5
- var tabs = _a.tabs;
6
- var pathname = usePathname();
7
- var tab = tabs === null || tabs === void 0 ? void 0 : tabs.find(function (_a) {
8
- var id = _a.id, url = _a.url;
9
- return (id !== 'docs' ? pathname.startsWith(url) : false);
10
- });
11
- var selected = (tab === null || tab === void 0 ? void 0 : tab.id) || 'docs';
12
- return (<Tabs selectedKey={selected}>
13
- <TabList items={tabs}>
14
- {function (_a) {
15
- var id = _a.id, label = _a.label, url = _a.url;
16
- return (<Tab id={id}>
17
- <Link href={url}>{label}</Link>
18
- </Tab>);
19
- }}
20
- </TabList>
21
- </Tabs>);
22
- }
@@ -1,4 +0,0 @@
1
- export declare function useShiso(): {
2
- content: any;
3
- config: any;
4
- };
@@ -1,6 +0,0 @@
1
- import { useContext } from 'react';
2
- import { ShisoContext } from '../Shiso';
3
- export function useShiso() {
4
- var _a = useContext(ShisoContext), content = _a.content, config = _a.config;
5
- return { content: content, config: config };
6
- }
@@ -1,5 +0,0 @@
1
- import '@umami/react-zen/styles.css';
2
- import { Blog } from './Blog';
3
- import { Docs } from './Docs';
4
- import { Shiso } from './Shiso';
5
- export { Blog, Docs, Shiso };
@@ -1,6 +0,0 @@
1
- 'use client';
2
- import '@umami/react-zen/styles.css';
3
- import { Blog } from './Blog';
4
- import { Docs } from './Docs';
5
- import { Shiso } from './Shiso';
6
- export { Blog, Docs, Shiso };
@@ -1,14 +0,0 @@
1
- export interface ShisoDocsConfig {
2
- tabs?: [];
3
- }
4
- export interface ShisoBlogConfig {
5
- }
6
- export interface ShisoConfig {
7
- contentDir: string;
8
- docs?: {
9
- [key: string]: any;
10
- };
11
- blog?: {
12
- [key: string]: any;
13
- };
14
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- import { ReactElement } from 'react';
2
- import type { ShisoConfig } from '@/lib/types';
3
- export declare const getContent: (name: string | undefined, folder: string) => Promise<any>;
4
- export declare const getContentIds: (folder: string) => Promise<any>;
5
- export declare function next(type: string, config: ShisoConfig): {
6
- generateMetadata: ({ params }: {
7
- params: Promise<{
8
- id: string[];
9
- }>;
10
- }) => Promise<{
11
- title: {
12
- absolute: string;
13
- default: string;
14
- };
15
- }>;
16
- generateStaticParams: () => Promise<any>;
17
- renderPage: (render: ({ type, content, config, }: {
18
- type: string;
19
- content: any;
20
- config: ShisoConfig;
21
- }) => ReactElement) => ({ params }: {
22
- params: Promise<{
23
- id: string[];
24
- }>;
25
- }) => Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
26
- };
File without changes