hyperbook 0.72.0 → 0.72.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.
package/dist/index.js CHANGED
@@ -155707,6 +155707,7 @@ function remarkDirectiveTabs_default(ctx) {
155707
155707
  if (!tabsId) {
155708
155708
  tabsId = hash(node3);
155709
155709
  }
155710
+ const instanceId = hash(node3);
155710
155711
  registerDirective(
155711
155712
  file,
155712
155713
  "tabs",
@@ -155733,8 +155734,23 @@ function remarkDirectiveTabs_default(ctx) {
155733
155734
  }
155734
155735
  tabTitleElements.push({
155735
155736
  type: "element",
155736
- tagName: "button",
155737
+ tagName: "input",
155737
155738
  properties: {
155739
+ type: "radio",
155740
+ name: `tabs-${instanceId}`,
155741
+ id: `tab-${instanceId}-${tabId}`,
155742
+ "data-tab-id": tabId,
155743
+ "data-tabs-id": tabsId,
155744
+ class: "tab-input",
155745
+ checked: first
155746
+ },
155747
+ children: []
155748
+ });
155749
+ tabTitleElements.push({
155750
+ type: "element",
155751
+ tagName: "label",
155752
+ properties: {
155753
+ for: `tab-${instanceId}-${tabId}`,
155738
155754
  "data-tab-id": tabId,
155739
155755
  "data-tabs-id": tabsId,
155740
155756
  class: "tab" + (first ? " active" : "")
@@ -155754,7 +155770,15 @@ function remarkDirectiveTabs_default(ctx) {
155754
155770
  });
155755
155771
  first = false;
155756
155772
  }
155773
+ const radioInputs = [];
155774
+ const labelElements = [];
155775
+ for (let i = 0; i < tabTitleElements.length; i += 2) {
155776
+ radioInputs.push(tabTitleElements[i]);
155777
+ labelElements.push(tabTitleElements[i + 1]);
155778
+ }
155757
155779
  data.hChildren = [
155780
+ ...radioInputs,
155781
+ // Radio inputs as direct children
155758
155782
  {
155759
155783
  type: "element",
155760
155784
  tagName: "div",
@@ -155762,7 +155786,8 @@ function remarkDirectiveTabs_default(ctx) {
155762
155786
  class: "tabs",
155763
155787
  "data-tabs-id": tabsId
155764
155788
  },
155765
- children: tabTitleElements
155789
+ children: labelElements
155790
+ // Only labels in tabs div
155766
155791
  },
155767
155792
  ...tabContentElements
155768
155793
  ];
@@ -156867,11 +156892,13 @@ body::-webkit-scrollbar {
156867
156892
  font-family: hyperbook-heading;
156868
156893
  src: url(${makeUrl(parseFont(font)[0], "public")});
156869
156894
  size-adjust: ${parseFont(font)[1]};
156895
+ font-display: swap;
156870
156896
  }
156871
156897
  @font-face {
156872
156898
  font-family: hyperbook-body;
156873
156899
  src: url(${makeUrl(parseFont(font)[0], "public")});
156874
156900
  size-adjust: ${parseFont(font)[1]};
156901
+ font-display: swap;
156875
156902
  }
156876
156903
  `;
156877
156904
  }
@@ -156881,6 +156908,7 @@ body::-webkit-scrollbar {
156881
156908
  font-family: hyperbook-body;
156882
156909
  src: url(${makeUrl(parseFont(fonts.body)[0], "public")});
156883
156910
  size-adjust: ${parseFont(fonts.body)[1]};
156911
+ font-display: swap;
156884
156912
  }
156885
156913
  `;
156886
156914
  }
@@ -156890,6 +156918,7 @@ body::-webkit-scrollbar {
156890
156918
  font-family: hyperbook-heading;
156891
156919
  src: url(${makeUrl(parseFont(fonts.heading)[0], "public")});
156892
156920
  size-adjust: ${parseFont(fonts.heading)[1]};
156921
+ font-display: swap;
156893
156922
  }
156894
156923
  `;
156895
156924
  }
@@ -156899,6 +156928,7 @@ body::-webkit-scrollbar {
156899
156928
  font-family: hyperbook-code;
156900
156929
  src: url(${makeUrl(parseFont(fonts.code)[0], "public")});
156901
156930
  size-adjust: ${parseFont(fonts.code)[1]};
156931
+ font-display: swap;
156902
156932
  }
156903
156933
  `;
156904
156934
  }
@@ -156946,7 +156976,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
156946
156976
  type: "element",
156947
156977
  tagName: "html",
156948
156978
  properties: {
156949
- lang: config2.language || "es"
156979
+ lang: config2.language || "es",
156980
+ class: "no-js"
156950
156981
  },
156951
156982
  children: [
156952
156983
  {
@@ -157086,6 +157117,19 @@ var rehypeHtmlStructure_default = (ctx) => () => {
157086
157117
  }
157087
157118
  ]
157088
157119
  },
157120
+ {
157121
+ type: "element",
157122
+ tagName: "script",
157123
+ properties: {},
157124
+ children: [
157125
+ {
157126
+ type: "raw",
157127
+ value: `
157128
+ // Remove no-js class as soon as JavaScript is available
157129
+ document.documentElement.classList.remove('no-js');`
157130
+ }
157131
+ ]
157132
+ },
157089
157133
  {
157090
157134
  type: "element",
157091
157135
  tagName: "script",
@@ -157110,7 +157154,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
157110
157154
  type: "element",
157111
157155
  tagName: "script",
157112
157156
  properties: {
157113
- src: makeUrl(["i18n.js"], "assets")
157157
+ src: makeUrl(["i18n.js"], "assets"),
157158
+ defer: true
157114
157159
  },
157115
157160
  children: []
157116
157161
  },
@@ -157118,7 +157163,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
157118
157163
  type: "element",
157119
157164
  tagName: "script",
157120
157165
  properties: {
157121
- src: makeUrl(["dexie.min.js"], "assets")
157166
+ src: makeUrl(["dexie.min.js"], "assets"),
157167
+ defer: true
157122
157168
  },
157123
157169
  children: []
157124
157170
  },
@@ -157126,7 +157172,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
157126
157172
  type: "element",
157127
157173
  tagName: "script",
157128
157174
  properties: {
157129
- src: makeUrl(["dexie-export-import.js"], "assets")
157175
+ src: makeUrl(["dexie-export-import.js"], "assets"),
157176
+ defer: true
157130
157177
  },
157131
157178
  children: []
157132
157179
  },
@@ -157134,7 +157181,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
157134
157181
  type: "element",
157135
157182
  tagName: "script",
157136
157183
  properties: {
157137
- src: makeUrl(["store.js"], "assets")
157184
+ src: makeUrl(["store.js"], "assets"),
157185
+ defer: true
157138
157186
  },
157139
157187
  children: []
157140
157188
  },
@@ -157155,7 +157203,8 @@ window.Prism.manual = true;`
157155
157203
  type: "element",
157156
157204
  tagName: "script",
157157
157205
  properties: {
157158
- src: makeUrl(["prism", "prism.js"], "assets")
157206
+ src: makeUrl(["prism", "prism.js"], "assets"),
157207
+ defer: true
157159
157208
  },
157160
157209
  children: []
157161
157210
  },
@@ -157411,69 +157460,7 @@ var makeNavigationPageElement = (ctx, page) => {
157411
157460
  };
157412
157461
  var makeNavigationSectionElement = (ctx, section) => {
157413
157462
  const { virtual, isEmpty, href, name, pages, sections, expanded } = section;
157414
- const children = [];
157415
157463
  let isExpanded = ctx.navigation.current?.href?.startsWith(href || "") || expanded;
157416
- if (!virtual) {
157417
- if (isEmpty) {
157418
- children.push({
157419
- type: "element",
157420
- tagName: "div",
157421
- properties: {
157422
- class: [
157423
- "collapsible",
157424
- "name",
157425
- "empty",
157426
- ctx.navigation.current?.href === href ? "active" : "",
157427
- isExpanded ? "expanded" : ""
157428
- ].join(" ")
157429
- },
157430
- children: [
157431
- {
157432
- type: "element",
157433
- tagName: "span",
157434
- properties: {
157435
- class: "label"
157436
- },
157437
- children: [
157438
- {
157439
- type: "text",
157440
- value: name
157441
- }
157442
- ]
157443
- }
157444
- ]
157445
- });
157446
- } else {
157447
- children.push({
157448
- type: "element",
157449
- tagName: "div",
157450
- properties: {
157451
- class: [
157452
- "collapsible",
157453
- "name",
157454
- ctx.navigation.current?.href === href ? "active" : "",
157455
- isExpanded ? "expanded" : ""
157456
- ].join(" ")
157457
- },
157458
- children: [
157459
- {
157460
- type: "element",
157461
- tagName: "a",
157462
- properties: {
157463
- href: ctx.makeUrl(href || "", "book"),
157464
- class: "label"
157465
- },
157466
- children: [
157467
- {
157468
- type: "text",
157469
- value: name
157470
- }
157471
- ]
157472
- }
157473
- ]
157474
- });
157475
- }
157476
- }
157477
157464
  const pagesElements = pages.filter((page) => !page.hide).map((page) => makeNavigationPageElement(ctx, page));
157478
157465
  const linksElements = [];
157479
157466
  if (pagesElements.length > 0) {
@@ -157488,22 +157475,86 @@ var makeNavigationSectionElement = (ctx, section) => {
157488
157475
  }
157489
157476
  const sectionElements = sections.filter((s3) => !s3.hide).map((s3) => makeNavigationSectionElement(ctx, s3));
157490
157477
  linksElements.push(...sectionElements);
157491
- children.push({
157492
- type: "element",
157493
- tagName: "div",
157494
- properties: {
157495
- class: virtual ? "links" : "collapsible-content links"
157496
- },
157497
- children: linksElements
157498
- });
157478
+ if (virtual) {
157479
+ return {
157480
+ type: "element",
157481
+ tagName: "div",
157482
+ properties: {
157483
+ class: "virtual-section"
157484
+ },
157485
+ children: [
157486
+ {
157487
+ type: "element",
157488
+ tagName: "div",
157489
+ properties: {
157490
+ class: "links"
157491
+ },
157492
+ children: linksElements
157493
+ }
157494
+ ]
157495
+ };
157496
+ }
157497
+ const summaryChildren = [];
157498
+ if (isEmpty) {
157499
+ summaryChildren.push({
157500
+ type: "element",
157501
+ tagName: "span",
157502
+ properties: {
157503
+ class: "label"
157504
+ },
157505
+ children: [
157506
+ {
157507
+ type: "text",
157508
+ value: name
157509
+ }
157510
+ ]
157511
+ });
157512
+ } else {
157513
+ summaryChildren.push({
157514
+ type: "element",
157515
+ tagName: "a",
157516
+ properties: {
157517
+ href: ctx.makeUrl(href || "", "book"),
157518
+ class: "label"
157519
+ },
157520
+ children: [
157521
+ {
157522
+ type: "text",
157523
+ value: name
157524
+ }
157525
+ ]
157526
+ });
157527
+ }
157499
157528
  return {
157500
157529
  type: "element",
157501
- tagName: "div",
157530
+ tagName: "details",
157502
157531
  properties: {
157503
157532
  "data-id": `_nav:${href}`,
157504
- class: virtual ? "virtual-section" : "section"
157533
+ class: [
157534
+ "section",
157535
+ ctx.navigation.current?.href === href ? "active" : "",
157536
+ isEmpty ? "empty" : ""
157537
+ ].join(" "),
157538
+ open: isExpanded
157505
157539
  },
157506
- children
157540
+ children: [
157541
+ {
157542
+ type: "element",
157543
+ tagName: "summary",
157544
+ properties: {
157545
+ class: "name"
157546
+ },
157547
+ children: summaryChildren
157548
+ },
157549
+ {
157550
+ type: "element",
157551
+ tagName: "div",
157552
+ properties: {
157553
+ class: "links"
157554
+ },
157555
+ children: linksElements
157556
+ }
157557
+ ]
157507
157558
  };
157508
157559
  };
157509
157560
  var makeNavigationElements = (ctx) => {
@@ -157815,7 +157866,8 @@ var makeHeaderElements = (ctx) => {
157815
157866
  tagName: "img",
157816
157867
  properties: {
157817
157868
  alt: "logo",
157818
- src: ctx.makeUrl(ctx.config.logo, "public")
157869
+ src: ctx.makeUrl(ctx.config.logo, "public"),
157870
+ height: "40"
157819
157871
  },
157820
157872
  children: []
157821
157873
  }
@@ -158769,10 +158821,8 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
158769
158821
  return [
158770
158822
  {
158771
158823
  type: "element",
158772
- tagName: "button",
158773
- properties: {
158774
- class: "collapsible"
158775
- },
158824
+ tagName: "summary",
158825
+ properties: {},
158776
158826
  children: [
158777
158827
  {
158778
158828
  type: "text",
@@ -158784,7 +158834,7 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
158784
158834
  type: "element",
158785
158835
  tagName: "div",
158786
158836
  properties: {
158787
- class: "collapsible-content"
158837
+ class: "content"
158788
158838
  },
158789
158839
  children: element5.children.flatMap(transformCollapsible)
158790
158840
  }
@@ -158807,7 +158857,7 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
158807
158857
  expectContainerDirective(node3, file, name);
158808
158858
  registerDirective(file, name, [], ["style.css"], []);
158809
158859
  node3.attributes = {};
158810
- data.hName = "div";
158860
+ data.hName = "details";
158811
158861
  data.hProperties = {
158812
158862
  class: "directive-collapsible",
158813
158863
  "data-id": id
@@ -158819,10 +158869,8 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
158819
158869
  data.hChildren = [
158820
158870
  {
158821
158871
  type: "element",
158822
- tagName: "button",
158823
- properties: {
158824
- class: "collapsible"
158825
- },
158872
+ tagName: "summary",
158873
+ properties: {},
158826
158874
  children: [
158827
158875
  {
158828
158876
  type: "text",
@@ -158834,7 +158882,7 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
158834
158882
  type: "element",
158835
158883
  tagName: "div",
158836
158884
  properties: {
158837
- class: "collapsible-content"
158885
+ class: "content"
158838
158886
  },
158839
158887
  children: collapsibleContent
158840
158888
  }
@@ -173475,7 +173523,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
173475
173523
  /***/ ((module) => {
173476
173524
 
173477
173525
  "use strict";
173478
- module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.72.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":{"create-hyperbook":"workspace:*","@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"}}');
173526
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.72.2","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":{"create-hyperbook":"workspace:*","@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"}}');
173479
173527
 
173480
173528
  /***/ })
173481
173529
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperbook",
3
- "version": "0.72.0",
3
+ "version": "0.72.2",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "update-check": "1.5.4",
58
58
  "ws": "^8.18.0",
59
59
  "create-hyperbook": "0.3.0",
60
- "@hyperbook/markdown": "0.44.0",
60
+ "@hyperbook/markdown": "0.45.0",
61
61
  "@hyperbook/fs": "0.21.0",
62
62
  "@hyperbook/types": "0.18.0"
63
63
  },