@umami/shiso 0.48.0 → 0.50.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/README.md CHANGED
@@ -20,7 +20,7 @@ In your `app` folder, create a folder for the content section you wish to add. I
20
20
  src
21
21
  ├── app
22
22
  │ └── docs
23
- │ └── [[...id]]
23
+ │ └── [[...slug]]
24
24
  │ └── page.jsx
25
25
  ```
26
26
 
package/dist/index.css CHANGED
@@ -38,22 +38,23 @@
38
38
  }
39
39
 
40
40
  /* virtual-css:css:2dd9c1a25bf05a14c9a7ab7ce1da6aef */
41
- .CodeBlock_container__NjNhN {
41
+ .CodeBlock_container__YzkwN {
42
42
  position: relative;
43
- background: var(--base-color-12);
43
+ background: var(--background-color);
44
+ border: 1px solid var(--base-color-1);
44
45
  padding: var(--spacing-5);
45
46
  border-radius: 6px;
46
47
  white-space: pre-wrap;
47
48
  word-wrap: break-word;
48
49
  }
49
- pre.CodeBlock_container__NjNhN code {
50
+ pre.CodeBlock_container__YzkwN code {
50
51
  font-family: var(--font-family-code);
51
- color: var(--base-color-4);
52
+ color: var(--font-color);
52
53
  padding: 0;
53
54
  border: 0;
54
55
  background: transparent;
55
56
  }
56
- .CodeBlock_button__YzMzM {
57
+ .CodeBlock_button__ZjNjN {
57
58
  border: 0;
58
59
  position: absolute;
59
60
  right: var(--spacing-5);
@@ -61,13 +62,13 @@ pre.CodeBlock_container__NjNhN code {
61
62
  cursor: pointer;
62
63
  background: transparent;
63
64
  }
64
- .CodeBlock_copy__MjRhM {
65
+ .CodeBlock_copy__Y2UyM {
65
66
  color: var(--base-color-4);
66
67
  }
67
- .CodeBlock_copy__MjRhM:hover {
68
+ .CodeBlock_copy__Y2UyM:hover {
68
69
  color: var(--base-color-1);
69
70
  }
70
- .CodeBlock_check__YTc2M {
71
+ .CodeBlock_check__ODM5Z {
71
72
  color: var(--success-color);
72
73
  }
73
74
 
package/dist/index.d.ts CHANGED
@@ -21,8 +21,9 @@ declare module '@umami/shiso/Blog' {
21
21
  date?: string;
22
22
  image?: string;
23
23
  anchors?: any[];
24
+ backUrl?: string;
24
25
  }
25
- export function Blog({ title, code, author, date, image, anchors }: BlogProps): import("react").JSX.Element;
26
+ export function Blog({ title, code, author, date, image, anchors, backUrl }: BlogProps): import("react").JSX.Element;
26
27
  }
27
28
 
28
29
  declare module '@umami/shiso/Docs' {
package/dist/index.js CHANGED
@@ -100,9 +100,10 @@ var import_react2 = require("react");
100
100
  var import_react_zen2 = require("@umami/react-zen");
101
101
 
102
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" };
103
+ var CodeBlock_default = { "container": "CodeBlock_container__YzkwN", "button": "CodeBlock_button__ZjNjN", "copy": "CodeBlock_copy__Y2UyM", "check": "CodeBlock_check__ODM5Z" };
104
104
 
105
105
  // src/components/CodeBlock.tsx
106
+ var import_classnames2 = __toESM(require("classnames"));
106
107
  var import_jsx_runtime2 = require("react/jsx-runtime");
107
108
  function CodeBlock(props) {
108
109
  const textInput = (0, import_react2.useRef)(null);
@@ -114,7 +115,7 @@ function CodeBlock(props) {
114
115
  setCopied(false);
115
116
  }, 1e3);
116
117
  };
117
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("pre", { ref: textInput, className: CodeBlock_default.container, children: [
118
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("pre", { ref: textInput, className: (0, import_classnames2.default)(CodeBlock_default.container, "dark-theme"), children: [
118
119
  props.children,
119
120
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { "aria-label": "Copy code", className: CodeBlock_default.button, onClick: handleCopy, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_zen2.Icon, { size: "sm", className: copied ? CodeBlock_default.check : CodeBlock_default.copy, children: copied ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_zen2.Icons.Check, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_zen2.Icons.Copy, {}) }) })
120
121
  ] });
@@ -126,7 +127,7 @@ var import_react_zen7 = require("@umami/react-zen");
126
127
  // src/components/SideNav.tsx
127
128
  var import_react3 = require("react");
128
129
  var import_react_zen3 = require("@umami/react-zen");
129
- var import_classnames2 = __toESM(require("classnames"));
130
+ var import_classnames3 = __toESM(require("classnames"));
130
131
  var import_navigation = require("next/navigation");
131
132
  var import_link = __toESM(require("next/link"));
132
133
 
@@ -161,7 +162,7 @@ function SideNav({
161
162
  {
162
163
  ...props,
163
164
  id: "shiso_docs_sidenav",
164
- className: (0, import_classnames2.default)(SideNav_default.nav, isSticky && SideNav_default.sticky, className),
165
+ className: (0, import_classnames3.default)(SideNav_default.nav, isSticky && SideNav_default.sticky, className),
165
166
  style: { ...style, height },
166
167
  children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_zen3.Column, { "aria-label": "nav", gap: "6", children: menu.map(({ section, pages }) => {
167
168
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_zen3.Column, { title: section, className: SideNav_default.items, children: [
@@ -170,7 +171,7 @@ function SideNav({
170
171
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
171
172
  import_link.default,
172
173
  {
173
- className: (0, import_classnames2.default)(SideNav_default.item, {
174
+ className: (0, import_classnames3.default)(SideNav_default.item, {
174
175
  [SideNav_default.selected]: url === pathname
175
176
  }),
176
177
  href: url,
@@ -401,12 +402,15 @@ function Card({ title, description, date, author, url, image }) {
401
402
 
402
403
  // src/components/Blogs.tsx
403
404
  var import_jsx_runtime9 = require("react/jsx-runtime");
404
- function Blogs({ content, config }) {
405
+ function Blogs({ content, config, ...props }) {
405
406
  if (!Array.isArray(content)) {
406
407
  const { meta, code, anchors, slug } = content;
407
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Blog, { ...meta, code, anchors });
408
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Blog, { ...props, ...meta, slug, code, anchors, backUrl: "/blog" });
408
409
  }
409
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Grid, { gap: "5", columns: "repeat(auto-fit, minmax(400px, 1fr)", children: content?.sort((a, b) => new Date(b.meta.date).getTime() - new Date(a.meta.date).getTime()).map(({ meta, slug }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Card, { url: `/blog/${slug}`, ...meta }, slug)) });
410
+ const items = content.sort(
411
+ (a, b) => new Date(b?.meta?.date).getTime() - new Date(a?.meta?.date).getTime()
412
+ );
413
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_zen9.Grid, { gap: "5", columns: "repeat(auto-fit, minmax(400px, 1fr)", children: items?.map(({ meta, slug }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Card, { url: `/blog/${slug}`, ...meta }, slug)) });
410
414
  }
411
415
 
412
416
  // src/components/Shiso.tsx
@@ -435,8 +439,9 @@ function useShiso() {
435
439
  }
436
440
 
437
441
  // src/components/Blog.tsx
442
+ var import_link5 = __toESM(require("next/link"));
438
443
  var import_jsx_runtime11 = require("react/jsx-runtime");
439
- function Blog({ title, code, author, date, image, anchors }) {
444
+ function Blog({ title, code, author, date, image, anchors, backUrl }) {
440
445
  const { config } = useShiso();
441
446
  const { top } = config?.blog || {};
442
447
  const linksDisplay = {
@@ -460,7 +465,11 @@ function Blog({ title, code, author, date, image, anchors }) {
460
465
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_zen11.Row, { gap: "6", children: [
461
466
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Markdown, { code }),
462
467
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PageLinks, { display: linksDisplay, items: anchors, style: { top } })
463
- ] })
468
+ ] }),
469
+ backUrl && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Row, { justifyContent: "flex-start", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Button, { style: { width: "auto" }, asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_link5.default, { href: backUrl, children: [
470
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Icon, { rotate: 180, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Icons.Arrow, {}) }),
471
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_zen11.Text, { children: "Back" })
472
+ ] }) }) })
464
473
  ] });
465
474
  }
466
475
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/components/Blog.tsx
4
- import { Heading as Heading5, Box as Box7, Text as Text6, Row as Row5, Column as Column5, Image as Image2 } from "@umami/react-zen";
4
+ import { Heading as Heading4, Box as Box6, Text as Text6, Row as Row4, Column as Column4, Image as Image2, Icon as Icon5, Icons as Icons5, Button as Button3 } from "@umami/react-zen";
5
5
  import { format as format2 } from "date-fns";
6
6
 
7
7
  // src/components/PageLinks.tsx
@@ -63,9 +63,10 @@ import { useState as useState2, useRef } from "react";
63
63
  import { Icon, Icons } from "@umami/react-zen";
64
64
 
65
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" };
66
+ var CodeBlock_default = { "container": "CodeBlock_container__YzkwN", "button": "CodeBlock_button__ZjNjN", "copy": "CodeBlock_copy__Y2UyM", "check": "CodeBlock_check__ODM5Z" };
67
67
 
68
68
  // src/components/CodeBlock.tsx
69
+ import classNames2 from "classnames";
69
70
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
70
71
  function CodeBlock(props) {
71
72
  const textInput = useRef(null);
@@ -77,7 +78,7 @@ function CodeBlock(props) {
77
78
  setCopied(false);
78
79
  }, 1e3);
79
80
  };
80
- return /* @__PURE__ */ jsxs2("pre", { ref: textInput, className: CodeBlock_default.container, children: [
81
+ return /* @__PURE__ */ jsxs2("pre", { ref: textInput, className: classNames2(CodeBlock_default.container, "dark-theme"), children: [
81
82
  props.children,
82
83
  /* @__PURE__ */ jsx2("button", { "aria-label": "Copy code", className: CodeBlock_default.button, onClick: handleCopy, children: /* @__PURE__ */ jsx2(Icon, { size: "sm", className: copied ? CodeBlock_default.check : CodeBlock_default.copy, children: copied ? /* @__PURE__ */ jsx2(Icons.Check, {}) : /* @__PURE__ */ jsx2(Icons.Copy, {}) }) })
83
84
  ] });
@@ -100,7 +101,7 @@ import {
100
101
  // src/components/SideNav.tsx
101
102
  import { useEffect as useEffect2, useState as useState3 } from "react";
102
103
  import { Text as Text2, Column as Column2 } from "@umami/react-zen";
103
- import classNames2 from "classnames";
104
+ import classNames3 from "classnames";
104
105
  import { usePathname } from "next/navigation";
105
106
  import Link from "next/link";
106
107
 
@@ -135,7 +136,7 @@ function SideNav({
135
136
  {
136
137
  ...props,
137
138
  id: "shiso_docs_sidenav",
138
- className: classNames2(SideNav_default.nav, isSticky && SideNav_default.sticky, className),
139
+ className: classNames3(SideNav_default.nav, isSticky && SideNav_default.sticky, className),
139
140
  style: { ...style, height },
140
141
  children: /* @__PURE__ */ jsx3(Column2, { "aria-label": "nav", gap: "6", children: menu.map(({ section, pages }) => {
141
142
  return /* @__PURE__ */ jsxs3(Column2, { title: section, className: SideNav_default.items, children: [
@@ -144,7 +145,7 @@ function SideNav({
144
145
  return /* @__PURE__ */ jsx3(
145
146
  Link,
146
147
  {
147
- className: classNames2(SideNav_default.item, {
148
+ className: classNames3(SideNav_default.item, {
148
149
  [SideNav_default.selected]: url === pathname
149
150
  }),
150
151
  href: url,
@@ -374,12 +375,15 @@ function Card({ title, description, date, author, url, image }) {
374
375
 
375
376
  // src/components/Blogs.tsx
376
377
  import { jsx as jsx9 } from "react/jsx-runtime";
377
- function Blogs({ content, config }) {
378
+ function Blogs({ content, config, ...props }) {
378
379
  if (!Array.isArray(content)) {
379
380
  const { meta, code, anchors, slug } = content;
380
- return /* @__PURE__ */ jsx9(Blog, { ...meta, code, anchors });
381
+ return /* @__PURE__ */ jsx9(Blog, { ...props, ...meta, slug, code, anchors, backUrl: "/blog" });
381
382
  }
382
- return /* @__PURE__ */ jsx9(Grid, { gap: "5", columns: "repeat(auto-fit, minmax(400px, 1fr)", children: content?.sort((a, b) => new Date(b.meta.date).getTime() - new Date(a.meta.date).getTime()).map(({ meta, slug }) => /* @__PURE__ */ jsx9(Card, { url: `/blog/${slug}`, ...meta }, slug)) });
383
+ const items = content.sort(
384
+ (a, b) => new Date(b?.meta?.date).getTime() - new Date(a?.meta?.date).getTime()
385
+ );
386
+ return /* @__PURE__ */ jsx9(Grid, { gap: "5", columns: "repeat(auto-fit, minmax(400px, 1fr)", children: items?.map(({ meta, slug }) => /* @__PURE__ */ jsx9(Card, { url: `/blog/${slug}`, ...meta }, slug)) });
383
387
  }
384
388
 
385
389
  // src/components/Shiso.tsx
@@ -408,8 +412,9 @@ function useShiso() {
408
412
  }
409
413
 
410
414
  // src/components/Blog.tsx
415
+ import Link5 from "next/link";
411
416
  import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
412
- function Blog({ title, code, author, date, image, anchors }) {
417
+ function Blog({ title, code, author, date, image, anchors, backUrl }) {
413
418
  const { config } = useShiso();
414
419
  const { top } = config?.blog || {};
415
420
  const linksDisplay = {
@@ -420,20 +425,24 @@ function Blog({ title, code, author, date, image, anchors }) {
420
425
  lg: "block",
421
426
  xl: "block"
422
427
  };
423
- return /* @__PURE__ */ jsxs8(Column5, { gap: "8", maxWidth: "960px", style: { margin: "0 auto" }, children: [
424
- /* @__PURE__ */ jsx11(Box7, { flexGrow: "1", paddingY: "6", children: title && /* @__PURE__ */ jsx11(Heading5, { size: "1", as: "h1", align: "center", children: title }) }),
425
- /* @__PURE__ */ jsxs8(Row5, { justifyContent: "space-between", children: [
428
+ return /* @__PURE__ */ jsxs8(Column4, { gap: "8", maxWidth: "960px", style: { margin: "0 auto" }, children: [
429
+ /* @__PURE__ */ jsx11(Box6, { flexGrow: "1", paddingY: "6", children: title && /* @__PURE__ */ jsx11(Heading4, { size: "1", as: "h1", align: "center", children: title }) }),
430
+ /* @__PURE__ */ jsxs8(Row4, { justifyContent: "space-between", children: [
426
431
  /* @__PURE__ */ jsx11(Text6, { color: "muted", children: date && format2(new Date(date), "PPP") }),
427
432
  /* @__PURE__ */ jsxs8(Text6, { color: "muted", children: [
428
433
  "Posted by ",
429
434
  author
430
435
  ] })
431
436
  ] }),
432
- image && /* @__PURE__ */ jsx11(Box7, { height: "480px", children: /* @__PURE__ */ jsx11(Image2, { src: image, alt: title, objectFit: "cover", borderRadius: "3" }) }),
433
- /* @__PURE__ */ jsxs8(Row5, { gap: "6", children: [
437
+ image && /* @__PURE__ */ jsx11(Box6, { height: "480px", children: /* @__PURE__ */ jsx11(Image2, { src: image, alt: title, objectFit: "cover", borderRadius: "3" }) }),
438
+ /* @__PURE__ */ jsxs8(Row4, { gap: "6", children: [
434
439
  /* @__PURE__ */ jsx11(Markdown, { code }),
435
440
  /* @__PURE__ */ jsx11(PageLinks, { display: linksDisplay, items: anchors, style: { top } })
436
- ] })
441
+ ] }),
442
+ backUrl && /* @__PURE__ */ jsx11(Row4, { justifyContent: "flex-start", children: /* @__PURE__ */ jsx11(Button3, { style: { width: "auto" }, asChild: true, children: /* @__PURE__ */ jsxs8(Link5, { href: backUrl, children: [
443
+ /* @__PURE__ */ jsx11(Icon5, { rotate: 180, children: /* @__PURE__ */ jsx11(Icons5.Arrow, {}) }),
444
+ /* @__PURE__ */ jsx11(Text6, { children: "Back" })
445
+ ] }) }) })
437
446
  ] });
438
447
  }
439
448
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umami/shiso",
3
- "version": "0.48.0",
3
+ "version": "0.50.0",
4
4
  "description": "A content layer for Next.js",
5
5
  "homepage": "https://umami.is/shiso",
6
6
  "repository": {
package/styles.css CHANGED
@@ -4363,22 +4363,23 @@ body a.Button_button__NmQ1Z {
4363
4363
  }
4364
4364
 
4365
4365
  /* virtual-css:css:2dd9c1a25bf05a14c9a7ab7ce1da6aef */
4366
- .CodeBlock_container__NjNhN {
4366
+ .CodeBlock_container__YzkwN {
4367
4367
  position: relative;
4368
- background: var(--base-color-12);
4368
+ background: var(--background-color);
4369
+ border: 1px solid var(--base-color-1);
4369
4370
  padding: var(--spacing-5);
4370
4371
  border-radius: 6px;
4371
4372
  white-space: pre-wrap;
4372
4373
  word-wrap: break-word;
4373
4374
  }
4374
- pre.CodeBlock_container__NjNhN code {
4375
+ pre.CodeBlock_container__YzkwN code {
4375
4376
  font-family: var(--font-family-code);
4376
- color: var(--base-color-4);
4377
+ color: var(--font-color);
4377
4378
  padding: 0;
4378
4379
  border: 0;
4379
4380
  background: transparent;
4380
4381
  }
4381
- .CodeBlock_button__YzMzM {
4382
+ .CodeBlock_button__ZjNjN {
4382
4383
  border: 0;
4383
4384
  position: absolute;
4384
4385
  right: var(--spacing-5);
@@ -4386,13 +4387,13 @@ pre.CodeBlock_container__NjNhN code {
4386
4387
  cursor: pointer;
4387
4388
  background: transparent;
4388
4389
  }
4389
- .CodeBlock_copy__MjRhM {
4390
+ .CodeBlock_copy__Y2UyM {
4390
4391
  color: var(--base-color-4);
4391
4392
  }
4392
- .CodeBlock_copy__MjRhM:hover {
4393
+ .CodeBlock_copy__Y2UyM:hover {
4393
4394
  color: var(--base-color-1);
4394
4395
  }
4395
- .CodeBlock_check__YTc2M {
4396
+ .CodeBlock_check__ODM5Z {
4396
4397
  color: var(--success-color);
4397
4398
  }
4398
4399