@rr0/ufoathome 0.105.7 → 0.105.8

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.
@@ -14,6 +14,6 @@ import Lf from"./sightingSchema-5AlscPkV.js";let rr=[],Da=[];(()=>{let s="lc,34,
14
14
  `),r.doc.toString().split(`
15
15
  `)))}),update:(r,o)=>{let l=r.baseline;for(const a of o.effects)a.is(oe.SET_BASELINE)&&(l=a.value.split(`
16
16
  `));return!o.docChanged&&l===r.baseline?r:{baseline:l,changed:new Set(li.changed(l,o.state.doc.toString().split(`
17
- `)))}}}),i=T.decorations.compute([t],r=>{const o=new Ne;for(const l of[...r.field(t).changed].sort((a,h)=>a-h))l<r.doc.lines&&o.add(r.doc.line(l+1).from,r.doc.line(l+1).from,L.line({class:"cm-changed-line"}));return o.finish()}),n=mo({class:"cm-changed-gutter",lineMarker:(r,o)=>r.state.field(t).changed.has(r.state.doc.lineAt(o.from).number-1)?oe.CHANGED_MARKER:null,lineMarkerChange:r=>r.docChanged||r.transactions.some(o=>o.effects.some(l=>l.is(oe.SET_BASELINE))),initialSpacer:()=>oe.CHANGED_MARKER});return{field:t,extensions:[t,i,n]}}constructor(e,t,i,n,r={}){const o=[...X0,...y0,...Cg,...Wm,...wf,...Cy,...Yp,b0],l=oe.changeMarks(r.baseline??t);this.changedField=l.field,o.unshift({key:"F7",run:()=>this.gotoChange(1),preventDefault:!0},{key:"Shift-F7",run:()=>this.gotoChange(-1),preventDefault:!0}),this.view=new T({parent:e,doc:t,extensions:[...l.extensions,oe.revealed,Rp(),Np({top:!0}),F.phrases.of(r.phrases??{}),zm(),np(),dg(),Gd(),Tm(),Jm(),U0(),ny(),uo.of(o),F.tabSize.of(2),qm(oe.COLOURS,{fallback:!0}),by(),kf.data.of({autocomplete:new Di().source}),Ny(),Ty(gy()),T.contentAttributes.of({"aria-label":n}),T.theme({"&":{maxHeight:"28rem",fontSize:"0.82em",border:"1px solid color-mix(in srgb, currentColor 25%, transparent)",borderRadius:"4px"},"&.cm-focused":{outline:"2px solid color-mix(in srgb, currentColor 45%, transparent)"},".cm-scroller":{overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},".cm-tooltip":{backgroundColor:"Canvas",color:"CanvasText",border:"1px solid color-mix(in srgb, CanvasText 30%, transparent)"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"Highlight",color:"HighlightText"},".cm-gutters":{backgroundColor:"transparent",color:"color-mix(in srgb, currentColor 55%, transparent)",border:"none"},".cm-changed-gutter":{width:"4px"},".cm-changed-bar":{width:"3px",height:"100%",backgroundColor:"#2f81f7"},".cm-changed-line":{backgroundColor:"color-mix(in srgb, #2f81f7 13%, transparent)"},".cm-revealed-line":{backgroundColor:"color-mix(in srgb, #f2cc60 30%, transparent)",boxShadow:"inset 3px 0 0 #f2cc60"},".cm-panels":{backgroundColor:"Canvas",color:"CanvasText",borderColor:"color-mix(in srgb, CanvasText 25%, transparent)"},".cm-panel.cm-search input, .cm-panel.cm-search button":{fontSize:"inherit"},".cm-panel.cm-search input[type=text], .cm-panel.cm-search input:not([type])":{backgroundColor:"Field",color:"FieldText",border:"1px solid color-mix(in srgb, CanvasText 35%, transparent)",borderRadius:"3px",padding:"2px 5px"},".cm-panel.cm-search button":{backgroundImage:"none",backgroundColor:"ButtonFace",color:"ButtonText",border:"1px solid color-mix(in srgb, CanvasText 35%, transparent)",borderRadius:"3px"},".cm-panel.cm-search label, .cm-panel.cm-search [name=close]":{color:"CanvasText"},".cm-searchMatch":{backgroundColor:"color-mix(in srgb, #f2cc60 40%, transparent)"},".cm-searchMatch-selected":{backgroundColor:"color-mix(in srgb, #f2cc60 75%, transparent)"}}),T.updateListener.of(a=>{a.docChanged&&!this.changing&&i(a.state.doc.toString()),a.selectionSet&&!this.silent&&!this.changing&&a.view.hasFocus&&(a.state.field(oe.revealed)!==null&&queueMicrotask(()=>this.view.dispatch({effects:oe.REVEAL.of(null)})),r.caretMoved?.(oi.at(a.state,a.state.selection.main.head)))})]})}get text(){return this.view.state.doc.toString()}set text(e){this.replaceText(e,!1)}replaceText(e,t){const i=this.view.state.doc.toString();if(e!==i){this.changing=!0;try{const n=Math.min(this.view.state.selection.main.head,e.length);this.view.dispatch({changes:{from:0,to:i.length,insert:e},selection:{anchor:n},annotations:Lc.of("full")})}finally{this.changing=!1}t&&this.revealChange(i,oe.MOST_LINES_SHOWN)}}static MOST_LINES_SHOWN=120;gotoChange(e){const t=[...this.view.state.field(this.changedField).changed].sort((c,f)=>c-f);if(t.length===0)return!1;const i=[];for(const c of t){const f=i[i.length-1];f!==void 0&&f.last===c-1?f.last=c:i.push({first:c,last:c})}const n=this.view.state.doc,r=n.lineAt(this.view.state.selection.main.head).number-1,o=i.find(c=>c.first<=r&&r<=c.last),l=e===1?i.find(c=>c.first>r)??i[0]:[...i].reverse().find(c=>c.first<(o?.first??r))??i[i.length-1],a=n.line(Math.min(l.first,n.lines-1)+1).from,h=n.line(Math.min(l.last,n.lines-1)+1).to;return this.view.dispatch({selection:{anchor:a,head:h},scrollIntoView:!0}),!0}markSaved(){this.view.dispatch({effects:oe.SET_BASELINE.of(this.view.state.doc.toString())})}openSearch(){this.view.focus(),xo(this.view)}reveal(e){const t=oi.range(this.view.state,e);if(t===void 0)return!1;this.silent=!0;try{this.view.dispatch({effects:oe.REVEAL.of(t)})}finally{this.silent=!1}return this.scrollTo(t.from),!0}scrollTo(e){const t=()=>{this.view.scrollDOM.scrollTop=Math.max(0,this.view.lineBlockAt(e).top-oe.SCROLL_MARGIN_PX)};t(),this.view.requestMeasure({read:()=>{},write:()=>requestAnimationFrame(t)})}static SCROLL_MARGIN_PX=24;get revealedText(){const e=this.view.state.field(oe.revealed);return e===null?void 0:this.view.state.doc.sliceString(e.from,e.to)}undo(e=!1){return this.step(Bo,e)}redo(e=!1){return this.step(ns,e)}get canUndo(){return gg(this.view.state)>0}get canRedo(){return yg(this.view.state)>0}step(e,t){const i=this.view.state.doc.toString();this.changing=!0;let n;try{n=e(this.view)}finally{this.changing=!1}return n&&t&&this.revealChange(i),n}revealChange(e,t=1/0){const i=this.view.state.doc,n=e.split(`
17
+ `)))}}}),i=T.decorations.compute([t],r=>{const o=new Ne;for(const l of[...r.field(t).changed].sort((a,h)=>a-h))l<r.doc.lines&&o.add(r.doc.line(l+1).from,r.doc.line(l+1).from,L.line({class:"cm-changed-line"}));return o.finish()}),n=mo({class:"cm-changed-gutter",lineMarker:(r,o)=>r.state.field(t).changed.has(r.state.doc.lineAt(o.from).number-1)?oe.CHANGED_MARKER:null,lineMarkerChange:r=>r.docChanged||r.transactions.some(o=>o.effects.some(l=>l.is(oe.SET_BASELINE))),initialSpacer:()=>oe.CHANGED_MARKER});return{field:t,extensions:[t,i,n]}}constructor(e,t,i,n,r={}){const o=[...X0,...y0,...Cg,...Wm,...wf,...Cy,...Yp,b0],l=oe.changeMarks(r.baseline??t);this.changedField=l.field,o.unshift({key:"F7",run:()=>this.gotoChange(1),preventDefault:!0},{key:"Shift-F7",run:()=>this.gotoChange(-1),preventDefault:!0}),this.view=new T({parent:e,doc:t,extensions:[...l.extensions,oe.revealed,Rp(),Np({top:!0}),F.phrases.of(r.phrases??{}),zm(),np(),dg(),Gd(),Tm(),Jm(),U0(),ny(),uo.of(o),F.tabSize.of(2),qm(oe.COLOURS,{fallback:!0}),by(),kf.data.of({autocomplete:new Di().source}),Ny(),Ty(gy()),T.contentAttributes.of({"aria-label":n}),T.theme({"&":{maxHeight:"28rem",fontSize:"0.82em",border:"1px solid color-mix(in srgb, currentColor 25%, transparent)",borderRadius:"4px"},"&.cm-focused":{outline:"2px solid color-mix(in srgb, currentColor 45%, transparent)"},".cm-scroller":{overflow:"auto",fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},".cm-tooltip":{backgroundColor:"Canvas",color:"CanvasText",border:"1px solid color-mix(in srgb, CanvasText 30%, transparent)"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"Highlight",color:"HighlightText"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"currentColor"},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground":{backgroundColor:"color-mix(in srgb, currentColor 22%, transparent)"},".cm-gutters":{backgroundColor:"transparent",color:"color-mix(in srgb, currentColor 55%, transparent)",border:"none"},".cm-changed-gutter":{width:"4px"},".cm-changed-bar":{width:"3px",height:"100%",backgroundColor:"#2f81f7"},".cm-changed-line":{backgroundColor:"color-mix(in srgb, #2f81f7 13%, transparent)"},".cm-revealed-line":{backgroundColor:"color-mix(in srgb, #f2cc60 30%, transparent)",boxShadow:"inset 3px 0 0 #f2cc60"},".cm-panels":{backgroundColor:"color-mix(in srgb, currentColor 6%, transparent)",color:"inherit",borderColor:"color-mix(in srgb, currentColor 25%, transparent)"},".cm-panel.cm-search input, .cm-panel.cm-search button":{fontSize:"inherit",color:"inherit"},".cm-panel.cm-search input[type=text], .cm-panel.cm-search input:not([type])":{backgroundColor:"color-mix(in srgb, currentColor 8%, transparent)",border:"1px solid color-mix(in srgb, currentColor 35%, transparent)",borderRadius:"3px",padding:"2px 5px"},".cm-panel.cm-search button":{backgroundImage:"none",backgroundColor:"color-mix(in srgb, currentColor 12%, transparent)",border:"1px solid color-mix(in srgb, currentColor 35%, transparent)",borderRadius:"3px"},".cm-panel.cm-search label, .cm-panel.cm-search [name=close]":{color:"inherit"},".cm-searchMatch":{backgroundColor:"color-mix(in srgb, #f2cc60 40%, transparent)"},".cm-searchMatch-selected":{backgroundColor:"color-mix(in srgb, #f2cc60 75%, transparent)"}}),T.updateListener.of(a=>{a.docChanged&&!this.changing&&i(a.state.doc.toString()),a.selectionSet&&!this.silent&&!this.changing&&a.view.hasFocus&&(a.state.field(oe.revealed)!==null&&queueMicrotask(()=>this.view.dispatch({effects:oe.REVEAL.of(null)})),r.caretMoved?.(oi.at(a.state,a.state.selection.main.head)))})]})}get text(){return this.view.state.doc.toString()}set text(e){this.replaceText(e,!1)}replaceText(e,t){const i=this.view.state.doc.toString();if(e!==i){this.changing=!0;try{const n=Math.min(this.view.state.selection.main.head,e.length);this.view.dispatch({changes:{from:0,to:i.length,insert:e},selection:{anchor:n},annotations:Lc.of("full")})}finally{this.changing=!1}t&&this.revealChange(i,oe.MOST_LINES_SHOWN)}}static MOST_LINES_SHOWN=120;gotoChange(e){const t=[...this.view.state.field(this.changedField).changed].sort((c,f)=>c-f);if(t.length===0)return!1;const i=[];for(const c of t){const f=i[i.length-1];f!==void 0&&f.last===c-1?f.last=c:i.push({first:c,last:c})}const n=this.view.state.doc,r=n.lineAt(this.view.state.selection.main.head).number-1,o=i.find(c=>c.first<=r&&r<=c.last),l=e===1?i.find(c=>c.first>r)??i[0]:[...i].reverse().find(c=>c.first<(o?.first??r))??i[i.length-1],a=n.line(Math.min(l.first,n.lines-1)+1).from,h=n.line(Math.min(l.last,n.lines-1)+1).to;return this.view.dispatch({selection:{anchor:a,head:h},scrollIntoView:!0}),!0}markSaved(){this.view.dispatch({effects:oe.SET_BASELINE.of(this.view.state.doc.toString())})}openSearch(){this.view.focus(),xo(this.view)}reveal(e){const t=oi.range(this.view.state,e);if(t===void 0)return!1;this.silent=!0;try{this.view.dispatch({effects:oe.REVEAL.of(t)})}finally{this.silent=!1}return this.scrollTo(t.from),!0}scrollTo(e){const t=()=>{this.view.scrollDOM.scrollTop=Math.max(0,this.view.lineBlockAt(e).top-oe.SCROLL_MARGIN_PX)};t(),this.view.requestMeasure({read:()=>{},write:()=>requestAnimationFrame(t)})}static SCROLL_MARGIN_PX=24;get revealedText(){const e=this.view.state.field(oe.revealed);return e===null?void 0:this.view.state.doc.sliceString(e.from,e.to)}undo(e=!1){return this.step(Bo,e)}redo(e=!1){return this.step(ns,e)}get canUndo(){return gg(this.view.state)>0}get canRedo(){return yg(this.view.state)>0}step(e,t){const i=this.view.state.doc.toString();this.changing=!0;let n;try{n=e(this.view)}finally{this.changing=!1}return n&&t&&this.revealChange(i),n}revealChange(e,t=1/0){const i=this.view.state.doc,n=e.split(`
18
18
  `),r=i.toString().split(`
19
19
  `);let o=0;for(;o<n.length&&o<r.length&&n[o]===r[o];)o++;let l=n.length,a=r.length;for(;l>o&&a>o&&n[l-1]===r[a-1];)l--,a--;if(a-o>t)return;const h=Math.min(o,i.lines-1)+1,c=Math.min(Math.max(h,a),i.lines),f={from:i.line(h).from,to:i.line(c).to};this.silent=!0;try{this.view.dispatch({effects:oe.REVEAL.of(f)})}finally{this.silent=!1}this.scrollTo(f.from)}get focused(){return this.view.hasFocus}destroy(){this.view.destroy()}}export{oe as SightingFileEditor};