@pretextbook/import 0.14.0 → 0.15.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 +1 @@
1
- "use strict";const n=require("./upload-CPMLFrdG.cjs");function f(e){if(e.type!=="result"||"pretextError"in e.result)return[];const t=e.result,o=new Set,s=r=>{const c=r?.buffer;c instanceof ArrayBuffer&&o.add(c)};return Object.values(t.assets??{}).forEach(s),Object.values(t.outputAssets??{}).forEach(s),t.project?.assets?.forEach(r=>s(r.data)),t.nativeProject?.assets?.forEach(r=>s(r.data)),[...o]}function u(e){self.postMessage(e,f(e))}self.onmessage=e=>{const t=e.data;if(t?.type!=="convert")return;const{requestId:o,files:s,assets:r,options:c}=t;try{const a=n.importProjectFromFiles(s,{...c,assets:r});u({type:"result",requestId:o,result:a})}catch(a){u({type:"error",requestId:o,message:a instanceof Error?a.message:"An unexpected error occurred."})}};
1
+ "use strict";const n=require("./upload-COaS_4pG.cjs");function f(e){if(e.type!=="result"||"pretextError"in e.result)return[];const t=e.result,o=new Set,s=r=>{const c=r?.buffer;c instanceof ArrayBuffer&&o.add(c)};return Object.values(t.assets??{}).forEach(s),Object.values(t.outputAssets??{}).forEach(s),t.project?.assets?.forEach(r=>s(r.data)),t.nativeProject?.assets?.forEach(r=>s(r.data)),[...o]}function u(e){self.postMessage(e,f(e))}self.onmessage=e=>{const t=e.data;if(t?.type!=="convert")return;const{requestId:o,files:s,assets:r,options:c}=t;try{const a=n.importProjectFromFiles(s,{...c,assets:r});u({type:"result",requestId:o,result:a})}catch(a){u({type:"error",requestId:o,message:a instanceof Error?a.message:"An unexpected error occurred."})}};
@@ -1,4 +1,4 @@
1
- import { k as n } from "./upload-w0BmYtpp.js";
1
+ import { k as n } from "./upload-Df7DMau_.js";
2
2
  function u(e) {
3
3
  if (e.type !== "result" || "pretextError" in e.result)
4
4
  return [];
@@ -1,3 +1,3 @@
1
- "use strict";const h=require("./upload-CPMLFrdG.cjs");function d(e,t){const n=e.length===0?[]:e.split(`
1
+ "use strict";const h=require("./upload-COaS_4pG.cjs");function d(e,t){const n=e.length===0?[]:e.split(`
2
2
  `),o=t.length===0?[]:t.split(`
3
3
  `);if(n.length+o.length>j)return[...n.map((c,f)=>({op:"remove",text:c,beforeLine:f+1})),...o.map((c,f)=>({op:"add",text:c,afterLine:f+1}))];const r=Array.from({length:n.length+1},()=>new Array(o.length+1).fill(0));for(let c=n.length-1;c>=0;c--)for(let f=o.length-1;f>=0;f--)r[c][f]=n[c]===o[f]?r[c+1][f+1]+1:Math.max(r[c+1][f],r[c][f+1]);const a=[];let i=0,s=0;for(;i<n.length&&s<o.length;)n[i]===o[s]?(a.push({op:"keep",text:n[i],beforeLine:i+1,afterLine:s+1}),i++,s++):r[i+1][s]>=r[i][s+1]?(a.push({op:"remove",text:n[i],beforeLine:i+1}),i++):(a.push({op:"add",text:o[s],afterLine:s+1}),s++);for(;i<n.length;)a.push({op:"remove",text:n[i],beforeLine:++i});for(;s<o.length;)a.push({op:"add",text:o[s],afterLine:++s});return a}const j=2e4;function m(e){let t=0,n=0;for(const o of e)o.op==="add"?t++:o.op==="remove"&&n++;return{added:t,removed:n}}function g(e,t=2){const n=e.map((i,s)=>i.op==="keep"?-1:s).filter(i=>i>=0);if(n.length===0)return[];const o=[];let r=Math.max(0,n[0]-t),a=Math.min(e.length-1,n[0]+t);for(const i of n.slice(1)){if(i-t<=a+1){a=Math.min(e.length-1,i+t);continue}o.push({lines:e.slice(r,a+1)}),r=Math.max(0,i-t),a=Math.min(e.length-1,i+t)}return o.push({lines:e.slice(r,a+1)}),o}function k(e,t=e.splitLevel){if(e.cleanChunks.length===0)return[];const n=h.mergeChunksAtLevel(e.cleanChunks,t),o=A(n),{pathByRef:r}=h.serializeProjectToFiles(e.project,{mainSourcePath:e.projectLayout.mainSourcePath,publicationPath:e.projectLayout.publicationPath,projectFilePath:e.projectLayout.projectFilePath,includeScaffold:!e.projectLayout.preserved}),a=[];for(const i of e.project.divisions){const s=r[i.xmlId];if(!s)continue;const c=i.isRoot?n.find(p=>p.kind==="preamble"||p.kind==="lead"):o.get(i.title);if(!c)continue;const f=d(c.before,c.after);a.push({path:s,title:i.title,before:c.before,after:c.after,stats:m(f),hunks:g(f),fixCount:c.fixes.length})}return a.sort((i,s)=>i.path.localeCompare(s.path))}function A(e){const t=new Map;for(const o of e)o.kind!=="division"||!o.title||t.set(o.title,t.has(o.title)?null:o);const n=new Map;for(const[o,r]of t)r&&n.set(o,r);return n}const v="converted";function M(e){return e.nativeOutputFiles!==void 0}function C(e,t=v){return t==="native"&&!M(e)?"converted":t}function T(e,t){return t==="native"?e.nativeProject??e.project:e.project}function y(e,t){return t==="converted"?e.outputFiles:e.nativeOutputFiles??e.files}function P(e,t){return t==="converted"?e.outputAssets:e.assets}function S(e){const t=e.action==="replace"||e.action==="rewrite"?`replaced with \`${e.replacement}\``:e.message??e.action,n=e.occurrences>1?` (x${e.occurrences})`:"";return`[${e.severity}] ${e.macro}: ${t}${n}`}const E=[".tex",".md",".markdown",".ptx",".xml",".zip",".gz",".tar.gz",".tgz"];function l(e){return e.acceptExtensions??E}function F(e,t){const n=e.toLowerCase();return t.some(o=>n.endsWith(o))}function u(e,t){return F(t,l(e))}function L(e){const t=new Set,n=[];for(const o of e)for(const r of l(o))t.has(r)||(t.add(r),n.push(r));return n}function x(e){for(let t=1;t<e.length;t++){const n=e.slice(0,t);if(l(e[t]).some(r=>n.some(a=>l(a).includes(r))))return e[t]}}function I(e,t){return e.find(n=>u(n,t))}function b(e,t){const n=I(e,t),o=x(e);if(!(!n||!o||o.id===n.id))return u(o,t)?o:void 0}function _(e,t){return`Cannot import ${e}: no converter reads that file type. Supported types are ${L(t).join(", ")}.`}exports.DEFAULT_ACCEPT_EXTENSIONS=E;exports.DEFAULT_IMPORT_MODE=v;exports.allAcceptExtensions=L;exports.alternateEngine=x;exports.alternateFor=b;exports.assetsForImportMode=P;exports.diffHunks=g;exports.diffLines=d;exports.diffStats=m;exports.engineAccepts=u;exports.engineExtensions=l;exports.fileChangesForImport=k;exports.filesForImportMode=y;exports.formatWarningLine=S;exports.hasNativeImportMode=M;exports.matchesExtension=F;exports.projectForImportMode=T;exports.resolveImportMode=C;exports.routeEngine=I;exports.unsupportedFileMessage=_;
@@ -1,4 +1,4 @@
1
- import { a2 as h, al as d } from "./upload-w0BmYtpp.js";
1
+ import { a2 as h, al as d } from "./upload-Df7DMau_.js";
2
2
  function m(e, t) {
3
3
  const n = e.length === 0 ? [] : e.split(`
4
4
  `), o = t.length === 0 ? [] : t.split(`
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./upload-CPMLFrdG.cjs"),m=require("./engine-routing-B03PZ4P-.cjs"),ie=/\$(?![\s$])([^$\n]{1,200})\$/;function se(e){const n=ie.exec(e);if(!n)return!1;const o=n[1];return/[\\^_{}]/.test(o)||/^[A-Za-z]'?$/.test(o.trim())}const ae=[{pattern:/\\(?:begin|end)\{[a-zA-Z*]+\}/,weight:3},{pattern:/\\\[[\s\S]*?\\\]|\$\$[\s\S]*?\$\$/,weight:3},{pattern:/\\[a-zA-Z]+\s*\{/,weight:2},{pattern:/\\\([\s\S]*?\\\)/,weight:2},{pattern:/\\[a-zA-Z]+\b/,weight:1},{pattern:/\\(?:label|ref|eqref|cite)\b/,weight:2}],ce=[{pattern:/^#{1,6}\s+\S/m,weight:3},{pattern:/^\s*```/m,weight:3},{pattern:/^\s*[-*+]\s+\S/m,weight:2},{pattern:/^\s*\d+[.)]\s+\S/m,weight:2},{pattern:/\*\*[^\s*][^*]*\*\*/,weight:2},{pattern:/\[[^\]\n]+\]\([^)\s]+\)/,weight:2},{pattern:/^\s*>\s+\S/m,weight:2},{pattern:/(?:^|\s)_[^_\s][^_\n]*_(?:\s|[.,;:!?]|$)/,weight:1},{pattern:/`[^`\n]+`/,weight:1}],le=2;function D(e,n){return n.reduce((o,{pattern:r,weight:i})=>o+(r.test(e)?i:0),0)}function $(e){return{latex:D(e,ae)+(se(e)?2:0),markdown:D(e,ce)}}function de(e){const n=e.trim();if(!n||n.startsWith("<"))return;const{latex:o,markdown:r}=$(n);if(!(Math.max(o,r)<le))return o>=r?"latex":"markdown"}const ue={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",pdf:"application/pdf",eps:"application/postscript",ps:"application/postscript",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",webp:"image/webp",ico:"image/vnd.microsoft.icon"};function pe(e){const n=e.split(".").pop()?.toLowerCase()??"";return ue[n]??"application/octet-stream"}const S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function me(e){const n=e.length,o=[];for(let r=0;r<n;r+=3){const i=e[r],a=r+1<n,s=r+2<n,c=a?e[r+1]:0,l=s?e[r+2]:0;o.push(S[i>>2]),o.push(S[(i&3)<<4|c>>4]),o.push(a?S[(c&15)<<2|l>>6]:"="),o.push(s?S[l&63]:"=")}return o.join("")}function j(e){return{ref:e.ref,fileName:e.fileName,contentType:pe(e.fileName),data:me(e.data)}}function X(e){return{ref:e.xmlId,source:e.content,sourceFormat:e.sourceFormat,isRoot:e.isRoot}}function z(e){return{title:e.title,docinfo:e.docinfo,documentKind:e.documentKind,divisions:e.divisions.map(X),assets:e.assets.map(j)}}function fe(e){return{ref:e.ref,kind:"file",title:e.fileName,short_description:e.fileName,file:{filename:e.fileName,content_type:e.contentType,data:e.data}}}function U(e){return{title:e.title,docinfo:e.docinfo,document_type:e.documentKind,divisions_attributes:e.divisions.map(n=>({ref:n.ref,source:n.source,source_format:n.sourceFormat,is_root:n.isRoot})),assets_attributes:e.assets.map(fe)}}function he(e){return U(z(e))}function ge(e,n){const{root:o,entries:r}=t.insertEntries(e,n),i=new Set(r.map(s=>s.xmlId)),a=e.divisions.filter(s=>!i.has(s.xmlId)&&!(n.unwrapRoot&&s.xmlId===o.xmlId));return{divisions:[...r,...a].map(X),assets:e.assets.map(j),placeholders:r.map(s=>`<plus:${s.type} ref="${s.xmlId}"/>`)}}const C=/<(\/?)p(?=[\s>/])/g;function Te(e){let n=0;C.lastIndex=0;let o;for(;(o=C.exec(e))!==null;)n+=o[1]?-1:1;return n>0}const xe=new RegExp(`<(${t.PRETEXT_DIVISION_TAGS.join("|")})(?=[\\s>/])`);function Pe(e){return xe.exec(e)?.[1]}function W(e,n,o){return e.split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./upload-COaS_4pG.cjs"),m=require("./engine-routing-3ULYdLy2.cjs"),ie=/\$(?![\s$])([^$\n]{1,200})\$/;function se(e){const n=ie.exec(e);if(!n)return!1;const o=n[1];return/[\\^_{}]/.test(o)||/^[A-Za-z]'?$/.test(o.trim())}const ae=[{pattern:/\\(?:begin|end)\{[a-zA-Z*]+\}/,weight:3},{pattern:/\\\[[\s\S]*?\\\]|\$\$[\s\S]*?\$\$/,weight:3},{pattern:/\\[a-zA-Z]+\s*\{/,weight:2},{pattern:/\\\([\s\S]*?\\\)/,weight:2},{pattern:/\\[a-zA-Z]+\b/,weight:1},{pattern:/\\(?:label|ref|eqref|cite)\b/,weight:2}],ce=[{pattern:/^#{1,6}\s+\S/m,weight:3},{pattern:/^\s*```/m,weight:3},{pattern:/^\s*[-*+]\s+\S/m,weight:2},{pattern:/^\s*\d+[.)]\s+\S/m,weight:2},{pattern:/\*\*[^\s*][^*]*\*\*/,weight:2},{pattern:/\[[^\]\n]+\]\([^)\s]+\)/,weight:2},{pattern:/^\s*>\s+\S/m,weight:2},{pattern:/(?:^|\s)_[^_\s][^_\n]*_(?:\s|[.,;:!?]|$)/,weight:1},{pattern:/`[^`\n]+`/,weight:1}],le=2;function D(e,n){return n.reduce((o,{pattern:r,weight:i})=>o+(r.test(e)?i:0),0)}function $(e){return{latex:D(e,ae)+(se(e)?2:0),markdown:D(e,ce)}}function de(e){const n=e.trim();if(!n||n.startsWith("<"))return;const{latex:o,markdown:r}=$(n);if(!(Math.max(o,r)<le))return o>=r?"latex":"markdown"}const ue={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",pdf:"application/pdf",eps:"application/postscript",ps:"application/postscript",bmp:"image/bmp",tiff:"image/tiff",tif:"image/tiff",webp:"image/webp",ico:"image/vnd.microsoft.icon"};function pe(e){const n=e.split(".").pop()?.toLowerCase()??"";return ue[n]??"application/octet-stream"}const S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function me(e){const n=e.length,o=[];for(let r=0;r<n;r+=3){const i=e[r],a=r+1<n,s=r+2<n,c=a?e[r+1]:0,l=s?e[r+2]:0;o.push(S[i>>2]),o.push(S[(i&3)<<4|c>>4]),o.push(a?S[(c&15)<<2|l>>6]:"="),o.push(s?S[l&63]:"=")}return o.join("")}function j(e){return{ref:e.ref,fileName:e.fileName,contentType:pe(e.fileName),data:me(e.data)}}function X(e){return{ref:e.xmlId,source:e.content,sourceFormat:e.sourceFormat,isRoot:e.isRoot}}function z(e){return{title:e.title,docinfo:e.docinfo,documentKind:e.documentKind,divisions:e.divisions.map(X),assets:e.assets.map(j)}}function fe(e){return{ref:e.ref,kind:"file",title:e.fileName,short_description:e.fileName,file:{filename:e.fileName,content_type:e.contentType,data:e.data}}}function U(e){return{title:e.title,docinfo:e.docinfo,document_type:e.documentKind,divisions_attributes:e.divisions.map(n=>({ref:n.ref,source:n.source,source_format:n.sourceFormat,is_root:n.isRoot})),assets_attributes:e.assets.map(fe)}}function he(e){return U(z(e))}function ge(e,n){const{root:o,entries:r}=t.insertEntries(e,n),i=new Set(r.map(s=>s.xmlId)),a=e.divisions.filter(s=>!i.has(s.xmlId)&&!(n.unwrapRoot&&s.xmlId===o.xmlId));return{divisions:[...r,...a].map(X),assets:e.assets.map(j),placeholders:r.map(s=>`<plus:${s.type} ref="${s.xmlId}"/>`)}}const C=/<(\/?)p(?=[\s>/])/g;function Te(e){let n=0;C.lastIndex=0;let o;for(;(o=C.exec(e))!==null;)n+=o[1]?-1:1;return n>0}const xe=new RegExp(`<(${t.PRETEXT_DIVISION_TAGS.join("|")})(?=[\\s>/])`);function Pe(e){return xe.exec(e)?.[1]}function W(e,n,o){return e.split(`
2
2
  `).map((r,i)=>i===0&&o?r:r&&n+r).join(`
3
3
  `)}const G=new Set(`abbr acro ad alert am angles articletitle attr bc c ca cd chord copyleft
4
4
  copyright custom dataurl dblbrackets dblprime degree delete dl doubleflat
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { i as Z, P as Y, f as M, d as J, r as Q, a as ee, b as N, c as O, w as b, s as j, e as te, g as ne, p as re, h as $, j as se, k as ae } from "./upload-w0BmYtpp.js";
2
- import { C as Ze, D as Ye, L as Je, l as Qe, m as et, M as tt, n as nt, o as rt, q as st, t as at, u as ot, v as it, x as ct, y as lt, z as ut, A as dt, B as pt, E as mt, F as ft, G as ht, H as gt, I as xt, J as wt, K as Tt, N as Pt, O as Et, Q as bt, R as vt, S as St, T as It, U as At, V as _t, W as $t, X as kt, Y as yt, Z as Lt, _ as Ft, $ as Ct, a0 as Rt, a1 as Dt, a2 as Mt, a3 as Nt, a4 as Ot, a5 as jt, a6 as Xt, a7 as zt, a8 as qt, a9 as Bt, aa as Kt, ab as Wt, ac as Gt, ad as Ht, ae as Ut, af as Vt, ag as Zt, ah as Yt, ai as Jt, aj as Qt, ak as en, al as tn, am as nn, an as rn } from "./upload-w0BmYtpp.js";
3
- import { D as an, a as on, b as cn, c as ln, d as un, e as dn, f as pn, g as mn, h as fn, i as hn, j as gn, k as xn, l as wn, m as Tn, n as Pn, o as En, p as bn, r as vn, q as Sn, u as In } from "./engine-routing-vjkGBbmx.js";
1
+ import { i as Z, P as Y, f as M, d as J, r as Q, a as ee, b as N, c as O, w as b, s as j, e as te, g as ne, p as re, h as $, j as se, k as ae } from "./upload-Df7DMau_.js";
2
+ import { C as Ze, D as Ye, L as Je, l as Qe, m as et, M as tt, n as nt, o as rt, q as st, t as at, u as ot, v as it, x as ct, y as lt, z as ut, A as dt, B as pt, E as mt, F as ft, G as ht, H as gt, I as xt, J as wt, K as Tt, N as Pt, O as Et, Q as bt, R as vt, S as St, T as It, U as At, V as _t, W as $t, X as kt, Y as yt, Z as Lt, _ as Ft, $ as Ct, a0 as Rt, a1 as Dt, a2 as Mt, a3 as Nt, a4 as Ot, a5 as jt, a6 as Xt, a7 as zt, a8 as qt, a9 as Bt, aa as Kt, ab as Wt, ac as Gt, ad as Ht, ae as Ut, af as Vt, ag as Zt, ah as Yt, ai as Jt, aj as Qt, ak as en, al as tn, am as nn, an as rn } from "./upload-Df7DMau_.js";
3
+ import { D as an, a as on, b as cn, c as ln, d as un, e as dn, f as pn, g as mn, h as fn, i as hn, j as gn, k as xn, l as wn, m as Tn, n as Pn, o as En, p as bn, r as vn, q as Sn, u as In } from "./engine-routing-DorSgyrU.js";
4
4
  const oe = /\$(?![\s$])([^$\n]{1,200})\$/;
5
5
  function ie(e) {
6
6
  const t = oe.exec(e);
@@ -35,7 +35,9 @@ export interface CleanLatexChunksResult {
35
35
  * (`mergeChunksAtLevel`), which lets the wizard change split depth without
36
36
  * re-cleaning or re-converting anything.
37
37
  */
38
- export declare function cleanLatexInChunks(source: string): CleanLatexChunksResult;
38
+ export declare function cleanLatexInChunks(source: string, options?: {
39
+ disable?: string[];
40
+ }): CleanLatexChunksResult;
39
41
  /**
40
42
  * Collapse chunks to the view a given split depth produces: one entry per file
41
43
  * that depth would generate, with the chunks below it concatenated in.
@@ -8,6 +8,12 @@ export interface PreambleInfo {
8
8
  author: string;
9
9
  /** Collected \newcommand / \renewcommand / \DeclareMathOperator / \def definitions. */
10
10
  macros: string;
11
+ /**
12
+ * The title-page calls (`\title`, `\subtitle`, `\author`, `\institute`,
13
+ * `\date`, `\titlegraphic`) verbatim, one per line. A slideshow hands these
14
+ * to the converter, which builds its `<frontmatter>` from them.
15
+ */
16
+ titlePageMacros: string;
11
17
  }
12
18
  export declare function splitLatexAtDocument(source: string): {
13
19
  preamble: string;
@@ -19,6 +25,12 @@ export declare function splitLatexAtDocument(source: string): {
19
25
  * Returns the inner content (without surrounding braces), or "".
20
26
  */
21
27
  export declare function extractLatexField(source: string, cmdName: string): string;
28
+ /**
29
+ * Every call of the title-page macros in `source`, verbatim: the name, an
30
+ * optional `[short]` argument, and the braced argument, e.g.
31
+ * `\title[Short]{A Long Title}`.
32
+ */
33
+ export declare function extractTitlePageMacros(source: string): string;
22
34
  export interface ExtractMacrosResult {
23
35
  /** Collected macro definitions, joined with newlines. */
24
36
  macros: string;
@@ -11,6 +11,27 @@ export interface XmlElementSpan {
11
11
  export declare function findTopLevelElements(source: string, name: string): XmlElementSpan[];
12
12
  export declare function findTopLevelElementsMatching(source: string, matches: (name: string) => boolean): XmlElementSpan[];
13
13
  export declare function findFirstElement(source: string, name: string): XmlElementSpan | null;
14
+ /**
15
+ * The document's root element — `<book>`, `<article>` or `<slideshow>` — or
16
+ * `null` when `source` carries none (a bare fragment).
17
+ *
18
+ * Every stage that has to locate a root goes through here rather than spelling
19
+ * the tags out, so a root the vocabulary gains cannot be understood by one
20
+ * stage and silently dropped by the next: a `<slideshow>` used to reach the
21
+ * pool builder, match neither `<book>` nor `<article>`, and get wrapped in an
22
+ * `<article>` that outlived the import.
23
+ *
24
+ * `source` is the content of `<pretext>`, whose content model in `pretext.rng`
25
+ * is a bare `<choice>` of the root elements — exactly one — and no content
26
+ * model in the grammar references a root element at all. So both a second root
27
+ * alongside the first and a root nested inside one are unreadable as a
28
+ * document rather than merely unusual, and throw. Picking a winner instead
29
+ * would hand the caller a project whose `documentKind` and whose source
30
+ * disagree, which is the failure this lookup exists to prevent; `detectDocumentKind`
31
+ * scans at any depth and would answer `<slideshow>` where the root says
32
+ * `<article>`.
33
+ */
34
+ export declare function findRootElement(source: string): XmlElementSpan | null;
14
35
  export declare function findAnyElement(source: string, name: string): XmlElementSpan | null;
15
36
  /**
16
37
  * One tag occurrence — an open, close, or self-closing tag — rather than a
@@ -4,6 +4,8 @@ export declare const PRETEXT_ROOT_TAGS: readonly ["book", "article", "slideshow"
4
4
  export declare const PRETEXT_DIVISION_TAGS: readonly ["frontmatter", "preface", "acknowledgement", "dedication", "biography", "contributors", "part", "introduction", "chapter", "section", "subsection", "subsubsection", "conclusion", "exercises", "worksheet", "handout", "reading-questions", "references", "solutions", "glossary", "backmatter", "appendix", "index", "colophon"];
5
5
  export type PretextRootTag = (typeof PRETEXT_ROOT_TAGS)[number];
6
6
  export type PretextDivisionTag = (typeof PRETEXT_DIVISION_TAGS)[number];
7
+ /** `name` as a root tag, or `undefined` when it does not name one. */
8
+ export declare function rootTagOf(name: string): PretextRootTag | undefined;
7
9
  export declare function isDivisionTag(name: string): name is PretextDivisionTag;
8
10
  export declare function filePrefixForDivision(type: string): string;
9
11
  export declare function isSingletonDivision(type: string): boolean;
package/dist/react.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),I=require("./upload-CPMLFrdG.cjs"),A=require("./engine-routing-B03PZ4P-.cjs");var ge={exports:{}},oe={};var Ie;function Ke(){if(Ie)return oe;Ie=1;var r=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function u(m,p,d){var y=null;if(d!==void 0&&(y=""+d),p.key!==void 0&&(y=""+p.key),"key"in p){d={};for(var R in p)R!=="key"&&(d[R]=p[R])}else d=p;return p=d.ref,{$$typeof:r,type:m,key:y,ref:p!==void 0?p:null,props:d}}return oe.Fragment=i,oe.jsx=u,oe.jsxs=u,oe}var ce={};var De;function Ve(){return De||(De=1,process.env.NODE_ENV!=="production"&&(function(){function r(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===G?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case K:return"Fragment";case V:return"Profiler";case C:return"StrictMode";case ne:return"Suspense";case ie:return"SuspenseList";case ve:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case D:return"Portal";case P:return t.displayName||"Context";case b:return(t._context.displayName||"Context")+".Consumer";case _:var l=t.render;return t=t.displayName,t||(t=l.displayName||l.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case de:return l=t.displayName||null,l!==null?l:r(t.type)||"Memo";case ae:l=t._payload,t=t._init;try{return r(t(l))}catch{}}return null}function i(t){return""+t}function u(t){try{i(t);var l=!1}catch{l=!0}if(l){l=console;var f=l.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return f.call(l,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),i(t)}}function m(t){if(t===K)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===ae)return"<...>";try{var l=r(t);return l?"<"+l+">":"<...>"}catch{return"<...>"}}function p(){var t=J.A;return t===null?null:t.getOwner()}function d(){return Error("react-stack-top-frame")}function y(t){if(ue.call(t,"key")){var l=Object.getOwnPropertyDescriptor(t,"key").get;if(l&&l.isReactWarning)return!1}return t.key!==void 0}function R(t,l){function f(){le||(le=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",l))}f.isReactWarning=!0,Object.defineProperty(t,"key",{get:f,configurable:!0})}function h(){var t=r(this.type);return xe[t]||(xe[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function k(t,l,f,g,B,O){var v=f.ref;return t={$$typeof:T,type:t,key:l,props:f,_owner:g},(v!==void 0?v:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:h}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:B}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:O}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function E(t,l,f,g,B,O){var v=l.children;if(v!==void 0)if(g)if(me(v)){for(g=0;g<v.length;g++)w(v[g]);Object.freeze&&Object.freeze(v)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(v);if(ue.call(l,"key")){v=r(t);var L=Object.keys(l).filter(function(se){return se!=="key"});g=0<L.length?"{key: someKey, "+L.join(": ..., ")+": ...}":"{key: someKey}",te[v+g]||(L=0<L.length?"{"+L.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),I=require("./upload-COaS_4pG.cjs"),A=require("./engine-routing-3ULYdLy2.cjs");var ge={exports:{}},oe={};var Ie;function Ke(){if(Ie)return oe;Ie=1;var r=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function u(m,p,d){var y=null;if(d!==void 0&&(y=""+d),p.key!==void 0&&(y=""+p.key),"key"in p){d={};for(var R in p)R!=="key"&&(d[R]=p[R])}else d=p;return p=d.ref,{$$typeof:r,type:m,key:y,ref:p!==void 0?p:null,props:d}}return oe.Fragment=i,oe.jsx=u,oe.jsxs=u,oe}var ce={};var De;function Ve(){return De||(De=1,process.env.NODE_ENV!=="production"&&(function(){function r(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===G?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case K:return"Fragment";case V:return"Profiler";case C:return"StrictMode";case ne:return"Suspense";case ie:return"SuspenseList";case ve:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case D:return"Portal";case P:return t.displayName||"Context";case b:return(t._context.displayName||"Context")+".Consumer";case _:var l=t.render;return t=t.displayName,t||(t=l.displayName||l.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case de:return l=t.displayName||null,l!==null?l:r(t.type)||"Memo";case ae:l=t._payload,t=t._init;try{return r(t(l))}catch{}}return null}function i(t){return""+t}function u(t){try{i(t);var l=!1}catch{l=!0}if(l){l=console;var f=l.error,g=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return f.call(l,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",g),i(t)}}function m(t){if(t===K)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===ae)return"<...>";try{var l=r(t);return l?"<"+l+">":"<...>"}catch{return"<...>"}}function p(){var t=J.A;return t===null?null:t.getOwner()}function d(){return Error("react-stack-top-frame")}function y(t){if(ue.call(t,"key")){var l=Object.getOwnPropertyDescriptor(t,"key").get;if(l&&l.isReactWarning)return!1}return t.key!==void 0}function R(t,l){function f(){le||(le=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",l))}f.isReactWarning=!0,Object.defineProperty(t,"key",{get:f,configurable:!0})}function h(){var t=r(this.type);return xe[t]||(xe[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function k(t,l,f,g,B,O){var v=f.ref;return t={$$typeof:T,type:t,key:l,props:f,_owner:g},(v!==void 0?v:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:h}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:B}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:O}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function E(t,l,f,g,B,O){var v=l.children;if(v!==void 0)if(g)if(me(v)){for(g=0;g<v.length;g++)w(v[g]);Object.freeze&&Object.freeze(v)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(v);if(ue.call(l,"key")){v=r(t);var L=Object.keys(l).filter(function(se){return se!=="key"});g=0<L.length?"{key: someKey, "+L.join(": ..., ")+": ...}":"{key: someKey}",te[v+g]||(L=0<L.length?"{"+L.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import He, { useState as h, useRef as ge, useEffect as Ze, useMemo as H } from "react";
2
- import { Z as Ue, a9 as Qe, a4 as et, D as tt, n as st, k as rt, h as nt, j as Ye, N as at, H as lt } from "./upload-w0BmYtpp.js";
3
- import { D as ot, a as ct, b as it, d as dt, q as De, k as ut, n as Oe, r as mt, l as Le, u as xt } from "./engine-routing-vjkGBbmx.js";
2
+ import { Z as Ue, a9 as Qe, a4 as et, D as tt, n as st, k as rt, h as nt, j as Ye, N as at, H as lt } from "./upload-Df7DMau_.js";
3
+ import { D as ot, a as ct, b as it, d as dt, q as De, k as ut, n as Oe, r as mt, l as Le, u as xt } from "./engine-routing-DorSgyrU.js";
4
4
  var be = { exports: {} }, le = {};
5
5
  var Ie;
6
6
  function pt() {