hyperbook 0.20.0 → 0.22.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforms/web",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "private": true,
5
5
  "dependencies": {
6
6
  "gray-matter": "4.0.3",
@@ -15,12 +15,13 @@
15
15
  "@hyperbook/element-bitflow": "0.1.15",
16
16
  "@hyperbook/element-bookmarks": "0.2.9",
17
17
  "@hyperbook/element-collapsible": "0.3.5",
18
+ "@hyperbook/drawer": "0.0.0",
18
19
  "@hyperbook/element-dl": "0.1.15",
19
- "@hyperbook/element-excalidraw": "0.4.5",
20
20
  "@hyperbook/element-embed": "0.1.5",
21
- "@hyperbook/element-mermaid": "0.1.14",
21
+ "@hyperbook/element-excalidraw": "0.4.5",
22
22
  "@hyperbook/element-online-ide": "0.3.3",
23
23
  "@hyperbook/element-plantuml": "0.1.1",
24
+ "@hyperbook/element-mermaid": "0.1.14",
24
25
  "@hyperbook/element-protect": "0.3.5",
25
26
  "@hyperbook/element-qr": "0.2.0",
26
27
  "@hyperbook/element-scratchblock": "0.1.5",
@@ -29,16 +30,15 @@
29
30
  "@hyperbook/element-tabs": "0.1.15",
30
31
  "@hyperbook/element-term": "0.1.14",
31
32
  "@hyperbook/element-youtube": "0.1.14",
32
- "@hyperbook/fs": "0.8.1",
33
- "@hyperbook/markdown": "0.7.0",
33
+ "@hyperbook/fs": "0.9.0",
34
+ "@hyperbook/markdown": "0.8.0",
34
35
  "@hyperbook/provider": "0.3.0",
35
- "@hyperbook/shell": "0.5.0",
36
+ "@hyperbook/shell": "0.6.0",
36
37
  "@hyperbook/store": "0.1.5",
37
- "@hyperbook/styles": "0.2.0",
38
- "@hyperbook/toc": "0.2.3"
38
+ "@hyperbook/styles": "0.2.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@hyperbook/next-watch": "0.3.0"
41
+ "@hyperbook/next-watch": "0.4.0"
42
42
  },
43
43
  "scripts": {
44
44
  "next:dev": "next-hyperbook-watch",
@@ -1 +1 @@
1
- import{Shell as F}from"@hyperbook/shell";import{parseTocFromMarkdown as N}from"@hyperbook/toc";import{Markdown as G}from"@hyperbook/markdown";import{useActivePageId as L,useLink as M}from"@hyperbook/provider";import{Fragment as H}from"react";import{vfile as u,hyperbook as k}from"@hyperbook/fs";import{useScrollHash as T}from"../useScrollHash";import B from"path";function J({markdown:r,data:a,navigation:o,toc:e}){const t=o.current,P=M();return L(),T(),<H><F navigation={o}toc={t.toc==!1?null:e}><article><G children={r}/></article>{!a.hide&&<div className="jump-container">{o.previous?<P className="jump previous"href={o.previous.href}>{o.previous.name}</P>:<div className="flex"/>}{o.next?<P className="jump next"href={o.next.href}>{o.next.name}</P>:<div className="flex"/>}</div>}</F></H>}const X=async({params:r})=>{const a=process.env.root??process.cwd();let o="";r.page&&(o=B.join(...r.page));const e=await u.get(a,"book","/"+o);if(!e)throw Error(`Missing file ${o}`);const{content:t,data:P}=await u.getMarkdown(e),w=await k.getJson(a),S=await k.getNavigation(a,e);return{props:{locale:P?.lang||w.language,markdown:t,data:P,toc:N(t),navigation:S}}},Y=async()=>{const r=process.env.root??process.cwd();return{paths:(await u.listForFolder(r,"book",k.allowedBookFiles)).map(e=>{const t=e.path.href.slice(1).split("/");return e.name==="index"&&e.path.directory===""&&t.pop(),{params:{page:t}}}),fallback:!1}};export{J as default,Y as getStaticPaths,X as getStaticProps};
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 +1 @@
1
- import"../index.css";import"@hyperbook/shell/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"../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 +1 @@
1
- import{Shell as F}from"@hyperbook/shell";import{Fragment as T}from"react";import{parseTocFromMarkdown as G}from"@hyperbook/toc";import{useActivePageId as M,useLink as b}from"@hyperbook/provider";import{Markdown as L}from"@hyperbook/markdown";import{glossary as y,hyperbook as S,vfile as v}from"@hyperbook/fs";import{useScrollHash as J}from"../../useScrollHash";function N({markdown:r,navigation:o,references:t,toc:e}){const P=b();return M(),J(),<F navigation={o}toc={e}><article><L children={r}/><div className="pages">{t.map((a,k)=><T key={a.path.href}>{k>0&&", "}<P href={a.path.href}>{a.name}</P></T>)}</div></article></F>}const D=async({params:r})=>{const o=process.env.root??process.cwd(),t=await v.get(o,"glossary","/glossary/"+r.term.join("/"));if(!t)throw Error(`Missing file ${t}`);const e=await y.getReferences(t),{content:P,data:a}=await v.getMarkdown(t),k=await S.getJson(o),u=await S.getNavigation(o,t);return{props:{locale:a?.lang||k.language,markdown:P,references:e,toc:G(P),navigation:u}}},K=async()=>{const r=process.env.root??process.cwd();return{paths:(await v.listForFolder(r,"glossary",y.allowedGlossaryFiles)).map(e=>({params:{term:e.path.href.slice(10).split("/")}})),fallback:!1}};export{N as default,K as getStaticPaths,D as getStaticProps};
1
+ import{Shell as S}from"@hyperbook/shell";import{Fragment as F}from"react";import{useActivePageId as T,useLink as G}from"@hyperbook/provider";import{Markdown as H}from"@hyperbook/markdown";import{hyperbook as v,vfile as w}from"@hyperbook/fs";import{useScrollHash as L}from"../../useScrollHash";function M({markdown:e,navigation:r,data:t,references:o}){const P=G();return T(),L(),<S navigation={r}><article><H children={e}showToc={t.toc!==!1}/><div className="pages">{o.map((a,k)=><F key={a.path.href}>{k>0&&", "}<P href={a.path.href}>{a.name}</P></F>)}</div></article></S>}const D=async({params:e})=>{const r=process.env.root??process.cwd(),t=await w.get(r,"glossary","/glossary/"+e.term.join("/"));if(!t)throw Error(`Missing file ${t}`);const{content:o,data:P}=await w.getMarkdown(t),a=await v.getJson(r),k=await v.getNavigation(r,t);return{props:{locale:P?.lang||a.language,markdown:o,data:P,references:t.references,navigation:k}}},K=async()=>{const e=process.env.root??process.cwd();return{paths:(await w.listForFolder(e,"glossary")).map(o=>({params:{term:o.path.href.slice(10).split("/")}})),fallback:!1}};export{M as default,K as getStaticPaths,D as getStaticProps};
@@ -1 +1 @@
1
- import{Shell as S}from"@hyperbook/shell";import{useActivePageId as d,useLink as N}from"@hyperbook/provider";import{glossary as w,hyperbook as k}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.get(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{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 +1 @@
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 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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperbook",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",
@@ -44,10 +44,10 @@
44
44
  "rimraf": "3.0.2",
45
45
  "tar": "6.1.14",
46
46
  "update-check": "1.5.4",
47
- "@platforms/web": "0.20.0"
47
+ "@platforms/web": "0.22.0"
48
48
  },
49
49
  "dependencies": {
50
- "@hyperbook/fs": "0.8.1",
50
+ "@hyperbook/fs": "0.9.0",
51
51
  "@hyperbook/types": "0.6.1"
52
52
  },
53
53
  "scripts": {