hyperbook 0.60.0 → 0.61.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.
@@ -274,9 +274,38 @@ var hyperbook = (function () {
274
274
  initBookmarks(root);
275
275
  }
276
276
 
277
+ // Check for standalone layout URL parameter or iframe context
278
+ function checkStandaloneMode() {
279
+ // Check if explicitly requested via URL parameter
280
+ const urlParams = new URLSearchParams(window.location.search);
281
+ const standaloneParam = urlParams.get('standalone') === 'true';
282
+
283
+ // Check if page is inside an iframe
284
+ const isInIframe = window.self !== window.top;
285
+
286
+ if (standaloneParam || isInIframe) {
287
+ const mainGrid = document.querySelector('.main-grid');
288
+ if (mainGrid && !mainGrid.classList.contains('layout-standalone')) {
289
+ mainGrid.classList.add('layout-standalone');
290
+ }
291
+
292
+ // Hide TOC and QR code buttons when in standalone mode
293
+ const tocToggle = document.getElementById('toc-toggle');
294
+ if (tocToggle) {
295
+ tocToggle.style.display = 'none';
296
+ }
297
+
298
+ const qrcodeOpen = document.getElementById('qrcode-open');
299
+ if (qrcodeOpen) {
300
+ qrcodeOpen.style.display = 'none';
301
+ }
302
+ }
303
+ }
304
+
277
305
  // Initialize existing elements on document load
278
306
  document.addEventListener("DOMContentLoaded", () => {
279
307
  init(document);
308
+ checkStandaloneMode();
280
309
  });
281
310
 
282
311
  // Observe for new elements added to the DOM
@@ -807,3 +807,62 @@ nav.toc li.level-3 {
807
807
  flex-shrink: 0;
808
808
  /* Prevent caption from shrinking */
809
809
  }
810
+
811
+ /* Wide layout: full width content with drawer-only navigation */
812
+ .main-grid.layout-wide {
813
+ grid-template-columns: 1fr;
814
+ grid-template-areas:
815
+ "header"
816
+ "article";
817
+
818
+
819
+ --main-width: 100%;
820
+ }
821
+
822
+ .main-grid.layout-wide .sidebar {
823
+ display: none;
824
+ }
825
+
826
+ .main-grid.layout-wide .mobile-nav {
827
+ display: flex;
828
+ align-items: center;
829
+ justify-content: center;
830
+ }
831
+
832
+ .main-grid.layout-wide main {
833
+ padding: 20px 40px;
834
+ max-width: 100%;
835
+ }
836
+
837
+ /* Standalone layout: content only, no navigation or header (for iframe embedding) */
838
+ .main-grid.layout-standalone {
839
+ grid-template-columns: 1fr;
840
+ grid-template-rows: 1fr;
841
+ grid-template-areas: "article";
842
+
843
+ --main-width: 100%;
844
+
845
+ #toc-toggle {
846
+ top: inherit;
847
+ }
848
+
849
+ #qrcode-open {
850
+ top: 90px;
851
+ }
852
+ }
853
+
854
+ .main-grid.layout-standalone header,
855
+ .main-grid.layout-standalone .sidebar {
856
+ display: none;
857
+ }
858
+
859
+ .main-grid.layout-standalone main {
860
+ padding: 20px 40px;
861
+ max-width: 100%;
862
+ }
863
+
864
+ .main-grid.layout-standalone .jump-container,
865
+ .main-grid.layout-standalone .meta,
866
+ .main-grid.layout-standalone #custom-links-footer {
867
+ display: none;
868
+ }
package/dist/index.js CHANGED
@@ -168391,12 +168391,19 @@ var makeCustomLinksFooter = (ctx) => {
168391
168391
  var rehypeShell_default = (ctx) => () => {
168392
168392
  return (tree, file) => {
168393
168393
  const originalChildren = tree.children;
168394
+ const layout = ctx.navigation.current?.layout || "default";
168395
+ let mainGridClass = "main-grid";
168396
+ if (layout === "wide") {
168397
+ mainGridClass = "main-grid layout-wide";
168398
+ } else if (layout === "standalone") {
168399
+ mainGridClass = "main-grid layout-standalone";
168400
+ }
168394
168401
  tree.children = [
168395
168402
  {
168396
168403
  type: "element",
168397
168404
  tagName: "div",
168398
168405
  properties: {
168399
- class: "main-grid"
168406
+ class: mainGridClass
168400
168407
  },
168401
168408
  children: [
168402
168409
  ...makeHeaderElements(ctx),
@@ -183311,7 +183318,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
183311
183318
  /***/ ((module) => {
183312
183319
 
183313
183320
  "use strict";
183314
- module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.60.0","author":"Mike Barkmin","homepage":"https://github.com/openpatch/hyperbook#readme","license":"MIT","bin":{"hyperbook":"./dist/index.js"},"files":["dist"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/openpatch/hyperbook.git","directory":"packages/hyperbook"},"bugs":{"url":"https://github.com/openpatch/hyperbook/issues"},"engines":{"node":">=12.22.0"},"scripts":{"version":"pnpm build","lint":"tsc --noEmit","dev":"ncc build ./index.ts -w -o dist/","build":"rimraf dist && ncc build ./index.ts -o ./dist/ --no-cache --no-source-map-register --external favicons --external sharp && node postbuild.mjs"},"dependencies":{"favicons":"^7.2.0"},"devDependencies":{"@hyperbook/fs":"workspace:*","@hyperbook/markdown":"workspace:*","@hyperbook/types":"workspace:*","@pnpm/exportable-manifest":"1000.0.6","@types/archiver":"6.0.3","@types/async-retry":"1.4.9","@types/cross-spawn":"6.0.6","@types/lunr":"^2.3.7","@types/prompts":"2.4.9","@types/tar":"6.1.13","@types/ws":"^8.5.14","@vercel/ncc":"0.38.3","archiver":"7.0.1","async-retry":"1.3.3","chalk":"5.4.1","chokidar":"4.0.3","commander":"12.1.0","cpy":"11.1.0","cross-spawn":"7.0.6","domutils":"^3.2.2","extract-zip":"^2.0.1","got":"12.6.0","htmlparser2":"^10.0.0","lunr":"^2.3.9","lunr-languages":"^1.14.0","mime":"^4.0.6","prompts":"2.4.2","rimraf":"6.0.1","tar":"7.4.3","update-check":"1.5.4","ws":"^8.18.0"}}');
183321
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.61.0","author":"Mike Barkmin","homepage":"https://github.com/openpatch/hyperbook#readme","license":"MIT","bin":{"hyperbook":"./dist/index.js"},"files":["dist"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/openpatch/hyperbook.git","directory":"packages/hyperbook"},"bugs":{"url":"https://github.com/openpatch/hyperbook/issues"},"engines":{"node":">=12.22.0"},"scripts":{"version":"pnpm build","lint":"tsc --noEmit","dev":"ncc build ./index.ts -w -o dist/","build":"rimraf dist && ncc build ./index.ts -o ./dist/ --no-cache --no-source-map-register --external favicons --external sharp && node postbuild.mjs"},"dependencies":{"favicons":"^7.2.0"},"devDependencies":{"@hyperbook/fs":"workspace:*","@hyperbook/markdown":"workspace:*","@hyperbook/types":"workspace:*","@pnpm/exportable-manifest":"1000.0.6","@types/archiver":"6.0.3","@types/async-retry":"1.4.9","@types/cross-spawn":"6.0.6","@types/lunr":"^2.3.7","@types/prompts":"2.4.9","@types/tar":"6.1.13","@types/ws":"^8.5.14","@vercel/ncc":"0.38.3","archiver":"7.0.1","async-retry":"1.3.3","chalk":"5.4.1","chokidar":"4.0.3","commander":"12.1.0","cpy":"11.1.0","cross-spawn":"7.0.6","domutils":"^3.2.2","extract-zip":"^2.0.1","got":"12.6.0","htmlparser2":"^10.0.0","lunr":"^2.3.9","lunr-languages":"^1.14.0","mime":"^4.0.6","prompts":"2.4.2","rimraf":"6.0.1","tar":"7.4.3","update-check":"1.5.4","ws":"^8.18.0"}}');
183315
183322
 
183316
183323
  /***/ })
183317
183324
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperbook",
3
- "version": "0.60.0",
3
+ "version": "0.61.0",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",
@@ -56,9 +56,9 @@
56
56
  "tar": "7.4.3",
57
57
  "update-check": "1.5.4",
58
58
  "ws": "^8.18.0",
59
- "@hyperbook/markdown": "0.35.1",
60
- "@hyperbook/types": "0.16.0",
61
- "@hyperbook/fs": "0.20.0"
59
+ "@hyperbook/markdown": "0.36.0",
60
+ "@hyperbook/fs": "0.20.0",
61
+ "@hyperbook/types": "0.17.0"
62
62
  },
63
63
  "scripts": {
64
64
  "version": "pnpm build",