@pretextbook/import 0.2.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/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 e=require("./import-mode-CSZlmUxw.cjs");function x(){const t=globalThis.crypto;return t?.randomUUID?t.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,n=>{const a=Math.random()*16|0;return(n==="x"?a:a&3|8).toString(16)})}function R(t){return{title:t.title,docinfo:t.docinfo,documentType:t.documentKind,divisions:t.divisions.map(n=>({id:x(),ref:n.xmlId,source:n.content,sourceFormat:n.sourceFormat,isRoot:n.isRoot})),assets:t.assets.map(n=>({id:x(),ref:n.ref,kind:"file",fileName:n.fileName,data:n.data}))}}const P={mainSourcePath:"source/main.ptx",publicationPath:"publication/publication.ptx",projectFilePath:"project.ptx",docinfoPath:"source/docinfo.ptx"};function f(t){return e.findAnyElement(t,"pretext")?t:`<pretext>
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
2
  ${t}
3
- </pretext>`}function h(t,n,a){const o=new Map,i=[],s=`${n}-`;return t.forEach((l,c)=>{const d=l.attributes["xml:id"];let u;if(d){const m=e.slugify(d);u=m.startsWith(s)?m:`${s}${m}`}else u=`${s}${e.padIndex(c+1,t.length)}`,a.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 \`${u}\` as filename.`});const p=o.get(u)??0;o.set(u,p+1);const r=p===0?u:`${u}-${p+1}`;i.push({span:l,slug:r,filename:`${r}.ptx`})}),i}function M(t,n,a,o){const i=e.findTopLevelElements(t,"section");if(i.length===0)return t;const l=h(i,"sec",o).map(c=>{const d=`source/${n}/${c.filename}`;return a[d]=e.withProlog(c.span.outer),{start:c.span.start,end:c.span.end,replacement:`<xi:include href="${n}/${c.filename}"/>`}});return e.spliceReplacements(t,l)}function S(t,n,a){const o=e.findAnyElement(t,"book");if(!o)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."}),g(t,n);const i={},s=e.findTopLevelElements(o.inner,"chapter");let l=o.inner;if(n.splitChapters&&s.length>0){const p=h(s,"ch",a).map(r=>{let m=r.span.outer;if(n.splitSections){const F=r.span.inner,T=M(F,r.slug,i,a);m=r.span.outer.slice(0,r.span.startTagEnd-r.span.start)+T+r.span.outer.slice(r.span.contentEnd-r.span.start)}const b=`source/${r.filename}`;return i[b]=e.withProlog(m),{start:r.span.start,end:r.span.end,replacement:`<xi:include href="${r.filename}"/>`}});l=e.spliceReplacements(o.inner,p)}const c=t.slice(o.start,o.startTagEnd)+l+t.slice(o.contentEnd,o.end),d=t.slice(0,o.start)+c+t.slice(o.end);return i[n.mainSourcePath]=e.withProlog(e.ensureXIncludeNamespace(f(d.trim()))),i}function g(t,n,a){const o={};return o[n.mainSourcePath]=e.withProlog(f(t.trim())),o}function v(t,n={}){const a=[],o=n.documentKind??e.detectDocumentKind(t),i={splitChapters:n.splitChapters??o==="book",splitSections:n.splitSections??!1,mainSourcePath:n.mainSourcePath??P.mainSourcePath,publicationPath:n.publicationPath??P.publicationPath,projectFilePath:n.projectFilePath??P.projectFilePath,docinfoPath:n.docinfoPath??P.docinfoPath},s=o==="book"?S(t,i,a):g(t,i);return s[i.projectFilePath]=e.renderProjectPtx({mainSource:i.mainSourcePath,publication:i.publicationPath}),s[i.publicationPath]=e.renderPublicationPtx(),{files:s,documentKind:o,warnings:a}}exports.LATEX_FORMAT_MARKERS=e.LATEX_FORMAT_MARKERS;exports.MARKDOWN_FORMAT_MARKERS=e.MARKDOWN_FORMAT_MARKERS;exports.assetsForImportMode=e.assetsForImportMode;exports.buildDivisionPool=e.buildDivisionPool;exports.cleanLatex=e.cleanLatex;exports.convertLatexToPretext=e.convertLatexToPretext;exports.convertMarkdownToPretext=e.convertMarkdownToPretext;exports.convertSourceToPretext=e.convertSourceToPretext;exports.detectDocumentKind=e.detectDocumentKind;exports.detectSourceFormat=e.detectSourceFormat;exports.divisionChildRefs=e.divisionChildRefs;exports.expandPretextIncludes=e.expandPretextIncludes;exports.filesForImportMode=e.filesForImportMode;exports.formatWarningLine=e.formatWarningLine;exports.getConversionErrorMessage=e.getConversionErrorMessage;exports.handleImportUploadFile=e.handleImportUploadFile;exports.importProjectFromFiles=e.importProjectFromFiles;exports.normalizePretextSource=e.normalizePretextSource;exports.renderProjectPtx=e.renderProjectPtx;exports.renderPublicationPtx=e.renderPublicationPtx;exports.sanitizeRef=e.sanitizeRef;exports.serializeProjectToFiles=e.serializeProjectToFiles;exports.buildPretextProjectFiles=v;exports.serializeProjectToPlusPayload=R;
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,14 +1,19 @@
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';
5
- export { filesForImportMode, assetsForImportMode, formatWarningLine, type ImportMode, } from './lib/import-mode';
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';
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';
8
13
  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, sanitizeRef, serializeProjectToFiles, serializeProjectToPlusPayload, divisionChildRefs, } from './lib/pool';
13
- export type { BuildDivisionPoolOptions, BuildDivisionPoolResult, SerializeProjectFilesOptions, SerializedProjectFiles, } from './lib/pool';
14
- export type { SourceFormat, ConversionContext, ConvertedPretextResult, UploadStatusType, UploadStatusMessage, UploadSourceType, ImportedProject, ImportedDivision, ImportedDivisionType, ImportedAsset, PlusProjectPayload, PlusDivisionRecord, PlusAssetRecord, ImportedProjectResult, ImportedProjectSuccess, ImportedProjectError, } from './lib/types';
17
+ export { buildDivisionPool, resolveSplitLevel, buildNativeDivisionPool, sanitizeRef, serializeProjectToFiles, serializeProjectToPlusPayload, divisionChildRefs, } from './lib/pool';
18
+ export type { BuildDivisionPoolOptions, BuildDivisionPoolResult, BuildNativeDivisionPoolOptions, SerializeProjectFilesOptions, SerializedProjectFiles, } from './lib/pool';
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,65 +1,91 @@
1
- import { d as T, r as E, a as R, f as P, b as h, w as f, s as g, e as v, c as M, p as j } from "./import-mode-BDY8WcYJ.js";
2
- import { L, M as U, g as z, h as O, i as N, j as W, k as B, l as X, m as q, n as G, o as H, q as J, t as Q, u as V, v as Y, x as Z, y as tt, z as et, A as nt } from "./import-mode-BDY8WcYJ.js";
3
- function x() {
4
- const t = globalThis.crypto;
5
- return t?.randomUUID ? t.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => {
6
- const s = Math.random() * 16 | 0;
7
- return (e === "x" ? s : s & 3 | 8).toString(16);
8
- });
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
+ png: "image/png",
5
+ jpg: "image/jpeg",
6
+ jpeg: "image/jpeg",
7
+ gif: "image/gif",
8
+ pdf: "application/pdf",
9
+ eps: "application/postscript",
10
+ ps: "application/postscript",
11
+ bmp: "image/bmp",
12
+ tiff: "image/tiff",
13
+ tif: "image/tiff",
14
+ webp: "image/webp",
15
+ ico: "image/vnd.microsoft.icon"
16
+ };
17
+ function I(t) {
18
+ const e = t.split(".").pop()?.toLowerCase() ?? "";
19
+ return k[e] ?? "application/octet-stream";
20
+ }
21
+ const f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
22
+ function w(t) {
23
+ const e = t.length, s = [];
24
+ for (let n = 0; n < e; n += 3) {
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
+ }
28
+ return s.join("");
9
29
  }
10
30
  function C(t) {
31
+ return {
32
+ ref: t.ref,
33
+ kind: "file",
34
+ title: t.fileName,
35
+ short_description: t.fileName,
36
+ file: {
37
+ filename: t.fileName,
38
+ content_type: I(t.fileName),
39
+ data: w(t.data)
40
+ }
41
+ };
42
+ }
43
+ function N(t) {
11
44
  return {
12
45
  title: t.title,
13
46
  docinfo: t.docinfo,
14
- documentType: t.documentKind,
15
- divisions: t.divisions.map((e) => ({
16
- id: x(),
47
+ document_type: t.documentKind,
48
+ divisions_attributes: t.divisions.map((e) => ({
17
49
  ref: e.xmlId,
18
50
  source: e.content,
19
- sourceFormat: e.sourceFormat,
20
- isRoot: e.isRoot
51
+ source_format: e.sourceFormat,
52
+ is_root: e.isRoot
21
53
  })),
22
- assets: t.assets.map((e) => ({
23
- id: x(),
24
- ref: e.ref,
25
- kind: "file",
26
- fileName: e.fileName,
27
- data: e.data
28
- }))
54
+ assets_attributes: t.assets.map(C)
29
55
  };
30
56
  }
31
- const p = {
57
+ const d = {
32
58
  mainSourcePath: "source/main.ptx",
33
59
  publicationPath: "publication/publication.ptx",
34
60
  projectFilePath: "project.ptx",
35
61
  docinfoPath: "source/docinfo.ptx"
36
62
  };
37
- function b(t) {
38
- return P(t, "pretext") ? t : `<pretext>
63
+ function x(t) {
64
+ return g(t, "pretext") ? t : `<pretext>
39
65
  ${t}
40
66
  </pretext>`;
41
67
  }
42
- function F(t, e, s) {
68
+ function T(t, e, s) {
43
69
  const n = /* @__PURE__ */ new Map(), a = [], i = `${e}-`;
44
70
  return t.forEach((c, r) => {
45
- const u = c.attributes["xml:id"];
46
- let l;
47
- if (u) {
48
- const m = M(u);
49
- l = m.startsWith(i) ? m : `${i}${m}`;
71
+ const l = c.attributes["xml:id"];
72
+ let p;
73
+ if (l) {
74
+ const u = M(l);
75
+ p = u.startsWith(i) ? u : `${i}${u}`;
50
76
  } else
51
- l = `${i}${j(r + 1, t.length)}`, s.push({
77
+ p = `${i}${$(r + 1, t.length)}`, s.push({
52
78
  action: "anomaly",
53
79
  severity: "info",
54
80
  kind: "structure",
55
81
  category: "missing_xml_id",
56
82
  macro: c.name,
57
83
  occurrences: 1,
58
- message: `<${c.name}> at position ${r + 1} has no xml:id; using \`${l}\` as filename.`
84
+ message: `<${c.name}> at position ${r + 1} has no xml:id; using \`${p}\` as filename.`
59
85
  });
60
- const d = n.get(l) ?? 0;
61
- n.set(l, d + 1);
62
- const o = d === 0 ? l : `${l}-${d + 1}`;
86
+ const m = n.get(p) ?? 0;
87
+ n.set(p, m + 1);
88
+ const o = m === 0 ? p : `${p}-${m + 1}`;
63
89
  a.push({
64
90
  span: c,
65
91
  slug: o,
@@ -67,22 +93,22 @@ function F(t, e, s) {
67
93
  });
68
94
  }), a;
69
95
  }
70
- function I(t, e, s, n) {
96
+ function y(t, e, s, n) {
71
97
  const a = h(t, "section");
72
98
  if (a.length === 0)
73
99
  return t;
74
- const c = F(a, "sec", n).map((r) => {
75
- const u = `source/${e}/${r.filename}`;
76
- return s[u] = f(r.span.outer), {
100
+ const c = T(a, "sec", n).map((r) => {
101
+ const l = `source/${e}/${r.filename}`;
102
+ return s[l] = P(r.span.outer), {
77
103
  start: r.span.start,
78
104
  end: r.span.end,
79
105
  replacement: `<xi:include href="${e}/${r.filename}"/>`
80
106
  };
81
107
  });
82
- return g(t, c);
108
+ return b(t, c);
83
109
  }
84
- function w(t, e, s) {
85
- const n = P(t, "book");
110
+ function D(t, e, s) {
111
+ const n = g(t, "book");
86
112
  if (!n)
87
113
  return s.push({
88
114
  action: "anomaly",
@@ -92,78 +118,95 @@ function w(t, e, s) {
92
118
  macro: "book",
93
119
  occurrences: 1,
94
120
  message: "Document was treated as a book but no <book> element found; emitting as a single file."
95
- }), $(t, e);
121
+ }), F(t, e);
96
122
  const a = {}, i = h(n.inner, "chapter");
97
123
  let c = n.inner;
98
124
  if (e.splitChapters && i.length > 0) {
99
- const d = F(i, "ch", s).map((o) => {
100
- let m = o.span.outer;
125
+ const m = T(i, "ch", s).map((o) => {
126
+ let u = o.span.outer;
101
127
  if (e.splitSections) {
102
- const y = o.span.inner, S = I(
103
- y,
128
+ const E = o.span.inner, _ = y(
129
+ E,
104
130
  o.slug,
105
131
  a,
106
132
  s
107
133
  );
108
- m = o.span.outer.slice(0, o.span.startTagEnd - o.span.start) + S + o.span.outer.slice(o.span.contentEnd - o.span.start);
134
+ u = o.span.outer.slice(0, o.span.startTagEnd - o.span.start) + _ + o.span.outer.slice(o.span.contentEnd - o.span.start);
109
135
  }
110
- const k = `source/${o.filename}`;
111
- return a[k] = f(m), {
136
+ const S = `source/${o.filename}`;
137
+ return a[S] = P(u), {
112
138
  start: o.span.start,
113
139
  end: o.span.end,
114
140
  replacement: `<xi:include href="${o.filename}"/>`
115
141
  };
116
142
  });
117
- c = g(n.inner, d);
143
+ c = b(n.inner, m);
118
144
  }
119
- const r = t.slice(n.start, n.startTagEnd) + c + t.slice(n.contentEnd, n.end), u = t.slice(0, n.start) + r + t.slice(n.end);
120
- return a[e.mainSourcePath] = f(
121
- v(b(u.trim()))
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 a[e.mainSourcePath] = P(
147
+ A(x(l.trim()))
122
148
  ), a;
123
149
  }
124
- function $(t, e, s) {
150
+ function F(t, e, s) {
125
151
  const n = {};
126
- return n[e.mainSourcePath] = f(
127
- b(t.trim())
152
+ return n[e.mainSourcePath] = P(
153
+ x(t.trim())
128
154
  ), n;
129
155
  }
130
- function D(t, e = {}) {
131
- const s = [], n = e.documentKind ?? T(t), a = {
156
+ function O(t, e = {}) {
157
+ const s = [], n = e.documentKind ?? j(t), a = {
132
158
  splitChapters: e.splitChapters ?? n === "book",
133
159
  splitSections: e.splitSections ?? !1,
134
- mainSourcePath: e.mainSourcePath ?? p.mainSourcePath,
135
- publicationPath: e.publicationPath ?? p.publicationPath,
136
- projectFilePath: e.projectFilePath ?? p.projectFilePath,
137
- docinfoPath: e.docinfoPath ?? p.docinfoPath
138
- }, i = n === "book" ? w(t, a, s) : $(t, a);
139
- return i[a.projectFilePath] = E({
160
+ mainSourcePath: e.mainSourcePath ?? d.mainSourcePath,
161
+ publicationPath: e.publicationPath ?? d.publicationPath,
162
+ projectFilePath: e.projectFilePath ?? d.projectFilePath,
163
+ docinfoPath: e.docinfoPath ?? d.docinfoPath
164
+ }, i = n === "book" ? D(t, a, s) : F(t, a);
165
+ return i[a.projectFilePath] = v({
140
166
  mainSource: a.mainSourcePath,
141
167
  publication: a.publicationPath
142
168
  }), i[a.publicationPath] = R(), { files: i, documentKind: n, warnings: s };
143
169
  }
144
170
  export {
145
- L as LATEX_FORMAT_MARKERS,
146
- U as MARKDOWN_FORMAT_MARKERS,
147
- z as assetsForImportMode,
148
- O as buildDivisionPool,
149
- D as buildPretextProjectFiles,
150
- N as cleanLatex,
151
- W as convertLatexToPretext,
152
- B as convertMarkdownToPretext,
153
- X as convertSourceToPretext,
154
- T as detectDocumentKind,
155
- q as detectSourceFormat,
156
- G as divisionChildRefs,
157
- H as expandPretextIncludes,
158
- J as filesForImportMode,
159
- Q as formatWarningLine,
160
- V as getConversionErrorMessage,
161
- Y as handleImportUploadFile,
162
- Z as importProjectFromFiles,
163
- tt as normalizePretextSource,
164
- E as renderProjectPtx,
171
+ B as LATEX_FORMAT_MARKERS,
172
+ W as MARKDOWN_FORMAT_MARKERS,
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,
165
207
  R as renderPublicationPtx,
166
- et as sanitizeRef,
167
- nt as serializeProjectToFiles,
168
- C as serializeProjectToPlusPayload
208
+ Ft as resolveSplitLevel,
209
+ St as sanitizeRef,
210
+ Et as serializeProjectToFiles,
211
+ N as serializeProjectToPlusPayload
169
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;
@@ -1,7 +1,15 @@
1
1
  import { CleaningWarning } from './clean/warnings';
2
- import { ImportedProjectSuccess } from './types';
2
+ import { ImportedProject, ImportedProjectSuccess } from './types';
3
3
  /** Which of the result's alternatives the user chose to import. */
4
4
  export type ImportMode = "converted" | "native";
5
+ /**
6
+ * The division pool the pretext-plus host should serialize for the chosen
7
+ * mode: the native (LaTeX/Markdown) pool when the user keeps the source
8
+ * format, otherwise the converted PreTeXt pool. Falls back to the converted
9
+ * pool when there is no native projection (e.g. PreTeXt input, or an import
10
+ * that produced no native source).
11
+ */
12
+ export declare function projectForImportMode(result: ImportedProjectSuccess, mode: ImportMode): ImportedProject;
5
13
  /** The text files a host should write for the chosen mode. */
6
14
  export declare function filesForImportMode(result: ImportedProjectSuccess, mode: ImportMode): Record<string, string>;
7
15
  /** The binary assets a host should write for the chosen mode. */
@@ -7,6 +7,10 @@ export declare function spliceReplacements(source: string, replacements: Array<{
7
7
  end: number;
8
8
  replacement: string;
9
9
  }>): string;
10
- /** Add `xmlns:xi` to the first root-like element that lacks it. */
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;
@@ -1,32 +1,41 @@
1
1
  import { CleaningWarning } from '../clean/warnings';
2
2
  import { DocumentKind } from '../layout/document-kind';
3
3
  import { ImportedProject } from '../types';
4
+ export { sanitizeRef } from './refs';
4
5
  export interface BuildDivisionPoolOptions {
5
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;
6
14
  splitChapters?: boolean;
7
15
  splitSections?: boolean;
8
16
  /** Binary assets keyed by their original (input) path. */
9
17
  assets?: Record<string, Uint8Array>;
10
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;
11
26
  export interface BuildDivisionPoolResult {
12
27
  project: ImportedProject;
13
28
  warnings: CleaningWarning[];
14
29
  }
15
- /**
16
- * Coerce a string into a REF_REGEX-safe ref: invalid characters collapse to
17
- * `-`, leading characters that can't start a ref are stripped. Returns `""`
18
- * when nothing valid remains.
19
- */
20
- export declare function sanitizeRef(raw: string): string;
21
30
  /**
22
31
  * Parse a converted PreTeXt document
23
32
  * (`<pretext><docinfo>…</docinfo><book|article>…`) into the division pool.
24
33
  *
25
34
  * - `docinfo` and the document `<title>` become project-level fields (the
26
35
  * plus data model); the file-tree serializer re-inlines them.
27
- * - With `splitChapters` (default for books), each `<chapter>` becomes its
28
- * own division, replaced in the root by `<plus:chapter ref="…"/>`;
29
- * `splitSections` does the same for `<section>`s within each chapter.
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.
30
39
  * - Every division's wrapper element carries `xml:id` equal to its ref;
31
40
  * missing ids are generated (`ch-01`, …), invalid/duplicate ids are
32
41
  * sanitized with a warning.
@@ -1,3 +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
+ export { buildNativeDivisionPool, type BuildNativeDivisionPoolOptions, } from './native-pool';
2
3
  export { serializeProjectToFiles, divisionChildRefs, type SerializeProjectFilesOptions, type SerializedProjectFiles, } from './serialize-files';
3
4
  export { serializeProjectToPlusPayload } from './serialize-plus';
@@ -0,0 +1,20 @@
1
+ import { DocumentKind } from '../layout/document-kind';
2
+ import { BuildDivisionPoolResult } from './division-pool';
3
+ export interface BuildNativeDivisionPoolOptions {
4
+ documentKind?: DocumentKind;
5
+ splitChapters?: boolean;
6
+ splitSections?: boolean;
7
+ /** Project title, hoisted from the converted PreTeXt pool. */
8
+ title?: string;
9
+ /** Project `<docinfo>`, hoisted from the converted PreTeXt pool. */
10
+ docinfo?: string;
11
+ /** Binary assets keyed by their original (input) path. */
12
+ assets?: Record<string, Uint8Array>;
13
+ }
14
+ /**
15
+ * Build a native (LaTeX/Markdown) division pool from cleaned native source.
16
+ * The result has the same shape as `buildDivisionPool`, so the same
17
+ * serializers consume it — `serializeProjectToPlusPayload` in particular emits
18
+ * `source_format: "latex" | "markdown"` divisions unchanged.
19
+ */
20
+ export declare function buildNativeDivisionPool(nativeSource: string, format: "latex" | "markdown", options?: BuildNativeDivisionPoolOptions): BuildDivisionPoolResult;
@@ -0,0 +1,39 @@
1
+ import { CleaningWarning } from '../clean/warnings';
2
+ import { ImportedAsset } from '../types';
3
+ /**
4
+ * Coerce a string into a REF_REGEX-safe ref: invalid characters collapse to
5
+ * `-`, leading characters that can't start a ref are stripped. Returns `""`
6
+ * when nothing valid remains.
7
+ */
8
+ export declare function sanitizeRef(raw: string): string;
9
+ /** Hands out refs, deduplicating with `-2`, `-3`, … suffixes. */
10
+ export declare class RefPool {
11
+ private used;
12
+ claim(preferred: string): string;
13
+ has(ref: string): boolean;
14
+ }
15
+ export interface ClaimRefResult {
16
+ ref: string;
17
+ renamedFrom?: string;
18
+ generated: boolean;
19
+ }
20
+ /**
21
+ * Decide a division's ref from a raw id (an `xml:id`, a `\label`, or nothing):
22
+ * the existing id when REF_REGEX-safe and unused, a sanitized/deduplicated
23
+ * variant when not (reported as a rename), or a generated `fallback` when
24
+ * there was no id at all.
25
+ */
26
+ export declare function claimRefFromId(rawId: string | undefined, refs: RefPool, fallback: string): ClaimRefResult;
27
+ /**
28
+ * Record the structural warning implied by a ref claim: a rename when the
29
+ * original id was invalid or collided, an info note when an id was generated.
30
+ * `elementName` is the division's type (e.g. `chapter`); `position` is its
31
+ * 1-based index among its siblings, for the generated-id message.
32
+ */
33
+ export declare function pushRefWarnings(warnings: CleaningWarning[], claim: ClaimRefResult, elementName: string, position: number): void;
34
+ /**
35
+ * Turn a map of raw asset bytes (keyed by original input path) into
36
+ * `ImportedAsset` records, minting a ref from each basename's stem and
37
+ * deduplicating against everything already claimed (divisions included).
38
+ */
39
+ export declare function buildAssets(rawAssets: Record<string, Uint8Array>, refs: RefPool): ImportedAsset[];
@@ -1,10 +1,5 @@
1
1
  import { ImportedProject, PlusProjectPayload } from '../types';
2
2
  /**
3
- * Serialize the division pool to a pretext-plus project payload.
4
- *
5
- * The host page maps this onto the Rails endpoints (snake_case
6
- * `divisions_attributes` / `assets_attributes`, multipart for asset bytes);
7
- * note that `docinfo` currently requires a follow-up PATCH after create —
8
- * see SPEC §4.3 for the endpoint mapping and known gaps.
3
+ * Serialize the division pool to a pretext-plus import payload.
9
4
  */
10
5
  export declare function serializeProjectToPlusPayload(project: ImportedProject): PlusProjectPayload;