hyperbook 0.72.1 → 0.73.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.
- package/dist/assets/client.js +32 -27
- package/dist/assets/directive-collapsible/style.css +19 -23
- package/dist/assets/directive-tabs/client.js +31 -27
- package/dist/assets/directive-tabs/style.css +95 -12
- package/dist/assets/directive-typst/client.js +631 -0
- package/dist/assets/directive-typst/style.css +466 -0
- package/dist/assets/prism/prism-typst.js +182 -0
- package/dist/assets/shell.css +55 -22
- package/dist/assets/store.js +2 -1
- package/dist/assets/uzip/uzip.js +1538 -0
- package/dist/index.js +549 -90
- package/dist/locales/de.json +21 -1
- package/dist/locales/en.json +21 -1
- package/package.json +2 -2
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: "
|
|
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:
|
|
155789
|
+
children: labelElements
|
|
155790
|
+
// Only labels in tabs div
|
|
155766
155791
|
},
|
|
155767
155792
|
...tabContentElements
|
|
155768
155793
|
];
|
|
@@ -155930,7 +155955,27 @@ var en_default = {
|
|
|
155930
155955
|
"webide-reset": "Reset",
|
|
155931
155956
|
"webide-reset-prompt": "Are you sure you want to reset the code?",
|
|
155932
155957
|
"webide-copy": "Copy",
|
|
155933
|
-
"webide-download": "Download"
|
|
155958
|
+
"webide-download": "Download",
|
|
155959
|
+
"typst-code": "Typst",
|
|
155960
|
+
"typst-reset": "Reset",
|
|
155961
|
+
"typst-reset-prompt": "Are you sure you want to reset the code?",
|
|
155962
|
+
"typst-download-pdf": "Download PDF",
|
|
155963
|
+
"typst-pdf-error": "Error exporting PDF",
|
|
155964
|
+
"typst-download-project": "Download Project",
|
|
155965
|
+
"typst-loading": "Loading Typst...",
|
|
155966
|
+
"typst-add-source-file": "Add source file",
|
|
155967
|
+
"typst-add-binary-file": "Add binary file",
|
|
155968
|
+
"typst-source": "Source",
|
|
155969
|
+
"typst-binary": "Binary",
|
|
155970
|
+
"typst-add": "Add",
|
|
155971
|
+
"typst-delete-file": "Delete file",
|
|
155972
|
+
"typst-delete-confirm": "Delete",
|
|
155973
|
+
"typst-filename-prompt": "Enter filename (e.g., helper.typ):",
|
|
155974
|
+
"typst-filename-error": "Filename must end with .typ or .typst",
|
|
155975
|
+
"typst-filename-exists": "File already exists",
|
|
155976
|
+
"typst-file-replace": "Replace existing file?",
|
|
155977
|
+
"typst-binary-files": "Binary Files",
|
|
155978
|
+
"typst-no-binary-files": "No binary files"
|
|
155934
155979
|
};
|
|
155935
155980
|
|
|
155936
155981
|
// locales/de.json
|
|
@@ -155989,7 +156034,27 @@ var de_default = {
|
|
|
155989
156034
|
"webide-reset": "Zur\xFCcksetzen",
|
|
155990
156035
|
"webide-reset-prompt": "Sind Sie sicher, dass Sie den Code zur\xFCcksetzen m\xF6chten?",
|
|
155991
156036
|
"webide-copy": "Kopieren",
|
|
155992
|
-
"webide-download": "Herunterladen"
|
|
156037
|
+
"webide-download": "Herunterladen",
|
|
156038
|
+
"typst-code": "Typst",
|
|
156039
|
+
"typst-reset": "Zur\xFCcksetzen",
|
|
156040
|
+
"typst-reset-prompt": "Sind Sie sicher, dass Sie den Code zur\xFCcksetzen m\xF6chten?",
|
|
156041
|
+
"typst-download-pdf": "PDF herunterladen",
|
|
156042
|
+
"typst-pdf-error": "Fehler beim PDF-Export",
|
|
156043
|
+
"typst-download-project": "Projekt herunterladen",
|
|
156044
|
+
"typst-loading": "Typst wird geladen...",
|
|
156045
|
+
"typst-add-source-file": "Quelldatei hinzuf\xFCgen",
|
|
156046
|
+
"typst-add-binary-file": "Bin\xE4rdatei hinzuf\xFCgen",
|
|
156047
|
+
"typst-source": "Quelle",
|
|
156048
|
+
"typst-binary": "Bin\xE4r",
|
|
156049
|
+
"typst-add": "Hinzuf\xFCgen",
|
|
156050
|
+
"typst-delete-file": "Datei l\xF6schen",
|
|
156051
|
+
"typst-delete-confirm": "L\xF6schen",
|
|
156052
|
+
"typst-filename-prompt": "Dateiname eingeben (z.B. helper.typ):",
|
|
156053
|
+
"typst-filename-error": "Dateiname muss auf .typ oder .typst enden",
|
|
156054
|
+
"typst-filename-exists": "Datei existiert bereits",
|
|
156055
|
+
"typst-file-replace": "Existierende Datei ersetzen?",
|
|
156056
|
+
"typst-binary-files": "Bin\xE4rdateien",
|
|
156057
|
+
"typst-no-binary-files": "Keine Bin\xE4rdateien"
|
|
155993
156058
|
};
|
|
155994
156059
|
|
|
155995
156060
|
// src/i18n.ts
|
|
@@ -156951,7 +157016,8 @@ var rehypeHtmlStructure_default = (ctx) => () => {
|
|
|
156951
157016
|
type: "element",
|
|
156952
157017
|
tagName: "html",
|
|
156953
157018
|
properties: {
|
|
156954
|
-
lang: config2.language || "es"
|
|
157019
|
+
lang: config2.language || "es",
|
|
157020
|
+
class: "no-js"
|
|
156955
157021
|
},
|
|
156956
157022
|
children: [
|
|
156957
157023
|
{
|
|
@@ -157091,6 +157157,19 @@ var rehypeHtmlStructure_default = (ctx) => () => {
|
|
|
157091
157157
|
}
|
|
157092
157158
|
]
|
|
157093
157159
|
},
|
|
157160
|
+
{
|
|
157161
|
+
type: "element",
|
|
157162
|
+
tagName: "script",
|
|
157163
|
+
properties: {},
|
|
157164
|
+
children: [
|
|
157165
|
+
{
|
|
157166
|
+
type: "raw",
|
|
157167
|
+
value: `
|
|
157168
|
+
// Remove no-js class as soon as JavaScript is available
|
|
157169
|
+
document.documentElement.classList.remove('no-js');`
|
|
157170
|
+
}
|
|
157171
|
+
]
|
|
157172
|
+
},
|
|
157094
157173
|
{
|
|
157095
157174
|
type: "element",
|
|
157096
157175
|
tagName: "script",
|
|
@@ -157169,6 +157248,15 @@ window.Prism.manual = true;`
|
|
|
157169
157248
|
},
|
|
157170
157249
|
children: []
|
|
157171
157250
|
},
|
|
157251
|
+
{
|
|
157252
|
+
type: "element",
|
|
157253
|
+
tagName: "script",
|
|
157254
|
+
properties: {
|
|
157255
|
+
src: makeUrl(["prism", "prism-typst.js"], "assets"),
|
|
157256
|
+
defer: true
|
|
157257
|
+
},
|
|
157258
|
+
children: []
|
|
157259
|
+
},
|
|
157172
157260
|
{
|
|
157173
157261
|
type: "element",
|
|
157174
157262
|
tagName: "link",
|
|
@@ -157421,69 +157509,7 @@ var makeNavigationPageElement = (ctx, page) => {
|
|
|
157421
157509
|
};
|
|
157422
157510
|
var makeNavigationSectionElement = (ctx, section) => {
|
|
157423
157511
|
const { virtual, isEmpty, href, name, pages, sections, expanded } = section;
|
|
157424
|
-
const children = [];
|
|
157425
157512
|
let isExpanded = ctx.navigation.current?.href?.startsWith(href || "") || expanded;
|
|
157426
|
-
if (!virtual) {
|
|
157427
|
-
if (isEmpty) {
|
|
157428
|
-
children.push({
|
|
157429
|
-
type: "element",
|
|
157430
|
-
tagName: "div",
|
|
157431
|
-
properties: {
|
|
157432
|
-
class: [
|
|
157433
|
-
"collapsible",
|
|
157434
|
-
"name",
|
|
157435
|
-
"empty",
|
|
157436
|
-
ctx.navigation.current?.href === href ? "active" : "",
|
|
157437
|
-
isExpanded ? "expanded" : ""
|
|
157438
|
-
].join(" ")
|
|
157439
|
-
},
|
|
157440
|
-
children: [
|
|
157441
|
-
{
|
|
157442
|
-
type: "element",
|
|
157443
|
-
tagName: "span",
|
|
157444
|
-
properties: {
|
|
157445
|
-
class: "label"
|
|
157446
|
-
},
|
|
157447
|
-
children: [
|
|
157448
|
-
{
|
|
157449
|
-
type: "text",
|
|
157450
|
-
value: name
|
|
157451
|
-
}
|
|
157452
|
-
]
|
|
157453
|
-
}
|
|
157454
|
-
]
|
|
157455
|
-
});
|
|
157456
|
-
} else {
|
|
157457
|
-
children.push({
|
|
157458
|
-
type: "element",
|
|
157459
|
-
tagName: "div",
|
|
157460
|
-
properties: {
|
|
157461
|
-
class: [
|
|
157462
|
-
"collapsible",
|
|
157463
|
-
"name",
|
|
157464
|
-
ctx.navigation.current?.href === href ? "active" : "",
|
|
157465
|
-
isExpanded ? "expanded" : ""
|
|
157466
|
-
].join(" ")
|
|
157467
|
-
},
|
|
157468
|
-
children: [
|
|
157469
|
-
{
|
|
157470
|
-
type: "element",
|
|
157471
|
-
tagName: "a",
|
|
157472
|
-
properties: {
|
|
157473
|
-
href: ctx.makeUrl(href || "", "book"),
|
|
157474
|
-
class: "label"
|
|
157475
|
-
},
|
|
157476
|
-
children: [
|
|
157477
|
-
{
|
|
157478
|
-
type: "text",
|
|
157479
|
-
value: name
|
|
157480
|
-
}
|
|
157481
|
-
]
|
|
157482
|
-
}
|
|
157483
|
-
]
|
|
157484
|
-
});
|
|
157485
|
-
}
|
|
157486
|
-
}
|
|
157487
157513
|
const pagesElements = pages.filter((page) => !page.hide).map((page) => makeNavigationPageElement(ctx, page));
|
|
157488
157514
|
const linksElements = [];
|
|
157489
157515
|
if (pagesElements.length > 0) {
|
|
@@ -157498,22 +157524,86 @@ var makeNavigationSectionElement = (ctx, section) => {
|
|
|
157498
157524
|
}
|
|
157499
157525
|
const sectionElements = sections.filter((s3) => !s3.hide).map((s3) => makeNavigationSectionElement(ctx, s3));
|
|
157500
157526
|
linksElements.push(...sectionElements);
|
|
157501
|
-
|
|
157502
|
-
|
|
157503
|
-
|
|
157504
|
-
|
|
157505
|
-
|
|
157506
|
-
|
|
157507
|
-
|
|
157508
|
-
|
|
157527
|
+
if (virtual) {
|
|
157528
|
+
return {
|
|
157529
|
+
type: "element",
|
|
157530
|
+
tagName: "div",
|
|
157531
|
+
properties: {
|
|
157532
|
+
class: "virtual-section"
|
|
157533
|
+
},
|
|
157534
|
+
children: [
|
|
157535
|
+
{
|
|
157536
|
+
type: "element",
|
|
157537
|
+
tagName: "div",
|
|
157538
|
+
properties: {
|
|
157539
|
+
class: "links"
|
|
157540
|
+
},
|
|
157541
|
+
children: linksElements
|
|
157542
|
+
}
|
|
157543
|
+
]
|
|
157544
|
+
};
|
|
157545
|
+
}
|
|
157546
|
+
const summaryChildren = [];
|
|
157547
|
+
if (isEmpty) {
|
|
157548
|
+
summaryChildren.push({
|
|
157549
|
+
type: "element",
|
|
157550
|
+
tagName: "span",
|
|
157551
|
+
properties: {
|
|
157552
|
+
class: "label"
|
|
157553
|
+
},
|
|
157554
|
+
children: [
|
|
157555
|
+
{
|
|
157556
|
+
type: "text",
|
|
157557
|
+
value: name
|
|
157558
|
+
}
|
|
157559
|
+
]
|
|
157560
|
+
});
|
|
157561
|
+
} else {
|
|
157562
|
+
summaryChildren.push({
|
|
157563
|
+
type: "element",
|
|
157564
|
+
tagName: "a",
|
|
157565
|
+
properties: {
|
|
157566
|
+
href: ctx.makeUrl(href || "", "book"),
|
|
157567
|
+
class: "label"
|
|
157568
|
+
},
|
|
157569
|
+
children: [
|
|
157570
|
+
{
|
|
157571
|
+
type: "text",
|
|
157572
|
+
value: name
|
|
157573
|
+
}
|
|
157574
|
+
]
|
|
157575
|
+
});
|
|
157576
|
+
}
|
|
157509
157577
|
return {
|
|
157510
157578
|
type: "element",
|
|
157511
|
-
tagName: "
|
|
157579
|
+
tagName: "details",
|
|
157512
157580
|
properties: {
|
|
157513
157581
|
"data-id": `_nav:${href}`,
|
|
157514
|
-
class:
|
|
157582
|
+
class: [
|
|
157583
|
+
"section",
|
|
157584
|
+
ctx.navigation.current?.href === href ? "active" : "",
|
|
157585
|
+
isEmpty ? "empty" : ""
|
|
157586
|
+
].join(" "),
|
|
157587
|
+
open: isExpanded
|
|
157515
157588
|
},
|
|
157516
|
-
children
|
|
157589
|
+
children: [
|
|
157590
|
+
{
|
|
157591
|
+
type: "element",
|
|
157592
|
+
tagName: "summary",
|
|
157593
|
+
properties: {
|
|
157594
|
+
class: "name"
|
|
157595
|
+
},
|
|
157596
|
+
children: summaryChildren
|
|
157597
|
+
},
|
|
157598
|
+
{
|
|
157599
|
+
type: "element",
|
|
157600
|
+
tagName: "div",
|
|
157601
|
+
properties: {
|
|
157602
|
+
class: "links"
|
|
157603
|
+
},
|
|
157604
|
+
children: linksElements
|
|
157605
|
+
}
|
|
157606
|
+
]
|
|
157517
157607
|
};
|
|
157518
157608
|
};
|
|
157519
157609
|
var makeNavigationElements = (ctx) => {
|
|
@@ -158780,10 +158870,8 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
|
|
|
158780
158870
|
return [
|
|
158781
158871
|
{
|
|
158782
158872
|
type: "element",
|
|
158783
|
-
tagName: "
|
|
158784
|
-
properties: {
|
|
158785
|
-
class: "collapsible"
|
|
158786
|
-
},
|
|
158873
|
+
tagName: "summary",
|
|
158874
|
+
properties: {},
|
|
158787
158875
|
children: [
|
|
158788
158876
|
{
|
|
158789
158877
|
type: "text",
|
|
@@ -158795,7 +158883,7 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
|
|
|
158795
158883
|
type: "element",
|
|
158796
158884
|
tagName: "div",
|
|
158797
158885
|
properties: {
|
|
158798
|
-
class: "
|
|
158886
|
+
class: "content"
|
|
158799
158887
|
},
|
|
158800
158888
|
children: element5.children.flatMap(transformCollapsible)
|
|
158801
158889
|
}
|
|
@@ -158818,7 +158906,7 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
|
|
|
158818
158906
|
expectContainerDirective(node3, file, name);
|
|
158819
158907
|
registerDirective(file, name, [], ["style.css"], []);
|
|
158820
158908
|
node3.attributes = {};
|
|
158821
|
-
data.hName = "
|
|
158909
|
+
data.hName = "details";
|
|
158822
158910
|
data.hProperties = {
|
|
158823
158911
|
class: "directive-collapsible",
|
|
158824
158912
|
"data-id": id
|
|
@@ -158830,10 +158918,8 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
|
|
|
158830
158918
|
data.hChildren = [
|
|
158831
158919
|
{
|
|
158832
158920
|
type: "element",
|
|
158833
|
-
tagName: "
|
|
158834
|
-
properties: {
|
|
158835
|
-
class: "collapsible"
|
|
158836
|
-
},
|
|
158921
|
+
tagName: "summary",
|
|
158922
|
+
properties: {},
|
|
158837
158923
|
children: [
|
|
158838
158924
|
{
|
|
158839
158925
|
type: "text",
|
|
@@ -158845,7 +158931,7 @@ var remarkDirectiveCollapsible_default = (ctx) => () => {
|
|
|
158845
158931
|
type: "element",
|
|
158846
158932
|
tagName: "div",
|
|
158847
158933
|
properties: {
|
|
158848
|
-
class: "
|
|
158934
|
+
class: "content"
|
|
158849
158935
|
},
|
|
158850
158936
|
children: collapsibleContent
|
|
158851
158937
|
}
|
|
@@ -173360,6 +173446,378 @@ var remarkDirectiveTextinput_default = (ctx) => () => {
|
|
|
173360
173446
|
};
|
|
173361
173447
|
};
|
|
173362
173448
|
|
|
173449
|
+
// src/remarkDirectiveTypst.ts
|
|
173450
|
+
function htmlEntities4(str) {
|
|
173451
|
+
return String(str).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
173452
|
+
}
|
|
173453
|
+
var remarkDirectiveTypst_default = (ctx) => () => {
|
|
173454
|
+
const name = "typst";
|
|
173455
|
+
return (tree, file) => {
|
|
173456
|
+
visit(tree, function(node3) {
|
|
173457
|
+
if (isDirective(node3) && node3.name === name) {
|
|
173458
|
+
const {
|
|
173459
|
+
height = "auto",
|
|
173460
|
+
id = hash(node3),
|
|
173461
|
+
mode = "preview"
|
|
173462
|
+
} = node3.attributes || {};
|
|
173463
|
+
const data = node3.data || (node3.data = {});
|
|
173464
|
+
expectContainerDirective(node3, file, name);
|
|
173465
|
+
registerDirective(file, name, ["client.js"], ["style.css"], []);
|
|
173466
|
+
requestJS(file, ["code-input", "code-input.min.js"]);
|
|
173467
|
+
requestCSS(file, ["code-input", "code-input.min.css"]);
|
|
173468
|
+
requestJS(file, ["code-input", "auto-close-brackets.min.js"]);
|
|
173469
|
+
requestJS(file, ["code-input", "indent.min.js"]);
|
|
173470
|
+
requestJS(file, ["uzip", "uzip.js"]);
|
|
173471
|
+
const sourceFiles = [];
|
|
173472
|
+
const binaryFiles = [];
|
|
173473
|
+
for (const child of node3.children) {
|
|
173474
|
+
if (child.type === "text") {
|
|
173475
|
+
const text9 = child.value;
|
|
173476
|
+
const fileMatches = text9.matchAll(
|
|
173477
|
+
/@file\s+dest="([^"]+)"\s+src="([^"]+)"/g
|
|
173478
|
+
);
|
|
173479
|
+
for (const match of fileMatches) {
|
|
173480
|
+
const dest = match[1];
|
|
173481
|
+
const src = match[2];
|
|
173482
|
+
const url = ctx.makeUrl(
|
|
173483
|
+
src,
|
|
173484
|
+
"public",
|
|
173485
|
+
ctx.navigation.current || void 0
|
|
173486
|
+
);
|
|
173487
|
+
binaryFiles.push({ dest, url });
|
|
173488
|
+
}
|
|
173489
|
+
const sourceMatches = text9.matchAll(
|
|
173490
|
+
/@source\s+dest="([^"]+)"\s+src="([^"]+)"/g
|
|
173491
|
+
);
|
|
173492
|
+
for (const match of sourceMatches) {
|
|
173493
|
+
const dest = match[1];
|
|
173494
|
+
const src = match[2];
|
|
173495
|
+
const content5 = readFile(src, ctx) || "";
|
|
173496
|
+
sourceFiles.push({ filename: dest, content: content5 });
|
|
173497
|
+
}
|
|
173498
|
+
} else if (child.type === "paragraph") {
|
|
173499
|
+
for (const textNode of child.children) {
|
|
173500
|
+
if (textNode.type === "text") {
|
|
173501
|
+
const text9 = textNode.value;
|
|
173502
|
+
const fileMatches = text9.matchAll(
|
|
173503
|
+
/@file\s+dest="([^"]+)"\s+src="([^"]+)"/g
|
|
173504
|
+
);
|
|
173505
|
+
for (const match of fileMatches) {
|
|
173506
|
+
const dest = match[1];
|
|
173507
|
+
const src = match[2];
|
|
173508
|
+
const url = ctx.makeUrl(
|
|
173509
|
+
src,
|
|
173510
|
+
"public",
|
|
173511
|
+
ctx.navigation.current || void 0
|
|
173512
|
+
);
|
|
173513
|
+
binaryFiles.push({ dest, url });
|
|
173514
|
+
}
|
|
173515
|
+
const sourceMatches = text9.matchAll(
|
|
173516
|
+
/@source\s+dest="([^"]+)"\s+src="([^"]+)"/g
|
|
173517
|
+
);
|
|
173518
|
+
for (const match of sourceMatches) {
|
|
173519
|
+
const dest = match[1];
|
|
173520
|
+
const src = match[2];
|
|
173521
|
+
const content5 = readFile(src, ctx) || "";
|
|
173522
|
+
sourceFiles.push({ filename: dest, content: content5 });
|
|
173523
|
+
}
|
|
173524
|
+
}
|
|
173525
|
+
}
|
|
173526
|
+
}
|
|
173527
|
+
}
|
|
173528
|
+
const codeBlocks = node3.children.filter(
|
|
173529
|
+
(n) => n.type === "code" && (n.lang === "typ" || n.lang === "typst")
|
|
173530
|
+
);
|
|
173531
|
+
if (codeBlocks.length > 0) {
|
|
173532
|
+
for (const codeBlock of codeBlocks) {
|
|
173533
|
+
const filename = codeBlock.meta?.trim() || "main.typ";
|
|
173534
|
+
sourceFiles.push({
|
|
173535
|
+
filename,
|
|
173536
|
+
content: codeBlock.value
|
|
173537
|
+
});
|
|
173538
|
+
}
|
|
173539
|
+
}
|
|
173540
|
+
let mainSource = sourceFiles.find(
|
|
173541
|
+
(f) => f.filename == "main.typ" || f.filename == "main.typst"
|
|
173542
|
+
);
|
|
173543
|
+
if (!mainSource && sourceFiles.length > 0) {
|
|
173544
|
+
mainSource = sourceFiles[0];
|
|
173545
|
+
} else if (!mainSource) {
|
|
173546
|
+
mainSource = { filename: "main.typ", content: "" };
|
|
173547
|
+
}
|
|
173548
|
+
const isEditMode = mode === "edit";
|
|
173549
|
+
const isPreviewMode = mode === "preview" || !isEditMode;
|
|
173550
|
+
data.hName = "div";
|
|
173551
|
+
data.hProperties = {
|
|
173552
|
+
class: ["directive-typst", isPreviewMode ? "preview-only" : ""].join(" ").trim(),
|
|
173553
|
+
"data-id": id,
|
|
173554
|
+
"data-source-files": Buffer.from(
|
|
173555
|
+
JSON.stringify(sourceFiles)
|
|
173556
|
+
).toString("base64"),
|
|
173557
|
+
"data-binary-files": Buffer.from(
|
|
173558
|
+
JSON.stringify(binaryFiles)
|
|
173559
|
+
).toString("base64")
|
|
173560
|
+
};
|
|
173561
|
+
const previewContainer = {
|
|
173562
|
+
type: "element",
|
|
173563
|
+
tagName: "div",
|
|
173564
|
+
properties: {
|
|
173565
|
+
class: "preview-container",
|
|
173566
|
+
style: `height: ${height};`
|
|
173567
|
+
},
|
|
173568
|
+
children: [
|
|
173569
|
+
{
|
|
173570
|
+
type: "element",
|
|
173571
|
+
tagName: "div",
|
|
173572
|
+
properties: {
|
|
173573
|
+
class: "typst-loading"
|
|
173574
|
+
},
|
|
173575
|
+
children: [
|
|
173576
|
+
{
|
|
173577
|
+
type: "element",
|
|
173578
|
+
tagName: "div",
|
|
173579
|
+
properties: {
|
|
173580
|
+
class: "typst-spinner"
|
|
173581
|
+
},
|
|
173582
|
+
children: []
|
|
173583
|
+
},
|
|
173584
|
+
{
|
|
173585
|
+
type: "element",
|
|
173586
|
+
tagName: "span",
|
|
173587
|
+
properties: {},
|
|
173588
|
+
children: [
|
|
173589
|
+
{
|
|
173590
|
+
type: "text",
|
|
173591
|
+
value: i18n.get("typst-loading")
|
|
173592
|
+
}
|
|
173593
|
+
]
|
|
173594
|
+
}
|
|
173595
|
+
]
|
|
173596
|
+
},
|
|
173597
|
+
{
|
|
173598
|
+
type: "element",
|
|
173599
|
+
tagName: "div",
|
|
173600
|
+
properties: {
|
|
173601
|
+
class: "typst-preview"
|
|
173602
|
+
},
|
|
173603
|
+
children: []
|
|
173604
|
+
}
|
|
173605
|
+
]
|
|
173606
|
+
};
|
|
173607
|
+
const downloadButton = {
|
|
173608
|
+
type: "element",
|
|
173609
|
+
tagName: "button",
|
|
173610
|
+
properties: {
|
|
173611
|
+
class: "download-pdf"
|
|
173612
|
+
},
|
|
173613
|
+
children: [
|
|
173614
|
+
{
|
|
173615
|
+
type: "text",
|
|
173616
|
+
value: i18n.get("typst-download-pdf")
|
|
173617
|
+
}
|
|
173618
|
+
]
|
|
173619
|
+
};
|
|
173620
|
+
const downloadProjectButton = {
|
|
173621
|
+
type: "element",
|
|
173622
|
+
tagName: "button",
|
|
173623
|
+
properties: {
|
|
173624
|
+
class: "download-project"
|
|
173625
|
+
},
|
|
173626
|
+
children: [
|
|
173627
|
+
{
|
|
173628
|
+
type: "text",
|
|
173629
|
+
value: i18n.get("typst-download-project")
|
|
173630
|
+
}
|
|
173631
|
+
]
|
|
173632
|
+
};
|
|
173633
|
+
if (isEditMode) {
|
|
173634
|
+
data.hChildren = [
|
|
173635
|
+
previewContainer,
|
|
173636
|
+
{
|
|
173637
|
+
type: "element",
|
|
173638
|
+
tagName: "div",
|
|
173639
|
+
properties: {
|
|
173640
|
+
class: "editor-container"
|
|
173641
|
+
},
|
|
173642
|
+
children: [
|
|
173643
|
+
{
|
|
173644
|
+
type: "element",
|
|
173645
|
+
tagName: "div",
|
|
173646
|
+
properties: {
|
|
173647
|
+
class: "file-tabs"
|
|
173648
|
+
},
|
|
173649
|
+
children: [
|
|
173650
|
+
{
|
|
173651
|
+
type: "element",
|
|
173652
|
+
tagName: "div",
|
|
173653
|
+
properties: {
|
|
173654
|
+
class: "tabs-list"
|
|
173655
|
+
},
|
|
173656
|
+
children: []
|
|
173657
|
+
},
|
|
173658
|
+
{
|
|
173659
|
+
type: "element",
|
|
173660
|
+
tagName: "button",
|
|
173661
|
+
properties: {
|
|
173662
|
+
class: "add-source-file",
|
|
173663
|
+
title: i18n.get("typst-add-source-file")
|
|
173664
|
+
},
|
|
173665
|
+
children: [
|
|
173666
|
+
{
|
|
173667
|
+
type: "text",
|
|
173668
|
+
value: "+"
|
|
173669
|
+
}
|
|
173670
|
+
]
|
|
173671
|
+
}
|
|
173672
|
+
]
|
|
173673
|
+
},
|
|
173674
|
+
{
|
|
173675
|
+
type: "element",
|
|
173676
|
+
tagName: "details",
|
|
173677
|
+
properties: {
|
|
173678
|
+
class: "binary-files-section"
|
|
173679
|
+
},
|
|
173680
|
+
children: [
|
|
173681
|
+
{
|
|
173682
|
+
type: "element",
|
|
173683
|
+
tagName: "summary",
|
|
173684
|
+
properties: {},
|
|
173685
|
+
children: [
|
|
173686
|
+
{
|
|
173687
|
+
type: "element",
|
|
173688
|
+
tagName: "span",
|
|
173689
|
+
properties: {
|
|
173690
|
+
class: "summary-text"
|
|
173691
|
+
},
|
|
173692
|
+
children: [
|
|
173693
|
+
{
|
|
173694
|
+
type: "element",
|
|
173695
|
+
tagName: "span",
|
|
173696
|
+
properties: {
|
|
173697
|
+
class: "summary-indicator"
|
|
173698
|
+
},
|
|
173699
|
+
children: [
|
|
173700
|
+
{
|
|
173701
|
+
type: "text",
|
|
173702
|
+
value: "\u25B6"
|
|
173703
|
+
}
|
|
173704
|
+
]
|
|
173705
|
+
},
|
|
173706
|
+
{
|
|
173707
|
+
type: "text",
|
|
173708
|
+
value: i18n.get("typst-binary-files")
|
|
173709
|
+
}
|
|
173710
|
+
]
|
|
173711
|
+
}
|
|
173712
|
+
]
|
|
173713
|
+
},
|
|
173714
|
+
{
|
|
173715
|
+
type: "element",
|
|
173716
|
+
tagName: "div",
|
|
173717
|
+
properties: {
|
|
173718
|
+
class: "binary-files-list"
|
|
173719
|
+
},
|
|
173720
|
+
children: []
|
|
173721
|
+
},
|
|
173722
|
+
{
|
|
173723
|
+
type: "element",
|
|
173724
|
+
tagName: "div",
|
|
173725
|
+
properties: {
|
|
173726
|
+
class: "binary-files-actions"
|
|
173727
|
+
},
|
|
173728
|
+
children: [
|
|
173729
|
+
{
|
|
173730
|
+
type: "element",
|
|
173731
|
+
tagName: "button",
|
|
173732
|
+
properties: {
|
|
173733
|
+
class: "add-binary-file",
|
|
173734
|
+
title: i18n.get("typst-add-binary-file")
|
|
173735
|
+
},
|
|
173736
|
+
children: [
|
|
173737
|
+
{
|
|
173738
|
+
type: "text",
|
|
173739
|
+
value: "+ " + i18n.get("typst-add")
|
|
173740
|
+
}
|
|
173741
|
+
]
|
|
173742
|
+
}
|
|
173743
|
+
]
|
|
173744
|
+
}
|
|
173745
|
+
]
|
|
173746
|
+
},
|
|
173747
|
+
{
|
|
173748
|
+
type: "element",
|
|
173749
|
+
tagName: "code-input",
|
|
173750
|
+
properties: {
|
|
173751
|
+
class: "editor typst active line-numbers",
|
|
173752
|
+
language: "typst",
|
|
173753
|
+
template: "typst-highlighted"
|
|
173754
|
+
},
|
|
173755
|
+
children: [
|
|
173756
|
+
{
|
|
173757
|
+
type: "raw",
|
|
173758
|
+
value: htmlEntities4(mainSource.content)
|
|
173759
|
+
}
|
|
173760
|
+
]
|
|
173761
|
+
},
|
|
173762
|
+
{
|
|
173763
|
+
type: "element",
|
|
173764
|
+
tagName: "div",
|
|
173765
|
+
properties: {
|
|
173766
|
+
class: "buttons bottom"
|
|
173767
|
+
},
|
|
173768
|
+
children: [
|
|
173769
|
+
{
|
|
173770
|
+
type: "element",
|
|
173771
|
+
tagName: "button",
|
|
173772
|
+
properties: {
|
|
173773
|
+
class: "reset"
|
|
173774
|
+
},
|
|
173775
|
+
children: [
|
|
173776
|
+
{
|
|
173777
|
+
type: "text",
|
|
173778
|
+
value: i18n.get("typst-reset")
|
|
173779
|
+
}
|
|
173780
|
+
]
|
|
173781
|
+
},
|
|
173782
|
+
downloadProjectButton,
|
|
173783
|
+
downloadButton
|
|
173784
|
+
]
|
|
173785
|
+
}
|
|
173786
|
+
]
|
|
173787
|
+
}
|
|
173788
|
+
];
|
|
173789
|
+
} else {
|
|
173790
|
+
data.hChildren = [
|
|
173791
|
+
previewContainer,
|
|
173792
|
+
{
|
|
173793
|
+
type: "element",
|
|
173794
|
+
tagName: "div",
|
|
173795
|
+
properties: {
|
|
173796
|
+
class: "buttons bottom"
|
|
173797
|
+
},
|
|
173798
|
+
children: [downloadProjectButton, downloadButton]
|
|
173799
|
+
},
|
|
173800
|
+
{
|
|
173801
|
+
type: "element",
|
|
173802
|
+
tagName: "textarea",
|
|
173803
|
+
properties: {
|
|
173804
|
+
class: "typst-source hidden",
|
|
173805
|
+
style: "display: none;"
|
|
173806
|
+
},
|
|
173807
|
+
children: [
|
|
173808
|
+
{
|
|
173809
|
+
type: "text",
|
|
173810
|
+
value: mainSource.content
|
|
173811
|
+
}
|
|
173812
|
+
]
|
|
173813
|
+
}
|
|
173814
|
+
];
|
|
173815
|
+
}
|
|
173816
|
+
}
|
|
173817
|
+
});
|
|
173818
|
+
};
|
|
173819
|
+
};
|
|
173820
|
+
|
|
173363
173821
|
// src/process.ts
|
|
173364
173822
|
var remark = (ctx) => {
|
|
173365
173823
|
i18n.init(ctx.config.language || "en");
|
|
@@ -173404,6 +173862,7 @@ var remark = (ctx) => {
|
|
|
173404
173862
|
remarkDirectiveMultievent_default(ctx),
|
|
173405
173863
|
remarkDirectiveLearningmap_default(ctx),
|
|
173406
173864
|
remarkDirectiveTextinput_default(ctx),
|
|
173865
|
+
remarkDirectiveTypst_default(ctx),
|
|
173407
173866
|
remarkCode_default(ctx),
|
|
173408
173867
|
remarkMath,
|
|
173409
173868
|
/* needs to be last directive */
|
|
@@ -173486,7 +173945,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
|
|
|
173486
173945
|
/***/ ((module) => {
|
|
173487
173946
|
|
|
173488
173947
|
"use strict";
|
|
173489
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.
|
|
173948
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.73.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"}}');
|
|
173490
173949
|
|
|
173491
173950
|
/***/ })
|
|
173492
173951
|
|