@hackersheet/next-document-content-components 0.1.0-alpha.1 → 0.1.0-alpha.3

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.
Files changed (29) hide show
  1. package/dist/cjs/components/code-block/code-block.d.ts +1 -1
  2. package/dist/cjs/components/code-block/code-block.js +3 -9
  3. package/dist/cjs/components/index.d.ts +1 -1
  4. package/dist/cjs/components/index.js +3 -3
  5. package/dist/cjs/components/link-card/link-card.js +1 -1
  6. package/dist/cjs/components/mermaid/mermaid.d.ts +6 -0
  7. package/dist/cjs/components/{code-block/code-block-mermaid.js → mermaid/mermaid.js} +5 -5
  8. package/dist/cjs/index.d.ts +1 -1
  9. package/dist/esm/components/code-block/code-block.d.mts +1 -1
  10. package/dist/esm/components/code-block/code-block.mjs +3 -9
  11. package/dist/esm/components/index.d.mts +1 -1
  12. package/dist/esm/components/index.mjs +2 -2
  13. package/dist/esm/components/link-card/link-card.mjs +1 -1
  14. package/dist/esm/components/mermaid/mermaid.d.mts +6 -0
  15. package/dist/esm/components/{code-block/code-block-mermaid.mjs → mermaid/mermaid.mjs} +2 -2
  16. package/dist/esm/index.d.mts +1 -1
  17. package/package.json +3 -17
  18. package/dist/cjs/components/code-block/code-block-kifu.d.ts +0 -9
  19. package/dist/cjs/components/code-block/code-block-kifu.js +0 -66
  20. package/dist/cjs/components/code-block/code-block-mermaid.d.ts +0 -8
  21. package/dist/cjs/components/kifu-to/kifu-to.d.ts +0 -6
  22. package/dist/cjs/components/kifu-to/kifu-to.js +0 -41
  23. package/dist/esm/components/code-block/code-block-kifu.d.mts +0 -9
  24. package/dist/esm/components/code-block/code-block-kifu.mjs +0 -36
  25. package/dist/esm/components/code-block/code-block-mermaid.d.mts +0 -8
  26. package/dist/esm/components/kifu-to/kifu-to.d.mts +0 -6
  27. package/dist/esm/components/kifu-to/kifu-to.mjs +0 -11
  28. package/dist/style.module.css +0 -279
  29. package/dist/style.module.scss.d.ts +0 -9
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { CodeBlockComponentProps } from '@hackersheet/react-document-content';
3
3
 
4
- declare function CodeBlock({ code, language }: CodeBlockComponentProps): Promise<React.JSX.Element>;
4
+ declare function CodeBlock({ code, ...props }: CodeBlockComponentProps): Promise<React.JSX.Element>;
5
5
 
6
6
  export { CodeBlock as default };
@@ -34,15 +34,9 @@ module.exports = __toCommonJS(code_block_exports);
34
34
  var import_react = __toESM(require("react"));
35
35
  var import_code_block_copy_button = __toESM(require("./code-block-copy-button"));
36
36
  var import_code_block_icon = __toESM(require("./code-block-icon"));
37
- var import_code_block_kifu = __toESM(require("./code-block-kifu"));
38
- var import_code_block_mermaid = __toESM(require("./code-block-mermaid"));
39
37
  var import_shiki = require("./shiki");
40
- async function CodeBlock({ code, language }) {
41
- const [lang, filename] = language.split(":");
42
- const isMermaid = lang === "mermaid";
43
- const isKifu = lang === "kifu";
44
- if (isMermaid) return /* @__PURE__ */ import_react.default.createElement(import_code_block_mermaid.default, { code });
45
- if (isKifu) return /* @__PURE__ */ import_react.default.createElement(import_code_block_kifu.default, { kifu: code, filename });
46
- const html = await (0, import_shiki.highlighteCode)(code, lang);
38
+ async function CodeBlock({ code, ...props }) {
39
+ const [language, filename] = props.language.split(":");
40
+ const html = await (0, import_shiki.highlighteCode)(code, language);
47
41
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "code-block" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "code-block-header" }, /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_code_block_icon.default, { language })), /* @__PURE__ */ import_react.default.createElement("div", { className: "code-block-filename" }, filename), /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(import_code_block_copy_button.default, { code }))), html && /* @__PURE__ */ import_react.default.createElement("div", { dangerouslySetInnerHTML: { __html: html } }), !html && /* @__PURE__ */ import_react.default.createElement("pre", null, code));
48
42
  }
@@ -1,8 +1,8 @@
1
1
  export { default as CodeBlock } from './code-block/code-block.js';
2
2
  export { default as Image } from './image/image.js';
3
- export { default as KifuTo } from './kifu-to/kifu-to.js';
4
3
  export { default as Link } from './link/link.js';
5
4
  export { default as LinkCard } from './link-card/link-card.js';
5
+ export { default as Mermaid } from './mermaid/mermaid.js';
6
6
  export { default as XPost } from './x-post/x-post.js';
7
7
  export { default as Youtube } from './youtube/youtube.js';
8
8
  import 'react';
@@ -30,27 +30,27 @@ var components_exports = {};
30
30
  __export(components_exports, {
31
31
  CodeBlock: () => import_code_block.default,
32
32
  Image: () => import_image.default,
33
- KifuTo: () => import_kifu_to.default,
34
33
  Link: () => import_link.default,
35
34
  LinkCard: () => import_link_card.default,
35
+ Mermaid: () => import_mermaid.default,
36
36
  XPost: () => import_x_post.default,
37
37
  Youtube: () => import_youtube.default
38
38
  });
39
39
  module.exports = __toCommonJS(components_exports);
40
40
  var import_code_block = __toESM(require("./code-block/code-block"));
41
41
  var import_image = __toESM(require("./image/image"));
42
- var import_kifu_to = __toESM(require("./kifu-to/kifu-to"));
43
42
  var import_link = __toESM(require("./link/link"));
44
43
  var import_link_card = __toESM(require("./link-card/link-card"));
44
+ var import_mermaid = __toESM(require("./mermaid/mermaid"));
45
45
  var import_x_post = __toESM(require("./x-post/x-post"));
46
46
  var import_youtube = __toESM(require("./youtube/youtube"));
47
47
  // Annotate the CommonJS export names for ESM import in node:
48
48
  0 && (module.exports = {
49
49
  CodeBlock,
50
50
  Image,
51
- KifuTo,
52
51
  Link,
53
52
  LinkCard,
53
+ Mermaid,
54
54
  XPost,
55
55
  Youtube
56
56
  });
@@ -43,5 +43,5 @@ function LinkCard({
43
43
  imageWidth
44
44
  }) {
45
45
  const faviconUrl = `https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://${domain}&size=16`;
46
- return /* @__PURE__ */ import_react.default.createElement("a", { href: url, className: "link-card" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-main" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-title" }, title), /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-description" }, description), /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-domain" }, /* @__PURE__ */ import_react.default.createElement("picture", null, /* @__PURE__ */ import_react.default.createElement("img", { src: faviconUrl, alt: `${domain} favicon`, width: 16, height: 16 })), /* @__PURE__ */ import_react.default.createElement("div", null, domain))), imageUrl && /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-image" }, /* @__PURE__ */ import_react.default.createElement(import_image.default, { alt: title, src: imageUrl, height: imageHeight, width: imageWidth })));
46
+ return /* @__PURE__ */ import_react.default.createElement("a", { href: url, className: "link-card" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-main" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-title-container" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-title" }, title)), /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-description" }, description), /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-domain" }, /* @__PURE__ */ import_react.default.createElement("picture", null, /* @__PURE__ */ import_react.default.createElement("img", { src: faviconUrl, alt: `${domain} favicon`, width: 16, height: 16 })), /* @__PURE__ */ import_react.default.createElement("div", null, domain))), imageUrl && /* @__PURE__ */ import_react.default.createElement("div", { className: "link-card-image" }, /* @__PURE__ */ import_react.default.createElement(import_image.default, { alt: title, src: imageUrl, height: imageHeight, width: imageWidth })));
47
47
  }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { MermaidComponentProps } from '@hackersheet/react-document-content';
3
+
4
+ declare function Mermaid({ code }: MermaidComponentProps): React.JSX.Element;
5
+
6
+ export { Mermaid as default };
@@ -27,11 +27,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  mod
28
28
  ));
29
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var code_block_mermaid_exports = {};
31
- __export(code_block_mermaid_exports, {
32
- default: () => CodeBlockMermaid
30
+ var mermaid_exports = {};
31
+ __export(mermaid_exports, {
32
+ default: () => Mermaid
33
33
  });
34
- module.exports = __toCommonJS(code_block_mermaid_exports);
34
+ module.exports = __toCommonJS(mermaid_exports);
35
35
  var import_crypto = require("crypto");
36
36
  var import_mermaid = __toESM(require("mermaid"));
37
37
  var import_next_themes = require("next-themes");
@@ -41,7 +41,7 @@ function createId(code) {
41
41
  hash.update(code);
42
42
  return "id-" + hash.digest("hex");
43
43
  }
44
- function CodeBlockMermaid({ code }) {
44
+ function Mermaid({ code }) {
45
45
  const ref = (0, import_react.useRef)(null);
46
46
  const [mounted, setMounted] = (0, import_react.useState)(false);
47
47
  const [svg, setSvg] = (0, import_react.useState)("");
@@ -1,8 +1,8 @@
1
1
  export { default as CodeBlock } from './components/code-block/code-block.js';
2
2
  export { default as Image } from './components/image/image.js';
3
- export { default as KifuTo } from './components/kifu-to/kifu-to.js';
4
3
  export { default as Link } from './components/link/link.js';
5
4
  export { default as LinkCard } from './components/link-card/link-card.js';
5
+ export { default as Mermaid } from './components/mermaid/mermaid.js';
6
6
  export { default as XPost } from './components/x-post/x-post.js';
7
7
  export { default as Youtube } from './components/youtube/youtube.js';
8
8
  import 'react';
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { CodeBlockComponentProps } from '@hackersheet/react-document-content';
3
3
 
4
- declare function CodeBlock({ code, language }: CodeBlockComponentProps): Promise<React.JSX.Element>;
4
+ declare function CodeBlock({ code, ...props }: CodeBlockComponentProps): Promise<React.JSX.Element>;
5
5
 
6
6
  export { CodeBlock as default };
@@ -1,16 +1,10 @@
1
1
  import React from "react";
2
2
  import CodeBlockCopyButton from "./code-block-copy-button";
3
3
  import CodeBlockIcon from "./code-block-icon";
4
- import CodeBlockKifu from "./code-block-kifu";
5
- import CodeBlockMermaid from "./code-block-mermaid";
6
4
  import { highlighteCode } from "./shiki";
7
- async function CodeBlock({ code, language }) {
8
- const [lang, filename] = language.split(":");
9
- const isMermaid = lang === "mermaid";
10
- const isKifu = lang === "kifu";
11
- if (isMermaid) return /* @__PURE__ */ React.createElement(CodeBlockMermaid, { code });
12
- if (isKifu) return /* @__PURE__ */ React.createElement(CodeBlockKifu, { kifu: code, filename });
13
- const html = await highlighteCode(code, lang);
5
+ async function CodeBlock({ code, ...props }) {
6
+ const [language, filename] = props.language.split(":");
7
+ const html = await highlighteCode(code, language);
14
8
  return /* @__PURE__ */ React.createElement("div", { className: "code-block" }, /* @__PURE__ */ React.createElement("div", { className: "code-block-header" }, /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(CodeBlockIcon, { language })), /* @__PURE__ */ React.createElement("div", { className: "code-block-filename" }, filename), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(CodeBlockCopyButton, { code }))), html && /* @__PURE__ */ React.createElement("div", { dangerouslySetInnerHTML: { __html: html } }), !html && /* @__PURE__ */ React.createElement("pre", null, code));
15
9
  }
16
10
  export {
@@ -1,8 +1,8 @@
1
1
  export { default as CodeBlock } from './code-block/code-block.mjs';
2
2
  export { default as Image } from './image/image.mjs';
3
- export { default as KifuTo } from './kifu-to/kifu-to.mjs';
4
3
  export { default as Link } from './link/link.mjs';
5
4
  export { default as LinkCard } from './link-card/link-card.mjs';
5
+ export { default as Mermaid } from './mermaid/mermaid.mjs';
6
6
  export { default as XPost } from './x-post/x-post.mjs';
7
7
  export { default as Youtube } from './youtube/youtube.mjs';
8
8
  import 'react';
@@ -1,16 +1,16 @@
1
1
  import CodeBlock from "./code-block/code-block";
2
2
  import Image from "./image/image";
3
- import KifuTo from "./kifu-to/kifu-to";
4
3
  import Link from "./link/link";
5
4
  import LinkCard from "./link-card/link-card";
5
+ import Mermaid from "./mermaid/mermaid";
6
6
  import XPost from "./x-post/x-post";
7
7
  import Youtube from "./youtube/youtube";
8
8
  export {
9
9
  CodeBlock,
10
10
  Image,
11
- KifuTo,
12
11
  Link,
13
12
  LinkCard,
13
+ Mermaid,
14
14
  XPost,
15
15
  Youtube
16
16
  };
@@ -10,7 +10,7 @@ function LinkCard({
10
10
  imageWidth
11
11
  }) {
12
12
  const faviconUrl = `https://t1.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=https://${domain}&size=16`;
13
- return /* @__PURE__ */ React.createElement("a", { href: url, className: "link-card" }, /* @__PURE__ */ React.createElement("div", { className: "link-card-main" }, /* @__PURE__ */ React.createElement("div", { className: "link-card-title" }, title), /* @__PURE__ */ React.createElement("div", { className: "link-card-description" }, description), /* @__PURE__ */ React.createElement("div", { className: "link-card-domain" }, /* @__PURE__ */ React.createElement("picture", null, /* @__PURE__ */ React.createElement("img", { src: faviconUrl, alt: `${domain} favicon`, width: 16, height: 16 })), /* @__PURE__ */ React.createElement("div", null, domain))), imageUrl && /* @__PURE__ */ React.createElement("div", { className: "link-card-image" }, /* @__PURE__ */ React.createElement(Image, { alt: title, src: imageUrl, height: imageHeight, width: imageWidth })));
13
+ return /* @__PURE__ */ React.createElement("a", { href: url, className: "link-card" }, /* @__PURE__ */ React.createElement("div", { className: "link-card-main" }, /* @__PURE__ */ React.createElement("div", { className: "link-card-title-container" }, /* @__PURE__ */ React.createElement("div", { className: "link-card-title" }, title)), /* @__PURE__ */ React.createElement("div", { className: "link-card-description" }, description), /* @__PURE__ */ React.createElement("div", { className: "link-card-domain" }, /* @__PURE__ */ React.createElement("picture", null, /* @__PURE__ */ React.createElement("img", { src: faviconUrl, alt: `${domain} favicon`, width: 16, height: 16 })), /* @__PURE__ */ React.createElement("div", null, domain))), imageUrl && /* @__PURE__ */ React.createElement("div", { className: "link-card-image" }, /* @__PURE__ */ React.createElement(Image, { alt: title, src: imageUrl, height: imageHeight, width: imageWidth })));
14
14
  }
15
15
  export {
16
16
  LinkCard as default
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { MermaidComponentProps } from '@hackersheet/react-document-content';
3
+
4
+ declare function Mermaid({ code }: MermaidComponentProps): React.JSX.Element;
5
+
6
+ export { Mermaid as default };
@@ -8,7 +8,7 @@ function createId(code) {
8
8
  hash.update(code);
9
9
  return "id-" + hash.digest("hex");
10
10
  }
11
- function CodeBlockMermaid({ code }) {
11
+ function Mermaid({ code }) {
12
12
  const ref = useRef(null);
13
13
  const [mounted, setMounted] = useState(false);
14
14
  const [svg, setSvg] = useState("");
@@ -37,5 +37,5 @@ function CodeBlockMermaid({ code }) {
37
37
  return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { dangerouslySetInnerHTML: { __html: svg }, ref }));
38
38
  }
39
39
  export {
40
- CodeBlockMermaid as default
40
+ Mermaid as default
41
41
  };
@@ -1,8 +1,8 @@
1
1
  export { default as CodeBlock } from './components/code-block/code-block.mjs';
2
2
  export { default as Image } from './components/image/image.mjs';
3
- export { default as KifuTo } from './components/kifu-to/kifu-to.mjs';
4
3
  export { default as Link } from './components/link/link.mjs';
5
4
  export { default as LinkCard } from './components/link-card/link-card.mjs';
5
+ export { default as Mermaid } from './components/mermaid/mermaid.mjs';
6
6
  export { default as XPost } from './components/x-post/x-post.mjs';
7
7
  export { default as Youtube } from './components/youtube/youtube.mjs';
8
8
  import 'react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hackersheet/next-document-content-components",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Hacker Sheet document content components for Next.js",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -10,19 +10,11 @@
10
10
  },
11
11
  "license": "MIT",
12
12
  "author": "",
13
- "sideEffects": [
14
- "*.css"
15
- ],
16
13
  "exports": {
17
14
  ".": {
18
15
  "require": "./dist/cjs/index.js",
19
16
  "import": "./dist/esm/index.mjs",
20
17
  "types": "./dist/esm/index.d.ts"
21
- },
22
- "./style": {
23
- "import": "./dist/style.module.css",
24
- "require": "./dist/style.module.css",
25
- "types": "./dist/style.module.scss.d.ts"
26
18
  }
27
19
  },
28
20
  "main": "./dist/cjs/index.js",
@@ -36,7 +28,6 @@
36
28
  "@hackersheet/react-document-content": "alpha",
37
29
  "@next/third-parties": "^14.2.5",
38
30
  "@shikijs/transformers": "^1.10.3",
39
- "kifu-for-js": "^5.4.1",
40
31
  "mermaid": "^10.9.1",
41
32
  "next-themes": "^0.3.0",
42
33
  "react-icons": "^5.2.1",
@@ -47,11 +38,8 @@
47
38
  "@types/react": "^18.0.0",
48
39
  "@types/react-dom": "^18.0.0",
49
40
  "next": "14.2.5",
50
- "postcss": "8.4.39",
51
41
  "react": "^18.0.0",
52
42
  "react-dom": "^18.0.0",
53
- "sass": "1.77.8",
54
- "typed-scss-modules": "8.0.1",
55
43
  "@hackersheet/eslint-config-custom": "0.0.0"
56
44
  },
57
45
  "peerDependencies": {
@@ -60,14 +48,12 @@
60
48
  "react-dom": "^18.0.0"
61
49
  },
62
50
  "scripts": {
63
- "build": "rm -rf ./dist && pnpm tsup && pnpm typegen:scss && pnpm build:css",
64
- "build:css": "cp src/styles/*.ts dist && pnpm sass src/styles/style.module.scss dist/style.module.css --no-source-map",
51
+ "build": "rm -rf ./dist && pnpm tsup",
65
52
  "check": "pnpm tsc && pnpm lint",
66
53
  "format": "pnpm -w format && pnpm lint:fix",
67
54
  "lint": "eslint \"**/*.{ts,tsx}\"",
68
55
  "lint:fix": "eslint --fix \"**/*.{ts,tsx}\"",
69
56
  "pub": "pnpm publish --access=public --tag alpha",
70
- "test": "echo \"Error: no test specified\" && exit 1",
71
- "typegen:scss": "typed-scss-modules src/styles/style.module.scss"
57
+ "test": "echo \"Error: no test specified\" && exit 1"
72
58
  }
73
59
  }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
-
3
- interface KifuProps {
4
- kifu: string;
5
- filename?: string;
6
- }
7
- declare function CodeBlockKifu({ kifu, filename }: KifuProps): React.JSX.Element | null;
8
-
9
- export { type KifuProps, CodeBlockKifu as default };
@@ -1,66 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var code_block_kifu_exports = {};
31
- __export(code_block_kifu_exports, {
32
- default: () => CodeBlockKifu
33
- });
34
- module.exports = __toCommonJS(code_block_kifu_exports);
35
- var import_kifu_for_js = require("kifu-for-js");
36
- var import_navigation = require("next/navigation");
37
- var import_react = __toESM(require("react"));
38
- function CodeBlockKifu({ kifu, filename }) {
39
- const searchParams = (0, import_navigation.useSearchParams)();
40
- const id = filename ? `user-content-${filename}` : void 0;
41
- const [kifuStore] = (0, import_react.useState)(() => new import_kifu_for_js.KifuStore({ kifu }));
42
- (0, import_react.useEffect)(() => {
43
- initKifuUserSettings();
44
- }, []);
45
- (0, import_react.useEffect)(() => {
46
- const newPly = Number(searchParams.get("ply") ?? 0);
47
- const hash = typeof window !== "undefined" ? window.location.hash.replace(/^#!?/, "") : "";
48
- if (hash === id) {
49
- kifuStore.player.goto(newPly);
50
- }
51
- }, [searchParams, kifuStore, id]);
52
- if (!kifuStore) {
53
- return null;
54
- }
55
- return /* @__PURE__ */ import_react.default.createElement("div", { className: "my-4 flex justify-center", id }, /* @__PURE__ */ import_react.default.createElement(import_kifu_for_js.KifuLite, { style: { width: "100%" }, kifuStore }));
56
- }
57
- function initKifuUserSettings() {
58
- const LOCALSTORAGE_KEY = "kifuforjs";
59
- const defaultSettings = {
60
- hapticFeedback: false
61
- };
62
- const settings = localStorage.getItem(LOCALSTORAGE_KEY);
63
- if (!settings) {
64
- localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(defaultSettings));
65
- }
66
- }
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
-
3
- interface CodeBlockMermaidProps {
4
- code: string;
5
- }
6
- declare function CodeBlockMermaid({ code }: CodeBlockMermaidProps): React.JSX.Element;
7
-
8
- export { type CodeBlockMermaidProps, CodeBlockMermaid as default };
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { KifuToComponentProps } from '@hackersheet/react-document-content';
3
-
4
- declare function KifuTo({ id, ply, label: defaultLabel }: KifuToComponentProps): React.JSX.Element;
5
-
6
- export { KifuTo as default };
@@ -1,41 +0,0 @@
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
- var kifu_to_exports = {};
30
- __export(kifu_to_exports, {
31
- default: () => KifuTo
32
- });
33
- module.exports = __toCommonJS(kifu_to_exports);
34
- var import_link = __toESM(require("next/link"));
35
- var import_react = __toESM(require("react"));
36
- function KifuTo({ id, ply, label: defaultLabel }) {
37
- const fullId = `user-content-${id}`;
38
- const href = `?ply=${ply}#${fullId}`;
39
- const label = defaultLabel ?? `${ply}\u624B\u76EE`;
40
- return /* @__PURE__ */ import_react.default.createElement(import_link.default, { href }, label);
41
- }
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
-
3
- interface KifuProps {
4
- kifu: string;
5
- filename?: string;
6
- }
7
- declare function CodeBlockKifu({ kifu, filename }: KifuProps): React.JSX.Element | null;
8
-
9
- export { type KifuProps, CodeBlockKifu as default };
@@ -1,36 +0,0 @@
1
- "use client";
2
- import { KifuLite, KifuStore } from "kifu-for-js";
3
- import { useSearchParams } from "next/navigation";
4
- import React, { useEffect, useState } from "react";
5
- function CodeBlockKifu({ kifu, filename }) {
6
- const searchParams = useSearchParams();
7
- const id = filename ? `user-content-${filename}` : void 0;
8
- const [kifuStore] = useState(() => new KifuStore({ kifu }));
9
- useEffect(() => {
10
- initKifuUserSettings();
11
- }, []);
12
- useEffect(() => {
13
- const newPly = Number(searchParams.get("ply") ?? 0);
14
- const hash = typeof window !== "undefined" ? window.location.hash.replace(/^#!?/, "") : "";
15
- if (hash === id) {
16
- kifuStore.player.goto(newPly);
17
- }
18
- }, [searchParams, kifuStore, id]);
19
- if (!kifuStore) {
20
- return null;
21
- }
22
- return /* @__PURE__ */ React.createElement("div", { className: "my-4 flex justify-center", id }, /* @__PURE__ */ React.createElement(KifuLite, { style: { width: "100%" }, kifuStore }));
23
- }
24
- function initKifuUserSettings() {
25
- const LOCALSTORAGE_KEY = "kifuforjs";
26
- const defaultSettings = {
27
- hapticFeedback: false
28
- };
29
- const settings = localStorage.getItem(LOCALSTORAGE_KEY);
30
- if (!settings) {
31
- localStorage.setItem(LOCALSTORAGE_KEY, JSON.stringify(defaultSettings));
32
- }
33
- }
34
- export {
35
- CodeBlockKifu as default
36
- };
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
-
3
- interface CodeBlockMermaidProps {
4
- code: string;
5
- }
6
- declare function CodeBlockMermaid({ code }: CodeBlockMermaidProps): React.JSX.Element;
7
-
8
- export { type CodeBlockMermaidProps, CodeBlockMermaid as default };
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { KifuToComponentProps } from '@hackersheet/react-document-content';
3
-
4
- declare function KifuTo({ id, ply, label: defaultLabel }: KifuToComponentProps): React.JSX.Element;
5
-
6
- export { KifuTo as default };
@@ -1,11 +0,0 @@
1
- import Link from "next/link";
2
- import React from "react";
3
- function KifuTo({ id, ply, label: defaultLabel }) {
4
- const fullId = `user-content-${id}`;
5
- const href = `?ply=${ply}#${fullId}`;
6
- const label = defaultLabel ?? `${ply}\u624B\u76EE`;
7
- return /* @__PURE__ */ React.createElement(Link, { href }, label);
8
- }
9
- export {
10
- KifuTo as default
11
- };
@@ -1,279 +0,0 @@
1
- .main :first-child {
2
- margin-top: 0;
3
- }
4
- .main * {
5
- word-break: break-word;
6
- scroll-margin-top: var(--hsdc-scroll-margin-top);
7
- }
8
- .main h1,
9
- .main h2,
10
- .main h3,
11
- .main h4,
12
- .main h5,
13
- .main h6 {
14
- margin: 4rem 0 1.5rem 0;
15
- padding: 0.5rem 0;
16
- font-weight: 700;
17
- border-bottom: 1px solid hsl(var(--hsdc-border));
18
- }
19
- .main p {
20
- margin: 1.8rem 0;
21
- }
22
- .main strong {
23
- font-weight: 700;
24
- }
25
- .main hr {
26
- margin: 4rem 0;
27
- }
28
- .main h1 {
29
- font-size: 2rem;
30
- }
31
- .main h2 {
32
- font-size: 1.5rem;
33
- }
34
- .main h3 {
35
- font-size: 1.2rem;
36
- }
37
- .main h4 {
38
- font-size: 1rem;
39
- }
40
- .main h5 {
41
- font-size: 0.8rem;
42
- }
43
- .main h6 {
44
- font-size: 0.7rem;
45
- }
46
- .main p {
47
- line-height: 2.2;
48
- letter-spacing: 0.04em;
49
- }
50
- .main ol,
51
- .main ul {
52
- padding-left: 1.5em;
53
- }
54
- .main ol ol,
55
- .main ol ul,
56
- .main ul ol,
57
- .main ul ul {
58
- padding-left: 1em;
59
- }
60
- .main ol li,
61
- .main ul li {
62
- line-height: 2rem;
63
- padding-left: 0.5rem;
64
- }
65
- .main ul {
66
- list-style-type: disc;
67
- }
68
- .main ul ul {
69
- list-style-type: circle;
70
- }
71
- .main ul ul ul {
72
- list-style-type: square;
73
- }
74
- .main ol {
75
- list-style-type: decimal;
76
- }
77
- .main ol ul {
78
- list-style-type: circle;
79
- }
80
- .main ol ul ul {
81
- list-style-type: square;
82
- }
83
- .main table {
84
- width: 100%;
85
- table-layout: fixed;
86
- border-collapse: separate;
87
- border-radius: 8px;
88
- border-spacing: 0;
89
- border: 1px solid hsl(var(--hsdc-border));
90
- overflow: hidden;
91
- }
92
- .main table thead {
93
- background-color: hsl(var(--hsdc-muted));
94
- }
95
- .main table tbody td {
96
- border-top: 1px solid hsl(var(--hsdc-border));
97
- }
98
- .main table tbody tr:hover {
99
- background-color: hsl(var(--hsdc-muted)/0.5);
100
- }
101
- .main table th,
102
- .main table td {
103
- padding: 8px;
104
- font-size: 0.875rem;
105
- text-align: left;
106
- }
107
- .main table th :global(&.left),
108
- .main table td :global(&.left) {
109
- text-align: left;
110
- }
111
- .main table th :global(&.center),
112
- .main table td :global(&.center) {
113
- text-align: center;
114
- }
115
- .main table th :global(&.right),
116
- .main table td :global(&.right) {
117
- text-align: right;
118
- }
119
- .main code:not(pre code) {
120
- border-radius: 4px;
121
- display: inline-block;
122
- box-sizing: border-box;
123
- padding: 2px 8px;
124
- font-family: var(--hsdc-font-code);
125
- line-height: 1.5;
126
- border: 1px solid hsl(var(--hsdc-border));
127
- background-color: hsl(var(--hsdc-muted));
128
- }
129
- .main blockquote {
130
- border-left: 12px solid hsl(var(--hsdc-border));
131
- color: hsl(var(--hsdc-muted-foreground));
132
- margin: 0;
133
- padding: 0 16px;
134
- }
135
- .main blockquote blockquote {
136
- margin: 0 12px;
137
- }
138
- .main a:not(article a) {
139
- color: hsl(var(--hsdc-link));
140
- }
141
- .main a:not(article a):hover {
142
- text-decoration-line: underline;
143
- }
144
- .main summary {
145
- cursor: pointer;
146
- }
147
- .main :global(.footnotes) {
148
- margin: 4rem 0 1.5rem 0;
149
- color: hsl(var(--hsdc-muted-foreground));
150
- }
151
- .main :global(.footnotes) p {
152
- margin: 0;
153
- }
154
- .main :global(.contains-task-list) {
155
- list-style-type: none;
156
- padding-left: 0;
157
- }
158
- .main :global(.contains-task-list) input {
159
- margin-right: 0.5rem;
160
- }
161
-
162
- .main :global(.react-tweet-theme) p {
163
- margin: 0;
164
- line-height: 1.5;
165
- font-size: 17px;
166
- }
167
- .main :global(.code-block) {
168
- margin: 1.5rem 0;
169
- border: 1px solid hsl(var(--hsdc-border));
170
- border-radius: 8px;
171
- overflow: hidden;
172
- }
173
- .main :global(.code-block) pre {
174
- font-family: var(--hsdc-font-code);
175
- font-size: 14px;
176
- padding: 16px;
177
- overflow: auto;
178
- background-color: hsl(var(--hsdc-code-block));
179
- }
180
- .main :global(.code-block) :global(.code-block-header) {
181
- display: flex;
182
- flex-direction: row;
183
- align-items: center;
184
- gap: 8px;
185
- font-size: 14px;
186
- padding: 8px 16px;
187
- background-color: hsl(var(--hsdc-muted));
188
- border-bottom: 1px solid hsl(var(--hsdc-border));
189
- }
190
- .main :global(.code-block) :global(.code-block-filename) {
191
- flex: 1 1 auto;
192
- }
193
- .main :global(.shiki) code {
194
- width: 100%;
195
- min-width: max-content;
196
- display: flex;
197
- flex-direction: column;
198
- margin: 0 -16px;
199
- }
200
- .main :global(.shiki) :global(span.line) {
201
- position: relative;
202
- width: 100%;
203
- padding: 0 16px;
204
- }
205
- .main :global(.shiki) :global(span.line.diff.add) {
206
- background-color: hsl(var(--hsdc-shiki-diff-add)/0.1) !important;
207
- }
208
- .main :global(.shiki) :global(span.line.diff.add)::before {
209
- position: absolute;
210
- left: 2px;
211
- content: "+";
212
- color: hsl(var(--hsdc-shiki-diff-add));
213
- }
214
- .main :global(.shiki) :global(span.line.diff.remove) {
215
- background-color: hsl(var(--hsdc-shiki-diff-remove)/0.1) !important;
216
- }
217
- .main :global(.shiki) :global(span.line.diff.remove)::before {
218
- position: absolute;
219
- left: 2px;
220
- content: "-";
221
- color: hsl(var(--hsdc-shiki-diff-remove));
222
- }
223
- .main :global(.shiki) :global(.highlighted-word) {
224
- background-color: hsl(var(--hsdc-shiki-highlighted-word)/0.2);
225
- padding: 2px 0;
226
- margin: -2px 0;
227
- }
228
- .main :global(.link-card) {
229
- display: flex;
230
- flex-direction: row;
231
- border: 1px solid hsl(var(--hsdc-border));
232
- border-radius: 8px;
233
- overflow: hidden;
234
- color: inherit;
235
- width: 100%;
236
- max-height: 144px;
237
- margin: 1.8rem 0;
238
- }
239
- .main :global(.link-card):hover {
240
- text-decoration: none;
241
- background-color: hsl(var(--hsdc-muted)/0.5);
242
- }
243
- .main :global(.link-card) :global(.link-card-main) {
244
- flex: 1;
245
- display: flex;
246
- flex-direction: column;
247
- padding: 12px 16px;
248
- overflow: hidden;
249
- gap: 8px;
250
- }
251
- .main :global(.link-card) :global(.link-card-main) > div {
252
- overflow: hidden;
253
- display: -webkit-box;
254
- -webkit-box-orient: vertical;
255
- line-clamp: 2;
256
- }
257
- .main :global(.link-card) :global(.link-card-main) :global(.link-card-title) {
258
- flex: 1 1 auto;
259
- }
260
- .main :global(.link-card) :global(.link-card-main) :global(.link-card-description) {
261
- font-size: 0.75rem;
262
- color: hsl(var(--hsdc-muted-foreground));
263
- }
264
- .main :global(.link-card) :global(.link-card-main) :global(.link-card-domain) {
265
- display: flex;
266
- flex-direction: row;
267
- align-items: center;
268
- gap: 8px;
269
- font-size: 0.75rem;
270
- color: hsl(var(--hsdc-muted-foreground));
271
- }
272
- .main :global(.link-card) :global(.link-card-image) {
273
- width: 35%;
274
- }
275
- .main :global(.link-card) :global(.link-card-image) img {
276
- object-fit: cover;
277
- width: 100%;
278
- height: 100%;
279
- }
@@ -1,9 +0,0 @@
1
- export type Styles = {
2
- main: string;
3
- };
4
-
5
- export type ClassNames = keyof Styles;
6
-
7
- declare const styles: Styles;
8
-
9
- export default styles;