@pretextbook/import 0.3.0 → 0.4.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/README.md +79 -8
- package/dist/import-mode-DlOXwZkx.cjs +115 -0
- package/dist/import-mode-G2KcSH17.js +4774 -0
- package/dist/import.css +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +100 -85
- package/dist/lib/clean/latex-includes.d.ts +19 -0
- package/dist/lib/clean/pretext-includes.d.ts +8 -0
- package/dist/lib/layout/shared.d.ts +5 -1
- package/dist/lib/layout/xml-scan.d.ts +1 -0
- package/dist/lib/pool/division-pool.d.ts +17 -3
- package/dist/lib/pool/index.d.ts +1 -1
- package/dist/lib/pretext-divisions.d.ts +9 -0
- package/dist/lib/project/analyze.d.ts +46 -0
- package/dist/lib/project/attach-roots.d.ts +46 -0
- package/dist/lib/project/existing-project.d.ts +40 -0
- package/dist/lib/project/manifest.d.ts +50 -0
- package/dist/lib/project/paths.d.ts +19 -0
- package/dist/lib/types.d.ts +32 -3
- package/dist/lib/upload.d.ts +40 -1
- package/dist/react/import-wizard.d.ts +21 -0
- package/dist/react/index.d.ts +1 -1
- package/dist/react.cjs +2 -2
- package/dist/react.js +577 -343
- package/package.json +1 -1
- package/dist/import-mode-DK83Lfue.js +0 -4214
- package/dist/import-mode-vewAEq9k.cjs +0 -95
package/dist/import.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-200:oklch(88.5% .062 18.334);--color-red-800:oklch(44.4% .177 26.899);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-green-700:oklch(52.7% .154 150.069);--color-blue-50:oklch(97% .014 254.604);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-0{margin:0}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.h-8{height:calc(var(--spacing) * 8)}.max-h-72{max-height:calc(var(--spacing) * 72)}.w-8{width:calc(var(--spacing) * 8)}.w-full{width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-700{border-color:var(--color-blue-700)}.border-red-200{border-color:var(--color-red-200)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-300{border-color:var(--color-slate-300)}.border-t-transparent{border-top-color:#0000}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-700{background-color:var(--color-blue-700)}.bg-red-50{background-color:var(--color-red-50)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-white{background-color:var(--color-white)}.p-4{padding:calc(var(--spacing) * 4)}.p-10{padding:calc(var(--spacing) * 10)}.px-1{padding-inline:var(--spacing)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-1{padding-top:var(--spacing)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-green-700{color:var(--color-green-700)}.text-red-800{color:var(--color-red-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-slate-400:hover{border-color:var(--color-slate-400)}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-200:hover{background-color:var(--color-slate-200)}.hover\:text-slate-900:hover{color:var(--color-slate-900)}}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}
|
|
1
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-outline-style:solid}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-200:oklch(88.5% .062 18.334);--color-red-800:oklch(44.4% .177 26.899);--color-amber-50:oklch(98.7% .022 95.277);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-200:oklch(92.4% .12 95.746);--color-amber-700:oklch(55.5% .163 48.998);--color-amber-800:oklch(47.3% .137 46.201);--color-green-700:oklch(52.7% .154 150.069);--color-blue-50:oklch(97% .014 254.604);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-slate-50:oklch(98.4% .003 247.858);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-200:oklch(92.9% .013 255.508);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-700:oklch(37.2% .044 257.287);--color-slate-800:oklch(27.9% .041 260.031);--color-slate-900:oklch(20.8% .042 265.755);--color-white:#fff;--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-semibold:600;--leading-relaxed:1.625;--radius-lg:.5rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.collapse{visibility:collapse}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-0{margin:0}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.h-8{height:calc(var(--spacing) * 8)}.max-h-72{max-height:calc(var(--spacing) * 72)}.w-8{width:calc(var(--spacing) * 8)}.w-full{width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-200{border-color:var(--color-amber-200)}.border-blue-200{border-color:var(--color-blue-200)}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-700{border-color:var(--color-blue-700)}.border-red-200{border-color:var(--color-red-200)}.border-slate-200{border-color:var(--color-slate-200)}.border-slate-300{border-color:var(--color-slate-300)}.border-t-transparent{border-top-color:#0000}.bg-amber-50{background-color:var(--color-amber-50)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-50{background-color:var(--color-blue-50)}.bg-blue-700{background-color:var(--color-blue-700)}.bg-red-50{background-color:var(--color-red-50)}.bg-slate-50{background-color:var(--color-slate-50)}.bg-slate-100{background-color:var(--color-slate-100)}.bg-white{background-color:var(--color-white)}.p-4{padding:calc(var(--spacing) * 4)}.p-10{padding:calc(var(--spacing) * 10)}.px-1{padding-inline:var(--spacing)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-16{padding-block:calc(var(--spacing) * 16)}.pt-1{padding-top:var(--spacing)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-amber-700{color:var(--color-amber-700)}.text-amber-800{color:var(--color-amber-800)}.text-blue-800{color:var(--color-blue-800)}.text-blue-900{color:var(--color-blue-900)}.text-green-700{color:var(--color-green-700)}.text-red-800{color:var(--color-red-800)}.text-slate-400{color:var(--color-slate-400)}.text-slate-500{color:var(--color-slate-500)}.text-slate-600{color:var(--color-slate-600)}.text-slate-700{color:var(--color-slate-700)}.text-slate-800{color:var(--color-slate-800)}.text-slate-900{color:var(--color-slate-900)}.text-white{color:var(--color-white)}.capitalize{text-transform:capitalize}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.last\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}@media(hover:hover){.hover\:border-slate-400:hover{border-color:var(--color-slate-400)}.hover\:bg-blue-600:hover{background-color:var(--color-blue-600)}.hover\:bg-slate-50:hover{background-color:var(--color-slate-50)}.hover\:bg-slate-200:hover{background-color:var(--color-slate-200)}.hover\:text-slate-900:hover{color:var(--color-slate-900)}}.disabled\:opacity-50:disabled{opacity:.5}}select,select option{background-color:var(--color-slate-50,#f8fafc);color:var(--color-slate-900,#0f172a)}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@keyframes spin{to{transform:rotate(360deg)}}
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
-
${
|
|
3
|
-
</pretext>`}function h(
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./import-mode-DlOXwZkx.cjs"),S={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 v(t){const o=t.split(".").pop()?.toLowerCase()??"";return S[o]??"application/octet-stream"}const f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function M(t){const o=t.length,r=[];for(let n=0;n<o;n+=3){const i=t[n],s=n+1<o,l=n+2<o,c=s?t[n+1]:0,u=l?t[n+2]:0;r.push(f[i>>2]),r.push(f[(i&3)<<4|c>>4]),r.push(s?f[(c&15)<<2|u>>6]:"="),r.push(l?f[u&63]:"=")}return r.join("")}function R(t){return{ref:t.ref,kind:"file",title:t.fileName,short_description:t.fileName,file:{filename:t.fileName,content_type:v(t.fileName),data:M(t.data)}}}function j(t){return{title:t.title,docinfo:t.docinfo,document_type:t.documentKind,divisions_attributes:t.divisions.map(o=>({ref:o.xmlId,source:o.content,source_format:o.sourceFormat,is_root:o.isRoot})),assets_attributes:t.assets.map(R)}}const P={mainSourcePath:"source/main.ptx",publicationPath:"publication/publication.ptx",projectFilePath:"project.ptx",docinfoPath:"source/docinfo.ptx"};function g(t){return e.findAnyElement(t,"pretext")?t:`<pretext>
|
|
2
|
+
${t}
|
|
3
|
+
</pretext>`}function h(t,o,r){const n=new Map,i=[],s=`${o}-`;return t.forEach((l,c)=>{const u=l.attributes["xml:id"];let p;if(u){const d=e.slugify(u);p=d.startsWith(s)?d:`${s}${d}`}else p=`${s}${e.padIndex(c+1,t.length)}`,r.push({action:"anomaly",severity:"info",kind:"structure",category:"missing_xml_id",macro:l.name,occurrences:1,message:`<${l.name}> at position ${c+1} has no xml:id; using \`${p}\` as filename.`});const m=n.get(p)??0;n.set(p,m+1);const a=m===0?p:`${p}-${m+1}`;i.push({span:l,slug:a,filename:`${a}.ptx`})}),i}function E(t,o,r,n){const i=e.findTopLevelElements(t,"section");if(i.length===0)return t;const l=h(i,"sec",n).map(c=>{const u=`source/${o}/${c.filename}`;return r[u]=e.withProlog(c.span.outer),{start:c.span.start,end:c.span.end,replacement:`<xi:include href="${o}/${c.filename}"/>`}});return e.spliceReplacements(t,l)}function _(t,o,r){const n=e.findAnyElement(t,"book");if(!n)return r.push({action:"anomaly",severity:"warning",kind:"structure",category:"missing_root",macro:"book",occurrences:1,message:"Document was treated as a book but no <book> element found; emitting as a single file."}),T(t,o);const i={},s=e.findTopLevelElements(n.inner,"chapter");let l=n.inner;if(o.splitChapters&&s.length>0){const m=h(s,"ch",r).map(a=>{let d=a.span.outer;if(o.splitSections){const b=a.span.inner,F=E(b,a.slug,i,r);d=a.span.outer.slice(0,a.span.startTagEnd-a.span.start)+F+a.span.outer.slice(a.span.contentEnd-a.span.start)}const x=`source/${a.filename}`;return i[x]=e.withProlog(d),{start:a.span.start,end:a.span.end,replacement:`<xi:include href="${a.filename}"/>`}});l=e.spliceReplacements(n.inner,m)}const c=t.slice(n.start,n.startTagEnd)+l+t.slice(n.contentEnd,n.end),u=t.slice(0,n.start)+c+t.slice(n.end);return i[o.mainSourcePath]=e.withProlog(e.ensureXIncludeNamespace(g(u.trim()))),i}function T(t,o,r){const n={};return n[o.mainSourcePath]=e.withProlog(g(t.trim())),n}function A(t,o={}){const r=[],n=o.documentKind??e.detectDocumentKind(t),i={splitChapters:o.splitChapters??n==="book",splitSections:o.splitSections??!1,mainSourcePath:o.mainSourcePath??P.mainSourcePath,publicationPath:o.publicationPath??P.publicationPath,projectFilePath:o.projectFilePath??P.projectFilePath,docinfoPath:o.docinfoPath??P.docinfoPath},s=n==="book"?_(t,i,r):T(t,i);return s[i.projectFilePath]=e.renderProjectPtx({mainSource:i.mainSourcePath,publication:i.publicationPath}),s[i.publicationPath]=e.renderPublicationPtx(),{files:s,documentKind:n,warnings:r}}exports.LATEX_FORMAT_MARKERS=e.LATEX_FORMAT_MARKERS;exports.MARKDOWN_FORMAT_MARKERS=e.MARKDOWN_FORMAT_MARKERS;exports.PRETEXT_DIVISION_TAGS=e.PRETEXT_DIVISION_TAGS;exports.PRETEXT_ROOT_TAGS=e.PRETEXT_ROOT_TAGS;exports.analyzeImportSources=e.analyzeImportSources;exports.assetsForImportMode=e.assetsForImportMode;exports.attachLatexRoots=e.attachLatexRoots;exports.attachMarkdownRoots=e.attachMarkdownRoots;exports.buildDivisionPool=e.buildDivisionPool;exports.buildNativeDivisionPool=e.buildNativeDivisionPool;exports.carryOverProjectFiles=e.carryOverProjectFiles;exports.cleanLatex=e.cleanLatex;exports.convertLatexToPretext=e.convertLatexToPretext;exports.convertMarkdownToPretext=e.convertMarkdownToPretext;exports.convertSourceToPretext=e.convertSourceToPretext;exports.defaultAttachLevel=e.defaultAttachLevel;exports.defaultManifestTarget=e.defaultManifestTarget;exports.detectDocumentKind=e.detectDocumentKind;exports.detectSourceFormat=e.detectSourceFormat;exports.divisionChildRefs=e.divisionChildRefs;exports.expandPretextIncludes=e.expandPretextIncludes;exports.extractUpload=e.extractUpload;exports.filePrefixForDivision=e.filePrefixForDivision;exports.filesForImportMode=e.filesForImportMode;exports.findProjectManifest=e.findProjectManifest;exports.formatWarningLine=e.formatWarningLine;exports.getConversionErrorMessage=e.getConversionErrorMessage;exports.handleImportUploadFile=e.handleImportUploadFile;exports.importProjectFromFiles=e.importProjectFromFiles;exports.isDivisionTag=e.isDivisionTag;exports.normalizePretextSource=e.normalizePretextSource;exports.parseProjectManifest=e.parseProjectManifest;exports.projectForImportMode=e.projectForImportMode;exports.renderProjectPtx=e.renderProjectPtx;exports.renderProjectPtxFromManifest=e.renderProjectPtxFromManifest;exports.renderPublicationPtx=e.renderPublicationPtx;exports.resolveSplitLevel=e.resolveSplitLevel;exports.sanitizeRef=e.sanitizeRef;exports.serializeProjectToFiles=e.serializeProjectToFiles;exports.buildPretextProjectFiles=A;exports.serializeProjectToPlusPayload=j;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export { detectSourceFormat, LATEX_FORMAT_MARKERS, MARKDOWN_FORMAT_MARKERS, } from './lib/detect-source-format';
|
|
2
2
|
export { convertLatexToPretext, convertMarkdownToPretext, normalizePretextSource, convertSourceToPretext, getConversionErrorMessage, } from './lib/convert';
|
|
3
3
|
export type { LatexConversionResult, MarkdownConversionResult, } from './lib/convert';
|
|
4
|
-
export { importProjectFromFiles, handleImportUploadFile, type ImportProjectOptions, } from './lib/upload';
|
|
4
|
+
export { importProjectFromFiles, handleImportUploadFile, extractUpload, type ExtractedUpload, type ImportProjectOptions, } from './lib/upload';
|
|
5
|
+
export { analyzeImportSources, type AnalyzeOptions, type RootCandidate, type RootReason, type UploadAnalysis, } from './lib/project/analyze';
|
|
6
|
+
export { attachLatexRoots, attachMarkdownRoots, defaultAttachLevel, type AttachLevel, type AttachedRootRecord, type AttachRootsResult, type RootAttachment, } from './lib/project/attach-roots';
|
|
7
|
+
export { defaultManifestTarget, findProjectManifest, parseProjectManifest, type ManifestTarget, type ProjectManifest, } from './lib/project/manifest';
|
|
8
|
+
export { carryOverProjectFiles, renderProjectPtxFromManifest, type CarryOverOptions, type CarryOverResult, } from './lib/project/existing-project';
|
|
9
|
+
export { PRETEXT_DIVISION_TAGS, PRETEXT_ROOT_TAGS, filePrefixForDivision, isDivisionTag, type PretextDivisionTag, type PretextRootTag, } from './lib/pretext-divisions';
|
|
5
10
|
export { filesForImportMode, assetsForImportMode, projectForImportMode, formatWarningLine, type ImportMode, } from './lib/import-mode';
|
|
6
11
|
export { cleanLatex } from './lib/clean/clean-latex';
|
|
7
12
|
export type { CleanLatexResult } from './lib/clean/clean-latex';
|
|
@@ -9,6 +14,6 @@ export { expandPretextIncludes } from './lib/clean/pretext-includes';
|
|
|
9
14
|
export type { CleaningWarning, CleaningSeverity, CleaningAction, } from './lib/clean/warnings';
|
|
10
15
|
export { buildPretextProjectFiles, detectDocumentKind, renderProjectPtx, renderPublicationPtx, } from './lib/layout';
|
|
11
16
|
export type { BuildProjectFilesOptions, BuildProjectFilesResult, DocumentKind, } from './lib/layout';
|
|
12
|
-
export { buildDivisionPool, buildNativeDivisionPool, sanitizeRef, serializeProjectToFiles, serializeProjectToPlusPayload, divisionChildRefs, } from './lib/pool';
|
|
17
|
+
export { buildDivisionPool, resolveSplitLevel, buildNativeDivisionPool, sanitizeRef, serializeProjectToFiles, serializeProjectToPlusPayload, divisionChildRefs, } from './lib/pool';
|
|
13
18
|
export type { BuildDivisionPoolOptions, BuildDivisionPoolResult, BuildNativeDivisionPoolOptions, SerializeProjectFilesOptions, SerializedProjectFiles, } from './lib/pool';
|
|
14
|
-
export type { SourceFormat, ConversionContext, ConvertedPretextResult, UploadStatusType, UploadStatusMessage, UploadSourceType, ImportedProject, ImportedDivision, ImportedDivisionType, ImportedAsset, PlusProjectPayload, PlusDivisionAttributes, PlusAssetAttributes, PlusAssetFile, ImportedProjectResult, ImportedProjectSuccess, ImportedProjectError, } from './lib/types';
|
|
19
|
+
export type { SourceFormat, ProjectLayout, ConversionContext, ConvertedPretextResult, UploadStatusType, UploadStatusMessage, UploadSourceType, ImportedProject, ImportedDivision, ImportedDivisionType, ImportedAsset, PlusProjectPayload, PlusDivisionAttributes, PlusAssetAttributes, PlusAssetFile, ImportedProjectResult, ImportedProjectSuccess, ImportedProjectError, } from './lib/types';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import { L as
|
|
3
|
-
const
|
|
1
|
+
import { d as j, r as v, a as R, f as g, b as h, w as P, s as b, e as A, c as M, p as $ } from "./import-mode-G2KcSH17.js";
|
|
2
|
+
import { L as B, M as W, P as X, g as G, h as U, i as H, j as q, k as J, l as Q, m as V, n as Y, o as Z, q as tt, t as et, u as nt, v as at, x as st, y as ot, z as it, A as rt, B as ct, C as lt, D as pt, E as ut, F as mt, G as ft, H as dt, I as Pt, J as gt, K as ht, N as bt, O as xt, Q as Tt, R as Ft, S as St, T as Et } from "./import-mode-G2KcSH17.js";
|
|
3
|
+
const k = {
|
|
4
4
|
png: "image/png",
|
|
5
5
|
jpg: "image/jpeg",
|
|
6
6
|
jpeg: "image/jpeg",
|
|
@@ -14,20 +14,20 @@ const w = {
|
|
|
14
14
|
webp: "image/webp",
|
|
15
15
|
ico: "image/vnd.microsoft.icon"
|
|
16
16
|
};
|
|
17
|
-
function
|
|
17
|
+
function I(t) {
|
|
18
18
|
const e = t.split(".").pop()?.toLowerCase() ?? "";
|
|
19
|
-
return
|
|
19
|
+
return k[e] ?? "application/octet-stream";
|
|
20
20
|
}
|
|
21
21
|
const f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
22
|
-
function
|
|
23
|
-
const e = t.length,
|
|
22
|
+
function w(t) {
|
|
23
|
+
const e = t.length, s = [];
|
|
24
24
|
for (let n = 0; n < e; n += 3) {
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const a = t[n], i = n + 1 < e, c = n + 2 < e, r = i ? t[n + 1] : 0, l = c ? t[n + 2] : 0;
|
|
26
|
+
s.push(f[a >> 2]), s.push(f[(a & 3) << 4 | r >> 4]), s.push(i ? f[(r & 15) << 2 | l >> 6] : "="), s.push(c ? f[l & 63] : "=");
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return s.join("");
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function C(t) {
|
|
31
31
|
return {
|
|
32
32
|
ref: t.ref,
|
|
33
33
|
kind: "file",
|
|
@@ -35,12 +35,12 @@ function y(t) {
|
|
|
35
35
|
short_description: t.fileName,
|
|
36
36
|
file: {
|
|
37
37
|
filename: t.fileName,
|
|
38
|
-
content_type:
|
|
39
|
-
data:
|
|
38
|
+
content_type: I(t.fileName),
|
|
39
|
+
data: w(t.data)
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function N(t) {
|
|
44
44
|
return {
|
|
45
45
|
title: t.title,
|
|
46
46
|
docinfo: t.docinfo,
|
|
@@ -51,7 +51,7 @@ function B(t) {
|
|
|
51
51
|
source_format: e.sourceFormat,
|
|
52
52
|
is_root: e.isRoot
|
|
53
53
|
})),
|
|
54
|
-
assets_attributes: t.assets.map(
|
|
54
|
+
assets_attributes: t.assets.map(C)
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
const d = {
|
|
@@ -61,20 +61,20 @@ const d = {
|
|
|
61
61
|
docinfoPath: "source/docinfo.ptx"
|
|
62
62
|
};
|
|
63
63
|
function x(t) {
|
|
64
|
-
return
|
|
64
|
+
return g(t, "pretext") ? t : `<pretext>
|
|
65
65
|
${t}
|
|
66
66
|
</pretext>`;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const n = /* @__PURE__ */ new Map(),
|
|
68
|
+
function T(t, e, s) {
|
|
69
|
+
const n = /* @__PURE__ */ new Map(), a = [], i = `${e}-`;
|
|
70
70
|
return t.forEach((c, r) => {
|
|
71
71
|
const l = c.attributes["xml:id"];
|
|
72
72
|
let p;
|
|
73
73
|
if (l) {
|
|
74
|
-
const u =
|
|
75
|
-
p = u.startsWith(
|
|
74
|
+
const u = M(l);
|
|
75
|
+
p = u.startsWith(i) ? u : `${i}${u}`;
|
|
76
76
|
} else
|
|
77
|
-
p = `${
|
|
77
|
+
p = `${i}${$(r + 1, t.length)}`, s.push({
|
|
78
78
|
action: "anomaly",
|
|
79
79
|
severity: "info",
|
|
80
80
|
kind: "structure",
|
|
@@ -85,21 +85,21 @@ function F(t, e, a) {
|
|
|
85
85
|
});
|
|
86
86
|
const m = n.get(p) ?? 0;
|
|
87
87
|
n.set(p, m + 1);
|
|
88
|
-
const
|
|
89
|
-
|
|
88
|
+
const o = m === 0 ? p : `${p}-${m + 1}`;
|
|
89
|
+
a.push({
|
|
90
90
|
span: c,
|
|
91
|
-
slug:
|
|
92
|
-
filename: `${
|
|
91
|
+
slug: o,
|
|
92
|
+
filename: `${o}.ptx`
|
|
93
93
|
});
|
|
94
|
-
}),
|
|
94
|
+
}), a;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
96
|
+
function y(t, e, s, n) {
|
|
97
|
+
const a = h(t, "section");
|
|
98
|
+
if (a.length === 0)
|
|
99
99
|
return t;
|
|
100
|
-
const c =
|
|
100
|
+
const c = T(a, "sec", n).map((r) => {
|
|
101
101
|
const l = `source/${e}/${r.filename}`;
|
|
102
|
-
return
|
|
102
|
+
return s[l] = P(r.span.outer), {
|
|
103
103
|
start: r.span.start,
|
|
104
104
|
end: r.span.end,
|
|
105
105
|
replacement: `<xi:include href="${e}/${r.filename}"/>`
|
|
@@ -107,10 +107,10 @@ function I(t, e, a, n) {
|
|
|
107
107
|
});
|
|
108
108
|
return b(t, c);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const n =
|
|
110
|
+
function D(t, e, s) {
|
|
111
|
+
const n = g(t, "book");
|
|
112
112
|
if (!n)
|
|
113
|
-
return
|
|
113
|
+
return s.push({
|
|
114
114
|
action: "anomaly",
|
|
115
115
|
severity: "warning",
|
|
116
116
|
kind: "structure",
|
|
@@ -118,80 +118,95 @@ function N(t, e, a) {
|
|
|
118
118
|
macro: "book",
|
|
119
119
|
occurrences: 1,
|
|
120
120
|
message: "Document was treated as a book but no <book> element found; emitting as a single file."
|
|
121
|
-
}),
|
|
122
|
-
const
|
|
121
|
+
}), F(t, e);
|
|
122
|
+
const a = {}, i = h(n.inner, "chapter");
|
|
123
123
|
let c = n.inner;
|
|
124
|
-
if (e.splitChapters &&
|
|
125
|
-
const m =
|
|
126
|
-
let u =
|
|
124
|
+
if (e.splitChapters && i.length > 0) {
|
|
125
|
+
const m = T(i, "ch", s).map((o) => {
|
|
126
|
+
let u = o.span.outer;
|
|
127
127
|
if (e.splitSections) {
|
|
128
|
-
const E =
|
|
128
|
+
const E = o.span.inner, _ = y(
|
|
129
129
|
E,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
o.slug,
|
|
131
|
+
a,
|
|
132
|
+
s
|
|
133
133
|
);
|
|
134
|
-
u =
|
|
134
|
+
u = o.span.outer.slice(0, o.span.startTagEnd - o.span.start) + _ + o.span.outer.slice(o.span.contentEnd - o.span.start);
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
return
|
|
138
|
-
start:
|
|
139
|
-
end:
|
|
140
|
-
replacement: `<xi:include href="${
|
|
136
|
+
const S = `source/${o.filename}`;
|
|
137
|
+
return a[S] = P(u), {
|
|
138
|
+
start: o.span.start,
|
|
139
|
+
end: o.span.end,
|
|
140
|
+
replacement: `<xi:include href="${o.filename}"/>`
|
|
141
141
|
};
|
|
142
142
|
});
|
|
143
143
|
c = b(n.inner, m);
|
|
144
144
|
}
|
|
145
145
|
const r = t.slice(n.start, n.startTagEnd) + c + t.slice(n.contentEnd, n.end), l = t.slice(0, n.start) + r + t.slice(n.end);
|
|
146
|
-
return
|
|
146
|
+
return a[e.mainSourcePath] = P(
|
|
147
147
|
A(x(l.trim()))
|
|
148
|
-
),
|
|
148
|
+
), a;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function F(t, e, s) {
|
|
151
151
|
const n = {};
|
|
152
|
-
return n[e.mainSourcePath] =
|
|
152
|
+
return n[e.mainSourcePath] = P(
|
|
153
153
|
x(t.trim())
|
|
154
154
|
), n;
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
const
|
|
156
|
+
function O(t, e = {}) {
|
|
157
|
+
const s = [], n = e.documentKind ?? j(t), a = {
|
|
158
158
|
splitChapters: e.splitChapters ?? n === "book",
|
|
159
159
|
splitSections: e.splitSections ?? !1,
|
|
160
160
|
mainSourcePath: e.mainSourcePath ?? d.mainSourcePath,
|
|
161
161
|
publicationPath: e.publicationPath ?? d.publicationPath,
|
|
162
162
|
projectFilePath: e.projectFilePath ?? d.projectFilePath,
|
|
163
163
|
docinfoPath: e.docinfoPath ?? d.docinfoPath
|
|
164
|
-
},
|
|
165
|
-
return
|
|
166
|
-
mainSource:
|
|
167
|
-
publication:
|
|
168
|
-
}),
|
|
164
|
+
}, i = n === "book" ? D(t, a, s) : F(t, a);
|
|
165
|
+
return i[a.projectFilePath] = v({
|
|
166
|
+
mainSource: a.mainSourcePath,
|
|
167
|
+
publication: a.publicationPath
|
|
168
|
+
}), i[a.publicationPath] = R(), { files: i, documentKind: n, warnings: s };
|
|
169
169
|
}
|
|
170
170
|
export {
|
|
171
|
-
|
|
171
|
+
B as LATEX_FORMAT_MARKERS,
|
|
172
172
|
W as MARKDOWN_FORMAT_MARKERS,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
173
|
+
X as PRETEXT_DIVISION_TAGS,
|
|
174
|
+
G as PRETEXT_ROOT_TAGS,
|
|
175
|
+
U as analyzeImportSources,
|
|
176
|
+
H as assetsForImportMode,
|
|
177
|
+
q as attachLatexRoots,
|
|
178
|
+
J as attachMarkdownRoots,
|
|
179
|
+
Q as buildDivisionPool,
|
|
180
|
+
V as buildNativeDivisionPool,
|
|
181
|
+
O as buildPretextProjectFiles,
|
|
182
|
+
Y as carryOverProjectFiles,
|
|
183
|
+
Z as cleanLatex,
|
|
184
|
+
tt as convertLatexToPretext,
|
|
185
|
+
et as convertMarkdownToPretext,
|
|
186
|
+
nt as convertSourceToPretext,
|
|
187
|
+
at as defaultAttachLevel,
|
|
188
|
+
st as defaultManifestTarget,
|
|
189
|
+
j as detectDocumentKind,
|
|
190
|
+
ot as detectSourceFormat,
|
|
191
|
+
it as divisionChildRefs,
|
|
192
|
+
rt as expandPretextIncludes,
|
|
193
|
+
ct as extractUpload,
|
|
194
|
+
lt as filePrefixForDivision,
|
|
195
|
+
pt as filesForImportMode,
|
|
196
|
+
ut as findProjectManifest,
|
|
197
|
+
mt as formatWarningLine,
|
|
198
|
+
ft as getConversionErrorMessage,
|
|
199
|
+
dt as handleImportUploadFile,
|
|
200
|
+
Pt as importProjectFromFiles,
|
|
201
|
+
gt as isDivisionTag,
|
|
202
|
+
ht as normalizePretextSource,
|
|
203
|
+
bt as parseProjectManifest,
|
|
204
|
+
xt as projectForImportMode,
|
|
205
|
+
v as renderProjectPtx,
|
|
206
|
+
Tt as renderProjectPtxFromManifest,
|
|
207
|
+
R as renderPublicationPtx,
|
|
208
|
+
Ft as resolveSplitLevel,
|
|
209
|
+
St as sanitizeRef,
|
|
210
|
+
Et as serializeProjectToFiles,
|
|
211
|
+
N as serializeProjectToPlusPayload
|
|
197
212
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve an `\input{…}` argument against the uploaded file set, trying the
|
|
3
|
+
* path as given, with `.tex` appended, and relative to the including file's
|
|
4
|
+
* directory.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveInputTarget(requestedPath: string, baseFile: string, texFiles: Record<string, string>): string | null;
|
|
7
|
+
export interface TexExpansion {
|
|
8
|
+
expandedText: string;
|
|
9
|
+
expandedCount: number;
|
|
10
|
+
missingInputs: string[];
|
|
11
|
+
/** Paths whose contents were inlined — they are parts, not roots. */
|
|
12
|
+
consumedPaths: string[];
|
|
13
|
+
}
|
|
14
|
+
export declare function expandTexInputs(mainTex: string, baseFile: string, texFiles: Record<string, string>, maxPasses?: number): TexExpansion;
|
|
15
|
+
/**
|
|
16
|
+
* Every `.tex` file that some other `.tex` file `\input`s — i.e. the files
|
|
17
|
+
* that are parts of a larger document rather than roots in their own right.
|
|
18
|
+
*/
|
|
19
|
+
export declare function collectTexInputTargets(texFiles: Record<string, string>): Set<string>;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
export declare function resolveIncludeTarget(requested: string, baseFile: string, files: Record<string, string>): string | null;
|
|
1
2
|
export interface PretextIncludeExpansion {
|
|
2
3
|
expandedText: string;
|
|
3
4
|
expandedCount: number;
|
|
4
5
|
missingIncludes: string[];
|
|
6
|
+
/** Paths whose contents were inlined — they are parts, not roots. */
|
|
7
|
+
consumedPaths: string[];
|
|
5
8
|
}
|
|
6
9
|
export declare function expandPretextIncludes(mainContent: string, baseFile: string, files: Record<string, string>, maxDepth?: number): PretextIncludeExpansion;
|
|
10
|
+
/**
|
|
11
|
+
* Every `.ptx`/`.xml` file that some other file `xi:include`s — i.e. the files
|
|
12
|
+
* that are parts of a larger document rather than roots in their own right.
|
|
13
|
+
*/
|
|
14
|
+
export declare function collectPretextIncludeTargets(files: Record<string, string>): Set<string>;
|
|
7
15
|
export declare function findLikelyMainPretextPath(files: Record<string, string>): string | null;
|
|
@@ -7,6 +7,10 @@ export declare function spliceReplacements(source: string, replacements: Array<{
|
|
|
7
7
|
end: number;
|
|
8
8
|
replacement: string;
|
|
9
9
|
}>): string;
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Add `xmlns:xi` to the first element that lacks it — the wrapper of whatever
|
|
12
|
+
* file we are writing, which may be any division (a `<part>` and a
|
|
13
|
+
* `<frontmatter>` can hold xi:includes just as a `<chapter>` can).
|
|
14
|
+
*/
|
|
11
15
|
export declare function ensureXIncludeNamespace(content: string): string;
|
|
12
16
|
export declare function withProlog(content: string): string;
|
|
@@ -9,5 +9,6 @@ export interface XmlElementSpan {
|
|
|
9
9
|
attributes: Record<string, string>;
|
|
10
10
|
}
|
|
11
11
|
export declare function findTopLevelElements(source: string, name: string): XmlElementSpan[];
|
|
12
|
+
export declare function findTopLevelElementsMatching(source: string, matches: (name: string) => boolean): XmlElementSpan[];
|
|
12
13
|
export declare function findFirstElement(source: string, name: string): XmlElementSpan | null;
|
|
13
14
|
export declare function findAnyElement(source: string, name: string): XmlElementSpan | null;
|
|
@@ -4,11 +4,25 @@ import { ImportedProject } from '../types';
|
|
|
4
4
|
export { sanitizeRef } from './refs';
|
|
5
5
|
export interface BuildDivisionPoolOptions {
|
|
6
6
|
documentKind?: DocumentKind;
|
|
7
|
+
/**
|
|
8
|
+
* How many levels of division to split out of the root, e.g. 1 splits a
|
|
9
|
+
* book's chapters (and its frontmatter/backmatter/appendices), 2 also splits
|
|
10
|
+
* each chapter's sections, 0 keeps the whole document in one division.
|
|
11
|
+
* Takes precedence over `splitChapters`/`splitSections`.
|
|
12
|
+
*/
|
|
13
|
+
splitLevel?: number;
|
|
7
14
|
splitChapters?: boolean;
|
|
8
15
|
splitSections?: boolean;
|
|
9
16
|
/** Binary assets keyed by their original (input) path. */
|
|
10
17
|
assets?: Record<string, Uint8Array>;
|
|
11
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Reconcile the split options into a single depth. `splitChapters` and
|
|
21
|
+
* `splitSections` predate `splitLevel` and stay supported, but they mean
|
|
22
|
+
* different depths in a book (chapters at 1, sections at 2) than in an article
|
|
23
|
+
* (sections at 1), so they are resolved against the document kind.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveSplitLevel(options: BuildDivisionPoolOptions, documentKind: DocumentKind): number;
|
|
12
26
|
export interface BuildDivisionPoolResult {
|
|
13
27
|
project: ImportedProject;
|
|
14
28
|
warnings: CleaningWarning[];
|
|
@@ -19,9 +33,9 @@ export interface BuildDivisionPoolResult {
|
|
|
19
33
|
*
|
|
20
34
|
* - `docinfo` and the document `<title>` become project-level fields (the
|
|
21
35
|
* plus data model); the file-tree serializer re-inlines them.
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
*
|
|
36
|
+
* - Divisions are split out to `splitLevel` levels deep (default: 1 for a
|
|
37
|
+
* book, 0 for an article), each replaced in its parent by a
|
|
38
|
+
* `<plus:TYPE ref="…"/>` placeholder.
|
|
25
39
|
* - Every division's wrapper element carries `xml:id` equal to its ref;
|
|
26
40
|
* missing ids are generated (`ch-01`, …), invalid/duplicate ids are
|
|
27
41
|
* sanitized with a warning.
|
package/dist/lib/pool/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { buildDivisionPool, sanitizeRef, type BuildDivisionPoolOptions, type BuildDivisionPoolResult, } from './division-pool';
|
|
1
|
+
export { buildDivisionPool, resolveSplitLevel, sanitizeRef, type BuildDivisionPoolOptions, type BuildDivisionPoolResult, } from './division-pool';
|
|
2
2
|
export { buildNativeDivisionPool, type BuildNativeDivisionPoolOptions, } from './native-pool';
|
|
3
3
|
export { serializeProjectToFiles, divisionChildRefs, type SerializeProjectFilesOptions, type SerializedProjectFiles, } from './serialize-files';
|
|
4
4
|
export { serializeProjectToPlusPayload } from './serialize-plus';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Root elements of a PreTeXt document. */
|
|
2
|
+
export declare const PRETEXT_ROOT_TAGS: readonly ["book", "article"];
|
|
3
|
+
/** Divisions that may be split into their own file, in rough outline order. */
|
|
4
|
+
export declare const PRETEXT_DIVISION_TAGS: readonly ["frontmatter", "preface", "acknowledgement", "dedication", "biography", "contributors", "part", "chapter", "section", "subsection", "subsubsection", "exercises", "worksheet", "reading-questions", "references", "solutions", "glossary", "backmatter", "appendix", "index", "colophon"];
|
|
5
|
+
export type PretextRootTag = (typeof PRETEXT_ROOT_TAGS)[number];
|
|
6
|
+
export type PretextDivisionTag = (typeof PRETEXT_DIVISION_TAGS)[number];
|
|
7
|
+
export declare function isDivisionTag(name: string): name is PretextDivisionTag;
|
|
8
|
+
export declare function filePrefixForDivision(type: string): string;
|
|
9
|
+
export declare function isSingletonDivision(type: string): boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SourceFormat } from '../types';
|
|
2
|
+
import { ProjectManifest } from './manifest';
|
|
3
|
+
/** Why a file is offered as a possible document root. */
|
|
4
|
+
export type RootReason = "manifest-target" | "latex-root" | "pretext-root" | "markdown-root" | "fallback";
|
|
5
|
+
export interface RootCandidate {
|
|
6
|
+
/** Path within the uploaded file set. */
|
|
7
|
+
path: string;
|
|
8
|
+
format: SourceFormat;
|
|
9
|
+
reason: RootReason;
|
|
10
|
+
/** Title mined from the file, when it declares one. */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** `project.ptx` target this candidate came from. */
|
|
13
|
+
targetName?: string;
|
|
14
|
+
/** That target's output format (`html`, `pdf`, …). */
|
|
15
|
+
targetFormat?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface UploadAnalysis {
|
|
18
|
+
/** The `project.ptx` governing the upload, when it has one. */
|
|
19
|
+
manifest: ProjectManifest | null;
|
|
20
|
+
/** Every file that could serve as a root, best first. */
|
|
21
|
+
candidates: RootCandidate[];
|
|
22
|
+
/** Formats represented among the candidates, in the order they are preferred. */
|
|
23
|
+
formats: SourceFormat[];
|
|
24
|
+
/** The candidate the import will use unless overridden. */
|
|
25
|
+
primary: RootCandidate | null;
|
|
26
|
+
/**
|
|
27
|
+
* Other roots of the *same* format as `primary` — a multi-root upload
|
|
28
|
+
* (several `\documentclass` files, several stray Markdown files). These are
|
|
29
|
+
* the files the caller can offer to attach as chapters or sections.
|
|
30
|
+
*/
|
|
31
|
+
extraRoots: RootCandidate[];
|
|
32
|
+
}
|
|
33
|
+
export interface AnalyzeOptions {
|
|
34
|
+
/** Restrict candidates to one format (the host's format dropdown). */
|
|
35
|
+
sourceFormat?: SourceFormat;
|
|
36
|
+
/** Force a specific file as the root, whatever the heuristics prefer. */
|
|
37
|
+
mainFile?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Survey an uploaded file set for possible document roots.
|
|
41
|
+
*
|
|
42
|
+
* Preference order, highest first: a `project.ptx` target (an existing PreTeXt
|
|
43
|
+
* project always knows its own root), then LaTeX, Markdown, and finally loose
|
|
44
|
+
* PreTeXt files — matching the pre-manifest behaviour of the pipeline.
|
|
45
|
+
*/
|
|
46
|
+
export declare function analyzeImportSources(files: Record<string, string>, options?: AnalyzeOptions): UploadAnalysis;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { CleaningWarning } from '../clean/warnings';
|
|
2
|
+
/** Division level an extra root is attached at. */
|
|
3
|
+
export type AttachLevel = "chapter" | "section";
|
|
4
|
+
/** A caller's instruction for one extra root. */
|
|
5
|
+
export interface RootAttachment {
|
|
6
|
+
/** Path of the extra root within the uploaded file set. */
|
|
7
|
+
path: string;
|
|
8
|
+
/** Level to attach at; defaults to the main document's own top level. */
|
|
9
|
+
level?: AttachLevel;
|
|
10
|
+
/** Heading text; defaults to the file's `\title`, else its filename. */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** Set false to leave this root out of the import entirely. */
|
|
13
|
+
include?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface AttachedRootRecord {
|
|
16
|
+
path: string;
|
|
17
|
+
title: string;
|
|
18
|
+
level: AttachLevel;
|
|
19
|
+
}
|
|
20
|
+
export interface AttachRootsResult {
|
|
21
|
+
/** The combined source, ready for the normal conversion pipeline. */
|
|
22
|
+
source: string;
|
|
23
|
+
attached: AttachedRootRecord[];
|
|
24
|
+
warnings: CleaningWarning[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The level extra roots attach at when the caller does not say: a chapter when
|
|
28
|
+
* the main document is book-like, a section otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export declare function defaultAttachLevel(mainSource: string): AttachLevel;
|
|
31
|
+
/**
|
|
32
|
+
* Splice the extra LaTeX roots into the main document.
|
|
33
|
+
*
|
|
34
|
+
* Each attached file contributes its body (what lies between
|
|
35
|
+
* `\begin{document}` and `\end{document}`, or the whole file when it declares
|
|
36
|
+
* neither) plus any macro definitions from its preamble, which are hoisted
|
|
37
|
+
* into the main preamble so the attached content's own commands still resolve.
|
|
38
|
+
*/
|
|
39
|
+
export declare function attachLatexRoots(mainSource: string, attachments: RootAttachment[], files: Record<string, string>): AttachRootsResult;
|
|
40
|
+
/**
|
|
41
|
+
* Markdown counterpart. Extra roots are appended under a depth-1 heading,
|
|
42
|
+
* which `remark-pretext` maps to the document's top-level division — so this
|
|
43
|
+
* currently only supports top-level attachment, not the chapter/section choice
|
|
44
|
+
* the LaTeX path offers.
|
|
45
|
+
*/
|
|
46
|
+
export declare function attachMarkdownRoots(mainSource: string, attachments: RootAttachment[], files: Record<string, string>): AttachRootsResult;
|