hyperbook 0.23.1 → 0.23.2

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforms/web",
3
- "version": "0.23.1",
3
+ "version": "0.23.2",
4
4
  "private": true,
5
5
  "dependencies": {
6
6
  "gray-matter": "4.0.3",
@@ -11,15 +11,15 @@
11
11
  "redux": "4.2.1",
12
12
  "redux-persist": "6.0.0",
13
13
  "@hyperbook/drawer": "0.1.1",
14
- "@hyperbook/element-audio": "0.2.0",
15
14
  "@hyperbook/element-alert": "0.2.0",
15
+ "@hyperbook/element-audio": "0.2.0",
16
16
  "@hyperbook/element-bitflow": "0.2.0",
17
17
  "@hyperbook/element-bookmarks": "0.3.0",
18
18
  "@hyperbook/element-collapsible": "0.4.0",
19
19
  "@hyperbook/element-dl": "0.2.0",
20
20
  "@hyperbook/element-embed": "0.2.0",
21
- "@hyperbook/element-excalidraw": "0.5.0",
22
- "@hyperbook/element-mermaid": "0.2.0",
21
+ "@hyperbook/element-excalidraw": "0.5.1",
22
+ "@hyperbook/element-mermaid": "0.2.1",
23
23
  "@hyperbook/element-online-ide": "0.4.0",
24
24
  "@hyperbook/element-plantuml": "0.2.0",
25
25
  "@hyperbook/element-protect": "0.4.0",
@@ -31,14 +31,14 @@
31
31
  "@hyperbook/element-term": "0.2.0",
32
32
  "@hyperbook/element-youtube": "0.2.0",
33
33
  "@hyperbook/fs": "0.10.0",
34
- "@hyperbook/markdown": "0.9.1",
34
+ "@hyperbook/markdown": "0.9.2",
35
35
  "@hyperbook/provider": "0.4.0",
36
- "@hyperbook/shell": "0.7.1",
36
+ "@hyperbook/shell": "0.7.2",
37
37
  "@hyperbook/store": "0.2.0",
38
38
  "@hyperbook/styles": "0.3.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@hyperbook/next-watch": "0.5.0"
41
+ "@hyperbook/next-watch": "0.5.1"
42
42
  },
43
43
  "scripts": {
44
44
  "next:dev": "next-hyperbook-watch",
@@ -1 +1,57 @@
1
- import{Shell as N}from"@hyperbook/shell";import{Markdown as F}from"@hyperbook/markdown";import{useActivePageId as G,useLink as L}from"@hyperbook/provider";import{Fragment as H}from"react";import{vfile as v,hyperbook as x}from"@hyperbook/fs";import{useScrollHash as J}from"../useScrollHash";import M from"path";function A({markdown:k,data:u,navigation:e}){const P=L();return G(),J(),<H><N navigation={e}><article><F children={k}showToc={u.toc!==!1}/></article>{!u.hide&&<div className="jump-container">{e.previous?<P className="jump previous"href={e.previous.href}>{e.previous.name}</P>:<div className="flex"/>}{e.next?<P className="jump next"href={e.next.href}>{e.next.name}</P>:<div className="flex"/>}</div>}</N></H>}const V=async({params:k})=>{const u=process.env.root??process.cwd();let e="";k.page&&(e=M.join(...k.page));const P=await v.get(u,"book","/"+e),{content:w,data:S}=await v.getMarkdown(P),y=await x.getJson(u),b=await x.getNavigation(u,P);return{props:{locale:S?.lang||y.language,markdown:w,data:S,navigation:b}}},W=async()=>{const k=process.env.root??process.cwd();return{paths:(await v.listForFolder(k,"book")).map(P=>{const w=P.path.href.slice(1).split("/");return P.name==="index"&&P.path.directory===""&&w.pop(),{params:{page:w}}}),fallback:!1}};export{A as default,W as getStaticPaths,V as getStaticProps};
1
+ import React from "react";
2
+ import { Shell } from "@hyperbook/shell";
3
+ import { Markdown } from "@hyperbook/markdown";
4
+ import { useActivePageId, useLink } from "@hyperbook/provider";
5
+ import { Fragment } from "react";
6
+ import { vfile, hyperbook } from "@hyperbook/fs";
7
+ import { useScrollHash } from "../useScrollHash";
8
+ import path from "path";
9
+ function BookPage({ markdown, data, navigation }) {
10
+ const Link = useLink();
11
+ useActivePageId();
12
+ useScrollHash();
13
+ return /* @__PURE__ */ React.createElement(Fragment, null, /* @__PURE__ */ React.createElement(Shell, { navigation }, /* @__PURE__ */ React.createElement("article", null, /* @__PURE__ */ React.createElement(Markdown, { children: markdown, showToc: data.toc !== false })), !data.hide && /* @__PURE__ */ React.createElement("div", { className: "jump-container" }, navigation.previous ? /* @__PURE__ */ React.createElement(Link, { className: "jump previous", href: navigation.previous.href }, navigation.previous.name) : /* @__PURE__ */ React.createElement("div", { className: "flex" }), navigation.next ? /* @__PURE__ */ React.createElement(Link, { className: "jump next", href: navigation.next.href }, navigation.next.name) : /* @__PURE__ */ React.createElement("div", { className: "flex" }))));
14
+ }
15
+ const getStaticProps = async ({ params }) => {
16
+ const root = process.env.root ?? process.cwd();
17
+ let href = "";
18
+ if (params.page) {
19
+ href = path.join(...params.page);
20
+ }
21
+ const file = await vfile.get(root, "book", "/" + href);
22
+ const { content, data } = await vfile.getMarkdown(file);
23
+ const hyperbookJson = await hyperbook.getJson(root);
24
+ const navigation = await hyperbook.getNavigation(root, file);
25
+ return {
26
+ props: {
27
+ locale: data?.lang || hyperbookJson.language,
28
+ markdown: content,
29
+ data,
30
+ navigation
31
+ }
32
+ };
33
+ };
34
+ const getStaticPaths = async () => {
35
+ const root = process.env.root ?? process.cwd();
36
+ const files = await vfile.listForFolder(root, "book");
37
+ const paths = files.map((f) => {
38
+ const page = f.path.href.slice(1).split("/");
39
+ if (f.name === "index" && f.path.directory === "") {
40
+ page.pop();
41
+ }
42
+ return {
43
+ params: {
44
+ page
45
+ }
46
+ };
47
+ });
48
+ return {
49
+ paths,
50
+ fallback: false
51
+ };
52
+ };
53
+ export {
54
+ BookPage as default,
55
+ getStaticPaths,
56
+ getStaticProps
57
+ };
@@ -1 +1,126 @@
1
- import"../index.css";import"@hyperbook/shell/index.css";import"@hyperbook/drawer/index.css";import"@hyperbook/markdown/katex.css";import"@hyperbook/markdown/index.css";import{Provider as L}from"@hyperbook/provider";import N from"@hyperbook/element-tabs";import"@hyperbook/element-tabs/index.css";import O from"@hyperbook/element-audio";import"@hyperbook/element-audio/index.css";import b from"@hyperbook/element-alert";import"@hyperbook/element-alert/index.css";import A from"@hyperbook/element-term";import"@hyperbook/element-term/index.css";import T from"@hyperbook/element-youtube";import"@hyperbook/element-youtube/index.css";import h from"@hyperbook/element-plantuml";import"@hyperbook/element-plantuml/index.css";import x from"@hyperbook/element-protect";import"@hyperbook/element-protect/index.css";import D from"@hyperbook/element-collapsible";import"@hyperbook/element-collapsible/index.css";import I from"@hyperbook/element-dl";import"@hyperbook/element-dl/index.css";import M from"@hyperbook/element-bookmarks";import"@hyperbook/element-bookmarks/index.css";import U from"@hyperbook/element-struktog";import"@hyperbook/element-struktog/index.css";import B from"@hyperbook/element-qr";import"@hyperbook/element-qr/index.css";import C from"@hyperbook/element-mermaid";import"@hyperbook/element-mermaid/index.css";import F from"@hyperbook/element-excalidraw";import"@hyperbook/element-excalidraw/index.css";import H from"@hyperbook/element-embed";import"@hyperbook/element-embed/index.css";import V from"@hyperbook/element-online-ide";import"@hyperbook/element-online-ide/index.css";import W from"@hyperbook/element-sql-ide";import"@hyperbook/element-sql-ide/index.css";import _ from"@hyperbook/element-bitflow";import"@hyperbook/element-bitflow/index.css";import j from"@hyperbook/element-scratchblock";import"@hyperbook/element-scratchblock/index.css";import J from"next/link";import Q from"next/head";import{Styles as R}from"@hyperbook/styles";import{localStorage as Y,noopStorage as z}from"@hyperbook/store";import{useRouter as G}from"next/router";import{useEffect as K}from"react";import X from"../../hyperbook.json";const Z=({ref:E,href:e,children:S,...P})=><J href={e}{...P}>{S}</J>,$=({basePath:E})=>e=>(process.env.NODE_ENV==="production"&&E&&e?.startsWith("/")&&(E.endsWith("/")?e=E.slice(0,-1)+e:e=E+e),e);function ee({Component:E,pageProps:e}){const S=G();return K(()=>{document.documentElement.lang=e.locale},[e.locale]),<L Link={Z}Head={Q}config={X}makeUrl={$}env={process.env.NODE_ENV==="production"?"production":"development"}elements={[N,O,b,A,T,D,h,x,I,H,M,U,V,W,B,C,F,j,_]}router={S}storage={typeof window<"u"?Y:z}loadFile={()=>async P=>fetch(P).then(g=>g.text())}saveFile={()=>async(P,g,w)=>{await fetch("/api/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:P,content:g,rootFolder:w})})}}getActivePageId={async()=>S.asPath.split("#")?.[0]||"/"}><R/><E{...e}/></L>}export{ee as default};
1
+ import React from "react";
2
+ import "../index.css";
3
+ import "@hyperbook/shell/index.css";
4
+ import "@hyperbook/drawer/index.css";
5
+ import "@hyperbook/markdown/katex.css";
6
+ import "@hyperbook/markdown/index.css";
7
+ import { Provider } from "@hyperbook/provider";
8
+ import elementTab from "@hyperbook/element-tabs";
9
+ import "@hyperbook/element-tabs/index.css";
10
+ import elementAudio from "@hyperbook/element-audio";
11
+ import "@hyperbook/element-audio/index.css";
12
+ import elementAlert from "@hyperbook/element-alert";
13
+ import "@hyperbook/element-alert/index.css";
14
+ import elementTerm from "@hyperbook/element-term";
15
+ import "@hyperbook/element-term/index.css";
16
+ import elementYoutube from "@hyperbook/element-youtube";
17
+ import "@hyperbook/element-youtube/index.css";
18
+ import elementPlantuml from "@hyperbook/element-plantuml";
19
+ import "@hyperbook/element-plantuml/index.css";
20
+ import elementProtect from "@hyperbook/element-protect";
21
+ import "@hyperbook/element-protect/index.css";
22
+ import elementCollapsible from "@hyperbook/element-collapsible";
23
+ import "@hyperbook/element-collapsible/index.css";
24
+ import elementDl from "@hyperbook/element-dl";
25
+ import "@hyperbook/element-dl/index.css";
26
+ import elementBookmarks from "@hyperbook/element-bookmarks";
27
+ import "@hyperbook/element-bookmarks/index.css";
28
+ import elementStruktog from "@hyperbook/element-struktog";
29
+ import "@hyperbook/element-struktog/index.css";
30
+ import elementQr from "@hyperbook/element-qr";
31
+ import "@hyperbook/element-qr/index.css";
32
+ import elementMermaid from "@hyperbook/element-mermaid";
33
+ import "@hyperbook/element-mermaid/index.css";
34
+ import elementExcalidraw from "@hyperbook/element-excalidraw";
35
+ import "@hyperbook/element-excalidraw/index.css";
36
+ import elementEmbed from "@hyperbook/element-embed";
37
+ import "@hyperbook/element-embed/index.css";
38
+ import elementOnlineIde from "@hyperbook/element-online-ide";
39
+ import "@hyperbook/element-online-ide/index.css";
40
+ import elementSqlIde from "@hyperbook/element-sql-ide";
41
+ import "@hyperbook/element-sql-ide/index.css";
42
+ import elementBitflow from "@hyperbook/element-bitflow";
43
+ import "@hyperbook/element-bitflow/index.css";
44
+ import elementScratchblock from "@hyperbook/element-scratchblock";
45
+ import "@hyperbook/element-scratchblock/index.css";
46
+ import Link from "next/link";
47
+ import Head from "next/head";
48
+ import { Styles } from "@hyperbook/styles";
49
+ import { localStorage, noopStorage } from "@hyperbook/store";
50
+ import { useRouter } from "next/router";
51
+ import { useEffect } from "react";
52
+ import hb from "../../hyperbook.json";
53
+ const MyLink = ({ ref, href, children, ...props }) => {
54
+ return /* @__PURE__ */ React.createElement(Link, { href, ...props }, children);
55
+ };
56
+ const makeUrl = ({ basePath }) => (path) => {
57
+ if (process.env.NODE_ENV === "production" && basePath && path?.startsWith("/")) {
58
+ if (basePath.endsWith("/")) {
59
+ path = basePath.slice(0, -1) + path;
60
+ } else {
61
+ path = basePath + path;
62
+ }
63
+ }
64
+ return path;
65
+ };
66
+ function MyApp({ Component, pageProps }) {
67
+ const router = useRouter();
68
+ useEffect(() => {
69
+ document.documentElement.lang = pageProps.locale;
70
+ }, [pageProps.locale]);
71
+ return /* @__PURE__ */ React.createElement(
72
+ Provider,
73
+ {
74
+ Link: MyLink,
75
+ Head,
76
+ config: hb,
77
+ makeUrl,
78
+ env: process.env.NODE_ENV === "production" ? "production" : "development",
79
+ elements: [
80
+ elementTab,
81
+ elementAudio,
82
+ elementAlert,
83
+ elementTerm,
84
+ elementYoutube,
85
+ elementCollapsible,
86
+ elementPlantuml,
87
+ elementProtect,
88
+ elementDl,
89
+ elementEmbed,
90
+ elementBookmarks,
91
+ elementStruktog,
92
+ elementOnlineIde,
93
+ elementSqlIde,
94
+ elementQr,
95
+ elementMermaid,
96
+ elementExcalidraw,
97
+ elementScratchblock,
98
+ elementBitflow
99
+ ],
100
+ router,
101
+ storage: typeof window !== "undefined" ? localStorage : noopStorage,
102
+ loadFile: () => async (path) => {
103
+ return fetch(path).then((res) => res.text());
104
+ },
105
+ saveFile: () => async (path, content, rootFolder) => {
106
+ await fetch("/api/save", {
107
+ method: "POST",
108
+ headers: {
109
+ "Content-Type": "application/json"
110
+ },
111
+ body: JSON.stringify({
112
+ path,
113
+ content,
114
+ rootFolder
115
+ })
116
+ });
117
+ },
118
+ getActivePageId: async () => router.asPath.split("#")?.[0] || "/"
119
+ },
120
+ /* @__PURE__ */ React.createElement(Styles, null),
121
+ /* @__PURE__ */ React.createElement(Component, { ...pageProps })
122
+ );
123
+ }
124
+ export {
125
+ MyApp as default
126
+ };
@@ -1 +1,11 @@
1
- import e,{Html as _,Head as D,Main as H,NextScript as A}from"next/document";class M extends e{render(){return<_ lang={this.props.__NEXT_DATA__.props.pageProps.locale}><D/><body><H/><A/></body></_>}}var h=M;export{h as default};
1
+ import React from "react";
2
+ import Document, { Html, Head, Main, NextScript } from "next/document";
3
+ class MyDocument extends Document {
4
+ render() {
5
+ return /* @__PURE__ */ React.createElement(Html, { lang: this.props.__NEXT_DATA__.props.pageProps.locale }, /* @__PURE__ */ React.createElement(Head, null), /* @__PURE__ */ React.createElement("body", null, /* @__PURE__ */ React.createElement(Main, null), /* @__PURE__ */ React.createElement(NextScript, null)));
6
+ }
7
+ }
8
+ var document_default = MyDocument;
9
+ export {
10
+ document_default as default
11
+ };
@@ -1 +1,39 @@
1
- import s from"fs/promises";import i from"path";async function o(a){var t=i.dirname(a);try{return await s.access(t),!0}catch{s.mkdir(t).then(async()=>o(t))}}const l={api:{bodyParser:{sizeLimit:"32mb"}}};async function c(a,t){process.env.NODE_ENV!=="development"&&t.status(404).json({status:"failed"});let{path:e,content:r,rootFolder:n}=a.body;n&&(e=i.join(n,e)),e=i.join(__dirname,"..","..","..","..",e);try{await o(e),await s.writeFile(e,r),t.status(202).json({status:"saved"})}catch(p){t.status(400).json(p)}}export{l as config,c as default};
1
+ import fs from "fs/promises";
2
+ import path from "path";
3
+ async function ensureDirectoryExistence(filePath) {
4
+ var dirname = path.dirname(filePath);
5
+ try {
6
+ await fs.access(dirname);
7
+ return true;
8
+ } catch (e) {
9
+ fs.mkdir(dirname).then(async () => ensureDirectoryExistence(dirname));
10
+ }
11
+ }
12
+ const config = {
13
+ api: {
14
+ bodyParser: {
15
+ sizeLimit: "32mb"
16
+ }
17
+ }
18
+ };
19
+ async function handler(req, res) {
20
+ if (process.env.NODE_ENV !== "development") {
21
+ res.status(404).json({ status: "failed" });
22
+ }
23
+ let { path: p, content, rootFolder } = req.body;
24
+ if (rootFolder) {
25
+ p = path.join(rootFolder, p);
26
+ }
27
+ p = path.join(__dirname, "..", "..", "..", "..", p);
28
+ try {
29
+ await ensureDirectoryExistence(p);
30
+ await fs.writeFile(p, content);
31
+ res.status(202).json({ status: "saved" });
32
+ } catch (e) {
33
+ res.status(400).json(e);
34
+ }
35
+ }
36
+ export {
37
+ config,
38
+ handler as default
39
+ };
@@ -1 +1,59 @@
1
- import{Shell as F}from"@hyperbook/shell";import{Fragment as T}from"react";import{useActivePageId as G,useLink as x}from"@hyperbook/provider";import{Markdown as H}from"@hyperbook/markdown";import{hyperbook as S,vfile as y}from"@hyperbook/fs";import{useScrollHash as L}from"../../useScrollHash";function M({markdown:e,navigation:o,data:t,references:a}){const P=x();return G(),L(),<F navigation={o}><article><H children={e}showToc={t.toc!==!1}/><div className="pages">{a.map((r,v)=><T key={r.path.href}>{v>0&&", "}<P href={r.path.href}>{r.markdown?.data?.name??r.name}</P></T>)}</div></article></F>}const D=async({params:e})=>{const o=process.env.root??process.cwd(),t=await y.get(o,"glossary","/glossary/"+e.term.join("/"));if(!t)throw Error(`Missing file ${t}`);const{content:a,data:P}=await y.getMarkdown(t),r=await S.getJson(o),v=await S.getNavigation(o,t);return{props:{locale:P?.lang||r.language,markdown:a,data:P,references:t.references,navigation:v}}},K=async()=>{const e=process.env.root??process.cwd();return{paths:(await y.listForFolder(e,"glossary")).map(a=>({params:{term:a.path.href.slice(10).split("/")}})),fallback:!1}};export{M as default,K as getStaticPaths,D as getStaticProps};
1
+ import React from "react";
2
+ import { Shell } from "@hyperbook/shell";
3
+ import { Fragment } from "react";
4
+ import { useActivePageId, useLink } from "@hyperbook/provider";
5
+ import { Markdown } from "@hyperbook/markdown";
6
+ import { hyperbook, vfile } from "@hyperbook/fs";
7
+ import { useScrollHash } from "../../useScrollHash";
8
+ function Term({
9
+ markdown,
10
+ navigation,
11
+ data,
12
+ references
13
+ }) {
14
+ const Link = useLink();
15
+ useActivePageId();
16
+ useScrollHash();
17
+ return /* @__PURE__ */ React.createElement(Shell, { navigation }, /* @__PURE__ */ React.createElement("article", null, /* @__PURE__ */ React.createElement(Markdown, { children: markdown, showToc: data.toc !== false }), /* @__PURE__ */ React.createElement("div", { className: "pages" }, references.map((p, i) => /* @__PURE__ */ React.createElement(Fragment, { key: p.path.href }, i > 0 && ", ", /* @__PURE__ */ React.createElement(Link, { href: p.path.href }, p.markdown?.data?.name ?? p.name))))));
18
+ }
19
+ const getStaticProps = async ({ params }) => {
20
+ const root = process.env.root ?? process.cwd();
21
+ const file = await vfile.get(
22
+ root,
23
+ "glossary",
24
+ "/glossary/" + params.term.join("/")
25
+ );
26
+ if (!file) {
27
+ throw Error(`Missing file ${file}`);
28
+ }
29
+ const { content, data } = await vfile.getMarkdown(file);
30
+ const hyperbookJson = await hyperbook.getJson(root);
31
+ const navigation = await hyperbook.getNavigation(root, file);
32
+ return {
33
+ props: {
34
+ locale: data?.lang || hyperbookJson.language,
35
+ markdown: content,
36
+ data,
37
+ references: file.references,
38
+ navigation
39
+ }
40
+ };
41
+ };
42
+ const getStaticPaths = async () => {
43
+ const root = process.env.root ?? process.cwd();
44
+ const files = await vfile.listForFolder(root, "glossary");
45
+ const paths = files.map((f) => ({
46
+ params: {
47
+ term: f.path.href.slice(10).split("/")
48
+ }
49
+ }));
50
+ return {
51
+ paths,
52
+ fallback: false
53
+ };
54
+ };
55
+ export {
56
+ Term as default,
57
+ getStaticPaths,
58
+ getStaticProps
59
+ };
@@ -1 +1,28 @@
1
- import{Shell as S}from"@hyperbook/shell";import{useActivePageId as d,useLink as N}from"@hyperbook/provider";import{hyperbook as k,vfile as w}from"@hyperbook/fs";import{useScrollHash as b}from"../../useScrollHash";function x({glossary:o,navigation:a}){const G=N();return d(),b(),<S navigation={a}><article className="glossary">{Object.keys(o).map(s=><div key={s}className="container"><div className="letter">{s}</div><ul className="terms">{o[s].map(P=><li key={P.href}><G className="term"href={P.href}>{P.name}</G></li>)}</ul></div>)}</article></S>}const z=async()=>{const o=process.env.root??process.cwd(),a=await w.getGlossary(o),G=await k.getJson(o),s=await k.getNavigation(o);return{props:{locale:G.language,glossary:a,navigation:s}}};export{x as default,z as getStaticProps};
1
+ import React from "react";
2
+ import { Shell } from "@hyperbook/shell";
3
+ import { useActivePageId, useLink } from "@hyperbook/provider";
4
+ import { hyperbook, vfile } from "@hyperbook/fs";
5
+ import { useScrollHash } from "../../useScrollHash";
6
+ function Glossary({ glossary, navigation }) {
7
+ const Link = useLink();
8
+ useActivePageId();
9
+ useScrollHash();
10
+ return /* @__PURE__ */ React.createElement(Shell, { navigation }, /* @__PURE__ */ React.createElement("article", { className: "glossary" }, Object.keys(glossary).map((letter) => /* @__PURE__ */ React.createElement("div", { key: letter, className: "container" }, /* @__PURE__ */ React.createElement("div", { className: "letter" }, letter), /* @__PURE__ */ React.createElement("ul", { className: "terms" }, glossary[letter].map((term) => /* @__PURE__ */ React.createElement("li", { key: term.href }, /* @__PURE__ */ React.createElement(Link, { className: "term", href: term.href }, term.name))))))));
11
+ }
12
+ const getStaticProps = async () => {
13
+ const root = process.env.root ?? process.cwd();
14
+ const glossaryData = await vfile.getGlossary(root);
15
+ const hyperbookJson = await hyperbook.getJson(root);
16
+ const navigation = await hyperbook.getNavigation(root);
17
+ return {
18
+ props: {
19
+ locale: hyperbookJson.language,
20
+ glossary: glossaryData,
21
+ navigation
22
+ }
23
+ };
24
+ };
25
+ export {
26
+ Glossary as default,
27
+ getStaticProps
28
+ };
@@ -1 +1,14 @@
1
- import{useEffect as e}from"react";const s=()=>{e(()=>{const o=window.location.hash;o&&setTimeout(()=>{document.querySelector(o)?.scrollIntoView({behavior:"smooth"})},100)})};export{s as useScrollHash};
1
+ import { useEffect } from "react";
2
+ const useScrollHash = () => {
3
+ useEffect(() => {
4
+ const hash = window.location.hash;
5
+ if (hash) {
6
+ setTimeout(() => {
7
+ document.querySelector(hash)?.scrollIntoView({ behavior: "smooth" });
8
+ }, 100);
9
+ }
10
+ });
11
+ };
12
+ export {
13
+ useScrollHash
14
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperbook",
3
- "version": "0.23.1",
3
+ "version": "0.23.2",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",
@@ -44,7 +44,7 @@
44
44
  "rimraf": "3.0.2",
45
45
  "tar": "6.1.14",
46
46
  "update-check": "1.5.4",
47
- "@platforms/web": "0.23.1"
47
+ "@platforms/web": "0.23.2"
48
48
  },
49
49
  "dependencies": {
50
50
  "@hyperbook/fs": "0.10.0",