@umami/shiso 0.1.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/.eslintrc.json +11 -0
- package/.prettierrc.json +7 -0
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/index.css +158 -0
- package/dist/index.d.ts +95 -0
- package/dist/index.js +335 -0
- package/dist/index.mjs +302 -0
- package/dts.mjs +8 -0
- package/esbuild.mjs +36 -0
- package/next.config.ts +15 -0
- package/package.json +83 -0
- package/public/leaf.png +0 -0
- package/public/leaf.svg +1 -0
- package/src/app/Footer.tsx +14 -0
- package/src/app/Header.tsx +14 -0
- package/src/app/blog/[[...id]]/page.tsx +8 -0
- package/src/app/docs/[[...id]]/page.tsx +8 -0
- package/src/app/layout.tsx +41 -0
- package/src/app/page.tsx +25 -0
- package/src/assets/leaf.svg +1 -0
- package/src/components/Footer.module.css +0 -0
- package/src/components/Footer.tsx +1 -0
- package/src/components/Header.module.css +0 -0
- package/src/components/Header.tsx +0 -0
- package/src/components/Markdown.tsx +21 -0
- package/src/components/Shiso.tsx +19 -0
- package/src/components/blog/Blog.module.css +0 -0
- package/src/components/blog/Blog.tsx +21 -0
- package/src/components/docs/Callout.module.css +6 -0
- package/src/components/docs/Callout.tsx +18 -0
- package/src/components/docs/CodeBlock.module.css +37 -0
- package/src/components/docs/CodeBlock.tsx +30 -0
- package/src/components/docs/ContentArea.module.css +63 -0
- package/src/components/docs/ContentArea.tsx +27 -0
- package/src/components/docs/Docs.tsx +50 -0
- package/src/components/docs/Note.tsx +5 -0
- package/src/components/docs/PageLinks.module.css +49 -0
- package/src/components/docs/PageLinks.tsx +49 -0
- package/src/components/docs/SideNav.module.css +32 -0
- package/src/components/docs/SideNav.tsx +46 -0
- package/src/components/docs/TopNav.tsx +25 -0
- package/src/components/icons/Leaf.tsx +15 -0
- package/src/components/icons/index.ts +1 -0
- package/src/components/index.ts +8 -0
- package/src/content/blog/index.mdx +5 -0
- package/src/content/docs/components/index.mdx +1 -0
- package/src/content/docs/components.mdx +5 -0
- package/src/content/docs/configuration.mdx +81 -0
- package/src/content/docs/index.mdx +11 -0
- package/src/content/docs/installation.mdx +38 -0
- package/src/content/docs/writing-content.mdx +95 -0
- package/src/declarations.d.ts +3 -0
- package/src/index.ts +5 -0
- package/src/lib/content.ts +61 -0
- package/src/lib/next.tsx +46 -0
- package/src/lib/types.ts +10 -0
- package/src/shiso.config.json +59 -0
- package/tsconfig.build.json +24 -0
- package/tsconfig.json +41 -0
package/.eslintrc.json
ADDED
package/.prettierrc.json
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Umami Software, Inc. <hello@umami.is>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
package/dist/index.css
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/* virtual-css:css:943a368a754a0f9e78019e2a7170fc27 */
|
|
2
|
+
/* virtual-css:css:3bad70522881721e67eb254a54940e2f */
|
|
3
|
+
.CodeBlock_container__ZWQ3M {
|
|
4
|
+
position: relative;
|
|
5
|
+
background: var(--base-color-900);
|
|
6
|
+
padding: var(--spacing-5);
|
|
7
|
+
border-radius: 6px;
|
|
8
|
+
white-space: pre-wrap;
|
|
9
|
+
word-wrap: break-word;
|
|
10
|
+
}
|
|
11
|
+
pre.CodeBlock_container__ZWQ3M code {
|
|
12
|
+
font-family: var(--font-family-code);
|
|
13
|
+
color: var(--base-color-300);
|
|
14
|
+
padding: 0;
|
|
15
|
+
border: 0;
|
|
16
|
+
background: transparent;
|
|
17
|
+
}
|
|
18
|
+
.CodeBlock_button__YzlkO {
|
|
19
|
+
border: 0;
|
|
20
|
+
position: absolute;
|
|
21
|
+
right: var(--spacing-5);
|
|
22
|
+
top: var(--spacing-5);
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
background: transparent;
|
|
25
|
+
}
|
|
26
|
+
.CodeBlock_copy__MGRjZ {
|
|
27
|
+
color: var(--base-color-300);
|
|
28
|
+
}
|
|
29
|
+
.CodeBlock_copy__MGRjZ:hover {
|
|
30
|
+
color: var(--base-color-50);
|
|
31
|
+
}
|
|
32
|
+
.CodeBlock_check__YTZlN {
|
|
33
|
+
color: var(--success-color);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* virtual-css:css:bdddb2ea104dd6a71620fa4540713b02 */
|
|
37
|
+
.PageLinks_title__NDFiN {
|
|
38
|
+
position: sticky;
|
|
39
|
+
top: 0;
|
|
40
|
+
}
|
|
41
|
+
.PageLinks_links__NDRmO {
|
|
42
|
+
position: sticky;
|
|
43
|
+
top: 30px;
|
|
44
|
+
height: max-content;
|
|
45
|
+
}
|
|
46
|
+
.PageLinks_links__NDRmO a {
|
|
47
|
+
display: block;
|
|
48
|
+
color: var(--font-muted-color);
|
|
49
|
+
text-wrap: nowrap;
|
|
50
|
+
text-decoration: none;
|
|
51
|
+
}
|
|
52
|
+
.PageLinks_links__NDRmO a:hover {
|
|
53
|
+
color: var(--primary-color);
|
|
54
|
+
}
|
|
55
|
+
.PageLinks_indent-1__ODFiY {
|
|
56
|
+
margin-left: 0;
|
|
57
|
+
}
|
|
58
|
+
.PageLinks_indent-2__OTFkY {
|
|
59
|
+
margin-left: 0;
|
|
60
|
+
}
|
|
61
|
+
.PageLinks_indent-3__ZGM3O {
|
|
62
|
+
margin-left: 10px;
|
|
63
|
+
}
|
|
64
|
+
.PageLinks_indent-4__Y2U0M {
|
|
65
|
+
margin-left: 20px;
|
|
66
|
+
}
|
|
67
|
+
.PageLinks_indent-5__MzUwM {
|
|
68
|
+
margin-left: 30px;
|
|
69
|
+
}
|
|
70
|
+
.PageLinks_indent-6__ZTQ4M {
|
|
71
|
+
margin-left: 40px;
|
|
72
|
+
}
|
|
73
|
+
a.PageLinks_selected__MDVlN {
|
|
74
|
+
color: var(--primary-color);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* virtual-css:css:ae384b93271e0eccb1944349dfa96582 */
|
|
78
|
+
.SideNav_nav__NmRlZ {
|
|
79
|
+
position: sticky;
|
|
80
|
+
top: 30px;
|
|
81
|
+
height: max-content;
|
|
82
|
+
}
|
|
83
|
+
.SideNav_item__ZmExN {
|
|
84
|
+
color: var(--font-muted-color);
|
|
85
|
+
padding: 0;
|
|
86
|
+
border-radius: 0;
|
|
87
|
+
border-left: var(--border-size-1) solid var(--border-color);
|
|
88
|
+
}
|
|
89
|
+
.SideNav_item__ZmExN a {
|
|
90
|
+
color: currentColor;
|
|
91
|
+
width: 100%;
|
|
92
|
+
padding: var(--padding-y) var(--padding-x);
|
|
93
|
+
text-decoration: none;
|
|
94
|
+
}
|
|
95
|
+
.SideNav_item__ZmExN a:hover {
|
|
96
|
+
color: var(--primary-color);
|
|
97
|
+
}
|
|
98
|
+
.SideNav_item__ZmExN.SideNav_selected__Y2U0Y {
|
|
99
|
+
color: var(--font-color);
|
|
100
|
+
border-color: var(--primary-color);
|
|
101
|
+
}
|
|
102
|
+
.SideNav_items__MWIxZ header {
|
|
103
|
+
padding: var(--padding-y) 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* virtual-css:css:cfe8b8b36b207068aec9d9119cf71383 */
|
|
107
|
+
.ContentArea_content__YzBjN {
|
|
108
|
+
font-size: 16px;
|
|
109
|
+
margin-bottom: 60px;
|
|
110
|
+
}
|
|
111
|
+
.ContentArea_content__YzBjN > p {
|
|
112
|
+
color: var(--font-muted-color);
|
|
113
|
+
line-height: 1.8;
|
|
114
|
+
}
|
|
115
|
+
.ContentArea_content__YzBjN a {
|
|
116
|
+
color: var(--font-color);
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
text-decoration: underline var(--font-faded-color);
|
|
119
|
+
text-underline-offset: 4px;
|
|
120
|
+
}
|
|
121
|
+
.ContentArea_content__YzBjN a:hover {
|
|
122
|
+
text-decoration: underline var(--font-color);
|
|
123
|
+
}
|
|
124
|
+
.ContentArea_content__YzBjN h1 {
|
|
125
|
+
font-size: var(--font-size-8);
|
|
126
|
+
letter-spacing: var(--letter-spacing-1);
|
|
127
|
+
margin: 0 0 var(--spacing-4) 0;
|
|
128
|
+
}
|
|
129
|
+
.ContentArea_content__YzBjN h2 {
|
|
130
|
+
font-size: var(--font-size-6);
|
|
131
|
+
letter-spacing: var(--letter-spacing-1);
|
|
132
|
+
margin: var(--spacing-8) 0 var(--spacing-4) 0;
|
|
133
|
+
}
|
|
134
|
+
.ContentArea_content__YzBjN h3 {
|
|
135
|
+
font-size: var(--font-size-5);
|
|
136
|
+
letter-spacing: var(--letter-spacing-1);
|
|
137
|
+
margin: var(--spacing-7) 0 var(--spacing-4) 0;
|
|
138
|
+
}
|
|
139
|
+
.ContentArea_content__YzBjN ul {
|
|
140
|
+
list-style: disc;
|
|
141
|
+
}
|
|
142
|
+
.ContentArea_content__YzBjN ol {
|
|
143
|
+
list-style: decimal;
|
|
144
|
+
}
|
|
145
|
+
.ContentArea_content__YzBjN pre {
|
|
146
|
+
margin: var(--spacing-5) 0;
|
|
147
|
+
}
|
|
148
|
+
.ContentArea_content__YzBjN code {
|
|
149
|
+
font-size: 14px;
|
|
150
|
+
}
|
|
151
|
+
.ContentArea_content__YzBjN code:not([class]) {
|
|
152
|
+
font-family: var(--font-family-code);
|
|
153
|
+
color: var(--font-color);
|
|
154
|
+
padding: var(--spacing-1);
|
|
155
|
+
border-radius: var(--border-radius);
|
|
156
|
+
background: var(--base-color-50);
|
|
157
|
+
font-weight: var(--font-weight-bold);
|
|
158
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Generated by dts-bundle v0.7.3
|
|
2
|
+
// Dependencies for this module:
|
|
3
|
+
// ../../react
|
|
4
|
+
|
|
5
|
+
declare module '@umami/shiso' {
|
|
6
|
+
export * from '@umami/shiso/blog/Blog';
|
|
7
|
+
export * from '@umami/shiso/docs/Callout';
|
|
8
|
+
export * from '@umami/shiso/docs/CodeBlock';
|
|
9
|
+
export * from '@umami/shiso/docs/Docs';
|
|
10
|
+
export * from '@umami/shiso/docs/SideNav';
|
|
11
|
+
export * from '@umami/shiso/docs/Note';
|
|
12
|
+
export * from '@umami/shiso/docs/PageLinks';
|
|
13
|
+
export * from '@umami/shiso/docs/TopNav';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare module '@umami/shiso/blog/Blog' {
|
|
17
|
+
export interface BlogProps {
|
|
18
|
+
content: any;
|
|
19
|
+
config: any;
|
|
20
|
+
}
|
|
21
|
+
export function Blog({ content }: BlogProps): import("react").JSX.Element;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module '@umami/shiso/docs/Callout' {
|
|
25
|
+
import { ReactNode } from 'react';
|
|
26
|
+
export interface CalloutProps {
|
|
27
|
+
variant: 'note' | 'warning' | 'info' | 'tip';
|
|
28
|
+
icon?: ReactNode;
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export default function Callout({ variant, icon, children }: CalloutProps): import("react").JSX.Element;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '@umami/shiso/docs/CodeBlock' {
|
|
35
|
+
export function CodeBlock(props: any): import("react").JSX.Element;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare module '@umami/shiso/docs/Docs' {
|
|
39
|
+
import { ShisoConfig } from '@umami/shiso/Shiso';
|
|
40
|
+
export interface contentsProps {
|
|
41
|
+
config: ShisoConfig;
|
|
42
|
+
content: any;
|
|
43
|
+
}
|
|
44
|
+
export function Docs({ content, config }: contentsProps): import("react").JSX.Element;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare module '@umami/shiso/docs/SideNav' {
|
|
48
|
+
import React from 'react';
|
|
49
|
+
export interface SideNavProps {
|
|
50
|
+
tabs: any;
|
|
51
|
+
navigation: any;
|
|
52
|
+
}
|
|
53
|
+
export default function SideNav({ tabs, navigation }: SideNavProps): React.JSX.Element;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
declare module '@umami/shiso/docs/Note' {
|
|
57
|
+
export function Note({ children }: {
|
|
58
|
+
children: React.ReactNode;
|
|
59
|
+
}): import("react").JSX.Element;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare module '@umami/shiso/docs/PageLinks' {
|
|
63
|
+
export default function PageLinks({ items, offset }: {
|
|
64
|
+
items: any;
|
|
65
|
+
offset?: number | undefined;
|
|
66
|
+
}): import("react").JSX.Element | null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare module '@umami/shiso/docs/TopNav' {
|
|
70
|
+
export default function TopNav({ tabs }: {
|
|
71
|
+
tabs: any;
|
|
72
|
+
}): import("react").JSX.Element;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
declare module '@umami/shiso/Shiso' {
|
|
76
|
+
import { ReactNode } from 'react';
|
|
77
|
+
export interface ShisoConfig {
|
|
78
|
+
contentDir: string;
|
|
79
|
+
docs?: {
|
|
80
|
+
[key: string]: any;
|
|
81
|
+
};
|
|
82
|
+
blog?: {
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export interface ShisoProps {
|
|
87
|
+
config: ShisoConfig;
|
|
88
|
+
children: ReactNode;
|
|
89
|
+
}
|
|
90
|
+
export const ShisoContext: import("react").Context<{
|
|
91
|
+
config: ShisoConfig;
|
|
92
|
+
}>;
|
|
93
|
+
export function Shiso({ config, children }: ShisoProps): import("react").JSX.Element;
|
|
94
|
+
}
|
|
95
|
+
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
Blog: () => Blog,
|
|
34
|
+
Docs: () => Docs,
|
|
35
|
+
next: () => next_exports
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(src_exports);
|
|
38
|
+
|
|
39
|
+
// css-modules:E:\dev\umami-shiso\src\components\blog\Blog.module.css
|
|
40
|
+
var Blog_default = {};
|
|
41
|
+
|
|
42
|
+
// src/components/Markdown.tsx
|
|
43
|
+
var import_rsc = require("next-mdx-remote/rsc");
|
|
44
|
+
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
45
|
+
var import_rehype_highlight = __toESM(require("rehype-highlight"));
|
|
46
|
+
var import_link = __toESM(require("next/link"));
|
|
47
|
+
|
|
48
|
+
// src/components/docs/CodeBlock.tsx
|
|
49
|
+
var import_react = require("react");
|
|
50
|
+
var import_react_zen = require("@umami/react-zen");
|
|
51
|
+
|
|
52
|
+
// css-modules:E:\dev\umami-shiso\src\components\docs\CodeBlock.module.css
|
|
53
|
+
var CodeBlock_default = { "container": "CodeBlock_container__ZWQ3M", "button": "CodeBlock_button__YzlkO", "copy": "CodeBlock_copy__MGRjZ", "check": "CodeBlock_check__YTZlN" };
|
|
54
|
+
|
|
55
|
+
// src/components/docs/CodeBlock.tsx
|
|
56
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
57
|
+
function CodeBlock(props) {
|
|
58
|
+
const textInput = (0, import_react.useRef)(null);
|
|
59
|
+
const [copied, setCopied] = (0, import_react.useState)(false);
|
|
60
|
+
const handleCopy = () => {
|
|
61
|
+
setCopied(true);
|
|
62
|
+
navigator?.clipboard?.writeText(textInput?.current?.textContent);
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
setCopied(false);
|
|
65
|
+
}, 1e3);
|
|
66
|
+
};
|
|
67
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("pre", { ref: textInput, className: CodeBlock_default.container, children: [
|
|
68
|
+
props.children,
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { "aria-label": "Copy code", className: CodeBlock_default.button, onClick: handleCopy, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_zen.Icon, { size: "sm", className: copied ? CodeBlock_default.check : CodeBlock_default.copy, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_zen.Icons.Check, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_zen.Icons.Copy, {}) }) })
|
|
70
|
+
] });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/components/Markdown.tsx
|
|
74
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
75
|
+
var options = {
|
|
76
|
+
mdxOptions: {
|
|
77
|
+
remarkPlugins: [import_remark_gfm.default],
|
|
78
|
+
rehypePlugins: [import_rehype_highlight.default]
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var components = {
|
|
82
|
+
a: (props) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_link.default, { ...props }),
|
|
83
|
+
pre: CodeBlock
|
|
84
|
+
};
|
|
85
|
+
function Markdown({ children }) {
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_rsc.MDXRemote, { source: children, components, options });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/components/blog/Blog.tsx
|
|
90
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
91
|
+
function Blog({ content }) {
|
|
92
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: Blog_default.blog, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: Blog_default.main, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: Blog_default.content, children: [
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { children: content?.meta?.title }),
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: Blog_default.description, children: content?.meta?.description }),
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Markdown, { children: content?.body })
|
|
96
|
+
] }) }) });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/components/docs/Docs.tsx
|
|
100
|
+
var import_react_zen6 = require("@umami/react-zen");
|
|
101
|
+
|
|
102
|
+
// src/components/docs/PageLinks.tsx
|
|
103
|
+
var import_react2 = require("react");
|
|
104
|
+
var import_react_zen2 = require("@umami/react-zen");
|
|
105
|
+
var import_classnames = __toESM(require("classnames"));
|
|
106
|
+
|
|
107
|
+
// css-modules:E:\dev\umami-shiso\src\components\docs\PageLinks.module.css
|
|
108
|
+
var PageLinks_default = { "title": "PageLinks_title__NDFiN", "links": "PageLinks_links__NDRmO", "indent-1": "PageLinks_indent-1__ODFiY", "indent-2": "PageLinks_indent-2__OTFkY", "indent-3": "PageLinks_indent-3__ZGM3O", "indent-4": "PageLinks_indent-4__Y2U0M", "indent-5": "PageLinks_indent-5__MzUwM", "indent-6": "PageLinks_indent-6__ZTQ4M", "selected": "PageLinks_selected__MDVlN" };
|
|
109
|
+
|
|
110
|
+
// src/components/docs/PageLinks.tsx
|
|
111
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
112
|
+
function PageLinks({ items, offset = 0 }) {
|
|
113
|
+
const [hash, setHash] = (0, import_react2.useState)(items?.[0]?.id);
|
|
114
|
+
(0, import_react2.useEffect)(() => {
|
|
115
|
+
const callback = () => {
|
|
116
|
+
const x = [...items].reverse().find(({ id }) => {
|
|
117
|
+
const rect = document.getElementById(id)?.getBoundingClientRect();
|
|
118
|
+
return rect && rect.top <= offset;
|
|
119
|
+
});
|
|
120
|
+
if (x) setHash(x.id);
|
|
121
|
+
};
|
|
122
|
+
window.addEventListener("scroll", callback, false);
|
|
123
|
+
return () => {
|
|
124
|
+
window.removeEventListener("scroll", callback, false);
|
|
125
|
+
};
|
|
126
|
+
}, []);
|
|
127
|
+
if (!items?.length) {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_zen2.Column, { gap: "3", minWidth: "240px", className: PageLinks_default.links, children: [
|
|
131
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_zen2.Text, { size: "2", weight: "bold", children: "On this page" }),
|
|
132
|
+
items.map(({ name, id, size }) => {
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
134
|
+
"a",
|
|
135
|
+
{
|
|
136
|
+
href: `#${id}`,
|
|
137
|
+
className: (0, import_classnames.default)(PageLinks_default[`indent-${size}`], { [PageLinks_default.selected]: hash === id }),
|
|
138
|
+
children: name
|
|
139
|
+
},
|
|
140
|
+
id
|
|
141
|
+
);
|
|
142
|
+
})
|
|
143
|
+
] });
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/components/docs/SideNav.tsx
|
|
147
|
+
var import_react_zen3 = require("@umami/react-zen");
|
|
148
|
+
var import_classnames2 = __toESM(require("classnames"));
|
|
149
|
+
var import_navigation = require("next/navigation");
|
|
150
|
+
var import_link2 = __toESM(require("next/link"));
|
|
151
|
+
|
|
152
|
+
// css-modules:E:\dev\umami-shiso\src\components\docs\SideNav.module.css
|
|
153
|
+
var SideNav_default = { "nav": "SideNav_nav__NmRlZ", "item": "SideNav_item__ZmExN", "selected": "SideNav_selected__Y2U0Y", "items": "SideNav_items__MWIxZ" };
|
|
154
|
+
|
|
155
|
+
// src/components/docs/SideNav.tsx
|
|
156
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
157
|
+
function SideNav({ tabs, navigation }) {
|
|
158
|
+
const pathname = (0, import_navigation.usePathname)();
|
|
159
|
+
const tab = tabs.find(({ url, id }) => id !== "docs" ? pathname.startsWith(url) : false);
|
|
160
|
+
const menu = navigation[tab?.id || "docs"];
|
|
161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_zen3.Box, { className: SideNav_default.nav, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_zen3.List, { items: navigation, children: menu.map(({ group, pages }) => {
|
|
162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react_zen3.ListSection, { title: group, className: SideNav_default.items, children: pages.map(({ label: text, url }, index) => {
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
164
|
+
import_react_zen3.ListItem,
|
|
165
|
+
{
|
|
166
|
+
className: (0, import_classnames2.default)(SideNav_default.item, {
|
|
167
|
+
[SideNav_default.selected]: url === pathname
|
|
168
|
+
}),
|
|
169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_link2.default, { href: url, prefetch: false, children: text })
|
|
170
|
+
},
|
|
171
|
+
index
|
|
172
|
+
);
|
|
173
|
+
}) }, group);
|
|
174
|
+
}) }) });
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// src/components/docs/TopNav.tsx
|
|
178
|
+
var import_link3 = __toESM(require("next/link"));
|
|
179
|
+
var import_navigation2 = require("next/navigation");
|
|
180
|
+
var import_react_zen4 = require("@umami/react-zen");
|
|
181
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
182
|
+
function TopNav({ tabs }) {
|
|
183
|
+
const pathname = (0, import_navigation2.usePathname)();
|
|
184
|
+
const tab = tabs.find(({ id, url }) => id !== "docs" ? pathname.startsWith(url) : false);
|
|
185
|
+
const selected = tab?.id || "docs";
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen4.Tabs, { selectedKey: selected, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen4.TabList, { items: tabs, children: ({ id, label, url }) => {
|
|
187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_zen4.Tab, { id, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_link3.default, { href: url, children: label }) });
|
|
188
|
+
} }) });
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// src/components/docs/ContentArea.tsx
|
|
192
|
+
var import_react_zen5 = require("@umami/react-zen");
|
|
193
|
+
|
|
194
|
+
// css-modules:E:\dev\umami-shiso\src\components\docs\ContentArea.module.css
|
|
195
|
+
var ContentArea_default = { "content": "ContentArea_content__YzBjN" };
|
|
196
|
+
|
|
197
|
+
// src/components/docs/ContentArea.tsx
|
|
198
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
199
|
+
function ContentArea({ title, description, group, body }) {
|
|
200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_react_zen5.Box, { flexGrow: 1, children: [
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen5.Text, { color: "primary", weight: "bold", children: group }),
|
|
202
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen5.Heading, { size: "8", as: "h1", children: title }),
|
|
203
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen5.Text, { type: "muted", children: description }),
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_react_zen5.Box, { className: ContentArea_default.content, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Markdown, { children: body }) })
|
|
205
|
+
] });
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// src/components/docs/Docs.tsx
|
|
209
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
210
|
+
function Docs({ content, config }) {
|
|
211
|
+
if (!content) {
|
|
212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_zen6.Heading, { size: "6", children: "Page not found" });
|
|
213
|
+
}
|
|
214
|
+
const { tabs, navigation } = config?.docs || {};
|
|
215
|
+
content.group = Object.keys(navigation).reduce((name, key) => {
|
|
216
|
+
if (!name) {
|
|
217
|
+
return navigation[key]?.find((section) => {
|
|
218
|
+
return section.pages.find(
|
|
219
|
+
(page) => page.url === `/docs/${content.id}` || page.url === `/docs` && content.id === "index"
|
|
220
|
+
);
|
|
221
|
+
})?.group;
|
|
222
|
+
}
|
|
223
|
+
return name;
|
|
224
|
+
}, null);
|
|
225
|
+
console.log({ config, tabs, content });
|
|
226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_zen6.Box, { flexGrow: "1", children: [
|
|
227
|
+
tabs && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TopNav, { tabs }),
|
|
228
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_react_zen6.Grid, { gap: "6", columns: "240px 1fr 240px", children: [
|
|
229
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SideNav, { tabs, navigation }),
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
231
|
+
ContentArea,
|
|
232
|
+
{
|
|
233
|
+
title: content?.meta?.title,
|
|
234
|
+
body: content?.body,
|
|
235
|
+
group: content?.group,
|
|
236
|
+
description: content?.meta?.description
|
|
237
|
+
}
|
|
238
|
+
),
|
|
239
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PageLinks, { items: content?.anchors, offset: 150 })
|
|
240
|
+
] })
|
|
241
|
+
] });
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/lib/next.tsx
|
|
245
|
+
var next_exports = {};
|
|
246
|
+
__export(next_exports, {
|
|
247
|
+
default: () => next_default
|
|
248
|
+
});
|
|
249
|
+
var import_node_path2 = __toESM(require("node:path"));
|
|
250
|
+
|
|
251
|
+
// src/lib/content.ts
|
|
252
|
+
var import_react3 = require("react");
|
|
253
|
+
var import_gray_matter = __toESM(require("gray-matter"));
|
|
254
|
+
var import_recursive_readdir = __toESM(require("recursive-readdir"));
|
|
255
|
+
var import_thenby = require("thenby");
|
|
256
|
+
var import_promises = __toESM(require("node:fs/promises"));
|
|
257
|
+
var import_node_path = __toESM(require("node:path"));
|
|
258
|
+
var getFiles = (0, import_react3.cache)(async (folder) => {
|
|
259
|
+
const dir = import_node_path.default.resolve(folder);
|
|
260
|
+
const files = await (0, import_recursive_readdir.default)(dir);
|
|
261
|
+
return Promise.all(
|
|
262
|
+
files.filter((file) => import_node_path.default.extname(file) === ".mdx").map(async (file) => {
|
|
263
|
+
const postContent = await import_promises.default.readFile(file, "utf8");
|
|
264
|
+
const { data, content } = (0, import_gray_matter.default)(postContent);
|
|
265
|
+
const id = file.replace(".mdx", "").replace(dir, "").replace(/\\/g, "/").replace(/^\//, "");
|
|
266
|
+
const anchors = [];
|
|
267
|
+
const body = content.split("\n").map((line) => {
|
|
268
|
+
const match = line.match(/(#+)\s+(.*)/);
|
|
269
|
+
if (match) {
|
|
270
|
+
const [, num, name] = match;
|
|
271
|
+
const id2 = name.toLowerCase().replace(/\s+/g, "-");
|
|
272
|
+
const size = num.length;
|
|
273
|
+
anchors.push({ name, id: id2, size });
|
|
274
|
+
return `<h${size} id="${id2}">${name.replace(/\{|\}/g, "")}</h${size}>`;
|
|
275
|
+
}
|
|
276
|
+
return line;
|
|
277
|
+
}).join("\n");
|
|
278
|
+
return {
|
|
279
|
+
meta: data,
|
|
280
|
+
id,
|
|
281
|
+
body,
|
|
282
|
+
anchors
|
|
283
|
+
};
|
|
284
|
+
})
|
|
285
|
+
).then((posts) => posts.sort((0, import_thenby.firstBy)("date", "desc")));
|
|
286
|
+
});
|
|
287
|
+
async function getFile(id, folder) {
|
|
288
|
+
const files = await getFiles(folder);
|
|
289
|
+
return files.find((file) => file?.id === id);
|
|
290
|
+
}
|
|
291
|
+
async function getContent(params, folder) {
|
|
292
|
+
const { id = [] } = params;
|
|
293
|
+
const name = id?.length ? id.join("/") : "index";
|
|
294
|
+
return getFile(name, folder);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// src/lib/next.tsx
|
|
298
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
299
|
+
var DEFAULT_CONTENT_DIR = "./src/content";
|
|
300
|
+
var components2 = {
|
|
301
|
+
docs: Docs,
|
|
302
|
+
blog: Blog
|
|
303
|
+
};
|
|
304
|
+
var next_default = (config) => {
|
|
305
|
+
const { contentDir = DEFAULT_CONTENT_DIR } = config || {};
|
|
306
|
+
const getMetadata = ({ title }) => {
|
|
307
|
+
return async ({ params }) => {
|
|
308
|
+
const content = await getContent(await params, contentDir);
|
|
309
|
+
return {
|
|
310
|
+
title: {
|
|
311
|
+
absolute: `${content?.meta?.title} \u2013 ${title}`,
|
|
312
|
+
default: title
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
const renderPage = ({ type }) => {
|
|
318
|
+
const folder = import_node_path2.default.resolve(process.cwd(), contentDir, type);
|
|
319
|
+
return async ({ params }) => {
|
|
320
|
+
const content = await getContent(await params, folder);
|
|
321
|
+
const Component = components2[type];
|
|
322
|
+
return Component && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Component, { content, config });
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
return {
|
|
326
|
+
getMetadata,
|
|
327
|
+
renderPage
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
331
|
+
0 && (module.exports = {
|
|
332
|
+
Blog,
|
|
333
|
+
Docs,
|
|
334
|
+
next
|
|
335
|
+
});
|