@pretextbook/import 0.16.0 → 0.17.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/index.d.ts CHANGED
@@ -31,4 +31,4 @@ export type { SourceFormat, ProjectLayout, ConversionContext, ConvertedPretextRe
31
31
  export { createWorkerEngine, runConversionInWorker, ConversionCancelledError, type ConversionWorker, type WorkerEngineOptions, type RunningConversion, } from './worker/worker-engine';
32
32
  export type { WorkerRequest, WorkerResponse, ConvertRequest, ResultResponse, ErrorResponse, } from './worker/protocol';
33
33
  export { PANDOC_ACCEPT_EXTENSIONS, PANDOC_BINARY_FORMATS, PANDOC_EXTENSION_FORMATS, fileExtension, pandocFormatForFileName, createPandocEngine, createRemotePandocEngine, describeRemotePandocFailure, extractPandocErrorDetail, DEFAULT_REMOTE_PANDOC_TIMEOUT_MS, type PandocInputFormat, type PandocBridge, type PandocEngineOptions, type RemotePandocEngineOptions, } from './lib/pandoc';
34
- export { DEFAULT_ACCEPT_EXTENSIONS, allAcceptExtensions, alternateEngine, alternateFor, engineAccepts, engineExtensions, matchesExtension, routeEngine, unsupportedFileMessage, type RoutableEngine, } from './lib/engine-routing';
34
+ export { DEFAULT_ACCEPT_EXTENSIONS, allAcceptExtensions, alternateEngine, alternateFor, engineAccepts, engineExtensions, experimentalEngineFor, experimentalEngines, matchesExtension, routeEngine, unsupportedFileMessage, type RoutableEngine, } from './lib/engine-routing';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as ae, P as re, f as B, d as se, r as le, a as ne, b as W, c as K, w, s as U, e as oe, g as me, p as ce, h as L, j as pe, k as de } from "./upload-Df7DMau_.js";
2
- import { C as xt, D as ft, L as kt, l as yt, m as qt, M as vt, n as wt, o as Tt, q as Et, t as Pt, u as St, v as jt, x as At, y as It, z as _t, A as zt, B as Lt, E as $t, F as Ct, G as Rt, H as Nt, I as Ft, J as Mt, K as Dt, N as Ot, O as Xt, Q as Bt, R as Wt, S as Kt, T as Ut, U as Ht, V as Gt, W as Zt, X as Vt, Y as Yt, Z as Jt, _ as Qt, $ as ei, a0 as ti, a1 as ii, a2 as ai, a3 as ri, a4 as si, a5 as li, a6 as ni, a7 as oi, a8 as mi, a9 as ci, aa as pi, ab as di, ac as ui, ad as bi, ae as gi, af as hi, ag as xi, ah as fi, ai as ki, aj as yi, ak as qi, al as vi, am as wi, an as Ti } from "./upload-Df7DMau_.js";
3
- import { D as Pi, a as Si, b as ji, c as Ai, d as Ii, e as _i, f as zi, g as Li, h as $i, i as Ci, j as Ri, k as Ni, l as Fi, m as Mi, n as Di, o as Oi, p as Xi, r as Bi, q as Wi, u as Ki } from "./engine-routing-DorSgyrU.js";
2
+ import { C as xt, D as ft, L as kt, l as qt, m as yt, M as vt, n as wt, o as Tt, q as Et, t as Pt, u as St, v as jt, x as At, y as It, z as _t, A as zt, B as Lt, E as $t, F as Ct, G as Rt, H as Ft, I as Nt, J as Mt, K as Dt, N as Ot, O as Xt, Q as Bt, R as Wt, S as Kt, T as Ut, U as Ht, V as Gt, W as Zt, X as Vt, Y as Yt, Z as Jt, _ as Qt, $ as ei, a0 as ti, a1 as ii, a2 as ai, a3 as ri, a4 as si, a5 as li, a6 as ni, a7 as oi, a8 as mi, a9 as ci, aa as pi, ab as di, ac as ui, ad as bi, ae as gi, af as hi, ag as xi, ah as fi, ai as ki, aj as qi, ak as yi, al as vi, am as wi, an as Ti } from "./upload-Df7DMau_.js";
3
+ import { D as Pi, a as Si, b as ji, c as Ai, d as Ii, e as _i, f as zi, g as Li, h as $i, i as Ci, j as Ri, k as Fi, l as Ni, m as Mi, n as Di, o as Oi, p as Xi, q as Bi, r as Wi, s as Ki, t as Ui, u as Hi } from "./engine-routing-DDxL53jG.js";
4
4
  import { verbatimTags as ue } from "@pretextbook/format";
5
5
  const be = /\$(?![\s$])([^$\n]{1,200})\$/;
6
6
  function ge(e) {
@@ -53,22 +53,22 @@ const he = [
53
53
  function ke(e) {
54
54
  return fe.test(e);
55
55
  }
56
- const ye = 2;
56
+ const qe = 2;
57
57
  function $(e, t) {
58
58
  return t.reduce(
59
59
  (i, { pattern: a, weight: r }) => i + (a.test(e) ? r : 0),
60
60
  0
61
61
  );
62
62
  }
63
- function qe(e) {
63
+ function ye(e) {
64
64
  return { latex: $(e, he) + (ge(e) ? 2 : 0), markdown: $(e, xe) };
65
65
  }
66
66
  function rt(e) {
67
67
  const t = e.trim();
68
68
  if (!t || t.startsWith("<") || ke(t))
69
69
  return;
70
- const { latex: i, markdown: a } = qe(t);
71
- if (!(Math.max(i, a) < ye))
70
+ const { latex: i, markdown: a } = ye(t);
71
+ if (!(Math.max(i, a) < qe))
72
72
  return i >= a ? "latex" : "markdown";
73
73
  }
74
74
  const ve = {
@@ -89,12 +89,12 @@ function we(e) {
89
89
  const t = e.split(".").pop()?.toLowerCase() ?? "";
90
90
  return ve[t] ?? "application/octet-stream";
91
91
  }
92
- const q = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
92
+ const y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
93
93
  function Te(e) {
94
94
  const t = e.length, i = [];
95
95
  for (let a = 0; a < t; a += 3) {
96
96
  const r = e[a], l = a + 1 < t, s = a + 2 < t, n = l ? e[a + 1] : 0, m = s ? e[a + 2] : 0;
97
- i.push(q[r >> 2]), i.push(q[(r & 3) << 4 | n >> 4]), i.push(l ? q[(n & 15) << 2 | m >> 6] : "="), i.push(s ? q[m & 63] : "=");
97
+ i.push(y[r >> 2]), i.push(y[(r & 3) << 4 | n >> 4]), i.push(l ? y[(n & 15) << 2 | m >> 6] : "="), i.push(s ? y[m & 63] : "=");
98
98
  }
99
99
  return i.join("");
100
100
  }
@@ -198,26 +198,26 @@ const Z = new Set(
198
198
  tage taxon term tex timeofday times timesignature today trademark ul url
199
199
  var viz vs xelatex xetex xref`.trim().split(/\s+/)
200
200
  ), R = /<!--[\s\S]*?-->/g;
201
- function N(e, t) {
201
+ function F(e, t) {
202
202
  R.lastIndex = 0;
203
203
  let i = 0, a;
204
204
  for (; (a = R.exec(t)) !== null; )
205
- a.index > i && F(e, t.slice(i, a.index)), e.push({ kind: "comment", text: a[0] }), i = a.index + a[0].length;
206
- i < t.length && F(e, t.slice(i));
205
+ a.index > i && N(e, t.slice(i, a.index)), e.push({ kind: "comment", text: a[0] }), i = a.index + a[0].length;
206
+ i < t.length && N(e, t.slice(i));
207
207
  }
208
- function F(e, t) {
208
+ function N(e, t) {
209
209
  e.push({ kind: "text", text: t, meaningful: /\S/.test(t) });
210
210
  }
211
211
  function Ie(e) {
212
212
  const t = [];
213
213
  let i = 0;
214
214
  for (const a of B(e, () => !0))
215
- a.start > i && N(t, e.slice(i, a.start)), t.push({
215
+ a.start > i && F(t, e.slice(i, a.start)), t.push({
216
216
  kind: "element",
217
217
  text: a.outer,
218
218
  paragraphContent: Z.has(a.name)
219
219
  }), i = a.end;
220
- return i < e.length && N(t, e.slice(i)), t;
220
+ return i < e.length && F(t, e.slice(i)), t;
221
221
  }
222
222
  function P(e) {
223
223
  return e.kind === "comment" || e.kind === "text" && !e.meaningful;
@@ -853,6 +853,49 @@ const $e = {
853
853
  "xml:lang"
854
854
  ]
855
855
  },
856
+ archive: {
857
+ elements: [
858
+ "copyleft",
859
+ "copyright",
860
+ "dblprime",
861
+ "degree",
862
+ "ellipsis",
863
+ "icon",
864
+ "kbd",
865
+ "langle",
866
+ "ldblbracket",
867
+ "lq",
868
+ "lsq",
869
+ "m",
870
+ "mdash",
871
+ "midpoint",
872
+ "minus",
873
+ "nbsp",
874
+ "ndash",
875
+ "obelus",
876
+ "permille",
877
+ "phonomark",
878
+ "pilcrow",
879
+ "plusminus",
880
+ "prime",
881
+ "rangle",
882
+ "rdblbracket",
883
+ "registered",
884
+ "rq",
885
+ "rsq",
886
+ "section-mark",
887
+ "servicemark",
888
+ "solidus",
889
+ "swungdash",
890
+ "times",
891
+ "trademark"
892
+ ],
893
+ attributes: []
894
+ },
895
+ archive_location: {
896
+ elements: [],
897
+ attributes: []
898
+ },
856
899
  article: {
857
900
  elements: [
858
901
  "activity",
@@ -1409,15 +1452,20 @@ const $e = {
1409
1452
  "alert",
1410
1453
  "am",
1411
1454
  "angles",
1455
+ "archive",
1456
+ "archive_location",
1412
1457
  "articletitle",
1413
1458
  "attr",
1414
1459
  "author",
1415
1460
  "bc",
1416
1461
  "c",
1417
1462
  "ca",
1463
+ "chapter-number",
1418
1464
  "chord",
1465
+ "collection-number",
1419
1466
  "collection-title",
1420
1467
  "container-title",
1468
+ "container-title-short",
1421
1469
  "copyleft",
1422
1470
  "copyright",
1423
1471
  "custom",
@@ -1437,6 +1485,7 @@ const $e = {
1437
1485
  "email",
1438
1486
  "etal",
1439
1487
  "etc",
1488
+ "event",
1440
1489
  "fillin",
1441
1490
  "flat",
1442
1491
  "foreign",
@@ -1470,6 +1519,7 @@ const $e = {
1470
1519
  "note",
1471
1520
  "number",
1472
1521
  "number-of-pages",
1522
+ "number-of-volumes",
1473
1523
  "obelus",
1474
1524
  "page",
1475
1525
  "page-first",
@@ -1503,6 +1553,7 @@ const $e = {
1503
1553
  "solidus",
1504
1554
  "sq",
1505
1555
  "stale",
1556
+ "status",
1506
1557
  "swungdash",
1507
1558
  "tag",
1508
1559
  "tage",
@@ -1519,6 +1570,7 @@ const $e = {
1519
1570
  "url",
1520
1571
  "URL",
1521
1572
  "var",
1573
+ "version",
1522
1574
  "viz",
1523
1575
  "volume",
1524
1576
  "vs",
@@ -1970,6 +2022,10 @@ const $e = {
1970
2022
  "xml:lang"
1971
2023
  ]
1972
2024
  },
2025
+ "chapter-number": {
2026
+ elements: [],
2027
+ attributes: []
2028
+ },
1973
2029
  checkpoint: {
1974
2030
  elements: [
1975
2031
  "feedback",
@@ -2047,6 +2103,10 @@ const $e = {
2047
2103
  "width"
2048
2104
  ]
2049
2105
  },
2106
+ "collection-number": {
2107
+ elements: [],
2108
+ attributes: []
2109
+ },
2050
2110
  "collection-title": {
2051
2111
  elements: [
2052
2112
  "copyleft",
@@ -2281,6 +2341,45 @@ const $e = {
2281
2341
  ],
2282
2342
  attributes: []
2283
2343
  },
2344
+ "container-title-short": {
2345
+ elements: [
2346
+ "copyleft",
2347
+ "copyright",
2348
+ "dblprime",
2349
+ "degree",
2350
+ "ellipsis",
2351
+ "icon",
2352
+ "kbd",
2353
+ "langle",
2354
+ "ldblbracket",
2355
+ "lq",
2356
+ "lsq",
2357
+ "m",
2358
+ "mdash",
2359
+ "midpoint",
2360
+ "minus",
2361
+ "nbsp",
2362
+ "ndash",
2363
+ "obelus",
2364
+ "permille",
2365
+ "phonomark",
2366
+ "pilcrow",
2367
+ "plusminus",
2368
+ "prime",
2369
+ "rangle",
2370
+ "rdblbracket",
2371
+ "registered",
2372
+ "rq",
2373
+ "rsq",
2374
+ "section-mark",
2375
+ "servicemark",
2376
+ "solidus",
2377
+ "swungdash",
2378
+ "times",
2379
+ "trademark"
2380
+ ],
2381
+ attributes: []
2382
+ },
2284
2383
  context: {
2285
2384
  elements: [
2286
2385
  "aside",
@@ -5986,6 +6085,10 @@ const $e = {
5986
6085
  elements: [],
5987
6086
  attributes: []
5988
6087
  },
6088
+ "number-of-volumes": {
6089
+ elements: [],
6090
+ attributes: []
6091
+ },
5989
6092
  obelus: {
5990
6093
  elements: [],
5991
6094
  attributes: []
@@ -8573,21 +8676,55 @@ const $e = {
8573
8676
  "biographical",
8574
8677
  "blockquote",
8575
8678
  "console",
8679
+ "copyleft",
8680
+ "copyright",
8681
+ "dblprime",
8682
+ "degree",
8683
+ "ellipsis",
8576
8684
  "figure",
8577
8685
  "historical",
8686
+ "icon",
8578
8687
  "idx",
8579
8688
  "image",
8689
+ "kbd",
8690
+ "langle",
8691
+ "ldblbracket",
8580
8692
  "list",
8581
8693
  "listing",
8694
+ "lq",
8695
+ "lsq",
8696
+ "m",
8697
+ "mdash",
8698
+ "midpoint",
8699
+ "minus",
8700
+ "nbsp",
8701
+ "ndash",
8702
+ "obelus",
8582
8703
  "p",
8704
+ "permille",
8705
+ "phonomark",
8706
+ "pilcrow",
8707
+ "plusminus",
8583
8708
  "pre",
8709
+ "prime",
8584
8710
  "program",
8711
+ "rangle",
8712
+ "rdblbracket",
8713
+ "registered",
8714
+ "rq",
8715
+ "rsq",
8585
8716
  "sage",
8586
8717
  "sbsgroup",
8718
+ "section-mark",
8719
+ "servicemark",
8587
8720
  "sidebyside",
8721
+ "solidus",
8722
+ "swungdash",
8588
8723
  "table",
8589
8724
  "tabular",
8725
+ "times",
8590
8726
  "title",
8727
+ "trademark",
8591
8728
  "video"
8592
8729
  ],
8593
8730
  attributes: [
@@ -9772,6 +9909,10 @@ const $e = {
9772
9909
  "width"
9773
9910
  ]
9774
9911
  },
9912
+ version: {
9913
+ elements: [],
9914
+ attributes: []
9915
+ },
9775
9916
  video: {
9776
9917
  elements: [
9777
9918
  "title",
@@ -10212,7 +10353,7 @@ const $e = {
10212
10353
  }, Re = (e) => e !== void 0 && /[A-Za-z_]/.test(e), D = (e, t) => {
10213
10354
  const i = /^[A-Za-z_][\w.:-]*/.exec(e.slice(t, t + 128));
10214
10355
  return i ? i[0] : "";
10215
- }, Ne = (e, t) => {
10356
+ }, Fe = (e, t) => {
10216
10357
  const i = [];
10217
10358
  let a = 0;
10218
10359
  const r = (l, s, n) => {
@@ -10252,7 +10393,7 @@ const $e = {
10252
10393
  a = s;
10253
10394
  }
10254
10395
  return { inText: !0, open: i };
10255
- }, Fe = [
10396
+ }, Ne = [
10256
10397
  // theorem-like
10257
10398
  "theorem",
10258
10399
  "lemma",
@@ -10306,7 +10447,7 @@ const $e = {
10306
10447
  "figure",
10307
10448
  "table"
10308
10449
  ];
10309
- new Set(Fe);
10450
+ new Set(Ne);
10310
10451
  [...Ce];
10311
10452
  [
10312
10453
  ...k,
@@ -10365,7 +10506,7 @@ function Xe(e) {
10365
10506
  return e.some((i) => i.name === "p");
10366
10507
  }
10367
10508
  function ct(e) {
10368
- const t = Ne(e, e.length), i = Xe(t.open);
10509
+ const t = Fe(e, e.length), i = Xe(t.open);
10369
10510
  return t.inText ? { literal: Oe(t.open), inline: i } : {
10370
10511
  literal: "the cursor is inside a tag, a comment or a CDATA section",
10371
10512
  inline: i
@@ -10710,9 +10851,9 @@ function bt(e) {
10710
10851
  const h = new FormData();
10711
10852
  i && h.set("token", i), h.set("file", d, d.name), h.set("from", I), l && h.set("standalone", "yes");
10712
10853
  const _ = new AbortController(), te = setTimeout(() => _.abort(), n);
10713
- let y;
10854
+ let q;
10714
10855
  try {
10715
- y = await A(t, {
10856
+ q = await A(t, {
10716
10857
  method: "POST",
10717
10858
  body: h,
10718
10859
  headers: a,
@@ -10729,10 +10870,10 @@ function bt(e) {
10729
10870
  } finally {
10730
10871
  clearTimeout(te);
10731
10872
  }
10732
- const z = await y.text();
10733
- if (!y.ok)
10873
+ const z = await q.text();
10874
+ if (!q.ok)
10734
10875
  throw new Error(
10735
- Qe(y.status, z, d.name)
10876
+ Qe(q.status, z, d.name)
10736
10877
  );
10737
10878
  return z;
10738
10879
  },
@@ -10750,8 +10891,8 @@ export {
10750
10891
  Ye as DEFAULT_REMOTE_PANDOC_TIMEOUT_MS,
10751
10892
  ft as DIVISION_LADDER,
10752
10893
  kt as LADDER_OVERFLOW_TAG,
10753
- yt as LATEX_DIVISION_COMMANDS,
10754
- qt as LATEX_FORMAT_MARKERS,
10894
+ qt as LATEX_DIVISION_COMMANDS,
10895
+ yt as LATEX_FORMAT_MARKERS,
10755
10896
  vt as MARKDOWN_FORMAT_MARKERS,
10756
10897
  wt as MAX_SUGGESTED_SPLIT_LEVEL,
10757
10898
  Q as PANDOC_ACCEPT_EXTENSIONS,
@@ -10778,11 +10919,11 @@ export {
10778
10919
  ke as containsXmlMarkup,
10779
10920
  Ct as convertLatexToPretext,
10780
10921
  Rt as convertMarkdownToPretext,
10781
- Nt as convertSourceToPretext,
10922
+ Ft as convertSourceToPretext,
10782
10923
  Ve as createPandocEngine,
10783
10924
  bt as createRemotePandocEngine,
10784
10925
  dt as createWorkerEngine,
10785
- Ft as dedupeXmlIds,
10926
+ Nt as dedupeXmlIds,
10786
10927
  Mt as defaultAttachLevel,
10787
10928
  Dt as defaultManifestTarget,
10788
10929
  Qe as describeRemotePandocFailure,
@@ -10797,29 +10938,31 @@ export {
10797
10938
  Ci as engineAccepts,
10798
10939
  Ri as engineExtensions,
10799
10940
  Wt as expandPretextIncludes,
10941
+ Fi as experimentalEngineFor,
10942
+ Ni as experimentalEngines,
10800
10943
  Je as extractPandocErrorDetail,
10801
10944
  L as extractUpload,
10802
- Ni as fileChangesForImport,
10945
+ Mi as fileChangesForImport,
10803
10946
  ee as fileExtension,
10804
10947
  Kt as filePrefixForDivision,
10805
- Fi as filesForImportMode,
10948
+ Di as filesForImportMode,
10806
10949
  Ut as findLatexFixes,
10807
10950
  Ht as findLatexHeaders,
10808
10951
  Gt as findProjectManifest,
10809
10952
  ot as firstDivisionTag,
10810
10953
  Zt as fixesToWarnings,
10811
- Mi as formatWarningLine,
10954
+ Oi as formatWarningLine,
10812
10955
  Vt as getConversionErrorMessage,
10813
10956
  Yt as getLatexCleanDiagnostics,
10814
10957
  Jt as handleImportUploadFile,
10815
- Di as hasNativeImportMode,
10958
+ Xi as hasNativeImportMode,
10816
10959
  de as importProjectFromFiles,
10817
10960
  Qt as isDivisionTag,
10818
10961
  nt as isInlineContext,
10819
10962
  ei as ladderDepth,
10820
10963
  ti as latexDivisionHierarchy,
10821
10964
  ii as latexFixesToCodeActions,
10822
- Oi as matchesExtension,
10965
+ Bi as matchesExtension,
10823
10966
  ai as mergeChunksAtLevel,
10824
10967
  ri as normalizePretextSource,
10825
10968
  si as outlineDivisions,
@@ -10829,7 +10972,7 @@ export {
10829
10972
  ct as pasteTargetAt,
10830
10973
  mt as placeConvertedMarkup,
10831
10974
  oi as prepareInsertSource,
10832
- Xi as projectForImportMode,
10975
+ Wi as projectForImportMode,
10833
10976
  mi as pruneDivisions,
10834
10977
  ci as rebuildImport,
10835
10978
  Se as recordsToPlusPayload,
@@ -10839,24 +10982,24 @@ export {
10839
10982
  di as renderProjectPtxFromManifest,
10840
10983
  ne as renderPublicationPtx,
10841
10984
  ui as reselectImport,
10842
- Bi as resolveImportMode,
10985
+ Ki as resolveImportMode,
10843
10986
  bi as resolveImportSplitLevel,
10844
10987
  gi as resolveSplitLevel,
10845
10988
  hi as retargetFragment,
10846
10989
  xi as retargetFragmentToDepth,
10847
10990
  fi as retargetImport,
10848
- Wi as routeEngine,
10991
+ Ui as routeEngine,
10849
10992
  He as runConversionInWorker,
10850
10993
  ki as sanitizeRef,
10851
- qe as scoreSnippetFormats,
10852
- yi as serializeForDestination,
10853
- qi as serializeInsertFiles,
10994
+ ye as scoreSnippetFormats,
10995
+ qi as serializeForDestination,
10996
+ yi as serializeInsertFiles,
10854
10997
  lt as serializeInsertToRecords,
10855
10998
  vi as serializeProjectToFiles,
10856
10999
  st as serializeProjectToPlusPayload,
10857
11000
  Ee as serializeProjectToRecords,
10858
11001
  wi as shiftLadderTag,
10859
11002
  Ti as suggestSplitLevel,
10860
- Ki as unsupportedFileMessage,
11003
+ Hi as unsupportedFileMessage,
10861
11004
  ze as wrapLooseParagraphs
10862
11005
  };
@@ -21,6 +21,8 @@ export interface RoutableEngine {
21
21
  description?: string;
22
22
  /** Extensions this engine accepts, with leading dots. */
23
23
  acceptExtensions?: string[];
24
+ /** Set when the engine is experimental; see `ImportEngine.experimentalNotice`. */
25
+ experimentalNotice?: string;
24
26
  }
25
27
  /** File extensions accepted by the built-in converter. */
26
28
  export declare const DEFAULT_ACCEPT_EXTENSIONS: string[];
@@ -61,5 +63,16 @@ export declare function routeEngine<T extends RoutableEngine>(engines: T[], file
61
63
  * to be told which is which.
62
64
  */
63
65
  export declare function alternateFor<T extends RoutableEngine>(engines: T[], fileName: string): T | undefined;
66
+ /**
67
+ * The engines the host marked experimental, in list order. Their notices are
68
+ * worth showing before any file is chosen, since a file converts the moment
69
+ * it is dropped.
70
+ */
71
+ export declare function experimentalEngines<T extends RoutableEngine>(engines: T[]): T[];
72
+ /**
73
+ * The engine an upload goes to, when that engine is experimental, or
74
+ * `undefined` when it goes to a dependable one or to none at all.
75
+ */
76
+ export declare function experimentalEngineFor<T extends RoutableEngine>(engines: T[], fileName: string): T | undefined;
64
77
  /** The message shown when no engine can read the file the author chose. */
65
78
  export declare function unsupportedFileMessage(fileName: string, engines: RoutableEngine[]): string;
@@ -42,6 +42,14 @@ export interface ImportEngine {
42
42
  description?: string;
43
43
  /** Extensions this engine accepts (with leading dot). Defaults to the built-in set. */
44
44
  acceptExtensions?: string[];
45
+ /**
46
+ * Marks a converter whose results are not yet dependable, in the host's own
47
+ * words — say, "Conversion from Word uses pandoc and is still experimental."
48
+ * The wizard shows it on the upload step, since a file converts the moment
49
+ * it is dropped, and again beside any result or failure this engine
50
+ * produces, where it also offers the host's `shareConversion`.
51
+ */
52
+ experimentalNotice?: string;
45
53
  /** Convert an uploaded file into an import result. */
46
54
  convertFile: (file: File, options: ImportProjectOptions) => Promise<ImportedProjectResult>;
47
55
  /** Unpack and survey an upload without converting it. */
@@ -62,6 +70,35 @@ export interface ImportEngine {
62
70
  */
63
71
  cancel?: () => void;
64
72
  }
73
+ /**
74
+ * A conversion by an experimental engine, handed to the host when the author
75
+ * chooses to share it (see `ImportWizardProps.shareConversion`).
76
+ */
77
+ export interface ConversionShare {
78
+ /** The upload exactly as the author chose it. */
79
+ file: File;
80
+ /** `id` of the engine that converted it. */
81
+ engineId: string;
82
+ /** `label` of the engine that converted it. */
83
+ engineLabel: string;
84
+ /** The converted PreTeXt (`pretextSource`), before any re-layout. Absent on failure. */
85
+ pretext?: string;
86
+ /** Why the conversion failed. Absent on success. */
87
+ error?: string;
88
+ }
89
+ /** The host's offer to receive conversions an author chooses to share. */
90
+ export interface ShareConversionOffer {
91
+ /** Text of the share button. Defaults to "Share this conversion". */
92
+ label?: string;
93
+ /** A line before the button saying where the conversion goes and why. */
94
+ description?: string;
95
+ /**
96
+ * Receives the conversion. The wizard waits on it to show "Sharing…" and
97
+ * then "Shared"; a rejection is shown beside the button, which stays
98
+ * available so the author can try again.
99
+ */
100
+ onShare: (share: ConversionShare) => void | Promise<void>;
101
+ }
65
102
  export interface ImportWizardProps {
66
103
  /**
67
104
  * Called when the user confirms the import. May return a promise — writing
@@ -102,6 +139,14 @@ export interface ImportWizardProps {
102
139
  * lets the author move the attach level and see the result before confirming.
103
140
  */
104
141
  insertTarget?: InsertTargetOffer;
142
+ /**
143
+ * Let the author send a conversion by an experimental engine (one with an
144
+ * `experimentalNotice`) to the host — its developers, say — so they can see
145
+ * where that converter falls short. Offered after the fact, beside the result
146
+ * or the failure, so the author decides having seen what came out. Omit it
147
+ * and the notice is shown without the offer.
148
+ */
149
+ shareConversion?: ShareConversionOffer;
105
150
  }
106
151
  /** What the host knows about the document an import is being inserted into. */
107
152
  export interface InsertTargetOffer {
@@ -124,4 +169,4 @@ export interface InsertTargetOffer {
124
169
  */
125
170
  externalDir?: string;
126
171
  }
127
- export declare function ImportWizard({ onConfirm, onCancel, importOptions, defaultDocumentKind, defaultImportMode, lockImportMode, onImportModeChange, engines, insertTarget, }: ImportWizardProps): import("react").JSX.Element;
172
+ export declare function ImportWizard({ onConfirm, onCancel, importOptions, defaultDocumentKind, defaultImportMode, lockImportMode, onImportModeChange, engines, insertTarget, shareConversion, }: ImportWizardProps): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  export { ImportWizard } from './import-wizard';
2
- export type { ImportWizardProps, ImportMode, ImportEngine, InsertTargetOffer, PreparedUpload, } from './import-wizard';
2
+ export type { ImportWizardProps, ImportMode, ImportEngine, ConversionShare, ShareConversionOffer, InsertTargetOffer, PreparedUpload, } from './import-wizard';
3
3
  export { ProcessingPanel } from './processing-panel';
4
4
  export type { ProcessingPanelProps } from './processing-panel';
5
5
  export { ImportSourceForm } from './import-source-form';