@umami/shiso 0.45.0 → 0.47.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 +45 -45
- package/dist/index.d.ts +56 -56
- package/dist/index.js +13 -9
- package/dist/index.mjs +13 -9
- package/package.json +1 -1
- package/server/index.d.ts +30 -30
- package/server/index.js +1 -1
- package/styles.css +45 -45
- package/dist/server.d.ts +0 -45
- package/dist/server.js +0 -159
package/dist/index.css
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
/* virtual-css:css:
|
|
2
|
-
.
|
|
1
|
+
/* virtual-css:css:e01d9571088b882a03b91eb2755da783 */
|
|
2
|
+
.PageLinks_links__NmJhO {
|
|
3
3
|
position: sticky;
|
|
4
4
|
top: var(--spacing-8);
|
|
5
5
|
height: max-content;
|
|
6
6
|
min-width: 240px;
|
|
7
7
|
}
|
|
8
|
-
.
|
|
8
|
+
.PageLinks_links__NmJhO a.PageLinks_link__OGI3M {
|
|
9
9
|
display: block;
|
|
10
10
|
color: var(--font-color-muted);
|
|
11
11
|
font-size: var(--font-size);
|
|
12
12
|
text-decoration: none;
|
|
13
13
|
}
|
|
14
|
-
.
|
|
14
|
+
.PageLinks_links__NmJhO a.PageLinks_link__OGI3M:hover {
|
|
15
15
|
color: var(--primary-color);
|
|
16
16
|
text-decoration: none;
|
|
17
17
|
}
|
|
18
|
-
.PageLinks_indent-
|
|
18
|
+
.PageLinks_indent-1__M2IxZ {
|
|
19
19
|
margin-left: 0;
|
|
20
20
|
}
|
|
21
|
-
.PageLinks_indent-
|
|
21
|
+
.PageLinks_indent-2__YTBlM {
|
|
22
22
|
margin-left: 0;
|
|
23
23
|
}
|
|
24
|
-
.PageLinks_indent-
|
|
24
|
+
.PageLinks_indent-3__YzJlZ {
|
|
25
25
|
margin-left: 10px;
|
|
26
26
|
}
|
|
27
|
-
.PageLinks_indent-
|
|
27
|
+
.PageLinks_indent-4__NDg3Z {
|
|
28
28
|
margin-left: 20px;
|
|
29
29
|
}
|
|
30
|
-
.PageLinks_indent-
|
|
30
|
+
.PageLinks_indent-5__ZTE4M {
|
|
31
31
|
margin-left: 30px;
|
|
32
32
|
}
|
|
33
|
-
.PageLinks_indent-
|
|
33
|
+
.PageLinks_indent-6__NTRjM {
|
|
34
34
|
margin-left: 40px;
|
|
35
35
|
}
|
|
36
|
-
.
|
|
36
|
+
.PageLinks_links__NmJhO a.PageLinks_selected__ZjhkN {
|
|
37
37
|
color: var(--primary-color);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
/* virtual-css:css:
|
|
41
|
-
.
|
|
40
|
+
/* virtual-css:css:2dd9c1a25bf05a14c9a7ab7ce1da6aef */
|
|
41
|
+
.CodeBlock_container__NjNhN {
|
|
42
42
|
position: relative;
|
|
43
43
|
background: var(--base-color-12);
|
|
44
44
|
padding: var(--spacing-5);
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
white-space: pre-wrap;
|
|
47
47
|
word-wrap: break-word;
|
|
48
48
|
}
|
|
49
|
-
pre.
|
|
49
|
+
pre.CodeBlock_container__NjNhN code {
|
|
50
50
|
font-family: var(--font-family-code);
|
|
51
51
|
color: var(--base-color-4);
|
|
52
52
|
padding: 0;
|
|
53
53
|
border: 0;
|
|
54
54
|
background: transparent;
|
|
55
55
|
}
|
|
56
|
-
.
|
|
56
|
+
.CodeBlock_button__YzMzM {
|
|
57
57
|
border: 0;
|
|
58
58
|
position: absolute;
|
|
59
59
|
right: var(--spacing-5);
|
|
@@ -61,123 +61,123 @@ pre.CodeBlock_container__MWNjM code {
|
|
|
61
61
|
cursor: pointer;
|
|
62
62
|
background: transparent;
|
|
63
63
|
}
|
|
64
|
-
.
|
|
64
|
+
.CodeBlock_copy__MjRhM {
|
|
65
65
|
color: var(--base-color-4);
|
|
66
66
|
}
|
|
67
|
-
.
|
|
67
|
+
.CodeBlock_copy__MjRhM:hover {
|
|
68
68
|
color: var(--base-color-1);
|
|
69
69
|
}
|
|
70
|
-
.
|
|
70
|
+
.CodeBlock_check__YTc2M {
|
|
71
71
|
color: var(--success-color);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
/* virtual-css:css:
|
|
75
|
-
.
|
|
74
|
+
/* virtual-css:css:62c31e195181c97259fa56b13d20ea6d */
|
|
75
|
+
.SideNav_nav__NTkxM {
|
|
76
76
|
overflow-y: auto;
|
|
77
77
|
min-width: 240px;
|
|
78
78
|
}
|
|
79
|
-
.
|
|
79
|
+
.SideNav_nav__NTkxM::-webkit-scrollbar {
|
|
80
80
|
width: 15px;
|
|
81
81
|
background: transparent;
|
|
82
82
|
display: none;
|
|
83
83
|
}
|
|
84
|
-
.
|
|
84
|
+
.SideNav_nav__NTkxM:hover::-webkit-scrollbar {
|
|
85
85
|
display: block;
|
|
86
86
|
}
|
|
87
|
-
.
|
|
87
|
+
.SideNav_nav__NTkxM::-webkit-scrollbar-track {
|
|
88
88
|
border: 7px solid rgba(0, 0, 0, 0);
|
|
89
89
|
background-color: var(--border-color);
|
|
90
90
|
background-clip: padding-box;
|
|
91
91
|
}
|
|
92
|
-
.
|
|
92
|
+
.SideNav_nav__NTkxM::-webkit-scrollbar-thumb {
|
|
93
93
|
border: 7px solid rgba(0, 0, 0, 0);
|
|
94
94
|
background-color: var(--primary-color);
|
|
95
95
|
background-clip: padding-box;
|
|
96
96
|
}
|
|
97
|
-
.
|
|
97
|
+
.SideNav_nav__NTkxM::-webkit-scrollbar-thumb:hover {
|
|
98
98
|
border: 5px solid rgba(0, 0, 0, 0);
|
|
99
99
|
background-color: var(--primary-color);
|
|
100
100
|
background-clip: padding-box;
|
|
101
101
|
}
|
|
102
|
-
.
|
|
102
|
+
.SideNav_nav__NTkxM.SideNav_sticky__YTdmY {
|
|
103
103
|
position: sticky;
|
|
104
104
|
top: var(--spacing-8);
|
|
105
105
|
}
|
|
106
|
-
.
|
|
106
|
+
.SideNav_nav__NTkxM .SideNav_item__MDk5Z {
|
|
107
107
|
color: var(--font-color-muted);
|
|
108
108
|
border-left: 1px solid var(--border-color);
|
|
109
109
|
padding: var(--padding);
|
|
110
110
|
text-decoration: none;
|
|
111
111
|
}
|
|
112
|
-
.
|
|
112
|
+
.SideNav_nav__NTkxM .SideNav_item__MDk5Z:hover {
|
|
113
113
|
color: var(--primary-color);
|
|
114
114
|
}
|
|
115
|
-
.
|
|
115
|
+
.SideNav_nav__NTkxM .SideNav_item__MDk5Z.SideNav_selected__ZjVkZ {
|
|
116
116
|
color: var(--font-color);
|
|
117
117
|
font-weight: 500;
|
|
118
118
|
border-color: var(--primary-color);
|
|
119
119
|
background-color: var(--highlight-color);
|
|
120
120
|
}
|
|
121
|
-
.
|
|
121
|
+
.SideNav_header__Y2YyY {
|
|
122
122
|
padding: var(--padding-y) 0;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
/* virtual-css:css:
|
|
126
|
-
.
|
|
125
|
+
/* virtual-css:css:4d0931c84adfae5533b067ea199724f8 */
|
|
126
|
+
.Markdown_content__YzRmN {
|
|
127
127
|
font-size: 16px;
|
|
128
128
|
margin-bottom: 60px;
|
|
129
129
|
}
|
|
130
|
-
.
|
|
130
|
+
.Markdown_content__YzRmN > p {
|
|
131
131
|
color: var(--font-color);
|
|
132
132
|
line-height: 1.8;
|
|
133
133
|
}
|
|
134
|
-
.
|
|
134
|
+
.Markdown_content__YzRmN a {
|
|
135
135
|
color: var(--font-color);
|
|
136
136
|
font-weight: 600;
|
|
137
137
|
text-decoration: underline var(--border-color);
|
|
138
138
|
text-underline-offset: 4px;
|
|
139
139
|
}
|
|
140
|
-
.
|
|
140
|
+
.Markdown_content__YzRmN a:hover {
|
|
141
141
|
color: var(--font-color);
|
|
142
142
|
text-decoration: underline var(--primary-color);
|
|
143
143
|
}
|
|
144
|
-
.
|
|
144
|
+
.Markdown_content__YzRmN img {
|
|
145
145
|
display: block;
|
|
146
146
|
max-width: 100%;
|
|
147
147
|
margin: 4rem auto;
|
|
148
148
|
box-shadow: 2px 2px 16px rgba(0, 0, 0, .1);
|
|
149
149
|
}
|
|
150
|
-
.
|
|
150
|
+
.Markdown_content__YzRmN h1 {
|
|
151
151
|
font-size: var(--font-size-8);
|
|
152
152
|
letter-spacing: var(--letter-spacing-1);
|
|
153
153
|
margin: 0 0 var(--spacing-4) 0;
|
|
154
154
|
}
|
|
155
|
-
.
|
|
155
|
+
.Markdown_content__YzRmN h2 {
|
|
156
156
|
font-size: var(--font-size-6);
|
|
157
157
|
letter-spacing: var(--letter-spacing-1);
|
|
158
158
|
margin: var(--spacing-8) 0 var(--spacing-4) 0;
|
|
159
159
|
}
|
|
160
|
-
.
|
|
160
|
+
.Markdown_content__YzRmN h3 {
|
|
161
161
|
font-size: var(--font-size-5);
|
|
162
162
|
letter-spacing: var(--letter-spacing-1);
|
|
163
163
|
margin: var(--spacing-7) 0 var(--spacing-4) 0;
|
|
164
164
|
}
|
|
165
|
-
.
|
|
165
|
+
.Markdown_content__YzRmN *[id] {
|
|
166
166
|
scroll-margin-top: var(--spacing-4);
|
|
167
167
|
}
|
|
168
|
-
.
|
|
168
|
+
.Markdown_content__YzRmN ul {
|
|
169
169
|
list-style: disc;
|
|
170
170
|
}
|
|
171
|
-
.
|
|
171
|
+
.Markdown_content__YzRmN ol {
|
|
172
172
|
list-style: decimal;
|
|
173
173
|
}
|
|
174
|
-
.
|
|
174
|
+
.Markdown_content__YzRmN pre {
|
|
175
175
|
margin: var(--spacing-5) 0;
|
|
176
176
|
}
|
|
177
|
-
.
|
|
177
|
+
.Markdown_content__YzRmN code {
|
|
178
178
|
font-size: 14px;
|
|
179
179
|
}
|
|
180
|
-
.
|
|
180
|
+
.Markdown_content__YzRmN code:not([class]) {
|
|
181
181
|
font-family: var(--font-family-code);
|
|
182
182
|
color: var(--font-color);
|
|
183
183
|
padding: var(--spacing-1);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
// Generated by dts-bundle v0.7.3
|
|
2
|
-
// Dependencies for this module:
|
|
3
|
-
// ../../react
|
|
4
|
-
// ../../@/lib/types
|
|
5
|
-
|
|
6
|
-
declare module '@umami/shiso' {
|
|
7
|
-
import '@umami/react-zen/styles.css';
|
|
8
|
-
import 'highlight.js/styles/github-dark.css';
|
|
9
|
-
import { Blog } from '@umami/shiso/Blog';
|
|
10
|
-
import { Docs } from '@umami/shiso/Docs';
|
|
11
|
-
import { Shiso } from '@umami/shiso/Shiso';
|
|
12
|
-
export { Blog, Docs, Shiso };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
declare module '@umami/shiso/Blog' {
|
|
16
|
-
export interface BlogProps {
|
|
17
|
-
title: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
code: string;
|
|
20
|
-
author?: string;
|
|
21
|
-
date?: string;
|
|
22
|
-
image?: string;
|
|
23
|
-
anchors?: any[];
|
|
24
|
-
}
|
|
25
|
-
export function Blog({ title, code, author, date, image, anchors }: BlogProps): import("react").JSX.Element;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
declare module '@umami/shiso/Docs' {
|
|
29
|
-
export function Docs({ content, config }: {
|
|
30
|
-
content: any;
|
|
31
|
-
config: any;
|
|
32
|
-
}): import("react").JSX.Element;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
declare module '@umami/shiso/Shiso' {
|
|
36
|
-
import { JSX } from 'react';
|
|
37
|
-
import type { ShisoConfig, ShisoContent } from '@/lib/types';
|
|
38
|
-
export interface ShisoProps {
|
|
39
|
-
type: string;
|
|
40
|
-
config: ShisoConfig;
|
|
41
|
-
content: ShisoContent;
|
|
42
|
-
components?: {
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
};
|
|
45
|
-
templates?: {
|
|
46
|
-
[key: string]: any;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
export type ShisoTemplateComponent = ({ content, config, }: {
|
|
50
|
-
content: any;
|
|
51
|
-
config: ShisoConfig;
|
|
52
|
-
}) => JSX.Element;
|
|
53
|
-
export const ShisoContext: import("react").Context<any>;
|
|
54
|
-
export function Shiso({ type, config, content, components, templates }: ShisoProps): JSX.Element;
|
|
55
|
-
}
|
|
56
|
-
|
|
1
|
+
// Generated by dts-bundle v0.7.3
|
|
2
|
+
// Dependencies for this module:
|
|
3
|
+
// ../../react
|
|
4
|
+
// ../../@/lib/types
|
|
5
|
+
|
|
6
|
+
declare module '@umami/shiso' {
|
|
7
|
+
import '@umami/react-zen/styles.css';
|
|
8
|
+
import 'highlight.js/styles/github-dark.css';
|
|
9
|
+
import { Blog } from '@umami/shiso/Blog';
|
|
10
|
+
import { Docs } from '@umami/shiso/Docs';
|
|
11
|
+
import { Shiso } from '@umami/shiso/Shiso';
|
|
12
|
+
export { Blog, Docs, Shiso };
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare module '@umami/shiso/Blog' {
|
|
16
|
+
export interface BlogProps {
|
|
17
|
+
title: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
code: string;
|
|
20
|
+
author?: string;
|
|
21
|
+
date?: string;
|
|
22
|
+
image?: string;
|
|
23
|
+
anchors?: any[];
|
|
24
|
+
}
|
|
25
|
+
export function Blog({ title, code, author, date, image, anchors }: BlogProps): import("react").JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare module '@umami/shiso/Docs' {
|
|
29
|
+
export function Docs({ content, config }: {
|
|
30
|
+
content: any;
|
|
31
|
+
config: any;
|
|
32
|
+
}): import("react").JSX.Element;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare module '@umami/shiso/Shiso' {
|
|
36
|
+
import { JSX } from 'react';
|
|
37
|
+
import type { ShisoConfig, ShisoContent } from '@/lib/types';
|
|
38
|
+
export interface ShisoProps {
|
|
39
|
+
type: string;
|
|
40
|
+
config: ShisoConfig;
|
|
41
|
+
content: ShisoContent;
|
|
42
|
+
components?: {
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
templates?: {
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export type ShisoTemplateComponent = ({ content, config, }: {
|
|
50
|
+
content: any;
|
|
51
|
+
config: ShisoConfig;
|
|
52
|
+
}) => JSX.Element;
|
|
53
|
+
export const ShisoContext: import("react").Context<any>;
|
|
54
|
+
export function Shiso({ type, config, content, components, templates }: ShisoProps): JSX.Element;
|
|
55
|
+
}
|
|
56
|
+
|
package/dist/index.js
CHANGED
|
@@ -46,8 +46,8 @@ var import_react = require("react");
|
|
|
46
46
|
var import_react_zen = require("@umami/react-zen");
|
|
47
47
|
var import_classnames = __toESM(require("classnames"));
|
|
48
48
|
|
|
49
|
-
// css-modules
|
|
50
|
-
var PageLinks_default = { "links": "
|
|
49
|
+
// css-modules:E:\dev\umami-shiso\src\components\PageLinks.module.css
|
|
50
|
+
var PageLinks_default = { "links": "PageLinks_links__NmJhO", "link": "PageLinks_link__OGI3M", "indent-1": "PageLinks_indent-1__M2IxZ", "indent-2": "PageLinks_indent-2__YTBlM", "indent-3": "PageLinks_indent-3__YzJlZ", "indent-4": "PageLinks_indent-4__NDg3Z", "indent-5": "PageLinks_indent-5__ZTE4M", "indent-6": "PageLinks_indent-6__NTRjM", "selected": "PageLinks_selected__ZjhkN" };
|
|
51
51
|
|
|
52
52
|
// src/components/PageLinks.tsx
|
|
53
53
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -99,8 +99,8 @@ var import_react_zen10 = require("@umami/react-zen");
|
|
|
99
99
|
var import_react2 = require("react");
|
|
100
100
|
var import_react_zen2 = require("@umami/react-zen");
|
|
101
101
|
|
|
102
|
-
// css-modules
|
|
103
|
-
var CodeBlock_default = { "container": "
|
|
102
|
+
// css-modules:E:\dev\umami-shiso\src\components\CodeBlock.module.css
|
|
103
|
+
var CodeBlock_default = { "container": "CodeBlock_container__NjNhN", "button": "CodeBlock_button__YzMzM", "copy": "CodeBlock_copy__MjRhM", "check": "CodeBlock_check__YTc2M" };
|
|
104
104
|
|
|
105
105
|
// src/components/CodeBlock.tsx
|
|
106
106
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -130,8 +130,8 @@ var import_classnames2 = __toESM(require("classnames"));
|
|
|
130
130
|
var import_navigation = require("next/navigation");
|
|
131
131
|
var import_link = __toESM(require("next/link"));
|
|
132
132
|
|
|
133
|
-
// css-modules
|
|
134
|
-
var SideNav_default = { "nav": "
|
|
133
|
+
// css-modules:E:\dev\umami-shiso\src\components\SideNav.module.css
|
|
134
|
+
var SideNav_default = { "nav": "SideNav_nav__NTkxM", "sticky": "SideNav_sticky__YTdmY", "item": "SideNav_item__MDk5Z", "selected": "SideNav_selected__ZjVkZ", "header": "SideNav_header__Y2YyY" };
|
|
135
135
|
|
|
136
136
|
// src/components/SideNav.tsx
|
|
137
137
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -209,8 +209,8 @@ var import_mdx = require("@mdx-js/mdx");
|
|
|
209
209
|
var import_react4 = require("@mdx-js/react");
|
|
210
210
|
var runtime = __toESM(require("react/jsx-runtime"));
|
|
211
211
|
|
|
212
|
-
// css-modules
|
|
213
|
-
var Markdown_default = { "content": "
|
|
212
|
+
// css-modules:E:\dev\umami-shiso\src\components\Markdown.module.css
|
|
213
|
+
var Markdown_default = { "content": "Markdown_content__YzRmN" };
|
|
214
214
|
|
|
215
215
|
// src/components/Markdown.tsx
|
|
216
216
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
@@ -415,13 +415,17 @@ var defaultTemplates = {
|
|
|
415
415
|
docs: Docs,
|
|
416
416
|
blog: Blogs
|
|
417
417
|
};
|
|
418
|
+
var shisoComponents = {
|
|
419
|
+
pre: CodeBlock,
|
|
420
|
+
code: import_react_zen10.Code
|
|
421
|
+
};
|
|
418
422
|
var ShisoContext = (0, import_react5.createContext)(null);
|
|
419
423
|
function Shiso({ type, config, content, components, templates }) {
|
|
420
424
|
const Component = { ...defaultTemplates, ...templates }[type];
|
|
421
425
|
if (!Component) {
|
|
422
426
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("h1", { children: `Component not found for type: ${type}` });
|
|
423
427
|
}
|
|
424
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ShisoContext.Provider, { value: { type, config, content, components, templates }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react6.MDXProvider, { components: {
|
|
428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ShisoContext.Provider, { value: { type, config, content, components, templates }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react6.MDXProvider, { components: { ...shisoComponents, ...components }, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, { config, content }) }) });
|
|
425
429
|
}
|
|
426
430
|
|
|
427
431
|
// src/components/hooks/useShiso.ts
|
package/dist/index.mjs
CHANGED
|
@@ -9,8 +9,8 @@ import { useEffect, useState } from "react";
|
|
|
9
9
|
import { Column, Text, Box } from "@umami/react-zen";
|
|
10
10
|
import classNames from "classnames";
|
|
11
11
|
|
|
12
|
-
// css-modules
|
|
13
|
-
var PageLinks_default = { "links": "
|
|
12
|
+
// css-modules:E:\dev\umami-shiso\src\components\PageLinks.module.css
|
|
13
|
+
var PageLinks_default = { "links": "PageLinks_links__NmJhO", "link": "PageLinks_link__OGI3M", "indent-1": "PageLinks_indent-1__M2IxZ", "indent-2": "PageLinks_indent-2__YTBlM", "indent-3": "PageLinks_indent-3__YzJlZ", "indent-4": "PageLinks_indent-4__NDg3Z", "indent-5": "PageLinks_indent-5__ZTE4M", "indent-6": "PageLinks_indent-6__NTRjM", "selected": "PageLinks_selected__ZjhkN" };
|
|
14
14
|
|
|
15
15
|
// src/components/PageLinks.tsx
|
|
16
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -62,8 +62,8 @@ import { Code } from "@umami/react-zen";
|
|
|
62
62
|
import { useState as useState2, useRef } from "react";
|
|
63
63
|
import { Icon, Icons } from "@umami/react-zen";
|
|
64
64
|
|
|
65
|
-
// css-modules
|
|
66
|
-
var CodeBlock_default = { "container": "
|
|
65
|
+
// css-modules:E:\dev\umami-shiso\src\components\CodeBlock.module.css
|
|
66
|
+
var CodeBlock_default = { "container": "CodeBlock_container__NjNhN", "button": "CodeBlock_button__YzMzM", "copy": "CodeBlock_copy__MjRhM", "check": "CodeBlock_check__YTc2M" };
|
|
67
67
|
|
|
68
68
|
// src/components/CodeBlock.tsx
|
|
69
69
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -104,8 +104,8 @@ import classNames2 from "classnames";
|
|
|
104
104
|
import { usePathname } from "next/navigation";
|
|
105
105
|
import Link from "next/link";
|
|
106
106
|
|
|
107
|
-
// css-modules
|
|
108
|
-
var SideNav_default = { "nav": "
|
|
107
|
+
// css-modules:E:\dev\umami-shiso\src\components\SideNav.module.css
|
|
108
|
+
var SideNav_default = { "nav": "SideNav_nav__NTkxM", "sticky": "SideNav_sticky__YTdmY", "item": "SideNav_item__MDk5Z", "selected": "SideNav_selected__ZjVkZ", "header": "SideNav_header__Y2YyY" };
|
|
109
109
|
|
|
110
110
|
// src/components/SideNav.tsx
|
|
111
111
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
@@ -183,8 +183,8 @@ import { runSync } from "@mdx-js/mdx";
|
|
|
183
183
|
import { useMDXComponents } from "@mdx-js/react";
|
|
184
184
|
import * as runtime from "react/jsx-runtime";
|
|
185
185
|
|
|
186
|
-
// css-modules
|
|
187
|
-
var Markdown_default = { "content": "
|
|
186
|
+
// css-modules:E:\dev\umami-shiso\src\components\Markdown.module.css
|
|
187
|
+
var Markdown_default = { "content": "Markdown_content__YzRmN" };
|
|
188
188
|
|
|
189
189
|
// src/components/Markdown.tsx
|
|
190
190
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -388,13 +388,17 @@ var defaultTemplates = {
|
|
|
388
388
|
docs: Docs,
|
|
389
389
|
blog: Blogs
|
|
390
390
|
};
|
|
391
|
+
var shisoComponents = {
|
|
392
|
+
pre: CodeBlock,
|
|
393
|
+
code: Code
|
|
394
|
+
};
|
|
391
395
|
var ShisoContext = createContext(null);
|
|
392
396
|
function Shiso({ type, config, content, components, templates }) {
|
|
393
397
|
const Component = { ...defaultTemplates, ...templates }[type];
|
|
394
398
|
if (!Component) {
|
|
395
399
|
return /* @__PURE__ */ jsx10("h1", { children: `Component not found for type: ${type}` });
|
|
396
400
|
}
|
|
397
|
-
return /* @__PURE__ */ jsx10(ShisoContext.Provider, { value: { type, config, content, components, templates }, children: /* @__PURE__ */ jsx10(MDXProvider, { components: {
|
|
401
|
+
return /* @__PURE__ */ jsx10(ShisoContext.Provider, { value: { type, config, content, components, templates }, children: /* @__PURE__ */ jsx10(MDXProvider, { components: { ...shisoComponents, ...components }, children: /* @__PURE__ */ jsx10(Component, { config, content }) }) });
|
|
398
402
|
}
|
|
399
403
|
|
|
400
404
|
// src/components/hooks/useShiso.ts
|
package/package.json
CHANGED
package/server/index.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
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, ShisoRenderProps, ShisoContent } from '@/lib/types';
|
|
9
|
-
export const parseFile: (file: string) => Promise<ShisoContent | null>;
|
|
10
|
-
export function next(type: string, config: ShisoConfig): {
|
|
11
|
-
generateMetadata: ({ params }: {
|
|
12
|
-
params: Promise<{
|
|
13
|
-
slug: string[];
|
|
14
|
-
}>;
|
|
15
|
-
}) => Promise<{
|
|
16
|
-
title: {
|
|
17
|
-
absolute: any;
|
|
18
|
-
default: any;
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
21
|
-
generateStaticParams: () => Promise<any>;
|
|
22
|
-
renderPage: (render: (props: ShisoRenderProps) => ReactElement) => ({ params }: {
|
|
23
|
-
params: Promise<{
|
|
24
|
-
slug: string[];
|
|
25
|
-
}>;
|
|
26
|
-
}) => Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
|
|
27
|
-
renderCollection: (render: (props: ShisoRenderProps) => ReactElement) => () => Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
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, ShisoRenderProps, ShisoContent } from '@/lib/types';
|
|
9
|
+
export const parseFile: (file: string) => Promise<ShisoContent | null>;
|
|
10
|
+
export function next(type: string, config: ShisoConfig): {
|
|
11
|
+
generateMetadata: ({ params }: {
|
|
12
|
+
params: Promise<{
|
|
13
|
+
slug: string[];
|
|
14
|
+
}>;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
title: {
|
|
17
|
+
absolute: any;
|
|
18
|
+
default: any;
|
|
19
|
+
};
|
|
20
|
+
}>;
|
|
21
|
+
generateStaticParams: () => Promise<any>;
|
|
22
|
+
renderPage: (render: (props: ShisoRenderProps) => ReactElement) => ({ params }: {
|
|
23
|
+
params: Promise<{
|
|
24
|
+
slug: string[];
|
|
25
|
+
}>;
|
|
26
|
+
}) => Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
|
|
27
|
+
renderCollection: (render: (props: ShisoRenderProps) => ReactElement) => () => Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
package/server/index.js
CHANGED
|
@@ -58,7 +58,7 @@ export var parseFile = cache(function (file) { return __awaiter(void 0, void 0,
|
|
|
58
58
|
var match = line.match(/^(#+)\s+(.*)/);
|
|
59
59
|
if (match) {
|
|
60
60
|
var num = match[1], name_1 = match[2];
|
|
61
|
-
var id = name_1.toLowerCase().replace(
|
|
61
|
+
var id = name_1.toLowerCase().replace(/\W+/g, '-');
|
|
62
62
|
var size = num.length;
|
|
63
63
|
anchors_1.push({ name: name_1, id: id, size: size });
|
|
64
64
|
}
|
package/styles.css
CHANGED
|
@@ -4323,47 +4323,47 @@ body a.Button_button__NmQ1Z {
|
|
|
4323
4323
|
font-size-adjust: 0.5;
|
|
4324
4324
|
}
|
|
4325
4325
|
|
|
4326
|
-
/* virtual-css:css:
|
|
4327
|
-
.
|
|
4326
|
+
/* virtual-css:css:e01d9571088b882a03b91eb2755da783 */
|
|
4327
|
+
.PageLinks_links__NmJhO {
|
|
4328
4328
|
position: sticky;
|
|
4329
4329
|
top: var(--spacing-8);
|
|
4330
4330
|
height: max-content;
|
|
4331
4331
|
min-width: 240px;
|
|
4332
4332
|
}
|
|
4333
|
-
.
|
|
4333
|
+
.PageLinks_links__NmJhO a.PageLinks_link__OGI3M {
|
|
4334
4334
|
display: block;
|
|
4335
4335
|
color: var(--font-color-muted);
|
|
4336
4336
|
font-size: var(--font-size);
|
|
4337
4337
|
text-decoration: none;
|
|
4338
4338
|
}
|
|
4339
|
-
.
|
|
4339
|
+
.PageLinks_links__NmJhO a.PageLinks_link__OGI3M:hover {
|
|
4340
4340
|
color: var(--primary-color);
|
|
4341
4341
|
text-decoration: none;
|
|
4342
4342
|
}
|
|
4343
|
-
.PageLinks_indent-
|
|
4343
|
+
.PageLinks_indent-1__M2IxZ {
|
|
4344
4344
|
margin-left: 0;
|
|
4345
4345
|
}
|
|
4346
|
-
.PageLinks_indent-
|
|
4346
|
+
.PageLinks_indent-2__YTBlM {
|
|
4347
4347
|
margin-left: 0;
|
|
4348
4348
|
}
|
|
4349
|
-
.PageLinks_indent-
|
|
4349
|
+
.PageLinks_indent-3__YzJlZ {
|
|
4350
4350
|
margin-left: 10px;
|
|
4351
4351
|
}
|
|
4352
|
-
.PageLinks_indent-
|
|
4352
|
+
.PageLinks_indent-4__NDg3Z {
|
|
4353
4353
|
margin-left: 20px;
|
|
4354
4354
|
}
|
|
4355
|
-
.PageLinks_indent-
|
|
4355
|
+
.PageLinks_indent-5__ZTE4M {
|
|
4356
4356
|
margin-left: 30px;
|
|
4357
4357
|
}
|
|
4358
|
-
.PageLinks_indent-
|
|
4358
|
+
.PageLinks_indent-6__NTRjM {
|
|
4359
4359
|
margin-left: 40px;
|
|
4360
4360
|
}
|
|
4361
|
-
.
|
|
4361
|
+
.PageLinks_links__NmJhO a.PageLinks_selected__ZjhkN {
|
|
4362
4362
|
color: var(--primary-color);
|
|
4363
4363
|
}
|
|
4364
4364
|
|
|
4365
|
-
/* virtual-css:css:
|
|
4366
|
-
.
|
|
4365
|
+
/* virtual-css:css:2dd9c1a25bf05a14c9a7ab7ce1da6aef */
|
|
4366
|
+
.CodeBlock_container__NjNhN {
|
|
4367
4367
|
position: relative;
|
|
4368
4368
|
background: var(--base-color-12);
|
|
4369
4369
|
padding: var(--spacing-5);
|
|
@@ -4371,14 +4371,14 @@ body a.Button_button__NmQ1Z {
|
|
|
4371
4371
|
white-space: pre-wrap;
|
|
4372
4372
|
word-wrap: break-word;
|
|
4373
4373
|
}
|
|
4374
|
-
pre.
|
|
4374
|
+
pre.CodeBlock_container__NjNhN code {
|
|
4375
4375
|
font-family: var(--font-family-code);
|
|
4376
4376
|
color: var(--base-color-4);
|
|
4377
4377
|
padding: 0;
|
|
4378
4378
|
border: 0;
|
|
4379
4379
|
background: transparent;
|
|
4380
4380
|
}
|
|
4381
|
-
.
|
|
4381
|
+
.CodeBlock_button__YzMzM {
|
|
4382
4382
|
border: 0;
|
|
4383
4383
|
position: absolute;
|
|
4384
4384
|
right: var(--spacing-5);
|
|
@@ -4386,123 +4386,123 @@ pre.CodeBlock_container__MWNjM code {
|
|
|
4386
4386
|
cursor: pointer;
|
|
4387
4387
|
background: transparent;
|
|
4388
4388
|
}
|
|
4389
|
-
.
|
|
4389
|
+
.CodeBlock_copy__MjRhM {
|
|
4390
4390
|
color: var(--base-color-4);
|
|
4391
4391
|
}
|
|
4392
|
-
.
|
|
4392
|
+
.CodeBlock_copy__MjRhM:hover {
|
|
4393
4393
|
color: var(--base-color-1);
|
|
4394
4394
|
}
|
|
4395
|
-
.
|
|
4395
|
+
.CodeBlock_check__YTc2M {
|
|
4396
4396
|
color: var(--success-color);
|
|
4397
4397
|
}
|
|
4398
4398
|
|
|
4399
|
-
/* virtual-css:css:
|
|
4400
|
-
.
|
|
4399
|
+
/* virtual-css:css:62c31e195181c97259fa56b13d20ea6d */
|
|
4400
|
+
.SideNav_nav__NTkxM {
|
|
4401
4401
|
overflow-y: auto;
|
|
4402
4402
|
min-width: 240px;
|
|
4403
4403
|
}
|
|
4404
|
-
.
|
|
4404
|
+
.SideNav_nav__NTkxM::-webkit-scrollbar {
|
|
4405
4405
|
width: 15px;
|
|
4406
4406
|
background: transparent;
|
|
4407
4407
|
display: none;
|
|
4408
4408
|
}
|
|
4409
|
-
.
|
|
4409
|
+
.SideNav_nav__NTkxM:hover::-webkit-scrollbar {
|
|
4410
4410
|
display: block;
|
|
4411
4411
|
}
|
|
4412
|
-
.
|
|
4412
|
+
.SideNav_nav__NTkxM::-webkit-scrollbar-track {
|
|
4413
4413
|
border: 7px solid rgba(0, 0, 0, 0);
|
|
4414
4414
|
background-color: var(--border-color);
|
|
4415
4415
|
background-clip: padding-box;
|
|
4416
4416
|
}
|
|
4417
|
-
.
|
|
4417
|
+
.SideNav_nav__NTkxM::-webkit-scrollbar-thumb {
|
|
4418
4418
|
border: 7px solid rgba(0, 0, 0, 0);
|
|
4419
4419
|
background-color: var(--primary-color);
|
|
4420
4420
|
background-clip: padding-box;
|
|
4421
4421
|
}
|
|
4422
|
-
.
|
|
4422
|
+
.SideNav_nav__NTkxM::-webkit-scrollbar-thumb:hover {
|
|
4423
4423
|
border: 5px solid rgba(0, 0, 0, 0);
|
|
4424
4424
|
background-color: var(--primary-color);
|
|
4425
4425
|
background-clip: padding-box;
|
|
4426
4426
|
}
|
|
4427
|
-
.
|
|
4427
|
+
.SideNav_nav__NTkxM.SideNav_sticky__YTdmY {
|
|
4428
4428
|
position: sticky;
|
|
4429
4429
|
top: var(--spacing-8);
|
|
4430
4430
|
}
|
|
4431
|
-
.
|
|
4431
|
+
.SideNav_nav__NTkxM .SideNav_item__MDk5Z {
|
|
4432
4432
|
color: var(--font-color-muted);
|
|
4433
4433
|
border-left: 1px solid var(--border-color);
|
|
4434
4434
|
padding: var(--padding);
|
|
4435
4435
|
text-decoration: none;
|
|
4436
4436
|
}
|
|
4437
|
-
.
|
|
4437
|
+
.SideNav_nav__NTkxM .SideNav_item__MDk5Z:hover {
|
|
4438
4438
|
color: var(--primary-color);
|
|
4439
4439
|
}
|
|
4440
|
-
.
|
|
4440
|
+
.SideNav_nav__NTkxM .SideNav_item__MDk5Z.SideNav_selected__ZjVkZ {
|
|
4441
4441
|
color: var(--font-color);
|
|
4442
4442
|
font-weight: 500;
|
|
4443
4443
|
border-color: var(--primary-color);
|
|
4444
4444
|
background-color: var(--highlight-color);
|
|
4445
4445
|
}
|
|
4446
|
-
.
|
|
4446
|
+
.SideNav_header__Y2YyY {
|
|
4447
4447
|
padding: var(--padding-y) 0;
|
|
4448
4448
|
}
|
|
4449
4449
|
|
|
4450
|
-
/* virtual-css:css:
|
|
4451
|
-
.
|
|
4450
|
+
/* virtual-css:css:4d0931c84adfae5533b067ea199724f8 */
|
|
4451
|
+
.Markdown_content__YzRmN {
|
|
4452
4452
|
font-size: 16px;
|
|
4453
4453
|
margin-bottom: 60px;
|
|
4454
4454
|
}
|
|
4455
|
-
.
|
|
4455
|
+
.Markdown_content__YzRmN > p {
|
|
4456
4456
|
color: var(--font-color);
|
|
4457
4457
|
line-height: 1.8;
|
|
4458
4458
|
}
|
|
4459
|
-
.
|
|
4459
|
+
.Markdown_content__YzRmN a {
|
|
4460
4460
|
color: var(--font-color);
|
|
4461
4461
|
font-weight: 600;
|
|
4462
4462
|
text-decoration: underline var(--border-color);
|
|
4463
4463
|
text-underline-offset: 4px;
|
|
4464
4464
|
}
|
|
4465
|
-
.
|
|
4465
|
+
.Markdown_content__YzRmN a:hover {
|
|
4466
4466
|
color: var(--font-color);
|
|
4467
4467
|
text-decoration: underline var(--primary-color);
|
|
4468
4468
|
}
|
|
4469
|
-
.
|
|
4469
|
+
.Markdown_content__YzRmN img {
|
|
4470
4470
|
display: block;
|
|
4471
4471
|
max-width: 100%;
|
|
4472
4472
|
margin: 4rem auto;
|
|
4473
4473
|
box-shadow: 2px 2px 16px rgba(0, 0, 0, .1);
|
|
4474
4474
|
}
|
|
4475
|
-
.
|
|
4475
|
+
.Markdown_content__YzRmN h1 {
|
|
4476
4476
|
font-size: var(--font-size-8);
|
|
4477
4477
|
letter-spacing: var(--letter-spacing-1);
|
|
4478
4478
|
margin: 0 0 var(--spacing-4) 0;
|
|
4479
4479
|
}
|
|
4480
|
-
.
|
|
4480
|
+
.Markdown_content__YzRmN h2 {
|
|
4481
4481
|
font-size: var(--font-size-6);
|
|
4482
4482
|
letter-spacing: var(--letter-spacing-1);
|
|
4483
4483
|
margin: var(--spacing-8) 0 var(--spacing-4) 0;
|
|
4484
4484
|
}
|
|
4485
|
-
.
|
|
4485
|
+
.Markdown_content__YzRmN h3 {
|
|
4486
4486
|
font-size: var(--font-size-5);
|
|
4487
4487
|
letter-spacing: var(--letter-spacing-1);
|
|
4488
4488
|
margin: var(--spacing-7) 0 var(--spacing-4) 0;
|
|
4489
4489
|
}
|
|
4490
|
-
.
|
|
4490
|
+
.Markdown_content__YzRmN *[id] {
|
|
4491
4491
|
scroll-margin-top: var(--spacing-4);
|
|
4492
4492
|
}
|
|
4493
|
-
.
|
|
4493
|
+
.Markdown_content__YzRmN ul {
|
|
4494
4494
|
list-style: disc;
|
|
4495
4495
|
}
|
|
4496
|
-
.
|
|
4496
|
+
.Markdown_content__YzRmN ol {
|
|
4497
4497
|
list-style: decimal;
|
|
4498
4498
|
}
|
|
4499
|
-
.
|
|
4499
|
+
.Markdown_content__YzRmN pre {
|
|
4500
4500
|
margin: var(--spacing-5) 0;
|
|
4501
4501
|
}
|
|
4502
|
-
.
|
|
4502
|
+
.Markdown_content__YzRmN code {
|
|
4503
4503
|
font-size: 14px;
|
|
4504
4504
|
}
|
|
4505
|
-
.
|
|
4505
|
+
.Markdown_content__YzRmN code:not([class]) {
|
|
4506
4506
|
font-family: var(--font-family-code);
|
|
4507
4507
|
color: var(--font-color);
|
|
4508
4508
|
padding: var(--spacing-1);
|
package/dist/server.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
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: (file: string) => Promise<{
|
|
10
|
-
path: string;
|
|
11
|
-
meta: {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
14
|
-
content: string;
|
|
15
|
-
code: string;
|
|
16
|
-
anchors: {
|
|
17
|
-
name: string;
|
|
18
|
-
id: string;
|
|
19
|
-
size: number;
|
|
20
|
-
}[];
|
|
21
|
-
} | null>;
|
|
22
|
-
export function next(type: string, config: ShisoConfig): {
|
|
23
|
-
generateMetadata: ({ params }: {
|
|
24
|
-
params: Promise<{
|
|
25
|
-
slug: string[];
|
|
26
|
-
}>;
|
|
27
|
-
}) => Promise<{
|
|
28
|
-
title: {
|
|
29
|
-
absolute: string;
|
|
30
|
-
default: any;
|
|
31
|
-
};
|
|
32
|
-
}>;
|
|
33
|
-
generateStaticParams: () => Promise<any>;
|
|
34
|
-
renderPage: (render: ({ type, content, config, }: {
|
|
35
|
-
type: string;
|
|
36
|
-
content: any;
|
|
37
|
-
config: ShisoConfig;
|
|
38
|
-
}) => ReactElement) => ({ params }: {
|
|
39
|
-
params: Promise<{
|
|
40
|
-
slug: string[];
|
|
41
|
-
}>;
|
|
42
|
-
}) => Promise<ReactElement<unknown, string | import("react").JSXElementConstructor<any>>>;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
package/dist/server.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { cache } from 'react';
|
|
38
|
-
import { compile } from '@mdx-js/mdx';
|
|
39
|
-
import remarkGfm from 'remark-gfm';
|
|
40
|
-
import rehypeHighlight from 'rehype-highlight';
|
|
41
|
-
import matter from 'gray-matter';
|
|
42
|
-
import fs from 'node:fs/promises';
|
|
43
|
-
import path from 'node:path';
|
|
44
|
-
import recursive from 'recursive-readdir';
|
|
45
|
-
export var getContent = cache(function (file) { return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
-
var postContent, _a, frontmatter, mdxContent, anchors_1, modifiedContent, code, _b, _c;
|
|
47
|
-
return __generator(this, function (_d) {
|
|
48
|
-
switch (_d.label) {
|
|
49
|
-
case 0:
|
|
50
|
-
_d.trys.push([0, 3, , 4]);
|
|
51
|
-
return [4 /*yield*/, fs.readFile(file, 'utf8')];
|
|
52
|
-
case 1:
|
|
53
|
-
postContent = _d.sent();
|
|
54
|
-
_a = matter(postContent), frontmatter = _a.data, mdxContent = _a.content;
|
|
55
|
-
anchors_1 = [];
|
|
56
|
-
modifiedContent = mdxContent
|
|
57
|
-
.split('\n')
|
|
58
|
-
.map(function (line) {
|
|
59
|
-
var match = line.match(/^(#+)\s+(.*)/);
|
|
60
|
-
if (match) {
|
|
61
|
-
var num = match[1], name_1 = match[2];
|
|
62
|
-
var id = name_1.toLowerCase().replace(/\s+/g, '-');
|
|
63
|
-
var size = num.length;
|
|
64
|
-
anchors_1.push({ name: name_1, id: id, size: size });
|
|
65
|
-
return "<h".concat(size, " id=\"").concat(id, "\">").concat(name_1.replace(/\{|\}/g, ''), "</h").concat(size, ">");
|
|
66
|
-
}
|
|
67
|
-
return line;
|
|
68
|
-
})
|
|
69
|
-
.join('\n');
|
|
70
|
-
_b = String;
|
|
71
|
-
return [4 /*yield*/, compile(modifiedContent, {
|
|
72
|
-
outputFormat: 'function-body',
|
|
73
|
-
remarkPlugins: [remarkGfm],
|
|
74
|
-
rehypePlugins: [rehypeHighlight],
|
|
75
|
-
})];
|
|
76
|
-
case 2:
|
|
77
|
-
code = _b.apply(void 0, [_d.sent()]);
|
|
78
|
-
return [2 /*return*/, {
|
|
79
|
-
path: file,
|
|
80
|
-
meta: frontmatter,
|
|
81
|
-
content: postContent,
|
|
82
|
-
code: code,
|
|
83
|
-
anchors: anchors_1,
|
|
84
|
-
}];
|
|
85
|
-
case 3:
|
|
86
|
-
_c = _d.sent();
|
|
87
|
-
return [2 /*return*/, null];
|
|
88
|
-
case 4: return [2 /*return*/];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}); });
|
|
92
|
-
export function next(type, config) {
|
|
93
|
-
var dir = path.join(config.contentDir, type);
|
|
94
|
-
var _a = config[type].title, title = _a === void 0 ? 'Shiso' : _a;
|
|
95
|
-
function generateMetadata(_a) {
|
|
96
|
-
return __awaiter(this, arguments, void 0, function (_b) {
|
|
97
|
-
var name, file, content;
|
|
98
|
-
var _c, _d, _e;
|
|
99
|
-
var params = _b.params;
|
|
100
|
-
return __generator(this, function (_f) {
|
|
101
|
-
switch (_f.label) {
|
|
102
|
-
case 0: return [4 /*yield*/, params];
|
|
103
|
-
case 1:
|
|
104
|
-
name = ((_d = (_c = (_f.sent())) === null || _c === void 0 ? void 0 : _c.slug) === null || _d === void 0 ? void 0 : _d.join('/')) || 'index';
|
|
105
|
-
file = path.join(dir, "".concat(name, ".mdx"));
|
|
106
|
-
return [4 /*yield*/, getContent(file)];
|
|
107
|
-
case 2:
|
|
108
|
-
content = _f.sent();
|
|
109
|
-
return [2 /*return*/, {
|
|
110
|
-
title: {
|
|
111
|
-
absolute: "".concat((_e = content === null || content === void 0 ? void 0 : content.meta) === null || _e === void 0 ? void 0 : _e.title, " \u2013 ").concat(title),
|
|
112
|
-
default: title,
|
|
113
|
-
},
|
|
114
|
-
}];
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function generateStaticParams() {
|
|
120
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
-
var files;
|
|
122
|
-
return __generator(this, function (_a) {
|
|
123
|
-
switch (_a.label) {
|
|
124
|
-
case 0: return [4 /*yield*/, recursive(dir)];
|
|
125
|
-
case 1:
|
|
126
|
-
files = _a.sent();
|
|
127
|
-
return [2 /*return*/, files
|
|
128
|
-
.map(function (file) {
|
|
129
|
-
return file.replace('.mdx', '').replace(dir, '').replace(/\\/g, '/').replace(/^\//, '');
|
|
130
|
-
})
|
|
131
|
-
.map(function (id) { return ({
|
|
132
|
-
id: id.split('/'),
|
|
133
|
-
}); })];
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
function renderPage(render) {
|
|
139
|
-
var _this = this;
|
|
140
|
-
return function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
141
|
-
var name, file, content;
|
|
142
|
-
var _c, _d;
|
|
143
|
-
var params = _b.params;
|
|
144
|
-
return __generator(this, function (_e) {
|
|
145
|
-
switch (_e.label) {
|
|
146
|
-
case 0: return [4 /*yield*/, params];
|
|
147
|
-
case 1:
|
|
148
|
-
name = ((_d = (_c = (_e.sent())) === null || _c === void 0 ? void 0 : _c.slug) === null || _d === void 0 ? void 0 : _d.join('/')) || 'index';
|
|
149
|
-
file = path.join(dir, "".concat(name, ".mdx"));
|
|
150
|
-
return [4 /*yield*/, getContent(file)];
|
|
151
|
-
case 2:
|
|
152
|
-
content = _e.sent();
|
|
153
|
-
return [2 /*return*/, render({ type: type, content: content, config: config })];
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}); };
|
|
157
|
-
}
|
|
158
|
-
return { generateMetadata: generateMetadata, generateStaticParams: generateStaticParams, renderPage: renderPage };
|
|
159
|
-
}
|