@umami/shiso 0.29.0 → 0.30.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
@@ -1,6 +1,6 @@
1
- /* virtual-css:css:0292bafad22c4cab436655610801c589 */
2
- /* virtual-css:css:85717ba9ea360d365e3f29144820b208 */
3
- .CodeBlock_container__YmFmN {
1
+ /* virtual-css:css:32abd77818c5161a011a843897f34903 */
2
+ /* virtual-css:css:2dd9c1a25bf05a14c9a7ab7ce1da6aef */
3
+ .CodeBlock_container__ZTkxY {
4
4
  position: relative;
5
5
  background: var(--base-color-900);
6
6
  padding: var(--spacing-5);
@@ -8,14 +8,14 @@
8
8
  white-space: pre-wrap;
9
9
  word-wrap: break-word;
10
10
  }
11
- pre.CodeBlock_container__YmFmN code {
11
+ pre.CodeBlock_container__ZTkxY code {
12
12
  font-family: var(--font-family-code);
13
13
  color: var(--base-color-300);
14
14
  padding: 0;
15
15
  border: 0;
16
16
  background: transparent;
17
17
  }
18
- .CodeBlock_button__NDg0Y {
18
+ .CodeBlock_button__MmZkO {
19
19
  border: 0;
20
20
  position: absolute;
21
21
  right: var(--spacing-5);
@@ -23,136 +23,139 @@ pre.CodeBlock_container__YmFmN code {
23
23
  cursor: pointer;
24
24
  background: transparent;
25
25
  }
26
- .CodeBlock_copy__MmQzM {
26
+ .CodeBlock_copy__M2I0N {
27
27
  color: var(--base-color-300);
28
28
  }
29
- .CodeBlock_copy__MmQzM:hover {
29
+ .CodeBlock_copy__M2I0N:hover {
30
30
  color: var(--base-color-50);
31
31
  }
32
- .CodeBlock_check__YmI0Z {
32
+ .CodeBlock_check__MjkzY {
33
33
  color: var(--success-color);
34
34
  }
35
35
 
36
- /* virtual-css:css:0ed498f49b21d225f1b5a4e1685cf2e5 */
37
- .PageLinks_links__MjgyM {
36
+ /* virtual-css:css:e01d9571088b882a03b91eb2755da783 */
37
+ .PageLinks_links__YmMzM {
38
38
  position: sticky;
39
39
  top: 30px;
40
40
  height: max-content;
41
41
  }
42
- .PageLinks_links__MjgyM a.PageLinks_link__YWRjO {
42
+ .PageLinks_links__YmMzM a.PageLinks_link__MjIyN {
43
43
  display: block;
44
44
  color: var(--font-color-muted);
45
45
  font-size: var(--font-size);
46
46
  text-wrap: nowrap;
47
47
  text-decoration: none;
48
48
  }
49
- .PageLinks_links__MjgyM a.PageLinks_link__YWRjO:hover {
49
+ .PageLinks_links__YmMzM a.PageLinks_link__MjIyN:hover {
50
50
  color: var(--primary-color);
51
51
  text-decoration: none;
52
52
  }
53
- .PageLinks_indent-1__MDcyM {
53
+ .PageLinks_indent-1__MDg5M {
54
54
  margin-left: 0;
55
55
  }
56
- .PageLinks_indent-2__OWYxZ {
56
+ .PageLinks_indent-2__YTU4M {
57
57
  margin-left: 0;
58
58
  }
59
- .PageLinks_indent-3__ZmYwM {
59
+ .PageLinks_indent-3__NTYxY {
60
60
  margin-left: 10px;
61
61
  }
62
- .PageLinks_indent-4__NzU2Y {
62
+ .PageLinks_indent-4__NjhmY {
63
63
  margin-left: 20px;
64
64
  }
65
- .PageLinks_indent-5__NmVkY {
65
+ .PageLinks_indent-5__ZmFiY {
66
66
  margin-left: 30px;
67
67
  }
68
- .PageLinks_indent-6__NzQ4N {
68
+ .PageLinks_indent-6__MmRkN {
69
69
  margin-left: 40px;
70
70
  }
71
- .PageLinks_links__MjgyM a.PageLinks_selected__YmZhY {
71
+ .PageLinks_links__YmMzM a.PageLinks_selected__NDQxY {
72
72
  color: var(--primary-color);
73
73
  }
74
74
 
75
- /* virtual-css:css:72ce2cfbba7b635b2ff1a5f4f5eeabf3 */
76
- .SideNav_nav__Mjk0M {
75
+ /* virtual-css:css:62c31e195181c97259fa56b13d20ea6d */
76
+ .SideNav_nav__YjU1O {
77
77
  overflow-y: auto;
78
+ scrollbar-width: thin;
79
+ scrollbar-color: var(--border-color) var(--background-color);
80
+ scrollbar-gutter: stable;
78
81
  }
79
- .SideNav_nav__Mjk0M.SideNav_sticky__ZmE5M {
82
+ .SideNav_nav__YjU1O.SideNav_sticky__NjhmY {
80
83
  position: sticky;
81
84
  top: 30px;
82
85
  }
83
- .SideNav_nav__Mjk0M .SideNav_item__ZmE0N {
86
+ .SideNav_nav__YjU1O .SideNav_item__ZGRlM {
84
87
  color: var(--font-color-muted);
85
88
  padding: 0;
86
89
  border-radius: 0;
87
90
  border-left: var(--border-size-1) solid var(--border-color);
88
91
  }
89
- .SideNav_nav__Mjk0M .SideNav_item__ZmE0N a {
92
+ .SideNav_nav__YjU1O .SideNav_item__ZGRlM a {
90
93
  color: currentColor;
91
94
  width: 100%;
92
95
  padding: var(--padding-y) var(--padding-x);
93
96
  text-decoration: none;
94
97
  }
95
- .SideNav_nav__Mjk0M .SideNav_item__ZmE0N a:hover {
98
+ .SideNav_nav__YjU1O .SideNav_item__ZGRlM a:hover {
96
99
  color: var(--primary-color);
97
100
  }
98
- .SideNav_nav__Mjk0M .SideNav_item__ZmE0N.SideNav_selected__MWRhM {
101
+ .SideNav_nav__YjU1O .SideNav_item__ZGRlM.SideNav_selected__NTMzY {
99
102
  color: var(--font-color);
100
103
  border-color: var(--primary-color);
101
104
  }
102
- .SideNav_items__NjM0Z header {
105
+ .SideNav_items__MWI3O header {
103
106
  padding: var(--padding-y) 0;
104
107
  }
105
108
 
106
- /* virtual-css:css:7938c95522eda3e1f8244364ad70b38c */
107
- .ContentArea_content__NGFkN {
109
+ /* virtual-css:css:71a58b2dae0a60276640236977b24d42 */
110
+ .ContentArea_content__MTM4Z {
108
111
  font-size: 16px;
109
112
  margin-bottom: 60px;
110
113
  }
111
- .ContentArea_content__NGFkN > p {
114
+ .ContentArea_content__MTM4Z > p {
112
115
  color: var(--font-color);
113
116
  line-height: 1.8;
114
117
  }
115
- .ContentArea_content__NGFkN a {
118
+ .ContentArea_content__MTM4Z a {
116
119
  color: var(--font-color);
117
120
  font-weight: 600;
118
121
  text-decoration: underline var(--border-color);
119
122
  text-underline-offset: 4px;
120
123
  }
121
- .ContentArea_content__NGFkN a:hover {
124
+ .ContentArea_content__MTM4Z a:hover {
122
125
  color: var(--font-color);
123
126
  text-decoration: underline var(--primary-color);
124
127
  }
125
- .ContentArea_content__NGFkN h1 {
128
+ .ContentArea_content__MTM4Z h1 {
126
129
  font-size: var(--font-size-8);
127
130
  letter-spacing: var(--letter-spacing-1);
128
131
  margin: 0 0 var(--spacing-4) 0;
129
132
  }
130
- .ContentArea_content__NGFkN h2 {
133
+ .ContentArea_content__MTM4Z h2 {
131
134
  font-size: var(--font-size-6);
132
135
  letter-spacing: var(--letter-spacing-1);
133
136
  margin: var(--spacing-8) 0 var(--spacing-4) 0;
134
137
  }
135
- .ContentArea_content__NGFkN h3 {
138
+ .ContentArea_content__MTM4Z h3 {
136
139
  font-size: var(--font-size-5);
137
140
  letter-spacing: var(--letter-spacing-1);
138
141
  margin: var(--spacing-7) 0 var(--spacing-4) 0;
139
142
  }
140
- .ContentArea_content__NGFkN *[id] {
143
+ .ContentArea_content__MTM4Z *[id] {
141
144
  scroll-margin-top: var(--spacing-4);
142
145
  }
143
- .ContentArea_content__NGFkN ul {
146
+ .ContentArea_content__MTM4Z ul {
144
147
  list-style: disc;
145
148
  }
146
- .ContentArea_content__NGFkN ol {
149
+ .ContentArea_content__MTM4Z ol {
147
150
  list-style: decimal;
148
151
  }
149
- .ContentArea_content__NGFkN pre {
152
+ .ContentArea_content__MTM4Z pre {
150
153
  margin: var(--spacing-5) 0;
151
154
  }
152
- .ContentArea_content__NGFkN code {
155
+ .ContentArea_content__MTM4Z code {
153
156
  font-size: 14px;
154
157
  }
155
- .ContentArea_content__NGFkN code:not([class]) {
158
+ .ContentArea_content__MTM4Z code:not([class]) {
156
159
  font-family: var(--font-family-code);
157
160
  color: var(--font-color);
158
161
  padding: var(--spacing-1);
package/dist/index.d.ts CHANGED
@@ -1,48 +1,48 @@
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
- content: any;
18
- config: any;
19
- }
20
- export function Blog({ content }: BlogProps): import("react").JSX.Element;
21
- }
22
-
23
- declare module '@umami/shiso/Docs' {
24
- export function Docs(): import("react").JSX.Element;
25
- }
26
-
27
- declare module '@umami/shiso/Shiso' {
28
- import { JSX } from 'react';
29
- import type { ShisoConfig, ShisoContent } from '@/lib/types';
30
- export interface ShisoProps {
31
- content: ShisoContent;
32
- type: string;
33
- config: ShisoConfig;
34
- components?: {
35
- [key: string]: any;
36
- };
37
- templates?: {
38
- [key: string]: any;
39
- };
40
- }
41
- export type ShisoTemplateComponent = ({ content, config, }: {
42
- content: any;
43
- config: ShisoConfig;
44
- }) => JSX.Element;
45
- export const ShisoContext: import("react").Context<any>;
46
- export function Shiso({ content, type, config, components, templates }: ShisoProps): JSX.Element;
47
- }
48
-
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
+ content: any;
18
+ config: any;
19
+ }
20
+ export function Blog({ content }: BlogProps): import("react").JSX.Element;
21
+ }
22
+
23
+ declare module '@umami/shiso/Docs' {
24
+ export function Docs(): import("react").JSX.Element;
25
+ }
26
+
27
+ declare module '@umami/shiso/Shiso' {
28
+ import { JSX } from 'react';
29
+ import type { ShisoConfig, ShisoContent } from '@/lib/types';
30
+ export interface ShisoProps {
31
+ content: ShisoContent;
32
+ type: string;
33
+ config: ShisoConfig;
34
+ components?: {
35
+ [key: string]: any;
36
+ };
37
+ templates?: {
38
+ [key: string]: any;
39
+ };
40
+ }
41
+ export type ShisoTemplateComponent = ({ content, config, }: {
42
+ content: any;
43
+ config: ShisoConfig;
44
+ }) => JSX.Element;
45
+ export const ShisoContext: import("react").Context<any>;
46
+ export function Shiso({ content, type, config, components, templates }: ShisoProps): JSX.Element;
47
+ }
48
+
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ var import_github_dark = require("highlight.js/styles/github-dark.css");
42
42
  // src/components/Blog.tsx
43
43
  var import_react_zen2 = require("@umami/react-zen");
44
44
 
45
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/Blog.module.css
45
+ // css-modules:E:\dev\umami-shiso\src\components\Blog.module.css
46
46
  var Blog_default = {};
47
47
 
48
48
  // src/components/Markdown.tsx
@@ -112,8 +112,8 @@ var import_react_zen4 = require("@umami/react-zen");
112
112
  var import_react2 = require("react");
113
113
  var import_react_zen3 = require("@umami/react-zen");
114
114
 
115
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/CodeBlock.module.css
116
- var CodeBlock_default = { "container": "CodeBlock_container__YmFmN", "button": "CodeBlock_button__NDg0Y", "copy": "CodeBlock_copy__MmQzM", "check": "CodeBlock_check__YmI0Z" };
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
117
 
118
118
  // src/components/CodeBlock.tsx
119
119
  var import_jsx_runtime4 = require("react/jsx-runtime");
@@ -159,8 +159,8 @@ var import_react6 = require("react");
159
159
  var import_react_zen5 = require("@umami/react-zen");
160
160
  var import_classnames = __toESM(require("classnames"));
161
161
 
162
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/PageLinks.module.css
163
- var PageLinks_default = { "links": "PageLinks_links__MjgyM", "link": "PageLinks_link__YWRjO", "indent-1": "PageLinks_indent-1__MDcyM", "indent-2": "PageLinks_indent-2__OWYxZ", "indent-3": "PageLinks_indent-3__ZmYwM", "indent-4": "PageLinks_indent-4__NzU2Y", "indent-5": "PageLinks_indent-5__NmVkY", "indent-6": "PageLinks_indent-6__NzQ4N", "selected": "PageLinks_selected__YmZhY" };
162
+ // 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" };
164
164
 
165
165
  // src/components/PageLinks.tsx
166
166
  var import_jsx_runtime6 = require("react/jsx-runtime");
@@ -207,8 +207,8 @@ var import_classnames2 = __toESM(require("classnames"));
207
207
  var import_navigation = require("next/navigation");
208
208
  var import_link = __toESM(require("next/link"));
209
209
 
210
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/SideNav.module.css
211
- var SideNav_default = { "nav": "SideNav_nav__Mjk0M", "sticky": "SideNav_sticky__ZmE5M", "item": "SideNav_item__ZmE0N", "selected": "SideNav_selected__MWRhM", "items": "SideNav_items__NjM0Z" };
210
+ // 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" };
212
212
 
213
213
  // src/components/SideNav.tsx
214
214
  var import_jsx_runtime7 = require("react/jsx-runtime");
@@ -275,8 +275,8 @@ function TopNav({ tabs }) {
275
275
  // src/components/ContentArea.tsx
276
276
  var import_react_zen8 = require("@umami/react-zen");
277
277
 
278
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/ContentArea.module.css
279
- var ContentArea_default = { "content": "ContentArea_content__NGFkN" };
278
+ // css-modules:E:\dev\umami-shiso\src\components\ContentArea.module.css
279
+ var ContentArea_default = { "content": "ContentArea_content__MTM4Z" };
280
280
 
281
281
  // src/components/ContentArea.tsx
282
282
  var import_link3 = __toESM(require("next/link"));
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import "highlight.js/styles/github-dark.css";
7
7
  // src/components/Blog.tsx
8
8
  import { Column as Column2 } from "@umami/react-zen";
9
9
 
10
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/Blog.module.css
10
+ // css-modules:E:\dev\umami-shiso\src\components\Blog.module.css
11
11
  var Blog_default = {};
12
12
 
13
13
  // src/components/Markdown.tsx
@@ -88,8 +88,8 @@ import { Code } from "@umami/react-zen";
88
88
  import { useState, useRef } from "react";
89
89
  import { Icon, Icons } from "@umami/react-zen";
90
90
 
91
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/CodeBlock.module.css
92
- var CodeBlock_default = { "container": "CodeBlock_container__YmFmN", "button": "CodeBlock_button__NDg0Y", "copy": "CodeBlock_copy__MmQzM", "check": "CodeBlock_check__YmI0Z" };
91
+ // css-modules:E:\dev\umami-shiso\src\components\CodeBlock.module.css
92
+ var CodeBlock_default = { "container": "CodeBlock_container__ZTkxY", "button": "CodeBlock_button__MmZkO", "copy": "CodeBlock_copy__M2I0N", "check": "CodeBlock_check__MjkzY" };
93
93
 
94
94
  // src/components/CodeBlock.tsx
95
95
  import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -135,8 +135,8 @@ import { useEffect, useState as useState2 } from "react";
135
135
  import { Column as Column3, Text, Box } from "@umami/react-zen";
136
136
  import classNames from "classnames";
137
137
 
138
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/PageLinks.module.css
139
- var PageLinks_default = { "links": "PageLinks_links__MjgyM", "link": "PageLinks_link__YWRjO", "indent-1": "PageLinks_indent-1__MDcyM", "indent-2": "PageLinks_indent-2__OWYxZ", "indent-3": "PageLinks_indent-3__ZmYwM", "indent-4": "PageLinks_indent-4__NzU2Y", "indent-5": "PageLinks_indent-5__NmVkY", "indent-6": "PageLinks_indent-6__NzQ4N", "selected": "PageLinks_selected__YmZhY" };
138
+ // css-modules:E:\dev\umami-shiso\src\components\PageLinks.module.css
139
+ 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" };
140
140
 
141
141
  // src/components/PageLinks.tsx
142
142
  import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
@@ -183,8 +183,8 @@ import classNames2 from "classnames";
183
183
  import { usePathname } from "next/navigation";
184
184
  import Link from "next/link";
185
185
 
186
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/SideNav.module.css
187
- var SideNav_default = { "nav": "SideNav_nav__Mjk0M", "sticky": "SideNav_sticky__ZmE5M", "item": "SideNav_item__ZmE0N", "selected": "SideNav_selected__MWRhM", "items": "SideNav_items__NjM0Z" };
186
+ // css-modules:E:\dev\umami-shiso\src\components\SideNav.module.css
187
+ var SideNav_default = { "nav": "SideNav_nav__YjU1O", "sticky": "SideNav_sticky__NjhmY", "item": "SideNav_item__ZGRlM", "selected": "SideNav_selected__NTMzY", "items": "SideNav_items__MWI3O" };
188
188
 
189
189
  // src/components/SideNav.tsx
190
190
  import { jsx as jsx7 } from "react/jsx-runtime";
@@ -251,8 +251,8 @@ function TopNav({ tabs }) {
251
251
  // src/components/ContentArea.tsx
252
252
  import { Heading, Box as Box3, Text as Text2, Row, Icon as Icon2, Icons as Icons2 } from "@umami/react-zen";
253
253
 
254
- // css-modules:/Users/mikecao/Development/umami-software/shiso/src/components/ContentArea.module.css
255
- var ContentArea_default = { "content": "ContentArea_content__NGFkN" };
254
+ // css-modules:E:\dev\umami-shiso\src\components\ContentArea.module.css
255
+ var ContentArea_default = { "content": "ContentArea_content__MTM4Z" };
256
256
 
257
257
  // src/components/ContentArea.tsx
258
258
  import Link3 from "next/link";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umami/shiso",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "description": "A content layer for Next.js",
5
5
  "homepage": "https://umami.is/shiso",
6
6
  "repository": {
@@ -62,7 +62,6 @@
62
62
  },
63
63
  "devDependencies": {
64
64
  "@svgr/cli": "^8.1.0",
65
- "@svgr/webpack": "^8.1.0",
66
65
  "@types/css-modules": "^1.0.5",
67
66
  "@types/mdx": "^2.0.11",
68
67
  "@types/node": "^22.10.4",
package/server/index.d.ts CHANGED
@@ -1,45 +1,45 @@
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
-
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.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
- }