hyperbook 0.9.3 → 0.10.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,10 +1,10 @@
1
1
  {
2
2
  "name": "@platforms/web",
3
- "version": "0.9.3",
3
+ "version": "0.10.0",
4
4
  "private": true,
5
5
  "dependencies": {
6
6
  "gray-matter": "4.0.3",
7
- "next": "12.3.4",
7
+ "next": "13.1.1",
8
8
  "react": "18.2.0",
9
9
  "react-dom": "18.2.0",
10
10
  "react-redux": "8.0.5",
@@ -13,26 +13,26 @@
13
13
  "@hyperbook/element-alert": "0.1.9",
14
14
  "@hyperbook/element-bitflow": "0.1.10",
15
15
  "@hyperbook/element-bookmarks": "0.2.4",
16
- "@hyperbook/element-collapsible": "0.2.5",
16
+ "@hyperbook/element-collapsible": "0.3.0",
17
17
  "@hyperbook/element-dl": "0.1.9",
18
18
  "@hyperbook/element-excalidraw": "0.3.1",
19
19
  "@hyperbook/element-mermaid": "0.1.9",
20
- "@hyperbook/element-protect": "0.2.4",
20
+ "@hyperbook/element-protect": "0.3.0",
21
21
  "@hyperbook/element-qr": "0.1.10",
22
22
  "@hyperbook/element-struktog": "0.1.9",
23
23
  "@hyperbook/element-tabs": "0.1.10",
24
24
  "@hyperbook/element-term": "0.1.9",
25
25
  "@hyperbook/element-youtube": "0.1.9",
26
- "@hyperbook/fs": "0.2.0",
27
- "@hyperbook/markdown": "0.5.1",
26
+ "@hyperbook/fs": "0.3.0",
27
+ "@hyperbook/markdown": "0.5.2",
28
28
  "@hyperbook/provider": "0.2.1",
29
- "@hyperbook/shell": "0.3.0",
29
+ "@hyperbook/shell": "0.4.0",
30
30
  "@hyperbook/store": "0.1.2",
31
31
  "@hyperbook/styles": "0.1.9",
32
32
  "@hyperbook/toc": "0.2.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@hyperbook/next-watch": "0.1.2"
35
+ "@hyperbook/next-watch": "0.2.0"
36
36
  },
37
37
  "scripts": {
38
38
  "next:dev": "next-hyperbook-watch",
@@ -1 +1 @@
1
- import v from"path";import{Shell as N}from"@hyperbook/shell";import{parseTocFromMarkdown as F}from"@hyperbook/toc";import{Markdown as G}from"@hyperbook/markdown";import{useActivePageId as L,useLink as H}from"@hyperbook/provider";import{Fragment as I}from"react";import{makeNavigationForHyperbook as T,readBook as B,readFile as M,readHyperbook as A}from"@hyperbook/fs";import{useScrollHash as $}from"../useScrollHash";function q({markdown:u,navigation:e,toc:k}){const x=e.current,P=H();return L(),$(),<I><N navigation={e}toc={x.toc==!1?null:k}><article><G children={u}/></article><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></I>}const Y=async({params:u})=>{const e=process.env.root??process.cwd();let k=v.join(e,"book"),x="/";u.page&&(k=v.join(k,...u.page),x="/"+v.join(...u.page));const{content:P,data:S}=await M(k),w=await A(e),j=await T(e,x);return{props:{locale:S?.lang||w.language,markdown:P,toc:F(P),navigation:j}}},Z=async()=>{const u=process.env.root??process.cwd();return{paths:(await B(u)).map(x=>{const P=v.relative(v.join(u,"book"),x).replace(/\.md$/,"").split("/");return P[P.length-1]==="index"&&P.pop(),{params:{page:P}}}),fallback:!1}};export{q as default,Z as getStaticPaths,Y as getStaticProps};
1
+ import v from"path";import{Shell as N}from"@hyperbook/shell";import{parseTocFromMarkdown as F}from"@hyperbook/toc";import{Markdown as G}from"@hyperbook/markdown";import{useActivePageId as L,useLink as H}from"@hyperbook/provider";import{Fragment as I}from"react";import{makeNavigationForHyperbook as T,readBook as B,readFile as M,readHyperbook as A,resolveSnippets as W}from"@hyperbook/fs";import{useScrollHash as $}from"../useScrollHash";function q({markdown:u,navigation:e,toc:k}){const S=e.current,P=H();return L(),$(),<I><N navigation={e}toc={S.toc==!1?null:k}><article><G children={u}/></article><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></I>}const Z=async({params:u})=>{const e=process.env.root??process.cwd();let k=v.join(e,"book"),S="/";u.page&&(k=v.join(k,...u.page),S="/"+v.join(...u.page));const{content:P,data:x}=await M(k),w=await W(e,P),j=await A(e),b=await T(e,S);return{props:{locale:x?.lang||j.language,markdown:w,toc:F(w),navigation:b}}},_=async()=>{const u=process.env.root??process.cwd();return{paths:(await B(u)).map(S=>{const P=v.relative(v.join(u,"book"),S).replace(/\.md$/,"").split("/");return P[P.length-1]==="index"&&P.pop(),{params:{page:P}}}),fallback:!1}};export{q as default,_ as getStaticPaths,Z 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 S}from"@hyperbook/provider";import O from"@hyperbook/element-tabs";import"@hyperbook/element-tabs/index.css";import T from"@hyperbook/element-alert";import"@hyperbook/element-alert/index.css";import w from"@hyperbook/element-term";import"@hyperbook/element-term/index.css";import x from"@hyperbook/element-youtube";import"@hyperbook/element-youtube/index.css";import A from"@hyperbook/element-protect";import"@hyperbook/element-protect/index.css";import D from"@hyperbook/element-collapsible";import"@hyperbook/element-collapsible/index.css";import M from"@hyperbook/element-dl";import"@hyperbook/element-dl/index.css";import U from"@hyperbook/element-bookmarks";import"@hyperbook/element-bookmarks/index.css";import b from"@hyperbook/element-struktog";import"@hyperbook/element-struktog/index.css";import h from"@hyperbook/element-qr";import"@hyperbook/element-qr/index.css";import B from"@hyperbook/element-mermaid";import"@hyperbook/element-mermaid/index.css";import C from"@hyperbook/element-excalidraw";import"@hyperbook/element-excalidraw/index.css";import F from"@hyperbook/element-bitflow";import"@hyperbook/element-bitflow/index.css";import H from"next/link";import V from"next/head";import{Styles as W}from"@hyperbook/styles";import{localStorage as _}from"@hyperbook/store";import{useRouter as j}from"next/router";import{useEffect as I}from"react";import J from"../../hyperbook.json";const Q=({href:E,children:r,...P})=><H href={E}><a{...P}>{r}</a></H>,R=({basePath:E})=>r=>(process.env.NODE_ENV==="production"&&E&&r.startsWith("/")&&(E.endsWith("/")?r=E.slice(0,-1)+r:r=E+r),r);function Y({Component:E,pageProps:r}){const P=j();return I(()=>{document.documentElement.lang=r.locale},[r.locale]),<S Link={Q}Head={V}config={J}makeUrl={R}env={process.env.NODE_ENV==="production"?"production":"development"}elements={[O,T,w,x,D,A,M,U,b,h,B,C,F]}router={P}storage={_}loadFile={()=>async g=>fetch(g).then(L=>L.text())}saveFile={()=>async(g,L,N)=>{await fetch("/api/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:g,content:L,rootFolder:N})})}}getActivePageId={async()=>P.asPath.split("#")?.[0]||"/"}><W/><E{...r}/></S>}export{Y as default};
1
+ import"../index.css";import"@hyperbook/shell/index.css";import"@hyperbook/markdown/katex.css";import"@hyperbook/markdown/index.css";import{Provider as S}from"@hyperbook/provider";import O from"@hyperbook/element-tabs";import"@hyperbook/element-tabs/index.css";import T from"@hyperbook/element-alert";import"@hyperbook/element-alert/index.css";import w from"@hyperbook/element-term";import"@hyperbook/element-term/index.css";import x from"@hyperbook/element-youtube";import"@hyperbook/element-youtube/index.css";import A from"@hyperbook/element-protect";import"@hyperbook/element-protect/index.css";import D from"@hyperbook/element-collapsible";import"@hyperbook/element-collapsible/index.css";import M from"@hyperbook/element-dl";import"@hyperbook/element-dl/index.css";import U from"@hyperbook/element-bookmarks";import"@hyperbook/element-bookmarks/index.css";import b from"@hyperbook/element-struktog";import"@hyperbook/element-struktog/index.css";import h from"@hyperbook/element-qr";import"@hyperbook/element-qr/index.css";import B from"@hyperbook/element-mermaid";import"@hyperbook/element-mermaid/index.css";import C from"@hyperbook/element-excalidraw";import"@hyperbook/element-excalidraw/index.css";import F from"@hyperbook/element-bitflow";import"@hyperbook/element-bitflow/index.css";import H from"next/link";import V from"next/head";import{Styles as W}from"@hyperbook/styles";import{localStorage as _}from"@hyperbook/store";import{useRouter as j}from"next/router";import{useEffect as I}from"react";import J from"../../hyperbook.json";const Q=({ref:E,href:r,children:g,...P})=><H href={r}{...P}>{g}</H>,R=({basePath:E})=>r=>(process.env.NODE_ENV==="production"&&E&&r.startsWith("/")&&(E.endsWith("/")?r=E.slice(0,-1)+r:r=E+r),r);function Y({Component:E,pageProps:r}){const g=j();return I(()=>{document.documentElement.lang=r.locale},[r.locale]),<S Link={Q}Head={V}config={J}makeUrl={R}env={process.env.NODE_ENV==="production"?"production":"development"}elements={[O,T,w,x,D,A,M,U,b,h,B,C,F]}router={g}storage={_}loadFile={()=>async P=>fetch(P).then(L=>L.text())}saveFile={()=>async(P,L,N)=>{await fetch("/api/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:P,content:L,rootFolder:N})})}}getActivePageId={async()=>g.asPath.split("#")?.[0]||"/"}><W/><E{...r}/></S>}export{Y as default};
@@ -1 +1 @@
1
- import v from"path";import{Shell as T}from"@hyperbook/shell";import{Fragment as F}from"react";import{parseTocFromMarkdown as b}from"@hyperbook/toc";import{useActivePageId as G,useLink as j}from"@hyperbook/provider";import{Markdown as H}from"@hyperbook/markdown";import{readFile as L,readGlossary as M,makeNavigationForHyperbook as N,readHyperbook as A,listPagesForTerm as I}from"@hyperbook/fs";import{useScrollHash as $}from"../../useScrollHash";function q({markdown:t,navigation:r,term:a,toc:o}){const P=j();return G(),$(),<T navigation={r}toc={a?.toc===!0?o:null}><article><H children={t}/><div className="pages">{a.pages.map((e,k)=><F key={e.href}>{k>0&&", "}<P href={e.href}>{e.name}</P></F>)}</div></article></T>}const X=async({params:t})=>{const r=process.env.root??process.cwd(),a=v.join(r,"glossary",...t.term),o="/glossary/"+v.join(...t.term),{content:P,data:e}=await L(a),k=await N(r,o),d=await A(r),S=await I(r,t.term[0]),u={...e,pages:S};return d?.repo&&(u.repo=d.repo+o+".md"),{props:{locale:e?.lang||d.language,term:u,markdown:P,toc:b(P),navigation:k,hyperbook:d}}},Y=async()=>{const t=process.env.root??process.cwd();return{paths:(await M(t)).map(o=>({params:{term:v.relative(v.join(t,"glossary"),o).replace(/\.md$/,"").split("/")}})),fallback:!1}};export{q as default,Y as getStaticPaths,X as getStaticProps};
1
+ import S from"path";import{Shell as T}from"@hyperbook/shell";import{Fragment as F}from"react";import{parseTocFromMarkdown as b}from"@hyperbook/toc";import{useActivePageId as G,useLink as j}from"@hyperbook/provider";import{Markdown as H}from"@hyperbook/markdown";import{readFile as L,readGlossary as M,makeNavigationForHyperbook as N,readHyperbook as A,listPagesForTerm as I,resolveSnippets as W}from"@hyperbook/fs";import{useScrollHash as $}from"../../useScrollHash";function q({markdown:t,navigation:o,term:a,toc:r}){const P=j();return G(),$(),<T navigation={o}toc={a?.toc===!0?r:null}><article><H children={t}/><div className="pages">{a.pages.map((e,d)=><F key={e.href}>{d>0&&", "}<P href={e.href}>{e.name}</P></F>)}</div></article></T>}const Y=async({params:t})=>{const o=process.env.root??process.cwd(),a=S.join(o,"glossary",...t.term),r="/glossary/"+S.join(...t.term),{content:P,data:e}=await L(a),d=await W(o,P),u=await N(o,r),v=await A(o),w=await I(o,t.term[0]),k={...e,pages:w};return v?.repo&&(k.repo=v.repo+r+".md"),{props:{locale:e?.lang||v.language,term:k,markdown:d,toc:b(d),navigation:u,hyperbook:v}}},Z=async()=>{const t=process.env.root??process.cwd();return{paths:(await M(t)).map(r=>({params:{term:S.relative(S.join(t,"glossary"),r).replace(/\.md$/,"").split("/")}})),fallback:!1}};export{q as default,Z as getStaticPaths,Y as getStaticProps};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperbook",
3
- "version": "0.9.3",
3
+ "version": "0.10.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.13",
46
46
  "update-check": "1.5.4",
47
- "@platforms/web": "0.9.3"
47
+ "@platforms/web": "0.10.0"
48
48
  },
49
49
  "dependencies": {
50
- "@hyperbook/fs": "0.2.0",
50
+ "@hyperbook/fs": "0.3.0",
51
51
  "@hyperbook/types": "0.5.0"
52
52
  },
53
53
  "scripts": {