overtype 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * OverType v2.0.3
2
+ * OverType v2.0.5
3
3
  * A lightweight markdown editor library with perfect WYSIWYG alignment
4
4
  * @license MIT
5
5
  * @author David Miranda
@@ -33,7 +33,7 @@ ${a}`:r;if(d){let L=o.value[o.selectionStart-1];o.selectionStart!==0&&L!=null&&!
33
33
  `)+u;return t?(n=Math.max(n+_(0,e.unorderedList).length+h.length,0),i=n):a.processed?(n=Math.max(o.selectionStart+h.length,0),i=o.selectionEnd+h.length+l-c):(n=Math.max(o.selectionStart+h.length,0),i=o.selectionEnd+h.length+l),{text:f,selectionStart:n,selectionEnd:i}}function he(o,e){let t=R(o,n=>Qe(n,e),{adjustSelection:(n,i,r,s)=>{let a=o.value.slice(s,o.selectionEnd),p=/^\d+\.\s+/,d=/^- /,l=p.test(a),c=d.test(a),h=e.orderedList&&l||e.unorderedList&&c;if(i===r)if(h){let u=a.match(e.orderedList?p:d),f=u?u[0].length:0;return{start:Math.max(i-f,s),end:Math.max(i-f,s)}}else if(l||c){let u=a.match(l?p:d),f=u?u[0].length:0,g=(e.unorderedList?2:3)-f;return{start:i+g,end:i+g}}else{let u=e.unorderedList?2:3;return{start:i+u,end:i+u}}else if(h){let u=a.match(e.orderedList?p:d),f=u?u[0].length:0;return{start:Math.max(i-f,s),end:Math.max(r-f,s)}}else if(l||c){let u=a.match(l?p:d),f=u?u[0].length:0,g=(e.unorderedList?2:3)-f;return{start:i+g,end:r+g}}else{let u=e.unorderedList?2:3;return{start:i+u,end:r+u}}}});I(o,t)}function Xe(o){if(!o)return[];let e=[],{selectionStart:t,selectionEnd:n,value:i}=o,r=i.split(`
34
34
  `),s=0,a="";for(let c of r){if(t>=s&&t<=s+c.length){a=c;break}s+=c.length+1}a.startsWith("- ")&&(a.startsWith("- [ ] ")||a.startsWith("- [x] ")?e.push("task-list"):e.push("bullet-list")),/^\d+\.\s/.test(a)&&e.push("numbered-list"),a.startsWith("> ")&&e.push("quote"),a.startsWith("# ")&&e.push("header"),a.startsWith("## ")&&e.push("header-2"),a.startsWith("### ")&&e.push("header-3");let p=Math.max(0,t-10),d=Math.min(i.length,n+10),l=i.slice(p,d);if(l.includes("**")){let c=i.slice(Math.max(0,t-100),t),h=i.slice(n,Math.min(i.length,n+100)),u=c.lastIndexOf("**"),f=h.indexOf("**");u!==-1&&f!==-1&&e.push("bold")}if(l.includes("_")){let c=i.slice(Math.max(0,t-100),t),h=i.slice(n,Math.min(i.length,n+100)),u=c.lastIndexOf("_"),f=h.indexOf("_");u!==-1&&f!==-1&&e.push("italic")}if(l.includes("`")){let c=i.slice(Math.max(0,t-100),t),h=i.slice(n,Math.min(i.length,n+100));c.includes("`")&&h.includes("`")&&e.push("code")}if(l.includes("[")&&l.includes("]")){let c=i.slice(Math.max(0,t-100),t),h=i.slice(n,Math.min(i.length,n+100)),u=c.lastIndexOf("["),f=h.indexOf("]");u!==-1&&f!==-1&&i.slice(n+f+1,n+f+10).startsWith("(")&&e.push("link")}return e}function U(o){if(!o||o.disabled||o.readOnly)return;y("toggleBold","Starting"),z(o,"Before");let e=$(E.bold),t=V(o,e);ce(t),I(o,t),z(o,"After")}function D(o){if(!o||o.disabled||o.readOnly)return;let e=$(E.italic),t=V(o,e);I(o,t)}function ue(o){if(!o||o.disabled||o.readOnly)return;let e=$(E.code),t=V(o,e);I(o,t)}function q(o,e={}){if(!o||o.disabled||o.readOnly)return;let t=o.value.slice(o.selectionStart,o.selectionEnd),n=$(E.link);if(t&&t.match(/^https?:\/\//)&&!e.url?(n.suffix=`](${t})`,n.replaceNext=""):e.url&&(n.suffix=`](${e.url})`,n.replaceNext=""),e.text&&!t){let s=o.selectionStart;o.value=o.value.slice(0,s)+e.text+o.value.slice(s),o.selectionStart=s,o.selectionEnd=s+e.text.length}let r=V(o,n);I(o,r)}function W(o){if(!o||o.disabled||o.readOnly)return;let e=$(E.bulletList);he(o,e)}function K(o){if(!o||o.disabled||o.readOnly)return;let e=$(E.numberedList);he(o,e)}function me(o){if(!o||o.disabled||o.readOnly)return;y("toggleQuote","Starting"),z(o,"Initial");let e=$(E.quote),t=R(o,n=>de(n,e),{prefix:e.prefix});ce(t),I(o,t),z(o,"Final")}function X(o){if(!o||o.disabled||o.readOnly)return;let e=$(E.taskList),t=R(o,n=>de(n,e),{prefix:e.prefix});I(o,t)}function Y(o,e=1,t=!1){if(!o||o.disabled||o.readOnly)return;(e<1||e>6)&&(e=1),y("insertHeader","============ START ============"),y("insertHeader",`Level: ${e}, Toggle: ${t}`),y("insertHeader",`Initial cursor: ${o.selectionStart}-${o.selectionEnd}`);let n=`header${e===1?"1":e}`,i=$(E[n]||E.header1);y("insertHeader",`Style prefix: "${i.prefix}"`);let r=o.value,s=o.selectionStart,a=o.selectionEnd,p=s;for(;p>0&&r[p-1]!==`
35
35
  `;)p--;let d=a;for(;d<r.length&&r[d]!==`
36
- `;)d++;let l=r.slice(p,d);y("insertHeader",`Current line (before): "${l}"`);let c=l.match(/^(#{1,6})\s*/),h=c?c[1].length:0,u=c?c[0].length:0;y("insertHeader","Existing header check:"),y("insertHeader",` - Match: ${c?`"${c[0]}"`:"none"}`),y("insertHeader",` - Existing level: ${h}`),y("insertHeader",` - Existing prefix length: ${u}`),y("insertHeader",` - Target level: ${e}`);let f=t&&h===e;y("insertHeader",`Should toggle OFF: ${f} (toggle=${t}, existingLevel=${h}, level=${e})`);let m=R(o,g=>{let v=g.value.slice(g.selectionStart,g.selectionEnd);y("insertHeader",`Line in operation: "${v}"`);let b=v.replace(/^#{1,6}\s*/,"");y("insertHeader",`Cleaned line: "${b}"`);let k;return f?(y("insertHeader","ACTION: Toggling OFF - removing header"),k=b):h>0?(y("insertHeader",`ACTION: Replacing H${h} with H${e}`),k=i.prefix+b):(y("insertHeader","ACTION: Adding new header"),k=i.prefix+b),y("insertHeader",`New line: "${k}"`),{text:k,selectionStart:g.selectionStart,selectionEnd:g.selectionEnd}},{prefix:i.prefix,adjustSelection:(g,v,b,k)=>{if(y("insertHeader","Adjusting selection:"),y("insertHeader",` - isRemoving param: ${g}`),y("insertHeader",` - shouldToggleOff: ${f}`),y("insertHeader",` - selStart: ${v}, selEnd: ${b}`),y("insertHeader",` - lineStartPos: ${k}`),f){let M=Math.max(v-u,k);return y("insertHeader",` - Removing header, adjusting by -${u}`),{start:M,end:v===b?M:Math.max(b-u,k)}}else if(u>0){let M=i.prefix.length-u;return y("insertHeader",` - Replacing header, adjusting by ${M}`),{start:v+M,end:b+M}}else return y("insertHeader",` - Adding header, adjusting by +${i.prefix.length}`),{start:v+i.prefix.length,end:b+i.prefix.length}}});y("insertHeader",`Final result: text="${m.text}", cursor=${m.selectionStart}-${m.selectionEnd}`),y("insertHeader","============ END ============"),I(o,m)}function fe(o){Y(o,1,!0)}function ge(o){Y(o,2,!0)}function ve(o){Y(o,3,!0)}function ye(o){return Xe(o)}var O=class{constructor(e){this.editor=e,this.textarea=e.textarea}handleKeydown(e){if(!(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey))return!1;let i=null;switch(e.key.toLowerCase()){case"b":e.shiftKey||(i="toggleBold");break;case"i":e.shiftKey||(i="toggleItalic");break;case"k":e.shiftKey||(i="insertLink");break;case"7":e.shiftKey&&(i="toggleNumberedList");break;case"8":e.shiftKey&&(i="toggleBulletList");break}return i?(e.preventDefault(),this.editor.toolbar?this.editor.toolbar.handleAction(i):this.handleAction(i),!0):!1}async handleAction(e){let t=this.textarea;if(t){t.focus();try{switch(e){case"toggleBold":U(t);break;case"toggleItalic":D(t);break;case"insertLink":q(t);break;case"toggleBulletList":W(t);break;case"toggleNumberedList":K(t);break}t.dispatchEvent(new Event("input",{bubbles:!0}))}catch(n){console.error("Error in markdown action:",n)}}}destroy(){}};var P={name:"solar",colors:{bgPrimary:"#faf0ca",bgSecondary:"#ffffff",text:"#0d3b66",h1:"#f95738",h2:"#ee964b",h3:"#3d8a51",strong:"#ee964b",em:"#f95738",link:"#0d3b66",code:"#0d3b66",codeBg:"rgba(244, 211, 94, 0.4)",blockquote:"#5a7a9b",hr:"#5a7a9b",syntaxMarker:"rgba(13, 59, 102, 0.52)",cursor:"#f95738",selection:"rgba(244, 211, 94, 0.4)",listMarker:"#ee964b",toolbarBg:"#ffffff",toolbarBorder:"rgba(13, 59, 102, 0.15)",toolbarIcon:"#0d3b66",toolbarHover:"#f5f5f5",toolbarActive:"#faf0ca"}},be={name:"cave",colors:{bgPrimary:"#141E26",bgSecondary:"#1D2D3E",text:"#c5dde8",h1:"#d4a5ff",h2:"#f6ae2d",h3:"#9fcfec",strong:"#f6ae2d",em:"#9fcfec",link:"#9fcfec",code:"#c5dde8",codeBg:"#1a232b",blockquote:"#9fcfec",hr:"#c5dde8",syntaxMarker:"rgba(159, 207, 236, 0.73)",cursor:"#f26419",selection:"rgba(51, 101, 138, 0.4)",listMarker:"#f6ae2d",toolbarBg:"#1D2D3E",toolbarBorder:"rgba(197, 221, 232, 0.1)",toolbarIcon:"#c5dde8",toolbarHover:"#243546",toolbarActive:"#2a3f52"}},we={solar:P,cave:be,light:P,dark:be};function B(o){return typeof o=="string"?{...we[o]||we.solar,name:o}:o}function N(o){let e=[];for(let[t,n]of Object.entries(o)){let i=t.replace(/([A-Z])/g,"-$1").toLowerCase();e.push(`--${i}: ${n};`)}return e.join(`
36
+ `;)d++;let l=r.slice(p,d);y("insertHeader",`Current line (before): "${l}"`);let c=l.match(/^(#{1,6})\s*/),h=c?c[1].length:0,u=c?c[0].length:0;y("insertHeader","Existing header check:"),y("insertHeader",` - Match: ${c?`"${c[0]}"`:"none"}`),y("insertHeader",` - Existing level: ${h}`),y("insertHeader",` - Existing prefix length: ${u}`),y("insertHeader",` - Target level: ${e}`);let f=t&&h===e;y("insertHeader",`Should toggle OFF: ${f} (toggle=${t}, existingLevel=${h}, level=${e})`);let m=R(o,g=>{let v=g.value.slice(g.selectionStart,g.selectionEnd);y("insertHeader",`Line in operation: "${v}"`);let b=v.replace(/^#{1,6}\s*/,"");y("insertHeader",`Cleaned line: "${b}"`);let k;return f?(y("insertHeader","ACTION: Toggling OFF - removing header"),k=b):h>0?(y("insertHeader",`ACTION: Replacing H${h} with H${e}`),k=i.prefix+b):(y("insertHeader","ACTION: Adding new header"),k=i.prefix+b),y("insertHeader",`New line: "${k}"`),{text:k,selectionStart:g.selectionStart,selectionEnd:g.selectionEnd}},{prefix:i.prefix,adjustSelection:(g,v,b,k)=>{if(y("insertHeader","Adjusting selection:"),y("insertHeader",` - isRemoving param: ${g}`),y("insertHeader",` - shouldToggleOff: ${f}`),y("insertHeader",` - selStart: ${v}, selEnd: ${b}`),y("insertHeader",` - lineStartPos: ${k}`),f){let M=Math.max(v-u,k);return y("insertHeader",` - Removing header, adjusting by -${u}`),{start:M,end:v===b?M:Math.max(b-u,k)}}else if(u>0){let M=i.prefix.length-u;return y("insertHeader",` - Replacing header, adjusting by ${M}`),{start:v+M,end:b+M}}else return y("insertHeader",` - Adding header, adjusting by +${i.prefix.length}`),{start:v+i.prefix.length,end:b+i.prefix.length}}});y("insertHeader",`Final result: text="${m.text}", cursor=${m.selectionStart}-${m.selectionEnd}`),y("insertHeader","============ END ============"),I(o,m)}function fe(o){Y(o,1,!0)}function ge(o){Y(o,2,!0)}function ve(o){Y(o,3,!0)}function ye(o){return Xe(o)}var O=class{constructor(e){this.editor=e,this.textarea=e.textarea}handleKeydown(e){if(!(navigator.platform.toLowerCase().includes("mac")?e.metaKey:e.ctrlKey))return!1;let i=null;switch(e.key.toLowerCase()){case"b":e.shiftKey||(i="toggleBold");break;case"i":e.shiftKey||(i="toggleItalic");break;case"k":e.shiftKey||(i="insertLink");break;case"7":e.shiftKey&&(i="toggleNumberedList");break;case"8":e.shiftKey&&(i="toggleBulletList");break}return i?(e.preventDefault(),this.editor.toolbar?this.editor.toolbar.handleAction(i):this.handleAction(i),!0):!1}async handleAction(e){let t=this.textarea;if(t){t.focus();try{switch(e){case"toggleBold":U(t);break;case"toggleItalic":D(t);break;case"insertLink":q(t);break;case"toggleBulletList":W(t);break;case"toggleNumberedList":K(t);break}t.dispatchEvent(new Event("input",{bubbles:!0}))}catch(n){console.error("Error in markdown action:",n)}}}destroy(){}};var P={name:"solar",colors:{bgPrimary:"#faf0ca",bgSecondary:"#ffffff",text:"#0d3b66",textPrimary:"#0d3b66",textSecondary:"#5a7a9b",h1:"#f95738",h2:"#ee964b",h3:"#3d8a51",strong:"#ee964b",em:"#f95738",del:"#ee964b",link:"#0d3b66",code:"#0d3b66",codeBg:"rgba(244, 211, 94, 0.4)",blockquote:"#5a7a9b",hr:"#5a7a9b",syntaxMarker:"rgba(13, 59, 102, 0.52)",syntax:"#999999",cursor:"#f95738",selection:"rgba(244, 211, 94, 0.4)",listMarker:"#ee964b",rawLine:"#5a7a9b",border:"#e0e0e0",hoverBg:"#f0f0f0",primary:"#0d3b66",toolbarBg:"#ffffff",toolbarIcon:"#0d3b66",toolbarHover:"#f5f5f5",toolbarActive:"#faf0ca"}},be={name:"cave",colors:{bgPrimary:"#141E26",bgSecondary:"#1D2D3E",text:"#c5dde8",textPrimary:"#c5dde8",textSecondary:"#9fcfec",h1:"#d4a5ff",h2:"#f6ae2d",h3:"#9fcfec",strong:"#f6ae2d",em:"#9fcfec",del:"#f6ae2d",link:"#9fcfec",code:"#c5dde8",codeBg:"#1a232b",blockquote:"#9fcfec",hr:"#c5dde8",syntaxMarker:"rgba(159, 207, 236, 0.73)",syntax:"#7a8c98",cursor:"#f26419",selection:"rgba(51, 101, 138, 0.4)",listMarker:"#f6ae2d",rawLine:"#9fcfec",border:"#2a3f52",hoverBg:"#243546",primary:"#9fcfec",toolbarBg:"#1D2D3E",toolbarIcon:"#c5dde8",toolbarHover:"#243546",toolbarActive:"#2a3f52"}},we={solar:P,cave:be,light:P,dark:be};function B(o){return typeof o=="string"?{...we[o]||we.solar,name:o}:o}function N(o){let e=[];for(let[t,n]of Object.entries(o)){let i=t.replace(/([A-Z])/g,"-$1").toLowerCase();e.push(`--${i}: ${n};`)}return e.join(`
37
37
  `)}function ke(o,e={}){return{...o,colors:{...o.colors,...e}}}function xe(o={}){let{fontSize:e="14px",lineHeight:t=1.6,fontFamily:n='"SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Code", Consolas, "Roboto Mono", "Noto Sans Mono", "Droid Sans Mono", "Ubuntu Mono", "DejaVu Sans Mono", "Liberation Mono", "Courier New", Courier, monospace',padding:i="20px",theme:r=null,mobile:s={}}=o,a=Object.keys(s).length>0?`
38
38
  @media (max-width: 640px) {
39
39
  .overtype-wrapper .overtype-input,
@@ -459,6 +459,8 @@ ${a}`:r;if(d){let L=o.value[o.selectionStart-1];o.selectionStart!==0&&L!=null&&!
459
459
  font-size: 0.85rem !important;
460
460
  color: #666 !important;
461
461
  flex-shrink: 0 !important; /* Don't shrink */
462
+ z-index: 10001 !important; /* Above link tooltip */
463
+ position: relative !important; /* Enable z-index */
462
464
  }
463
465
 
464
466
  /* Dark theme stats bar */
@@ -496,6 +498,7 @@ ${a}`:r;if(d){let L=o.value[o.selectionStart-1];o.selectionStart!==0&&L!=null&&!
496
498
  gap: 4px !important;
497
499
  padding: 8px !important; /* Override reset */
498
500
  background: var(--toolbar-bg, var(--bg-primary, #f8f9fa)) !important; /* Override reset */
501
+ border-bottom: 1px solid var(--toolbar-border, transparent) !important; /* Override reset */
499
502
  overflow-x: auto !important; /* Allow horizontal scrolling */
500
503
  overflow-y: hidden !important; /* Hide vertical overflow */
501
504
  -webkit-overflow-scrolling: touch !important;
@@ -936,7 +939,7 @@ ${a}`:r;if(d){let L=o.value[o.selectionStart-1];o.selectionStart!==0&&L!=null&&!
936
939
  </svg>`,Be=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
937
940
  <path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" fill="none"></path>
938
941
  <circle cx="12" cy="12" r="3" fill="none"></circle>
939
- </svg>`;var x={bold:{name:"bold",icon:Le,title:"Bold (Ctrl+B)",action:({editor:o,event:e})=>{U(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},italic:{name:"italic",icon:Se,title:"Italic (Ctrl+I)",action:({editor:o,event:e})=>{D(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},code:{name:"code",icon:$e,title:"Inline Code",action:({editor:o,event:e})=>{ue(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},separator:{name:"separator"},link:{name:"link",icon:Ae,title:"Insert Link",action:({editor:o,event:e})=>{q(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},h1:{name:"h1",icon:Ee,title:"Heading 1",action:({editor:o,event:e})=>{fe(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},h2:{name:"h2",icon:Ce,title:"Heading 2",action:({editor:o,event:e})=>{ge(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},h3:{name:"h3",icon:Te,title:"Heading 3",action:({editor:o,event:e})=>{ve(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},bulletList:{name:"bulletList",icon:He,title:"Bullet List",action:({editor:o,event:e})=>{W(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},orderedList:{name:"orderedList",icon:Me,title:"Numbered List",action:({editor:o,event:e})=>{K(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},taskList:{name:"taskList",icon:Pe,title:"Task List",action:({editor:o,event:e})=>{X&&(X(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0})))}},quote:{name:"quote",icon:Ie,title:"Quote",action:({editor:o,event:e})=>{me(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},viewMode:{name:"viewMode",icon:Be,title:"View mode"}},G=[x.bold,x.italic,x.code,x.separator,x.link,x.separator,x.h1,x.h2,x.h3,x.separator,x.bulletList,x.orderedList,x.taskList,x.separator,x.quote,x.separator,x.viewMode];var w=class w{constructor(e,t={}){let n;if(typeof e=="string"){if(n=document.querySelectorAll(e),n.length===0)throw new Error(`No elements found for selector: ${e}`);n=Array.from(n)}else if(e instanceof Element)n=[e];else if(e instanceof NodeList)n=Array.from(e);else if(Array.isArray(e))n=e;else throw new Error("Invalid target: must be selector string, Element, NodeList, or Array");return n.map(r=>{if(r.overTypeInstance)return r.overTypeInstance.reinit(t),r.overTypeInstance;let s=Object.create(w.prototype);return s._init(r,t),r.overTypeInstance=s,w.instances.set(r,s),s})}_init(e,t={}){this.element=e,this.instanceTheme=t.theme||null,this.options=this._mergeOptions(t),this.instanceId=++w.instanceCount,this.initialized=!1,w.injectStyles(),w.initGlobalListeners();let n=e.querySelector(".overtype-container"),i=e.querySelector(".overtype-wrapper");n||i?this._recoverFromDOM(n,i):this._buildFromScratch(),this.shortcuts=new O(this),this.linkTooltip=new J(this),this.initialized=!0,this.options.onChange&&this.options.onChange(this.getValue(),this)}_mergeOptions(e){let t={fontSize:"14px",lineHeight:1.6,fontFamily:'"SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Code", Consolas, "Roboto Mono", "Noto Sans Mono", "Droid Sans Mono", "Ubuntu Mono", "DejaVu Sans Mono", "Liberation Mono", "Courier New", Courier, monospace',padding:"16px",mobile:{fontSize:"16px",padding:"12px",lineHeight:1.5},textareaProps:{},autofocus:!1,autoResize:!1,minHeight:"100px",maxHeight:null,placeholder:"Start typing...",value:"",onChange:null,onKeydown:null,showActiveLineRaw:!1,showStats:!1,toolbar:!1,toolbarButtons:null,statsFormatter:null,smartLists:!0,codeHighlighter:null},{theme:n,colors:i,...r}=e;return{...t,...r}}_recoverFromDOM(e,t){if(e&&e.classList.contains("overtype-container"))this.container=e,this.wrapper=e.querySelector(".overtype-wrapper");else if(t){this.wrapper=t,this.container=document.createElement("div"),this.container.className="overtype-container";let n=this.instanceTheme||w.currentTheme||P,i=typeof n=="string"?n:n.name;if(i&&this.container.setAttribute("data-theme",i),this.instanceTheme){let r=typeof this.instanceTheme=="string"?B(this.instanceTheme):this.instanceTheme;if(r&&r.colors){let s=N(r.colors);this.container.style.cssText+=s}}t.parentNode.insertBefore(this.container,t),this.container.appendChild(t)}if(!this.wrapper){e&&e.remove(),t&&t.remove(),this._buildFromScratch();return}if(this.textarea=this.wrapper.querySelector(".overtype-input"),this.preview=this.wrapper.querySelector(".overtype-preview"),!this.textarea||!this.preview){this.container.remove(),this._buildFromScratch();return}this.wrapper._instance=this,this.options.fontSize&&this.wrapper.style.setProperty("--instance-font-size",this.options.fontSize),this.options.lineHeight&&this.wrapper.style.setProperty("--instance-line-height",String(this.options.lineHeight)),this.options.padding&&this.wrapper.style.setProperty("--instance-padding",this.options.padding),this._configureTextarea(),this._applyOptions()}_buildFromScratch(){let e=this._extractContent();this.element.innerHTML="",this._createDOM(),(e||this.options.value)&&this.setValue(e||this.options.value),this._applyOptions()}_extractContent(){let e=this.element.querySelector(".overtype-input");return e?e.value:this.element.textContent||""}_createDOM(){this.container=document.createElement("div"),this.container.className="overtype-container";let e=this.instanceTheme||w.currentTheme||P,t=typeof e=="string"?e:e.name;if(t&&this.container.setAttribute("data-theme",t),this.instanceTheme){let n=typeof this.instanceTheme=="string"?B(this.instanceTheme):this.instanceTheme;if(n&&n.colors){let i=N(n.colors);this.container.style.cssText+=i}}this.wrapper=document.createElement("div"),this.wrapper.className="overtype-wrapper",this.options.fontSize&&this.wrapper.style.setProperty("--instance-font-size",this.options.fontSize),this.options.lineHeight&&this.wrapper.style.setProperty("--instance-line-height",String(this.options.lineHeight)),this.options.padding&&this.wrapper.style.setProperty("--instance-padding",this.options.padding),this.wrapper._instance=this,this.textarea=document.createElement("textarea"),this.textarea.className="overtype-input",this.textarea.placeholder=this.options.placeholder,this._configureTextarea(),this.options.textareaProps&&Object.entries(this.options.textareaProps).forEach(([n,i])=>{n==="className"||n==="class"?this.textarea.className+=" "+i:n==="style"&&typeof i=="object"?Object.assign(this.textarea.style,i):this.textarea.setAttribute(n,i)}),this.preview=document.createElement("div"),this.preview.className="overtype-preview",this.preview.setAttribute("aria-hidden","true"),this.wrapper.appendChild(this.textarea),this.wrapper.appendChild(this.preview),this.container.appendChild(this.wrapper),this.options.showStats&&(this.statsBar=document.createElement("div"),this.statsBar.className="overtype-stats",this.container.appendChild(this.statsBar),this._updateStats()),this.element.appendChild(this.container),this.options.autoResize?this._setupAutoResize():this.container.classList.remove("overtype-auto-resize")}_configureTextarea(){this.textarea.setAttribute("autocomplete","off"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.setAttribute("data-gramm","false"),this.textarea.setAttribute("data-gramm_editor","false"),this.textarea.setAttribute("data-enable-grammarly","false")}_createToolbar(){let e=this.options.toolbarButtons||G;this.toolbar=new Z(this,{toolbarButtons:e}),this.toolbar.create(),this._toolbarSelectionListener=()=>{this.toolbar&&this.toolbar.updateButtonStates()},this._toolbarInputListener=()=>{this.toolbar&&this.toolbar.updateButtonStates()},this.textarea.addEventListener("selectionchange",this._toolbarSelectionListener),this.textarea.addEventListener("input",this._toolbarInputListener)}_cleanupToolbarListeners(){this._toolbarSelectionListener&&(this.textarea.removeEventListener("selectionchange",this._toolbarSelectionListener),this._toolbarSelectionListener=null),this._toolbarInputListener&&(this.textarea.removeEventListener("input",this._toolbarInputListener),this._toolbarInputListener=null)}_applyOptions(){this.options.autofocus&&this.textarea.focus(),this.options.autoResize?this.container.classList.contains("overtype-auto-resize")||this._setupAutoResize():this.container.classList.remove("overtype-auto-resize"),this.options.toolbar&&!this.toolbar?this._createToolbar():!this.options.toolbar&&this.toolbar&&(this._cleanupToolbarListeners(),this.toolbar.destroy(),this.toolbar=null),this.updatePreview()}updatePreview(){let e=this.textarea.value,t=this.textarea.selectionStart,n=this._getCurrentLine(e,t),i=this.container.dataset.mode==="preview",r=S.parse(e,n,this.options.showActiveLineRaw,this.options.codeHighlighter,i);this.preview.innerHTML=r||'<span style="color: #808080;">Start typing...</span>',this._applyCodeBlockBackgrounds(),this.options.showStats&&this.statsBar&&this._updateStats(),this.options.onChange&&this.initialized&&this.options.onChange(e,this)}_applyCodeBlockBackgrounds(){let e=this.preview.querySelectorAll(".code-fence");for(let t=0;t<e.length-1;t+=2){let n=e[t],i=e[t+1],r=n.parentElement,s=i.parentElement;!r||!s||(n.style.display="block",i.style.display="block",r.classList.add("code-block-line"),s.classList.add("code-block-line"))}}_getCurrentLine(e,t){return e.substring(0,t).split(`
942
+ </svg>`;var x={bold:{name:"bold",icon:Le,title:"Bold (Ctrl+B)",action:({editor:o,event:e})=>{U(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},italic:{name:"italic",icon:Se,title:"Italic (Ctrl+I)",action:({editor:o,event:e})=>{D(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},code:{name:"code",icon:$e,title:"Inline Code",action:({editor:o,event:e})=>{ue(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},separator:{name:"separator"},link:{name:"link",icon:Ae,title:"Insert Link",action:({editor:o,event:e})=>{q(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},h1:{name:"h1",icon:Ee,title:"Heading 1",action:({editor:o,event:e})=>{fe(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},h2:{name:"h2",icon:Ce,title:"Heading 2",action:({editor:o,event:e})=>{ge(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},h3:{name:"h3",icon:Te,title:"Heading 3",action:({editor:o,event:e})=>{ve(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},bulletList:{name:"bulletList",icon:He,title:"Bullet List",action:({editor:o,event:e})=>{W(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},orderedList:{name:"orderedList",icon:Me,title:"Numbered List",action:({editor:o,event:e})=>{K(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},taskList:{name:"taskList",icon:Pe,title:"Task List",action:({editor:o,event:e})=>{X&&(X(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0})))}},quote:{name:"quote",icon:Ie,title:"Quote",action:({editor:o,event:e})=>{me(o.textarea),o.textarea.dispatchEvent(new Event("input",{bubbles:!0}))}},viewMode:{name:"viewMode",icon:Be,title:"View mode"}},G=[x.bold,x.italic,x.code,x.separator,x.link,x.separator,x.h1,x.h2,x.h3,x.separator,x.bulletList,x.orderedList,x.taskList,x.separator,x.quote,x.separator,x.viewMode];var w=class w{constructor(e,t={}){let n;if(typeof e=="string"){if(n=document.querySelectorAll(e),n.length===0)throw new Error(`No elements found for selector: ${e}`);n=Array.from(n)}else if(e instanceof Element)n=[e];else if(e instanceof NodeList)n=Array.from(e);else if(Array.isArray(e))n=e;else throw new Error("Invalid target: must be selector string, Element, NodeList, or Array");return n.map(r=>{if(r.overTypeInstance)return r.overTypeInstance.reinit(t),r.overTypeInstance;let s=Object.create(w.prototype);return s._init(r,t),r.overTypeInstance=s,w.instances.set(r,s),s})}_init(e,t={}){this.element=e,this.instanceTheme=t.theme||null,this.options=this._mergeOptions(t),this.instanceId=++w.instanceCount,this.initialized=!1,w.injectStyles(),w.initGlobalListeners();let n=e.querySelector(".overtype-container"),i=e.querySelector(".overtype-wrapper");n||i?this._recoverFromDOM(n,i):this._buildFromScratch(),this.shortcuts=new O(this),this.linkTooltip=new J(this),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.textarea.scrollTop=this.preview.scrollTop,this.textarea.scrollLeft=this.preview.scrollLeft})}),this.initialized=!0,this.options.onChange&&this.options.onChange(this.getValue(),this)}_mergeOptions(e){let t={fontSize:"14px",lineHeight:1.6,fontFamily:'"SF Mono", SFMono-Regular, Menlo, Monaco, "Cascadia Code", Consolas, "Roboto Mono", "Noto Sans Mono", "Droid Sans Mono", "Ubuntu Mono", "DejaVu Sans Mono", "Liberation Mono", "Courier New", Courier, monospace',padding:"16px",mobile:{fontSize:"16px",padding:"12px",lineHeight:1.5},textareaProps:{},autofocus:!1,autoResize:!1,minHeight:"100px",maxHeight:null,placeholder:"Start typing...",value:"",onChange:null,onKeydown:null,showActiveLineRaw:!1,showStats:!1,toolbar:!1,toolbarButtons:null,statsFormatter:null,smartLists:!0,codeHighlighter:null},{theme:n,colors:i,...r}=e;return{...t,...r}}_recoverFromDOM(e,t){if(e&&e.classList.contains("overtype-container"))this.container=e,this.wrapper=e.querySelector(".overtype-wrapper");else if(t){this.wrapper=t,this.container=document.createElement("div"),this.container.className="overtype-container";let n=this.instanceTheme||w.currentTheme||P,i=typeof n=="string"?n:n.name;if(i&&this.container.setAttribute("data-theme",i),this.instanceTheme){let r=typeof this.instanceTheme=="string"?B(this.instanceTheme):this.instanceTheme;if(r&&r.colors){let s=N(r.colors);this.container.style.cssText+=s}}t.parentNode.insertBefore(this.container,t),this.container.appendChild(t)}if(!this.wrapper){e&&e.remove(),t&&t.remove(),this._buildFromScratch();return}if(this.textarea=this.wrapper.querySelector(".overtype-input"),this.preview=this.wrapper.querySelector(".overtype-preview"),!this.textarea||!this.preview){this.container.remove(),this._buildFromScratch();return}this.wrapper._instance=this,this.options.fontSize&&this.wrapper.style.setProperty("--instance-font-size",this.options.fontSize),this.options.lineHeight&&this.wrapper.style.setProperty("--instance-line-height",String(this.options.lineHeight)),this.options.padding&&this.wrapper.style.setProperty("--instance-padding",this.options.padding),this._configureTextarea(),this._applyOptions()}_buildFromScratch(){let e=this._extractContent();this.element.innerHTML="",this._createDOM(),(e||this.options.value)&&this.setValue(e||this.options.value),this._applyOptions()}_extractContent(){let e=this.element.querySelector(".overtype-input");return e?e.value:this.element.textContent||""}_createDOM(){this.container=document.createElement("div"),this.container.className="overtype-container";let e=this.instanceTheme||w.currentTheme||P,t=typeof e=="string"?e:e.name;if(t&&this.container.setAttribute("data-theme",t),this.instanceTheme){let n=typeof this.instanceTheme=="string"?B(this.instanceTheme):this.instanceTheme;if(n&&n.colors){let i=N(n.colors);this.container.style.cssText+=i}}this.wrapper=document.createElement("div"),this.wrapper.className="overtype-wrapper",this.options.fontSize&&this.wrapper.style.setProperty("--instance-font-size",this.options.fontSize),this.options.lineHeight&&this.wrapper.style.setProperty("--instance-line-height",String(this.options.lineHeight)),this.options.padding&&this.wrapper.style.setProperty("--instance-padding",this.options.padding),this.wrapper._instance=this,this.textarea=document.createElement("textarea"),this.textarea.className="overtype-input",this.textarea.placeholder=this.options.placeholder,this._configureTextarea(),this.options.textareaProps&&Object.entries(this.options.textareaProps).forEach(([n,i])=>{n==="className"||n==="class"?this.textarea.className+=" "+i:n==="style"&&typeof i=="object"?Object.assign(this.textarea.style,i):this.textarea.setAttribute(n,i)}),this.preview=document.createElement("div"),this.preview.className="overtype-preview",this.preview.setAttribute("aria-hidden","true"),this.wrapper.appendChild(this.textarea),this.wrapper.appendChild(this.preview),this.container.appendChild(this.wrapper),this.options.showStats&&(this.statsBar=document.createElement("div"),this.statsBar.className="overtype-stats",this.container.appendChild(this.statsBar),this._updateStats()),this.element.appendChild(this.container),this.options.autoResize?this._setupAutoResize():this.container.classList.remove("overtype-auto-resize")}_configureTextarea(){this.textarea.setAttribute("autocomplete","off"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.setAttribute("data-gramm","false"),this.textarea.setAttribute("data-gramm_editor","false"),this.textarea.setAttribute("data-enable-grammarly","false")}_createToolbar(){let e=this.options.toolbarButtons||G;this.toolbar=new Z(this,{toolbarButtons:e}),this.toolbar.create(),this._toolbarSelectionListener=()=>{this.toolbar&&this.toolbar.updateButtonStates()},this._toolbarInputListener=()=>{this.toolbar&&this.toolbar.updateButtonStates()},this.textarea.addEventListener("selectionchange",this._toolbarSelectionListener),this.textarea.addEventListener("input",this._toolbarInputListener)}_cleanupToolbarListeners(){this._toolbarSelectionListener&&(this.textarea.removeEventListener("selectionchange",this._toolbarSelectionListener),this._toolbarSelectionListener=null),this._toolbarInputListener&&(this.textarea.removeEventListener("input",this._toolbarInputListener),this._toolbarInputListener=null)}_applyOptions(){this.options.autofocus&&this.textarea.focus(),this.options.autoResize?this.container.classList.contains("overtype-auto-resize")||this._setupAutoResize():this.container.classList.remove("overtype-auto-resize"),this.options.toolbar&&!this.toolbar?this._createToolbar():!this.options.toolbar&&this.toolbar&&(this._cleanupToolbarListeners(),this.toolbar.destroy(),this.toolbar=null),this.updatePreview()}updatePreview(){let e=this.textarea.value,t=this.textarea.selectionStart,n=this._getCurrentLine(e,t),i=this.container.dataset.mode==="preview",r=S.parse(e,n,this.options.showActiveLineRaw,this.options.codeHighlighter,i);this.preview.innerHTML=r||'<span style="color: #808080;">Start typing...</span>',this._applyCodeBlockBackgrounds(),this.options.showStats&&this.statsBar&&this._updateStats(),this.options.onChange&&this.initialized&&this.options.onChange(e,this)}_applyCodeBlockBackgrounds(){let e=this.preview.querySelectorAll(".code-fence");for(let t=0;t<e.length-1;t+=2){let n=e[t],i=e[t+1],r=n.parentElement,s=i.parentElement;!r||!s||(n.style.display="block",i.style.display="block",r.classList.add("code-block-line"),s.classList.add("code-block-line"))}}_getCurrentLine(e,t){return e.substring(0,t).split(`
940
943
  `).length-1}handleInput(e){this.updatePreview()}handleKeydown(e){if(e.key==="Tab"){e.preventDefault();let n=this.textarea.selectionStart,i=this.textarea.selectionEnd,r=this.textarea.value;if(n!==i&&e.shiftKey){let s=r.substring(0,n),a=r.substring(n,i),p=r.substring(i),l=a.split(`
941
944
  `).map(c=>c.replace(/^ /,"")).join(`
942
945
  `);document.execCommand?(this.textarea.setSelectionRange(n,i),document.execCommand("insertText",!1,l)):(this.textarea.value=s+l+p,this.textarea.selectionStart=n,this.textarea.selectionEnd=n+l.length)}else if(n!==i){let s=r.substring(0,n),a=r.substring(n,i),p=r.substring(i),l=a.split(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "overtype",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "A lightweight markdown editor library with perfect WYSIWYG alignment using an invisible textarea overlay",
5
5
  "main": "dist/overtype.cjs",
6
6
  "module": "dist/overtype.esm.js",
@@ -26,7 +26,8 @@
26
26
  },
27
27
  "type": "module",
28
28
  "scripts": {
29
- "build": "node scripts/build.js",
29
+ "generate:types": "node scripts/generate-types.js",
30
+ "build": "npm run generate:types && node scripts/build.js",
30
31
  "build:prod": "npm test && npm run build",
31
32
  "dev": "http-server website -p 8080 -c-1",
32
33
  "watch": "node scripts/build.js --watch",
@@ -315,8 +315,12 @@ class OverTypeEditor extends HTMLElement {
315
315
  break;
316
316
 
317
317
  case 'theme':
318
- // Theme changes require re-injecting styles
318
+ // Theme changes require re-injecting styles and updating the editor instance
319
319
  this._reinjectStyles();
320
+ // Update the OverType instance's theme so it sets data-theme attribute
321
+ if (this._editor && this._editor.setTheme) {
322
+ this._editor.setTheme(value || 'solar');
323
+ }
320
324
  break;
321
325
 
322
326
  case 'placeholder':
package/src/overtype.d.ts CHANGED
@@ -1,35 +1,41 @@
1
1
  // Type definitions for OverType
2
2
  // Project: https://github.com/panphora/overtype
3
- // Definitions generated from JSDoc comments and implementation
3
+ // Definitions generated from themes.js and styles.js
4
+ // DO NOT EDIT MANUALLY - Run 'npm run generate:types' to regenerate
4
5
 
5
6
  export interface Theme {
6
7
  name: string;
7
8
  colors: {
8
9
  bgPrimary?: string;
9
10
  bgSecondary?: string;
10
- text?: string;
11
- textSecondary?: string;
11
+ blockquote?: string;
12
+ border?: string;
13
+ code?: string;
14
+ codeBg?: string;
15
+ cursor?: string;
16
+ del?: string;
17
+ em?: string;
12
18
  h1?: string;
13
19
  h2?: string;
14
20
  h3?: string;
15
- strong?: string;
16
- em?: string;
17
- link?: string;
18
- code?: string;
19
- codeBg?: string;
20
- blockquote?: string;
21
+ hoverBg?: string;
21
22
  hr?: string;
22
- syntaxMarker?: string;
23
+ link?: string;
23
24
  listMarker?: string;
24
- cursor?: string;
25
- selection?: string;
25
+ primary?: string;
26
26
  rawLine?: string;
27
- // Toolbar theme colors
27
+ selection?: string;
28
+ strong?: string;
29
+ syntax?: string;
30
+ syntaxMarker?: string;
31
+ text?: string;
32
+ textPrimary?: string;
33
+ textSecondary?: string;
34
+ toolbarActive?: string;
28
35
  toolbarBg?: string;
29
- toolbarIcon?: string;
36
+ toolbarBorder?: string;
30
37
  toolbarHover?: string;
31
- toolbarActive?: string;
32
- border?: string;
38
+ toolbarIcon?: string;
33
39
  };
34
40
  }
35
41
 
@@ -166,12 +172,12 @@ export interface OverTypeInstance {
166
172
  setTheme(theme: string | Theme): this;
167
173
  setCodeHighlighter(highlighter: ((code: string, language: string) => string) | null): void;
168
174
  updatePreview(): void;
169
-
175
+
170
176
  // HTML output methods
171
177
  getRenderedHTML(options?: RenderOptions): string;
172
178
  getCleanHTML(): string;
173
179
  getPreviewHTML(): string;
174
-
180
+
175
181
  // View mode methods
176
182
  showNormalEditMode(): this;
177
183
  showPlainTextarea(): this;
@@ -209,4 +215,4 @@ export const toolbarButtons: {
209
215
  /**
210
216
  * Default toolbar button layout with separators
211
217
  */
212
- export const defaultToolbarButtons: ToolbarButton[];
218
+ export const defaultToolbarButtons: ToolbarButton[];
package/src/overtype.js CHANGED
@@ -103,6 +103,16 @@ class OverType {
103
103
  // Setup link tooltip
104
104
  this.linkTooltip = new LinkTooltip(this);
105
105
 
106
+ // Sync scroll positions on initial render
107
+ // This ensures textarea matches preview scroll if page is reloaded while scrolled
108
+ // Double requestAnimationFrame waits for browser to restore scroll position
109
+ requestAnimationFrame(() => {
110
+ requestAnimationFrame(() => {
111
+ this.textarea.scrollTop = this.preview.scrollTop;
112
+ this.textarea.scrollLeft = this.preview.scrollLeft;
113
+ });
114
+ });
115
+
106
116
  // Mark as initialized
107
117
  this.initialized = true;
108
118
 
package/src/styles.js CHANGED
@@ -456,6 +456,8 @@ export function generateStyles(options = {}) {
456
456
  font-size: 0.85rem !important;
457
457
  color: #666 !important;
458
458
  flex-shrink: 0 !important; /* Don't shrink */
459
+ z-index: 10001 !important; /* Above link tooltip */
460
+ position: relative !important; /* Enable z-index */
459
461
  }
460
462
 
461
463
  /* Dark theme stats bar */
@@ -493,6 +495,7 @@ export function generateStyles(options = {}) {
493
495
  gap: 4px !important;
494
496
  padding: 8px !important; /* Override reset */
495
497
  background: var(--toolbar-bg, var(--bg-primary, #f8f9fa)) !important; /* Override reset */
498
+ border-bottom: 1px solid var(--toolbar-border, transparent) !important; /* Override reset */
496
499
  overflow-x: auto !important; /* Allow horizontal scrolling */
497
500
  overflow-y: hidden !important; /* Hide vertical overflow */
498
501
  -webkit-overflow-scrolling: touch !important;
package/src/themes.js CHANGED
@@ -12,23 +12,30 @@ export const solar = {
12
12
  bgPrimary: '#faf0ca', // Lemon Chiffon - main background
13
13
  bgSecondary: '#ffffff', // White - editor background
14
14
  text: '#0d3b66', // Yale Blue - main text
15
+ textPrimary: '#0d3b66', // Yale Blue - primary text (same as text)
16
+ textSecondary: '#5a7a9b', // Muted blue - secondary text
15
17
  h1: '#f95738', // Tomato - h1 headers
16
- h2: '#ee964b', // Sandy Brown - h2 headers
18
+ h2: '#ee964b', // Sandy Brown - h2 headers
17
19
  h3: '#3d8a51', // Forest green - h3 headers
18
20
  strong: '#ee964b', // Sandy Brown - bold text
19
21
  em: '#f95738', // Tomato - italic text
22
+ del: '#ee964b', // Sandy Brown - deleted text (same as strong)
20
23
  link: '#0d3b66', // Yale Blue - links
21
24
  code: '#0d3b66', // Yale Blue - inline code
22
25
  codeBg: 'rgba(244, 211, 94, 0.4)', // Naples Yellow with transparency
23
26
  blockquote: '#5a7a9b', // Muted blue - blockquotes
24
27
  hr: '#5a7a9b', // Muted blue - horizontal rules
25
28
  syntaxMarker: 'rgba(13, 59, 102, 0.52)', // Yale Blue with transparency
29
+ syntax: '#999999', // Gray - syntax highlighting fallback
26
30
  cursor: '#f95738', // Tomato - cursor
27
31
  selection: 'rgba(244, 211, 94, 0.4)', // Naples Yellow with transparency
28
32
  listMarker: '#ee964b', // Sandy Brown - list markers
33
+ rawLine: '#5a7a9b', // Muted blue - raw line indicators
34
+ border: '#e0e0e0', // Light gray - borders
35
+ hoverBg: '#f0f0f0', // Very light gray - hover backgrounds
36
+ primary: '#0d3b66', // Yale Blue - primary accent
29
37
  // Toolbar colors
30
38
  toolbarBg: '#ffffff', // White - toolbar background
31
- toolbarBorder: 'rgba(13, 59, 102, 0.15)', // Yale Blue border
32
39
  toolbarIcon: '#0d3b66', // Yale Blue - icon color
33
40
  toolbarHover: '#f5f5f5', // Light gray - hover background
34
41
  toolbarActive: '#faf0ca', // Lemon Chiffon - active button background
@@ -44,23 +51,30 @@ export const cave = {
44
51
  bgPrimary: '#141E26', // Deep ocean - main background
45
52
  bgSecondary: '#1D2D3E', // Darker charcoal - editor background
46
53
  text: '#c5dde8', // Light blue-gray - main text
54
+ textPrimary: '#c5dde8', // Light blue-gray - primary text (same as text)
55
+ textSecondary: '#9fcfec', // Brighter blue - secondary text
47
56
  h1: '#d4a5ff', // Rich lavender - h1 headers
48
57
  h2: '#f6ae2d', // Hunyadi Yellow - h2 headers
49
58
  h3: '#9fcfec', // Brighter blue - h3 headers
50
59
  strong: '#f6ae2d', // Hunyadi Yellow - bold text
51
60
  em: '#9fcfec', // Brighter blue - italic text
61
+ del: '#f6ae2d', // Hunyadi Yellow - deleted text (same as strong)
52
62
  link: '#9fcfec', // Brighter blue - links
53
63
  code: '#c5dde8', // Light blue-gray - inline code
54
64
  codeBg: '#1a232b', // Very dark blue - code background
55
65
  blockquote: '#9fcfec', // Brighter blue - same as italic
56
66
  hr: '#c5dde8', // Light blue-gray - horizontal rules
57
67
  syntaxMarker: 'rgba(159, 207, 236, 0.73)', // Brighter blue semi-transparent
68
+ syntax: '#7a8c98', // Muted gray-blue - syntax highlighting fallback
58
69
  cursor: '#f26419', // Orange Pantone - cursor
59
70
  selection: 'rgba(51, 101, 138, 0.4)', // Lapis Lazuli with transparency
60
71
  listMarker: '#f6ae2d', // Hunyadi Yellow - list markers
72
+ rawLine: '#9fcfec', // Brighter blue - raw line indicators
73
+ border: '#2a3f52', // Dark blue-gray - borders
74
+ hoverBg: '#243546', // Slightly lighter charcoal - hover backgrounds
75
+ primary: '#9fcfec', // Brighter blue - primary accent
61
76
  // Toolbar colors for dark theme
62
77
  toolbarBg: '#1D2D3E', // Darker charcoal - toolbar background
63
- toolbarBorder: 'rgba(197, 221, 232, 0.1)', // Light blue-gray border
64
78
  toolbarIcon: '#c5dde8', // Light blue-gray - icon color
65
79
  toolbarHover: '#243546', // Slightly lighter charcoal - hover background
66
80
  toolbarActive: '#2a3f52', // Even lighter - active button background