@pretextbook/import 0.4.0 → 0.6.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/import-mode-Bu7Pi9k4.cjs +135 -0
- package/dist/import-mode-C0KIll3S.js +7023 -0
- package/dist/import.css +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +9 -3
- package/dist/index.js +160 -138
- package/dist/lib/clean/clean-chunks.d.ts +47 -0
- package/dist/lib/clean/clean-latex.d.ts +35 -1
- package/dist/lib/convert.d.ts +7 -0
- package/dist/lib/diff.d.ts +36 -0
- package/dist/lib/file-changes.d.ts +22 -0
- package/dist/lib/latex-split.d.ts +86 -0
- package/dist/lib/pool/native-pool.d.ts +6 -0
- package/dist/lib/pool/serialize-files.d.ts +6 -0
- package/dist/lib/pretext-divisions.d.ts +1 -1
- package/dist/lib/types.d.ts +14 -0
- package/dist/lib/upload.d.ts +27 -1
- package/dist/react.cjs +2 -2
- package/dist/react.js +484 -417
- package/package.json +5 -4
- package/dist/import-mode-DlOXwZkx.cjs +0 -115
- package/dist/import-mode-G2KcSH17.js +0 -4774
- package/dist/lib/clean/latex-clean.d.ts +0 -10
- package/dist/lib/clean/latex-data.d.ts +0 -38
- package/dist/lib/clean/latex-scan.d.ts +0 -11
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;--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)}}
|
|
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-red-900:oklch(39.6% .141 25.723);--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-50:oklch(98.2% .018 155.826);--color-green-700:oklch(52.7% .154 150.069);--color-green-900:oklch(39.3% .095 152.535);--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)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.table{display:table}.h-8{height:calc(var(--spacing) * 8)}.max-h-48{max-height:calc(var(--spacing) * 48)}.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}.grow{flex-grow:1}.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-100{border-color:var(--color-slate-100)}.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-green-50{background-color:var(--color-green-50)}.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-3{padding-inline:calc(var(--spacing) * 3)}.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-3{padding-block:calc(var(--spacing) * 3)}.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-green-900{color:var(--color-green-900)}.text-red-800{color:var(--color-red-800)}.text-red-900{color:var(--color-red-900)}.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))}.select-none{-webkit-user-select:none;user-select:none}.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 e=require("./import-mode-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./import-mode-Bu7Pi9k4.cjs"),v={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 F(t){const i=t.split(".").pop()?.toLowerCase()??"";return v[i]??"application/octet-stream"}const m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function E(t){const i=t.length,a=[];for(let n=0;n<i;n+=3){const o=t[n],s=n+1<i,c=n+2<i,l=s?t[n+1]:0,p=c?t[n+2]:0;a.push(m[o>>2]),a.push(m[(o&3)<<4|l>>4]),a.push(s?m[(l&15)<<2|p>>6]:"="),a.push(c?m[p&63]:"=")}return a.join("")}function _(t){return{ref:t.ref,kind:"file",title:t.fileName,short_description:t.fileName,file:{filename:t.fileName,content_type:F(t.fileName),data:E(t.data)}}}function A(t){return{title:t.title,docinfo:t.docinfo,document_type:t.documentKind,divisions_attributes:t.divisions.map(i=>({ref:i.xmlId,source:i.content,source_format:i.sourceFormat,is_root:i.isRoot})),assets_attributes:t.assets.map(_)}}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
2
|
${t}
|
|
3
|
-
</pretext>`}function
|
|
3
|
+
</pretext>`}function x(t,i,a){const n=new Map,o=[],s=`${i}-`;return t.forEach((c,l)=>{const p=c.attributes["xml:id"];let u;if(p){const d=e.slugify(p);u=d.startsWith(s)?d:`${s}${d}`}else u=`${s}${e.padIndex(l+1,t.length)}`,a.push({action:"anomaly",severity:"info",kind:"structure",category:"missing_xml_id",macro:c.name,occurrences:1,message:`<${c.name}> at position ${l+1} has no xml:id; using \`${u}\` as filename.`});const f=n.get(u)??0;n.set(u,f+1);const r=f===0?u:`${u}-${f+1}`;o.push({span:c,slug:r,filename:`${r}.ptx`})}),o}function b(t,i,a,n){const o=e.findTopLevelElements(t,"section");if(o.length===0)return t;const c=x(o,"sec",n).map(l=>{const p=`source/${i}/${l.filename}`;return a[p]=e.withProlog(l.span.outer),{start:l.span.start,end:l.span.end,replacement:`<xi:include href="${i}/${l.filename}"/>`}});return e.spliceReplacements(t,c)}function I(t,i,a){const n=e.findAnyElement(t,"book");if(!n)return a.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."}),h(t,i);const o={},s=e.findTopLevelElements(n.inner,"chapter");let c=n.inner;if(i.splitChapters&&s.length>0){const f=x(s,"ch",a).map(r=>{let d=r.span.outer;if(i.splitSections){const L=r.span.inner,S=b(L,r.slug,o,a);d=r.span.outer.slice(0,r.span.startTagEnd-r.span.start)+S+r.span.outer.slice(r.span.contentEnd-r.span.start)}const T=`source/${r.filename}`;return o[T]=e.withProlog(d),{start:r.span.start,end:r.span.end,replacement:`<xi:include href="${r.filename}"/>`}});c=e.spliceReplacements(n.inner,f)}const l=t.slice(n.start,n.startTagEnd)+c+t.slice(n.contentEnd,n.end),p=t.slice(0,n.start)+l+t.slice(n.end);return o[i.mainSourcePath]=e.withProlog(e.ensureXIncludeNamespace(g(p.trim()))),o}function h(t,i,a){const n={};return n[i.mainSourcePath]=e.withProlog(g(t.trim())),n}function M(t,i={}){const a=[],n=i.documentKind??e.detectDocumentKind(t),o={splitChapters:i.splitChapters??n==="book",splitSections:i.splitSections??!1,mainSourcePath:i.mainSourcePath??P.mainSourcePath,publicationPath:i.publicationPath??P.publicationPath,projectFilePath:i.projectFilePath??P.projectFilePath,docinfoPath:i.docinfoPath??P.docinfoPath},s=n==="book"?I(t,o,a):h(t,o);return s[o.projectFilePath]=e.renderProjectPtx({mainSource:o.mainSourcePath,publication:o.publicationPath}),s[o.publicationPath]=e.renderPublicationPtx(),{files:s,documentKind:n,warnings:a}}exports.CLEAN_RULES=e.CLEAN_RULES;exports.LATEX_DIVISION_COMMANDS=e.LATEX_DIVISION_COMMANDS;exports.LATEX_FORMAT_MARKERS=e.LATEX_FORMAT_MARKERS;exports.MARKDOWN_FORMAT_MARKERS=e.MARKDOWN_FORMAT_MARKERS;exports.MAX_SUGGESTED_SPLIT_LEVEL=e.MAX_SUGGESTED_SPLIT_LEVEL;exports.PRETEXT_DIVISION_TAGS=e.PRETEXT_DIVISION_TAGS;exports.PRETEXT_ROOT_TAGS=e.PRETEXT_ROOT_TAGS;exports.analyzeImportSources=e.analyzeImportSources;exports.applyLatexFixes=e.applyLatexFixes;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.cleanLatexInChunks=e.cleanLatexInChunks;exports.cleanLatexText=e.cleanLatexText;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.diffHunks=e.diffHunks;exports.diffLines=e.diffLines;exports.diffStats=e.diffStats;exports.divisionChildRefs=e.divisionChildRefs;exports.divisionsAtLevel=e.divisionsAtLevel;exports.expandPretextIncludes=e.expandPretextIncludes;exports.extractUpload=e.extractUpload;exports.fileChangesForImport=e.fileChangesForImport;exports.filePrefixForDivision=e.filePrefixForDivision;exports.filesForImportMode=e.filesForImportMode;exports.findLatexFixes=e.findLatexFixes;exports.findLatexHeaders=e.findLatexHeaders;exports.findProjectManifest=e.findProjectManifest;exports.fixesToWarnings=e.fixesToWarnings;exports.formatWarningLine=e.formatWarningLine;exports.getConversionErrorMessage=e.getConversionErrorMessage;exports.getLatexCleanDiagnostics=e.getLatexCleanDiagnostics;exports.handleImportUploadFile=e.handleImportUploadFile;exports.importProjectFromFiles=e.importProjectFromFiles;exports.isDivisionTag=e.isDivisionTag;exports.latexDivisionHierarchy=e.latexDivisionHierarchy;exports.latexFixesToCodeActions=e.latexFixesToCodeActions;exports.mergeChunksAtLevel=e.mergeChunksAtLevel;exports.normalizePretextSource=e.normalizePretextSource;exports.parseLatexDivisions=e.parseLatexDivisions;exports.parseProjectManifest=e.parseProjectManifest;exports.projectForImportMode=e.projectForImportMode;exports.relayoutImport=e.relayoutImport;exports.renderProjectPtx=e.renderProjectPtx;exports.renderProjectPtxFromManifest=e.renderProjectPtxFromManifest;exports.renderPublicationPtx=e.renderPublicationPtx;exports.resolveImportSplitLevel=e.resolveImportSplitLevel;exports.resolveSplitLevel=e.resolveSplitLevel;exports.sanitizeRef=e.sanitizeRef;exports.serializeProjectToFiles=e.serializeProjectToFiles;exports.suggestSplitLevel=e.suggestSplitLevel;exports.buildPretextProjectFiles=M;exports.serializeProjectToPlusPayload=A;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
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, extractUpload, type ExtractedUpload, type ImportProjectOptions, } from './lib/upload';
|
|
4
|
+
export { importProjectFromFiles, handleImportUploadFile, extractUpload, relayoutImport, resolveImportSplitLevel, type ExtractedUpload, type ImportProjectOptions, type SplitLevelContext, } from './lib/upload';
|
|
5
|
+
export { LATEX_DIVISION_COMMANDS, findLatexHeaders, latexDivisionHierarchy, parseLatexDivisions, divisionsAtLevel, suggestSplitLevel, MAX_SUGGESTED_SPLIT_LEVEL, type LatexDivision, type LatexDivisionCommand, } from './lib/latex-split';
|
|
6
|
+
export { fileChangesForImport, type FileChangeRecord, } from './lib/file-changes';
|
|
7
|
+
export { diffLines, diffHunks, diffStats, type DiffLine, type DiffHunk, type DiffStats, } from './lib/diff';
|
|
8
|
+
export { cleanLatexInChunks, mergeChunksAtLevel, type CleanedChunk, type CleanLatexChunksResult, } from './lib/clean/clean-chunks';
|
|
5
9
|
export { analyzeImportSources, type AnalyzeOptions, type RootCandidate, type RootReason, type UploadAnalysis, } from './lib/project/analyze';
|
|
6
10
|
export { attachLatexRoots, attachMarkdownRoots, defaultAttachLevel, type AttachLevel, type AttachedRootRecord, type AttachRootsResult, type RootAttachment, } from './lib/project/attach-roots';
|
|
7
11
|
export { defaultManifestTarget, findProjectManifest, parseProjectManifest, type ManifestTarget, type ProjectManifest, } from './lib/project/manifest';
|
|
8
12
|
export { carryOverProjectFiles, renderProjectPtxFromManifest, type CarryOverOptions, type CarryOverResult, } from './lib/project/existing-project';
|
|
9
13
|
export { PRETEXT_DIVISION_TAGS, PRETEXT_ROOT_TAGS, filePrefixForDivision, isDivisionTag, type PretextDivisionTag, type PretextRootTag, } from './lib/pretext-divisions';
|
|
10
14
|
export { filesForImportMode, assetsForImportMode, projectForImportMode, formatWarningLine, type ImportMode, } from './lib/import-mode';
|
|
11
|
-
export { cleanLatex } from './lib/clean/clean-latex';
|
|
12
|
-
export type { CleanLatexResult } from './lib/clean/clean-latex';
|
|
15
|
+
export { cleanLatex, fixesToWarnings } from './lib/clean/clean-latex';
|
|
16
|
+
export type { CleanLatexOptions, CleanLatexResult, } from './lib/clean/clean-latex';
|
|
17
|
+
export { CLEAN_RULES, findLatexFixes, applyLatexFixes, cleanLatexText, getLatexCleanDiagnostics, latexFixesToCodeActions, } from '@pretextbook/latex-style-pretext';
|
|
18
|
+
export type { CleanRule, CleanScope, FindFixesOptions, LatexFix, } from '@pretextbook/latex-style-pretext';
|
|
13
19
|
export { expandPretextIncludes } from './lib/clean/pretext-includes';
|
|
14
20
|
export type { CleaningWarning, CleaningSeverity, CleaningAction, } from './lib/clean/warnings';
|
|
15
21
|
export { buildPretextProjectFiles, detectDocumentKind, renderProjectPtx, renderPublicationPtx, } from './lib/layout';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { d as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
1
|
+
import { d as _, r as v, a as A, f as g, b as h, w as P, s as x, e as I, c as C, p as j } from "./import-mode-C0KIll3S.js";
|
|
2
|
+
import { C as B, L as X, g as U, M as W, h as G, P as H, i as V, j as Y, k as q, l as J, m as Q, n as Z, o as ee, q as te, t as ae, u as se, v as ne, x as ie, y as oe, z as re, A as ce, B as le, D as pe, E as ue, F as fe, G as me, H as de, I as Pe, J as ge, K as he, N as xe, O as be, Q as Se, R as Te, S as Ee, T as Fe, U as Le, V as _e, W as ve, X as Ae, Y as Ie, Z as Ce, _ as je, $ as Me, a0 as Re, a1 as ke, a2 as $e, a3 as De, a4 as ye, a5 as we, a6 as Ne, a7 as Oe, a8 as Ke, a9 as ze, aa as Be, ab as Xe, ac as Ue, ad as We } from "./import-mode-C0KIll3S.js";
|
|
3
|
+
const M = {
|
|
4
4
|
png: "image/png",
|
|
5
5
|
jpg: "image/jpeg",
|
|
6
6
|
jpeg: "image/jpeg",
|
|
@@ -14,44 +14,44 @@ const k = {
|
|
|
14
14
|
webp: "image/webp",
|
|
15
15
|
ico: "image/vnd.microsoft.icon"
|
|
16
16
|
};
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
return
|
|
17
|
+
function R(e) {
|
|
18
|
+
const t = e.split(".").pop()?.toLowerCase() ?? "";
|
|
19
|
+
return M[t] ?? "application/octet-stream";
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
for (let
|
|
25
|
-
const
|
|
26
|
-
|
|
21
|
+
const m = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
22
|
+
function k(e) {
|
|
23
|
+
const t = e.length, n = [];
|
|
24
|
+
for (let a = 0; a < t; a += 3) {
|
|
25
|
+
const s = e[a], o = a + 1 < t, c = a + 2 < t, r = o ? e[a + 1] : 0, l = c ? e[a + 2] : 0;
|
|
26
|
+
n.push(m[s >> 2]), n.push(m[(s & 3) << 4 | r >> 4]), n.push(o ? m[(r & 15) << 2 | l >> 6] : "="), n.push(c ? m[l & 63] : "=");
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return n.join("");
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function $(e) {
|
|
31
31
|
return {
|
|
32
|
-
ref:
|
|
32
|
+
ref: e.ref,
|
|
33
33
|
kind: "file",
|
|
34
|
-
title:
|
|
35
|
-
short_description:
|
|
34
|
+
title: e.fileName,
|
|
35
|
+
short_description: e.fileName,
|
|
36
36
|
file: {
|
|
37
|
-
filename:
|
|
38
|
-
content_type:
|
|
39
|
-
data:
|
|
37
|
+
filename: e.fileName,
|
|
38
|
+
content_type: R(e.fileName),
|
|
39
|
+
data: k(e.data)
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
function N(
|
|
43
|
+
function N(e) {
|
|
44
44
|
return {
|
|
45
|
-
title:
|
|
46
|
-
docinfo:
|
|
47
|
-
document_type:
|
|
48
|
-
divisions_attributes:
|
|
49
|
-
ref:
|
|
50
|
-
source:
|
|
51
|
-
source_format:
|
|
52
|
-
is_root:
|
|
45
|
+
title: e.title,
|
|
46
|
+
docinfo: e.docinfo,
|
|
47
|
+
document_type: e.documentKind,
|
|
48
|
+
divisions_attributes: e.divisions.map((t) => ({
|
|
49
|
+
ref: t.xmlId,
|
|
50
|
+
source: t.content,
|
|
51
|
+
source_format: t.sourceFormat,
|
|
52
|
+
is_root: t.isRoot
|
|
53
53
|
})),
|
|
54
|
-
assets_attributes:
|
|
54
|
+
assets_attributes: e.assets.map($)
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
const d = {
|
|
@@ -60,21 +60,21 @@ const d = {
|
|
|
60
60
|
projectFilePath: "project.ptx",
|
|
61
61
|
docinfoPath: "source/docinfo.ptx"
|
|
62
62
|
};
|
|
63
|
-
function
|
|
64
|
-
return g(
|
|
65
|
-
${
|
|
63
|
+
function b(e) {
|
|
64
|
+
return g(e, "pretext") ? e : `<pretext>
|
|
65
|
+
${e}
|
|
66
66
|
</pretext>`;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
return
|
|
68
|
+
function S(e, t, n) {
|
|
69
|
+
const a = /* @__PURE__ */ new Map(), s = [], o = `${t}-`;
|
|
70
|
+
return e.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 = C(l);
|
|
75
|
+
p = u.startsWith(o) ? u : `${o}${u}`;
|
|
76
76
|
} else
|
|
77
|
-
p = `${
|
|
77
|
+
p = `${o}${j(r + 1, e.length)}`, n.push({
|
|
78
78
|
action: "anomaly",
|
|
79
79
|
severity: "info",
|
|
80
80
|
kind: "structure",
|
|
@@ -83,34 +83,34 @@ function T(t, e, s) {
|
|
|
83
83
|
occurrences: 1,
|
|
84
84
|
message: `<${c.name}> at position ${r + 1} has no xml:id; using \`${p}\` as filename.`
|
|
85
85
|
});
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
86
|
+
const f = a.get(p) ?? 0;
|
|
87
|
+
a.set(p, f + 1);
|
|
88
|
+
const i = f === 0 ? p : `${p}-${f + 1}`;
|
|
89
|
+
s.push({
|
|
90
90
|
span: c,
|
|
91
|
-
slug:
|
|
92
|
-
filename: `${
|
|
91
|
+
slug: i,
|
|
92
|
+
filename: `${i}.ptx`
|
|
93
93
|
});
|
|
94
|
-
}),
|
|
94
|
+
}), s;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
99
|
-
return
|
|
100
|
-
const c =
|
|
101
|
-
const l = `source/${
|
|
102
|
-
return
|
|
96
|
+
function D(e, t, n, a) {
|
|
97
|
+
const s = h(e, "section");
|
|
98
|
+
if (s.length === 0)
|
|
99
|
+
return e;
|
|
100
|
+
const c = S(s, "sec", a).map((r) => {
|
|
101
|
+
const l = `source/${t}/${r.filename}`;
|
|
102
|
+
return n[l] = P(r.span.outer), {
|
|
103
103
|
start: r.span.start,
|
|
104
104
|
end: r.span.end,
|
|
105
|
-
replacement: `<xi:include href="${
|
|
105
|
+
replacement: `<xi:include href="${t}/${r.filename}"/>`
|
|
106
106
|
};
|
|
107
107
|
});
|
|
108
|
-
return
|
|
108
|
+
return x(e, c);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
113
|
-
return
|
|
110
|
+
function y(e, t, n) {
|
|
111
|
+
const a = g(e, "book");
|
|
112
|
+
if (!a)
|
|
113
|
+
return n.push({
|
|
114
114
|
action: "anomaly",
|
|
115
115
|
severity: "warning",
|
|
116
116
|
kind: "structure",
|
|
@@ -118,95 +118,117 @@ function D(t, e, s) {
|
|
|
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
|
|
123
|
-
let c =
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
let u =
|
|
127
|
-
if (
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
121
|
+
}), T(e, t);
|
|
122
|
+
const s = {}, o = h(a.inner, "chapter");
|
|
123
|
+
let c = a.inner;
|
|
124
|
+
if (t.splitChapters && o.length > 0) {
|
|
125
|
+
const f = S(o, "ch", n).map((i) => {
|
|
126
|
+
let u = i.span.outer;
|
|
127
|
+
if (t.splitSections) {
|
|
128
|
+
const F = i.span.inner, L = D(
|
|
129
|
+
F,
|
|
130
|
+
i.slug,
|
|
131
|
+
s,
|
|
132
|
+
n
|
|
133
133
|
);
|
|
134
|
-
u =
|
|
134
|
+
u = i.span.outer.slice(0, i.span.startTagEnd - i.span.start) + L + i.span.outer.slice(i.span.contentEnd - i.span.start);
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
return
|
|
138
|
-
start:
|
|
139
|
-
end:
|
|
140
|
-
replacement: `<xi:include href="${
|
|
136
|
+
const E = `source/${i.filename}`;
|
|
137
|
+
return s[E] = P(u), {
|
|
138
|
+
start: i.span.start,
|
|
139
|
+
end: i.span.end,
|
|
140
|
+
replacement: `<xi:include href="${i.filename}"/>`
|
|
141
141
|
};
|
|
142
142
|
});
|
|
143
|
-
c =
|
|
143
|
+
c = x(a.inner, f);
|
|
144
144
|
}
|
|
145
|
-
const r =
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
),
|
|
145
|
+
const r = e.slice(a.start, a.startTagEnd) + c + e.slice(a.contentEnd, a.end), l = e.slice(0, a.start) + r + e.slice(a.end);
|
|
146
|
+
return s[t.mainSourcePath] = P(
|
|
147
|
+
I(b(l.trim()))
|
|
148
|
+
), s;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
151
|
-
const
|
|
152
|
-
return
|
|
153
|
-
|
|
154
|
-
),
|
|
150
|
+
function T(e, t, n) {
|
|
151
|
+
const a = {};
|
|
152
|
+
return a[t.mainSourcePath] = P(
|
|
153
|
+
b(e.trim())
|
|
154
|
+
), a;
|
|
155
155
|
}
|
|
156
|
-
function O(
|
|
157
|
-
const
|
|
158
|
-
splitChapters:
|
|
159
|
-
splitSections:
|
|
160
|
-
mainSourcePath:
|
|
161
|
-
publicationPath:
|
|
162
|
-
projectFilePath:
|
|
163
|
-
docinfoPath:
|
|
164
|
-
},
|
|
165
|
-
return
|
|
166
|
-
mainSource:
|
|
167
|
-
publication:
|
|
168
|
-
}),
|
|
156
|
+
function O(e, t = {}) {
|
|
157
|
+
const n = [], a = t.documentKind ?? _(e), s = {
|
|
158
|
+
splitChapters: t.splitChapters ?? a === "book",
|
|
159
|
+
splitSections: t.splitSections ?? !1,
|
|
160
|
+
mainSourcePath: t.mainSourcePath ?? d.mainSourcePath,
|
|
161
|
+
publicationPath: t.publicationPath ?? d.publicationPath,
|
|
162
|
+
projectFilePath: t.projectFilePath ?? d.projectFilePath,
|
|
163
|
+
docinfoPath: t.docinfoPath ?? d.docinfoPath
|
|
164
|
+
}, o = a === "book" ? y(e, s, n) : T(e, s);
|
|
165
|
+
return o[s.projectFilePath] = v({
|
|
166
|
+
mainSource: s.mainSourcePath,
|
|
167
|
+
publication: s.publicationPath
|
|
168
|
+
}), o[s.publicationPath] = A(), { files: o, documentKind: a, warnings: n };
|
|
169
169
|
}
|
|
170
170
|
export {
|
|
171
|
-
B as
|
|
171
|
+
B as CLEAN_RULES,
|
|
172
|
+
X as LATEX_DIVISION_COMMANDS,
|
|
173
|
+
U as LATEX_FORMAT_MARKERS,
|
|
172
174
|
W as MARKDOWN_FORMAT_MARKERS,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
q as
|
|
178
|
-
J as
|
|
179
|
-
Q as
|
|
180
|
-
|
|
175
|
+
G as MAX_SUGGESTED_SPLIT_LEVEL,
|
|
176
|
+
H as PRETEXT_DIVISION_TAGS,
|
|
177
|
+
V as PRETEXT_ROOT_TAGS,
|
|
178
|
+
Y as analyzeImportSources,
|
|
179
|
+
q as applyLatexFixes,
|
|
180
|
+
J as assetsForImportMode,
|
|
181
|
+
Q as attachLatexRoots,
|
|
182
|
+
Z as attachMarkdownRoots,
|
|
183
|
+
ee as buildDivisionPool,
|
|
184
|
+
te as buildNativeDivisionPool,
|
|
181
185
|
O as buildPretextProjectFiles,
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
186
|
+
ae as carryOverProjectFiles,
|
|
187
|
+
se as cleanLatex,
|
|
188
|
+
ne as cleanLatexInChunks,
|
|
189
|
+
ie as cleanLatexText,
|
|
190
|
+
oe as convertLatexToPretext,
|
|
191
|
+
re as convertMarkdownToPretext,
|
|
192
|
+
ce as convertSourceToPretext,
|
|
193
|
+
le as defaultAttachLevel,
|
|
194
|
+
pe as defaultManifestTarget,
|
|
195
|
+
_ as detectDocumentKind,
|
|
196
|
+
ue as detectSourceFormat,
|
|
197
|
+
fe as diffHunks,
|
|
198
|
+
me as diffLines,
|
|
199
|
+
de as diffStats,
|
|
200
|
+
Pe as divisionChildRefs,
|
|
201
|
+
ge as divisionsAtLevel,
|
|
202
|
+
he as expandPretextIncludes,
|
|
203
|
+
xe as extractUpload,
|
|
204
|
+
be as fileChangesForImport,
|
|
205
|
+
Se as filePrefixForDivision,
|
|
206
|
+
Te as filesForImportMode,
|
|
207
|
+
Ee as findLatexFixes,
|
|
208
|
+
Fe as findLatexHeaders,
|
|
209
|
+
Le as findProjectManifest,
|
|
210
|
+
_e as fixesToWarnings,
|
|
211
|
+
ve as formatWarningLine,
|
|
212
|
+
Ae as getConversionErrorMessage,
|
|
213
|
+
Ie as getLatexCleanDiagnostics,
|
|
214
|
+
Ce as handleImportUploadFile,
|
|
215
|
+
je as importProjectFromFiles,
|
|
216
|
+
Me as isDivisionTag,
|
|
217
|
+
Re as latexDivisionHierarchy,
|
|
218
|
+
ke as latexFixesToCodeActions,
|
|
219
|
+
$e as mergeChunksAtLevel,
|
|
220
|
+
De as normalizePretextSource,
|
|
221
|
+
ye as parseLatexDivisions,
|
|
222
|
+
we as parseProjectManifest,
|
|
223
|
+
Ne as projectForImportMode,
|
|
224
|
+
Oe as relayoutImport,
|
|
205
225
|
v as renderProjectPtx,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
226
|
+
Ke as renderProjectPtxFromManifest,
|
|
227
|
+
A as renderPublicationPtx,
|
|
228
|
+
ze as resolveImportSplitLevel,
|
|
229
|
+
Be as resolveSplitLevel,
|
|
230
|
+
Xe as sanitizeRef,
|
|
231
|
+
Ue as serializeProjectToFiles,
|
|
232
|
+
N as serializeProjectToPlusPayload,
|
|
233
|
+
We as suggestSplitLevel
|
|
212
234
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LatexFix } from '@pretextbook/latex-style-pretext';
|
|
2
|
+
import { CleaningWarning } from './warnings';
|
|
3
|
+
export interface CleanedChunk {
|
|
4
|
+
/**
|
|
5
|
+
* Heading path from the document root — `["Limits", "One-sided limits"]`.
|
|
6
|
+
* Empty for the preamble and for body text ahead of the first heading.
|
|
7
|
+
*/
|
|
8
|
+
path: string[];
|
|
9
|
+
/** The chunk's own heading, or `""` when it has none. */
|
|
10
|
+
title: string;
|
|
11
|
+
/** `"preamble"`, a LaTeX sectioning command, or `null` for the lead-in text. */
|
|
12
|
+
kind: "preamble" | "lead" | "division";
|
|
13
|
+
/** Sectioning command that opened this chunk, when `kind` is `"division"`. */
|
|
14
|
+
command?: string;
|
|
15
|
+
/** Depth in the document's own hierarchy; 0 for preamble and lead-in. */
|
|
16
|
+
level: number;
|
|
17
|
+
before: string;
|
|
18
|
+
after: string;
|
|
19
|
+
fixes: LatexFix[];
|
|
20
|
+
}
|
|
21
|
+
export interface CleanLatexChunksResult {
|
|
22
|
+
/** The cleaned document, chunks rejoined in source order. */
|
|
23
|
+
output: string;
|
|
24
|
+
chunks: CleanedChunk[];
|
|
25
|
+
/** Aggregate over every chunk — the document-level summary. */
|
|
26
|
+
warnings: CleaningWarning[];
|
|
27
|
+
fixes: LatexFix[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Clean `source`, cutting it at every division header so each piece carries its
|
|
31
|
+
* own before/after text and fix list.
|
|
32
|
+
*
|
|
33
|
+
* Chunks are cut at the *deepest* level the document has, not at a requested
|
|
34
|
+
* split depth. A shallower view is a matter of concatenating consecutive chunks
|
|
35
|
+
* (`mergeChunksAtLevel`), which lets the wizard change split depth without
|
|
36
|
+
* re-cleaning or re-converting anything.
|
|
37
|
+
*/
|
|
38
|
+
export declare function cleanLatexInChunks(source: string): CleanLatexChunksResult;
|
|
39
|
+
/**
|
|
40
|
+
* Collapse chunks to the view a given split depth produces: one entry per file
|
|
41
|
+
* that depth would generate, with the chunks below it concatenated in.
|
|
42
|
+
*
|
|
43
|
+
* `level` 0 gives a single entry for the whole body; 1 one per top-level
|
|
44
|
+
* division; and so on. The preamble is always its own entry, since it never
|
|
45
|
+
* becomes a file of its own.
|
|
46
|
+
*/
|
|
47
|
+
export declare function mergeChunksAtLevel(chunks: CleanedChunk[], level: number): CleanedChunk[];
|
|
@@ -1,6 +1,40 @@
|
|
|
1
|
+
import { CleanScope, LatexFix } from '@pretextbook/latex-style-pretext';
|
|
1
2
|
import { CleaningWarning } from './warnings';
|
|
3
|
+
export interface CleanLatexOptions {
|
|
4
|
+
/**
|
|
5
|
+
* What the text is. Defaults to `"auto"`, which detects `\begin{document}`.
|
|
6
|
+
* Per-division cleaning (SPEC §3.8) passes `"body"`.
|
|
7
|
+
*/
|
|
8
|
+
scope?: CleanScope;
|
|
9
|
+
/** Rule ids to skip. */
|
|
10
|
+
disable?: string[];
|
|
11
|
+
}
|
|
2
12
|
export interface CleanLatexResult {
|
|
3
13
|
output: string;
|
|
14
|
+
/** Aggregate, one row per rule — what the wizard's summary list renders. */
|
|
4
15
|
warnings: CleaningWarning[];
|
|
16
|
+
/**
|
|
17
|
+
* Positioned fixes, in application order. The before/after diff and any
|
|
18
|
+
* per-file report read these; `warnings` is the rolled-up view of the same
|
|
19
|
+
* data.
|
|
20
|
+
*/
|
|
21
|
+
fixes: LatexFix[];
|
|
5
22
|
}
|
|
6
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Clean a piece of LaTeX: strip comments and trailing junk, then apply every
|
|
25
|
+
* cleaning rule to a fixpoint.
|
|
26
|
+
*
|
|
27
|
+
* `trimJunk` runs first and stays on this side of the boundary deliberately.
|
|
28
|
+
* Deleting every comment is right for an import (they are authoring notes about
|
|
29
|
+
* LaTeX, not content) but wrong for an editor, where the author is looking at
|
|
30
|
+
* their own comments and would not expect a cleanup to eat them.
|
|
31
|
+
*/
|
|
32
|
+
export declare function cleanLatex(source: string, options?: CleanLatexOptions): CleanLatexResult;
|
|
33
|
+
/**
|
|
34
|
+
* Roll positioned fixes up into one `CleaningWarning` per rule.
|
|
35
|
+
*
|
|
36
|
+
* A rule with `reportMatch` emits two rows, matching what the cleaner has always
|
|
37
|
+
* produced: a `save` carrying the matched text (so the author can reconstruct
|
|
38
|
+
* what a `\def` meant) and a `delete` recording that it went away.
|
|
39
|
+
*/
|
|
40
|
+
export declare function fixesToWarnings(fixes: LatexFix[]): CleaningWarning[];
|
package/dist/lib/convert.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CleanedChunk } from './clean/clean-chunks';
|
|
1
2
|
import { CleaningWarning } from './clean/warnings';
|
|
2
3
|
import { ConvertedPretextResult, SourceFormat } from './types';
|
|
3
4
|
export declare function normalizePretextSource(pretextSource: string): string;
|
|
@@ -5,6 +6,12 @@ export interface LatexConversionResult {
|
|
|
5
6
|
pretext: string;
|
|
6
7
|
cleanedLatex: string;
|
|
7
8
|
warnings: CleaningWarning[];
|
|
9
|
+
/**
|
|
10
|
+
* The cleaned source cut at its division headers, each piece carrying its own
|
|
11
|
+
* before/after text. The wizard's per-file diff reads these; see
|
|
12
|
+
* `clean-chunks.ts` for why cleaning is partitioned rather than global.
|
|
13
|
+
*/
|
|
14
|
+
cleanChunks: CleanedChunk[];
|
|
8
15
|
}
|
|
9
16
|
export declare function convertLatexToPretext(latexSource: string): LatexConversionResult;
|
|
10
17
|
export interface MarkdownConversionResult {
|