@gjsify/gtksource-core 0.58.0 → 0.59.1
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/lib/esm/buffer.js +1 -1
- package/lib/esm/conformance.js +1 -1
- package/lib/esm/editor-session.js +2 -2
- package/lib/esm/gutter-paint-vectors.js +3 -1
- package/lib/esm/gutter-renderer.js +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/signal-stop-vectors.js +1 -0
- package/lib/esm/signals.js +1 -1
- package/lib/esm/view-vectors.js +1 -1
- package/lib/types/buffer.d.ts +1 -0
- package/lib/types/conformance.d.ts +1 -0
- package/lib/types/editor-driver.d.ts +28 -7
- package/lib/types/editor-session.d.ts +8 -4
- package/lib/types/gutter-renderer.d.ts +7 -2
- package/lib/types/index.d.ts +1 -0
- package/lib/types/signal-stop-vectors.d.ts +54 -0
- package/lib/types/signal-stop-vectors.gjs.spec.d.ts +2 -0
- package/lib/types/signal-stop-vectors.spec.d.ts +2 -0
- package/lib/types/signals.d.ts +25 -4
- package/lib/types/view-vectors.d.ts +1 -0
- package/package.json +4 -4
package/lib/esm/buffer.js
CHANGED
|
@@ -2,4 +2,4 @@ import"./_virtual/_rolldown/runtime.js";import{SignalEmitter as e}from"./signals
|
|
|
2
2
|
`)),this.highlight=r!==!1&&String(r)!==`false`}get text(){return this.lines.join(`
|
|
3
3
|
`)}set text(e){this.recording=!1;try{this.replace(0,this.length,e??``),this.placeCursor(this.length)}finally{this.recording=!0}this.undoStack=[],this.redoStack=[],this.open&&(this.open.edits.length=0),this.syncUndoState()}get length(){return this.offsetOfLine(this.lines.length-1)+this.lines[this.lines.length-1].length}get lineCount(){return this.lines.length}getLine(e){let t=this.lines[e];if(t===void 0)throw RangeError(`Buffer: line ${e} is outside 0..${this.lines.length-1}`);return t}getLines(){return[...this.lines]}offsetOfLine(e){if(e<0||e>=this.lines.length)throw RangeError(`Buffer: line ${e} is outside 0..${this.lines.length-1}`);for(;this.startsValidTo<=e;){let e=this.startsValidTo-1;this.lineStarts[this.startsValidTo]=this.lineStarts[e]+this.lines[e].length+1,this.startsValidTo++}return this.lineStarts[e]}lineOfOffset(e){this.checkOffset(e);let t=0,n=this.lines.length-1;for(;t<n;){let r=t+n+1>>1;this.offsetOfLine(r)<=e?t=r:n=r-1}return t}getText(e=0,t=this.length){if(this.checkOffset(e),this.checkOffset(t),e>t)throw RangeError(`Buffer: range ${e}..${t} is reversed`);return this.text.slice(e,t)}insert(e,t){this.replace(e,e,t)}delete(e,t){if(typeof e==`number`&&typeof t==`number`){this.replace(e,t,``);return}let n=typeof e==`number`?e:this.ownIter(e,`delete`),r=typeof t==`number`?t:this.ownIter(t,`delete`);this.replace(Math.min(n,r),Math.max(n,r),``)}replace(e,t,n){if(this.checkOffset(e),this.checkOffset(t),e>t)throw RangeError(`Buffer: range ${e}..${t} is reversed`);let r=this.lineOfOffset(e),i=this.lineOfOffset(t),a=this.offsetOfLine(r),o=this.offsetOfLine(i),s=this.lines.slice(r,i+1).join(`
|
|
4
4
|
`).slice(e-a,t-a);if(s===``&&n===``)return;let c=(this.lines[r].slice(0,e-a)+n+this.lines[i].slice(t-o)).split(`
|
|
5
|
-
`);this.lines.splice(r,i-r+1,...c),this.startsValidTo=Math.min(this.startsValidTo,r+1);let l=this.cursor,shift=r=>r>=t?r-s.length+n.length:r>e?e+n.length:r;this.cursor=shift(this.cursor),this.bound=shift(this.bound);let u={start:e,removedText:s,insertedText:n,firstLine:r,removedLines:i-r+1,insertedLines:c.length};this.record(u,l),this.emit(`changed`,u),this.cursor!==l&&this.emit(`notify::cursor-position`),this.emit(`cursor-moved`)}get cursorPosition(){return this.cursor}get cursor_position(){return new t(this,this.cursor).get_offset()}get selectionBoundPosition(){return this.bound}selectRange(e,t){this.checkOffset(e),this.checkOffset(t),e!==this.cursor&&this.moveInsert(e),t!==this.bound&&this.moveBound(t)}placeCursor(e){this.selectRange(e,e)}moveInsert(e){this.cursor=e,this.emit(`mark-set`,new t(this,e),this.insertMark)
|
|
5
|
+
`);this.lines.splice(r,i-r+1,...c),this.startsValidTo=Math.min(this.startsValidTo,r+1);let l=this.cursor,shift=r=>r>=t?r-s.length+n.length:r>e?e+n.length:r;this.cursor=shift(this.cursor),this.bound=shift(this.bound);let u={start:e,removedText:s,insertedText:n,firstLine:r,removedLines:i-r+1,insertedLines:c.length};this.record(u,l),this.emit(`changed`,u),this.cursor!==l&&this.emit(`notify::cursor-position`),this.emit(`cursor-moved`)}get cursorPosition(){return this.cursor}get cursor_position(){return new t(this,this.cursor).get_offset()}get selectionBoundPosition(){return this.bound}selectRange(e,t){this.checkOffset(e),this.checkOffset(t),e!==this.cursor&&this.moveInsert(e),t!==this.bound&&this.moveBound(t)}placeCursor(e){this.selectRange(e,e)}moveInsert(e){this.cursor=e,this.emit(`mark-set`,new t(this,e),this.insertMark)}moveBound(e){this.bound=e,this.emit(`mark-set`,new t(this,e),this.boundMark)}get_insert(){return this.insertMark}get_selection_bound(){return this.boundMark}get_start_iter(){return new t(this,0)}get_end_iter(){return new t(this,this.length)}get_selection_bounds(){let e=Math.min(this.cursor,this.bound),n=Math.max(this.cursor,this.bound);return[e!==n,new t(this,e),new t(this,n)]}get_text(e,t,n){let r=this.ownIter(e,`get_text`),i=this.ownIter(t,`get_text`);return this.getText(Math.min(r,i),Math.max(r,i))}move_mark(e,t){let n=this.ownIter(t,`move_mark`);if(e===this.insertMark)this.moveInsert(n);else if(e===this.boundMark)this.moveBound(n);else throw Error(`GtkSource.Buffer.move_mark: only the 'insert' and 'selection_bound' marks exist`)}insert_at_cursor(e,t){if(t!==-1)throw Error(`GtkSource.Buffer.insert_at_cursor: only len -1 is implemented`);this.insert(this.cursor,e)}set_language(e){this.language=e}set_style_scheme(e){this.styleScheme=e}begin_user_action(){this.depth++>0||(this.open={edits:[],before:this.cursor},this.emit(`begin-user-action`))}end_user_action(){if(this.depth===0||--this.depth>0)return;let e=this.open;this.open=null,e&&e.edits.length>0&&this.push(e),this.emit(`end-user-action`)}get can_undo(){return this.undoStack.length>0}get can_redo(){return this.redoStack.length>0}undo(){let e=this.depth===0?this.undoStack.pop():void 0;e&&(this.emit(`undo`),this.applyHistory(()=>{for(let t of[...e.edits].reverse())this.replace(t.start,t.start+t.insertedText.length,t.removedText)}),this.moveInsert(e.before),this.moveBound(e.before),this.redoStack.push(e),this.syncUndoState())}redo(){let e=this.depth===0?this.redoStack.pop():void 0;if(!e)return;this.emit(`redo`),this.applyHistory(()=>{for(let t of e.edits)this.replace(t.start,t.start+t.removedText.length,t.insertedText)});let t=e.edits[e.edits.length-1],n=t.start+t.insertedText.length;this.moveInsert(n),this.moveBound(n),this.undoStack.push(e),this.syncUndoState()}applyHistory(e){this.recording=!1;try{e()}finally{this.recording=!0}}record(e,t){this.recording&&(this.redoStack=[],this.open?this.open.edits.push(e):this.push({edits:[e],before:t}))}push(e){this.undoStack.push(e),this.syncUndoState()}syncUndoState(){let e=this.can_undo,t=this.can_redo,n=e!==this.reportedUndo,r=t!==this.reportedRedo;this.reportedUndo=e,this.reportedRedo=t,n&&this.emit(`notify::can-undo`),r&&this.emit(`notify::can-redo`)}classHandler(e,t){e===`mark-set`&&t[1]===this.insertMark&&(this.emit(`cursor-moved`),this.emit(`notify::cursor-position`))}checkSignal(e){if(!r.has(e))throw Error(`GtkSource.Buffer: signal '${e}' is not implemented`)}ownIter(e,n){if(!(e instanceof t)||e.source!==this)throw TypeError(`GtkSource.Buffer.${n}: the iterator belongs to another buffer`);return e.utf16Offset}get language(){return this.lang}set language(e){e!==this.lang&&(this.lang=e,this.emit(`notify::language`))}get styleScheme(){return this.scheme}set styleScheme(e){e!==this.scheme&&(this.scheme=e,this.emit(`notify::style-scheme`))}get highlightSyntax(){return this.highlight}set highlightSyntax(e){e!==this.highlight&&(this.highlight=e,this.emit(`notify::highlight-syntax`))}checkOffset(e){if(!Number.isInteger(e)||e<0||e>this.length)throw RangeError(`Buffer: offset ${e} is outside 0..${this.length}`)}};export{GtkSourceBuffer as Buffer,GtkSourceBuffer,t as TextIter,n as TextMark};
|
package/lib/esm/conformance.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GTKSOURCE_BUFFER_VECTORS as e}from"./buffer-vectors.js";import{GTKSOURCE_INIT_VECTORS as t}from"./init-vectors.js";import{GTKSOURCE_MANAGER_VECTORS as n}from"./managers-vectors.js";import{GTKSOURCE_VIEW_DEFAULT_VECTORS as r,GTKSOURCE_VIEW_SURFACE_VECTORS as i}from"./view-vectors.js";import{GUTTER_PAINT_VECTORS as a}from"./gutter-paint-vectors.js";export{e as GTKSOURCE_BUFFER_VECTORS,t as GTKSOURCE_INIT_VECTORS,n as GTKSOURCE_MANAGER_VECTORS,r as GTKSOURCE_VIEW_DEFAULT_VECTORS,i as GTKSOURCE_VIEW_SURFACE_VECTORS,a as GUTTER_PAINT_VECTORS};
|
|
1
|
+
import{GTKSOURCE_BUFFER_VECTORS as e}from"./buffer-vectors.js";import{GTKSOURCE_INIT_VECTORS as t}from"./init-vectors.js";import{GTKSOURCE_MANAGER_VECTORS as n}from"./managers-vectors.js";import{GTKSOURCE_VIEW_DEFAULT_VECTORS as r,GTKSOURCE_VIEW_SURFACE_VECTORS as i}from"./view-vectors.js";import{GUTTER_PAINT_VECTORS as a}from"./gutter-paint-vectors.js";import{GTKSOURCE_STOP_VECTORS as o}from"./signal-stop-vectors.js";export{e as GTKSOURCE_BUFFER_VECTORS,t as GTKSOURCE_INIT_VECTORS,n as GTKSOURCE_MANAGER_VECTORS,o as GTKSOURCE_STOP_VECTORS,r as GTKSOURCE_VIEW_DEFAULT_VECTORS,i as GTKSOURCE_VIEW_SURFACE_VECTORS,a as GUTTER_PAINT_VECTORS};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{SignalEmitter as e}from"./signals.js";import{
|
|
2
|
-
`){let t=leadingWhitespace(this.current.getLine(this.current.lineOfOffset(e)));t!==``&&(this.current.insert(e+1,t),this.driver.setSelection(this.current.cursorPosition,this.current.cursorPosition))}}}onNativeSelection(e,t){if(this.mirroring)return;let clamp=e=>Math.min(Math.max(0,e),this.current.length);this.fromNative=!0;try{this.current.selectRange(clamp(t),clamp(e))}finally{this.fromNative=!1}}setProp(e,t,n){this.props[e]!==t&&(this.props[e]=t,this.emit(`notify::${n}`),this.pushLayout())}pushLayout(){let{props:e}=this;this.driver.setLayout({showLineNumbers:e.showLineNumbers,monospace:e.monospace,editable:e.editable,highlightCurrentLine:e.highlightCurrentLine,cursorVisible:e.cursorVisible,leftMargin:e.leftMargin,rightMargin:e.rightMargin,topMargin:e.topMargin,bottomMargin:e.bottomMargin})}get autoIndent(){return this.props.autoIndent}set autoIndent(e){this.setProp(`autoIndent`,e,`auto-indent`)}get indentWidth(){return this.props.indentWidth}set indentWidth(e){this.setProp(`indentWidth`,e,`indent-width`)}get showLineNumbers(){return this.props.showLineNumbers}set showLineNumbers(e){this.setProp(`showLineNumbers`,e,`show-line-numbers`)}get monospace(){return this.props.monospace}set monospace(e){this.setProp(`monospace`,e,`monospace`)}get editable(){return this.props.editable}set editable(e){this.setProp(`editable`,e,`editable`)}get highlightCurrentLine(){return this.props.highlightCurrentLine}set highlightCurrentLine(e){this.setProp(`highlightCurrentLine`,e,`highlight-current-line`)}get cursorVisible(){return this.props.cursorVisible}set cursorVisible(e){this.setProp(`cursorVisible`,e,`cursor-visible`)}get leftMargin(){return this.props.leftMargin}set leftMargin(e){this.setProp(`leftMargin`,e,`left-margin`)}get rightMargin(){return this.props.rightMargin}set rightMargin(e){this.setProp(`rightMargin`,e,`right-margin`)}get topMargin(){return this.props.topMargin}set topMargin(e){this.setProp(`topMargin`,e,`top-margin`)}get bottomMargin(){return this.props.bottomMargin}set bottomMargin(e){this.setProp(`bottomMargin`,e,`bottom-margin`)}setColorScheme(e){this.variant=e,this.controller.setColorScheme(e)}dispose(){for(let e of this.bufferHandlers.splice(0))this.current.disconnect(e);this.controller.dispose()}};export{EditorSession,leadingWhitespace};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{SignalEmitter as e}from"./signals.js";import{TextIter as t}from"./text-iter.js";import{Buffer as n}from"./buffer.js";import{GutterLines as r,GutterRendererText as i,parseMarkup as a}from"./gutter-renderer.js";import{StyleSchemeManager as o}from"./style-scheme.js";import{HighlightController as s}from"./highlight-controller.js";function leadingWhitespace(e){return/^[ \t]*/.exec(e)[0]}function cellOf(e){if(!(e instanceof i))return{text:``,runs:null};if(e.markup!==null){let t=a(e.markup);return{text:t.map(e=>e.text).join(``),runs:t}}return{text:e.text??``,runs:null}}var EditorSession=class extends e{constructor(e,t=o.getDefault(),r=`light`){super(),this.driver=e,this.schemes=t,this.bufferHandlers=[],this.mirroring=!1,this.fromNative=!1,this.gutters=null,this.defaultRan=!1,this.props={autoIndent:!1,indentWidth:-1,showLineNumbers:!1,monospace:!1,editable:!0,highlightCurrentLine:!1,cursorVisible:!0,leftMargin:0,rightMargin:0,topMargin:0,bottomMargin:0},this.variant=r,e.bind(this),this.attach(new n)}get buffer(){return this.current}set buffer(e){e!==this.current&&(this.attach(e),this.emit(`notify::buffer`))}attach(e){if(this.current){for(let e of this.bufferHandlers.splice(0))this.current.disconnect(e);this.controller.dispose()}this.current=e,this.bufferHandlers.push(e.connect(`changed`,(e,t)=>this.onBufferChanged(t)),e.connect(`mark-set`,()=>this.onBufferCursor())),this.mirroring=!0;try{this.driver.setText(e.text)}finally{this.mirroring=!1}this.controller=new s(e,this.driver,this.schemes,this.variant),this.driver.setLineCount(e.lineCount),this.driver.setSelection(e.cursorPosition,e.cursorPosition),this.pushLayout()}onBufferChanged(e){if(!this.fromNative){this.mirroring=!0;try{this.driver.replaceRange(e.start,e.start+e.removedText.length,e.insertedText)}finally{this.mirroring=!1}}e.insertedLines!==e.removedLines&&this.driver.setLineCount(this.current.lineCount)}onBufferCursor(){this.fromNative||this.mirroring||this.driver.setSelection(this.current.selectionBoundPosition,this.current.cursorPosition)}bindGutters(e){this.gutters=e;let t=this.driver.gutterSides??[3];e.watch(()=>this.driver.invalidateGutter(),e=>{if(!t.includes(e.window_type))throw Error(`GtkSource.Gutter: this platform does not paint the ${e.window_type===4?`RIGHT`:`LEFT`} gutter (ADR 0103)`)})}renderersOf(e){let t=this.gutters?.get(e);return{renderers:t?.renderers??[],positions:t?.positions??[]}}metricsOf(e,t){return{position:t,widthRequest:e.width_request,marginStart:e.margin_start,marginEnd:e.margin_end}}gutterColumns(e=3){let{renderers:t,positions:n}=this.renderersOf(e);return t.map((e,t)=>this.metricsOf(e,n[t]))}queryGutter(e,t,n=3){let{renderers:i,positions:a}=this.renderersOf(n);if(i.length===0||this.gutters===null)return[];let o=new r(this.gutters.view,this.current,e,t);return i.map((n,r)=>{let i=n.vfunc_query_data,s=[];for(let r=e;r<=t;r++)i?.call(n,o,r),s.push(cellOf(n));return{...this.metricsOf(n,a[r]),cells:s}})}onNativeEdit(e,t,n){if(!this.mirroring){this.fromNative=!0,this.current.begin_user_action();try{this.current.replace(e,e+t,n)}finally{this.fromNative=!1,this.current.end_user_action()}if(this.props.autoIndent&&n===`
|
|
2
|
+
`){let t=leadingWhitespace(this.current.getLine(this.current.lineOfOffset(e)));t!==``&&(this.current.insert(e+1,t),this.driver.setSelection(this.current.cursorPosition,this.current.cursorPosition))}}}onNativeSelection(e,t){if(this.mirroring)return;let clamp=e=>Math.min(Math.max(0,e),this.current.length);this.fromNative=!0;try{this.current.selectRange(clamp(t),clamp(e))}finally{this.fromNative=!1}(this.current.cursorPosition!==clamp(t)||this.current.selectionBoundPosition!==clamp(e))&&this.onBufferCursor()}onNativeExtendSelection(e,n){let r=this.current,i=Math.min(Math.max(0,n),r.length),a=new t(r,i),o=new t(r,i);this.defaultRan=!1;let s=this.emitHandled(`extend-selection`,e,new t(r,i),a,o);return this.defaultRan?null:s?[a.utf16Offset,o.utf16Offset]:[i,i]}onNativeCopy(){return this.defaultRan=!1,this.emit(`copy-clipboard`),this.defaultRan}classHandler(e){if(!(e!==`extend-selection`&&e!==`copy-clipboard`))return e===`copy-clipboard`&&this.driver.copySelection?.(),this.defaultRan=!0,!0}setProp(e,t,n){this.props[e]!==t&&(this.props[e]=t,this.emit(`notify::${n}`),this.pushLayout())}pushLayout(){let{props:e}=this;this.driver.setLayout({showLineNumbers:e.showLineNumbers,monospace:e.monospace,editable:e.editable,highlightCurrentLine:e.highlightCurrentLine,cursorVisible:e.cursorVisible,leftMargin:e.leftMargin,rightMargin:e.rightMargin,topMargin:e.topMargin,bottomMargin:e.bottomMargin})}get autoIndent(){return this.props.autoIndent}set autoIndent(e){this.setProp(`autoIndent`,e,`auto-indent`)}get indentWidth(){return this.props.indentWidth}set indentWidth(e){this.setProp(`indentWidth`,e,`indent-width`)}get showLineNumbers(){return this.props.showLineNumbers}set showLineNumbers(e){this.setProp(`showLineNumbers`,e,`show-line-numbers`)}get monospace(){return this.props.monospace}set monospace(e){this.setProp(`monospace`,e,`monospace`)}get editable(){return this.props.editable}set editable(e){this.setProp(`editable`,e,`editable`)}get highlightCurrentLine(){return this.props.highlightCurrentLine}set highlightCurrentLine(e){this.setProp(`highlightCurrentLine`,e,`highlight-current-line`)}get cursorVisible(){return this.props.cursorVisible}set cursorVisible(e){this.setProp(`cursorVisible`,e,`cursor-visible`)}get leftMargin(){return this.props.leftMargin}set leftMargin(e){this.setProp(`leftMargin`,e,`left-margin`)}get rightMargin(){return this.props.rightMargin}set rightMargin(e){this.setProp(`rightMargin`,e,`right-margin`)}get topMargin(){return this.props.topMargin}set topMargin(e){this.setProp(`topMargin`,e,`top-margin`)}get bottomMargin(){return this.props.bottomMargin}set bottomMargin(e){this.setProp(`bottomMargin`,e,`bottom-margin`)}setColorScheme(e){this.variant=e,this.controller.setColorScheme(e)}dispose(){for(let e of this.bufferHandlers.splice(0))this.current.disconnect(e);this.controller.dispose()}};export{EditorSession,leadingWhitespace};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";let e=0;function recording(t){let n=[];class Recorder extends t.GtkSource.GutterRendererText{vfunc_query_data(e,t){n.push({line:t,first:e.get_first(),last:e.get_last(),cursor:e.is_cursor(t)}),this.text=`#${t}`}}return{renderer:new(t.GObject.registerClass({GTypeName:`GoVecRecorder${++e}`},Recorder))({width_request:40}),queries:n}}function firstPass(e){let t=[];for(let n of e){if(t.includes(n.line))break;t.push(n.line)}return t}async function shown(e,t,n,r=0){let
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";let e=0;function recording(t){let n=[];class Recorder extends t.GtkSource.GutterRendererText{vfunc_query_data(e,t){n.push({line:t,first:e.get_first(),last:e.get_last(),cursor:e.is_cursor(t)}),this.text=`#${t}`}}return{renderer:new(t.GObject.registerClass({GTypeName:`GoVecRecorder${++e}`},Recorder))({width_request:40}),queries:n}}function firstPass(e){let t=[];for(let n of e){if(t.includes(n.line))break;t.push(n.line)}return t}async function shown(e,t,n,r=0,i=3){let a=new e.GtkSource.View;a.buffer.text=n;let o=a.get_gutter(i),{renderer:s,queries:c}=recording(e);return o.insert(s,r),await t.present(a),{view:a,gutter:o,renderer:s,queries:c}}function numbered(t){class Numbered extends t.GtkSource.GutterRendererText{constructor(...e){super(...e),this.seen=[]}get start_value(){return this.stored??0}set start_value(e){this.stored=e,this.queue_draw()}vfunc_query_data(e,t){this.text=String(this.start_value+t),this.seen.push([t,this.text])}}let{ParamSpec:n,ParamFlags:r}=t.GObject;return t.GObject.registerClass({GTypeName:`GoVecNumbered${++e}`,Properties:{"start-value":n.uint(`start-value`,``,``,r.READWRITE,0,1e3,0)}},Numbered)}const t=[{rule:`the RIGHT gutter asks its renderers per visible line, with the visible range and the cursor line`,paints:!0,async observe(e,t){let{queries:n}=await shown(e,t,`a
|
|
2
|
+
b
|
|
3
|
+
c`,0,4),r=n.slice(0,firstPass(n).length);return{right:r.map(e=>e.line),cursor:r.map(e=>e.cursor)}},shows:{right:[0,1,2],cursor:[!1,!1,!0]}},{rule:`vfunc_query_data runs once per visible line, in order, with the visible range and the cursor line`,paints:!0,unlocks:[`GtkSource.GutterRenderer.vfunc_query_data`],async observe(e,t){let{queries:n}=await shown(e,t,`a
|
|
2
4
|
b
|
|
3
5
|
c`),r=n.slice(0,firstPass(n).length);return{lines:r.map(e=>e.line),range:[r[0]?.first,r[0]?.last],cursor:r.map(e=>e.cursor)}},shows:{lines:[0,1,2],range:[0,2],cursor:[!1,!1,!0]}},{rule:`queue_draw on the renderer and on the gutter, however often, costs one more pass`,paints:!0,async observe(e,t){let{renderer:n,gutter:r,queries:i}=await shown(e,t,`a
|
|
4
6
|
b
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";import{GIR_TYPE as e,GObjectObject as t}from"@gjsify/adwaita-core";const n=3,r=[[`margin_start`,`marginStart`,0],[`margin_end`,`marginEnd`,0],[`width_request`,`widthRequest`,-1],[`focusable`,`focusable`,!1],[`focus_on_click`,`focusOnClick`,!0]],
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{GIR_TYPE as e,GObjectObject as t}from"@gjsify/adwaita-core";const n=3,r=4,i=[[`margin_start`,`marginStart`,0],[`margin_end`,`marginEnd`,0],[`width_request`,`widthRequest`,-1],[`focusable`,`focusable`,!1],[`focus_on_click`,`focusOnClick`,!0]],a=new Set(i.map(([e])=>e));function snakeCase(e){return e.replace(/-/g,`_`).replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}function byteSlice(e,t){if(t<0)return e;let n=0,r=0;for(let i of e){let e=i.codePointAt(0),a=e<128?1:e<2048?2:e<65536?3:4;if(n+a>t)break;n+=a,r+=i.length}return e.slice(0,r)}const o=new WeakMap;function stateOf(e){let t=o.get(e);return t===void 0&&(t={owner:null,widget:new Map(i.map(([e,,t])=>[e,t]))},o.set(e,t)),t}var s=class GutterRenderer extends t{static{this[e]=`GtkSource.GutterRenderer`}constructor(e={}){let t={},n={};for(let[r,i]of Object.entries(e))(a.has(snakeCase(r))?t:n)[r]=i;if(super(n),new.target===GutterRenderer)throw TypeError(`Cannot instantiate abstract type GtkSourceGutterRenderer`);for(let[e,n]of Object.entries(t))this[e]=n}get_view(){return stateOf(this).owner?.get_view()??null}get view(){return this.get_view()}queue_draw(){stateOf(this).owner?.queue_draw()}attach(e){stateOf(this).owner=e}widgetProperty(e,t){let n=stateOf(this);return t!==void 0&&n.widget.get(e)!==t&&(n.widget.set(e,t),n.owner?.queue_draw()),n.widget.get(e)}};for(let[e,t]of i)for(let n of new Set([e,t]))Object.defineProperty(s.prototype,n,{get(){return this.widgetProperty(e)},set(t){this.widgetProperty(e,t)},enumerable:!0});var GutterRendererText=class extends s{constructor(e={}){let{text:t,markup:n,...r}=e;super(r),t!==void 0&&(this.text=t),n!==void 0&&(this.markup=n)}get text(){return this.plain??null}set text(e){this.plain=e,this.marked=null}get markup(){return this.marked??null}set markup(e){this.marked=e,this.plain=null}set_text(e,t){this.text=byteSlice(e,t)}set_markup(e,t){this.markup=byteSlice(e,t)}},GutterLines=class{constructor(e,t,n,r){this.owner=e,this.text=t,this.first=n,this.last=r}get_first(){return this.first}get_last(){return this.last}get_buffer(){return this.text}get_view(){return this.owner}is_cursor(e){return this.text.lineOfOffset(this.text.cursorPosition)===e}},Gutter=class{constructor(e,t,n=()=>{},r=()=>{}){this.owner=e,this.window_type=t,this.listener=n,this.guard=r,this.placed=[]}get_view(){return this.owner}get view(){return this.owner}insert(e,t){return e.get_view()===null?(this.guard(this),e.attach(this),this.placed.push({renderer:e,position:t}),this.sort(),this.queue_draw(),!0):!1}remove(e){let t=this.placed.findIndex(t=>t.renderer===e);t<0||(this.placed.splice(t,1),e.attach(null),this.queue_draw())}reorder(e,t){let n=this.placed.find(t=>t.renderer===e);n!==void 0&&(n.position=t,this.sort(),this.queue_draw())}queue_draw(){this.listener(this)}get renderers(){return this.placed.map(e=>e.renderer)}get positions(){return this.placed.map(e=>e.position)}sort(){this.placed.sort((e,t)=>e.position-t.position)}},GutterSet=class{constructor(e){this.view=e,this.gutters=new Map,this.listener=()=>{},this.guard=()=>{}}watch(e,t=()=>{}){this.listener=e,this.guard=t}get(e){if(e!==3&&e!==4)return null;let t=this.gutters.get(e);return t===void 0&&(t=new Gutter(this.view,e,e=>this.listener(e),e=>this.guard(e)),this.gutters.set(e,t)),t}};const c={amp:`&`,lt:`<`,gt:`>`,quot:`"`,apos:`'`},l={b:`bold`,i:`italic`,u:`underline`,s:`strikethrough`};function parseMarkup(e){let t=[],n=[],r=/<(\/?)([a-zA-Z]+)[^>]*>|([^<]+)/g;for(let i=r.exec(e);i!==null;i=r.exec(e)){if(i[3]===void 0){if(i[1]===`/`){let e=n.lastIndexOf(i[2]);e>=0&&n.splice(e,1)}else i[0].endsWith(`/>`)||n.push(i[2]);continue}let e=i[3].replace(/&(amp|lt|gt|quot|apos);/g,(e,t)=>c[t]),styled=e=>n.some(t=>l[t]===e);t.push({text:e,bold:styled(`bold`),italic:styled(`italic`),underline:styled(`underline`),strikethrough:styled(`strikethrough`)})}return t}export{Gutter,GutterLines,s as GutterRenderer,GutterRendererText,GutterSet,n as WINDOW_LEFT,r as WINDOW_RIGHT,parseMarkup};
|
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SignalEmitter as e}from"./signals.js";import{TextIter as t,TextMark as n}from"./text-iter.js";import{Buffer as r}from"./buffer.js";import{toBoolean as i,toNumber as a}from"./coerce.js";import{parseColor as o}from"./color.js";import"./editor-driver.js";import{Gutter as s,GutterLines as c,GutterRenderer as l,GutterRendererText as u,GutterSet as d,WINDOW_LEFT as f,parseMarkup as
|
|
1
|
+
import{SignalEmitter as e}from"./signals.js";import{TextIter as t,TextMark as n}from"./text-iter.js";import{Buffer as r}from"./buffer.js";import{toBoolean as i,toNumber as a}from"./coerce.js";import{parseColor as o}from"./color.js";import"./editor-driver.js";import{Gutter as s,GutterLines as c,GutterRenderer as l,GutterRendererText as u,GutterSet as d,WINDOW_LEFT as f,WINDOW_RIGHT as p,parseMarkup as m}from"./gutter-renderer.js";import{UnsupportedRegexError as h,translateRegex as g}from"./regex.js";import{XmlParseError as _,childElements as v,decodeEntities as y,parseXml as b,textContent as x}from"./xml.js";import{keywordPattern as S,parseLanguage as C}from"./lang.js";import{INITIAL_STATE as w,Tokenizer as T,schemeStyleName as E}from"./tokenizer.js";import{IncrementalHighlighter as D,sameState as O}from"./highlighter.js";import{parseStyleScheme as k,resolveStyle as A}from"./style.js";import{FALLBACK_DARK_ID as j,FALLBACK_LIGHT_ID as M,fallbackDarkScheme as N,fallbackLightScheme as P}from"./fallback-schemes.js";import{StyleScheme as F,StyleSchemeManager as I,paletteOf as L}from"./style-scheme.js";import{TokenStyler as R}from"./token-styler.js";import{HighlightController as z}from"./highlight-controller.js";import{EditorSession as B,leadingWhitespace as V}from"./editor-session.js";import{digitCount as H,emphasisedLine as U,gutterWidth as W,visibleLines as G}from"./gutter.js";import"./types.js";import{Language as K,LanguageManager as q}from"./language-manager.js";import{LineStore as J}from"./line-store.js";import{init as Y}from"./init.js";import{STOP_EMISSION as X}from"@gjsify/adwaita-core";export{r as Buffer,r as GtkSourceBuffer,B as EditorSession,j as FALLBACK_DARK_ID,M as FALLBACK_LIGHT_ID,s as Gutter,c as GutterLines,l as GutterRenderer,u as GutterRendererText,d as GutterSet,z as HighlightController,w as INITIAL_STATE,D as IncrementalHighlighter,K as Language,q as LanguageManager,J as LineStore,X as STOP_EMISSION,e as SignalEmitter,F as StyleScheme,I as StyleSchemeManager,t as TextIter,n as TextMark,R as TokenStyler,T as Tokenizer,h as UnsupportedRegexError,f as WINDOW_LEFT,p as WINDOW_RIGHT,_ as XmlParseError,v as childElements,y as decodeEntities,H as digitCount,U as emphasisedLine,N as fallbackDarkScheme,P as fallbackLightScheme,W as gutterWidth,Y as init,S as keywordPattern,V as leadingWhitespace,L as paletteOf,o as parseColor,C as parseLanguage,m as parseMarkup,k as parseStyleScheme,b as parseXml,A as resolveStyle,O as sameState,E as schemeStyleName,x as textContent,i as toBoolean,a as toNumber,g as translateRegex,G as visibleLines};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";const bufferOf=e=>{let t=new e.GtkSource.Buffer;return t.text=`hello world`,t},viewOf=e=>{let t=new e.GtkSource.View;return t.buffer=bufferOf(e),t},iterAt=(e,t)=>{let n=e.get_start_iter();return n.set_offset(t),n},e=[{rule:`stopping mark-set skips later handlers, the default (cursor-moved) and connect_after ones`,view:!1,observe:e=>{let t=bufferOf(e),n=[];return t.connect(`mark-set`,(t=>{n.push(`first`),e.GObject.signal_stop_emission_by_name(t,`mark-set`)})),t.connect(`mark-set`,(()=>n.push(`second`))),t.connect_after(`mark-set`,(()=>n.push(`after`))),t.connect(`cursor-moved`,(()=>n.push(`cursor-moved`))),t.move_mark(t.get_insert(),iterAt(t,3)),n},shows:[`first`]},{rule:`a stop ends that emission only: the next mark-set runs the default and every handler`,view:!1,observe:e=>{let t=bufferOf(e),n=[],r=!0;return t.connect(`mark-set`,(t=>{n.push(`first`),r&&e.GObject.signal_stop_emission_by_name(t,`mark-set`)})),t.connect(`mark-set`,(()=>n.push(`second`))),t.connect(`cursor-moved`,(()=>n.push(`cursor-moved`))),t.connect_after(`mark-set`,(()=>n.push(`after`))),t.move_mark(t.get_insert(),iterAt(t,3)),r=!1,t.move_mark(t.get_insert(),iterAt(t,4)),n},shows:[`first`,`first`,`second`,`cursor-moved`,`after`]},{rule:`without a stop the default runs between the plain and the connect_after handlers`,view:!1,observe:e=>{let t=bufferOf(e),n=[];return t.connect_after(`mark-set`,(()=>n.push(`after`))),t.connect(`cursor-moved`,(()=>n.push(`cursor-moved`))),t.connect(`mark-set`,(()=>n.push(`plain`))),t.move_mark(t.get_insert(),iterAt(t,3)),n},shows:[`plain`,`cursor-moved`,`after`]},{rule:`a handler that moves the mark itself, then stops, stops the outer emission only (Learn6502)`,view:!1,observe:e=>{let t=bufferOf(e),n=[];return t.connect(`mark-set`,((t,r,i)=>{n.push(`first:${r.get_offset()}`),r.get_offset()!==0&&(r.set_offset(0),t.move_mark(i,r),e.GObject.signal_stop_emission_by_name(t,`mark-set`))})),t.connect(`mark-set`,((e,t)=>n.push(`second:${t.get_offset()}`))),t.connect(`cursor-moved`,(()=>n.push(`cursor-moved`))),t.move_mark(t.get_insert(),iterAt(t,5)),n},shows:[`first:5`,`first:0`,`second:0`,`cursor-moved`]},{rule:`stopping mark-set of the selection_bound mark skips its later handlers too`,view:!1,observe:e=>{let t=bufferOf(e),n=[];return t.connect(`mark-set`,((t,r,i)=>{n.push(`first:${i.name}`),e.GObject.signal_stop_emission_by_name(t,`mark-set`)})),t.connect_after(`mark-set`,(()=>n.push(`after`))),t.move_mark(t.get_selection_bound(),iterAt(t,2)),n},shows:[`first:selection_bound`]},{rule:`stopping a signal without a default (cursor-moved) skips later and connect_after handlers`,view:!1,observe:e=>{let t=bufferOf(e),n=[];return t.connect(`cursor-moved`,(t=>{n.push(`first`),e.GObject.signal_stop_emission_by_name(t,`cursor-moved`)})),t.connect(`cursor-moved`,(()=>n.push(`second`))),t.connect_after(`cursor-moved`,(()=>n.push(`after`))),t.move_mark(t.get_insert(),iterAt(t,3)),n},shows:[`first`]},{rule:`a handler an earlier one disconnected during the emission does not run`,view:!1,observe:e=>{let t=bufferOf(e),n=[],r=0;return t.connect(`mark-set`,(e=>{n.push(`first`),e.disconnect(r)})),r=t.connect(`mark-set`,(()=>n.push(`second`))),t.move_mark(t.get_insert(),iterAt(t,3)),n},shows:[`first`]},{rule:`stopping with no emission in progress does nothing`,view:!1,observe:e=>{let t=bufferOf(e),n=[],r=console.warn;console.warn=()=>{};try{e.GObject.signal_stop_emission_by_name(t,`mark-set`)}finally{console.warn=r}return t.connect(`mark-set`,(()=>n.push(`plain`))),t.move_mark(t.get_insert(),iterAt(t,3)),n},shows:[`plain`]},{rule:`extend-selection: no stop runs the default, which handles it, so connect_after does not run`,view:!0,observe:(e,t)=>{let n=viewOf(e),r=[];return n.connect(`extend-selection`,(()=>r.push(`plain`)&&!1)),n.connect_after(`extend-selection`,(()=>r.push(`after`)&&!1)),[t.extendSelection(n,2),r]},shows:[`native`,[`plain`]]},{rule:`extend-selection: stopping skips the default, so the click selects nothing (Learn6502)`,view:!0,observe:(e,t)=>{let n=viewOf(e),r=[];return n.connect(`extend-selection`,(t=>{r.push(`first`),e.GObject.signal_stop_emission_by_name(t,`extend-selection`)})),n.connect(`extend-selection`,(()=>r.push(`second`)&&!1)),n.connect_after(`extend-selection`,(()=>r.push(`after`)&&!1)),[t.extendSelection(n,2),r]},shows:[[2,2],[`first`]]},{rule:`copy-clipboard: connect_after runs after the default; a stop skips it`,view:!0,observe:(e,t)=>{let run=n=>{let r=viewOf(e),i=[];return r.connect(`copy-clipboard`,(t=>{i.push(`plain`),n&&e.GObject.signal_stop_emission_by_name(t,`copy-clipboard`)})),r.connect_after(`copy-clipboard`,(()=>i.push(`after`))),t.copyClipboard(r),i};return[run(!1),run(!0)]},shows:[[`plain`,`after`],[`plain`]]}];export{e as GTKSOURCE_STOP_VECTORS};
|
package/lib/esm/signals.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";let
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";import{STOP_EMISSION as e}from"@gjsify/adwaita-core";let t=1;var SignalEmitter=class{constructor(){this.handlers=new Map,this.emissions=[]}connect(e,t){return this.add(e,t,!1)}connect_after(e,t){return this.add(e,t,!0)}checkSignal(e){}add(e,n,r){this.checkSignal(e);let i=t++;return this.handlers.set(i,{name:e,callback:n,after:r}),i}disconnect(e){if(!this.handlers.delete(e))throw Error(`No signal handler with id ${e} on this object`)}classHandler(e,t){}emit(e,...t){this.run(e,t,!1)}emitHandled(e,...t){return this.run(e,t,!0)}run(e,t,n){let r=Array.from(this.handlers).filter(([,t])=>t.name===e),i={name:e,stopped:!1};this.emissions.push(i);let a=!1,stage=e=>{for(let[o,s]of r){if(i.stopped)return!0;if(s.after!==e||!this.handlers.has(o))continue;let r=s.callback(this,...t);if(n&&r)return a=!0,!0}return i.stopped};try{if(stage(!1))return a;let r=this.classHandler(e,t);return n&&r?!0:(i.stopped||stage(!0),a)}finally{this.emissions.splice(this.emissions.lastIndexOf(i),1)}}[e](e){for(let t=this.emissions.length-1;t>=0;t--){let n=this.emissions[t];if(n.name===e&&!n.stopped){n.stopped=!0;return}}console.warn(`no emission of signal "${e}" to stop`)}};export{SignalEmitter};
|
package/lib/esm/view-vectors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./_virtual/_rolldown/runtime.js";const e=[{property:`auto-indent`,member:`autoIndent`,shows:!1},{property:`indent-width`,member:`indentWidth`,shows:-1},{property:`show-line-numbers`,member:`showLineNumbers`,shows:!1},{property:`highlight-current-line`,member:`highlightCurrentLine`,shows:!1},{property:`monospace`,member:`monospace`,shows:!1},{property:`editable`,member:`editable`,shows:!0},{property:`cursor-visible`,member:`cursorVisible`,shows:!0},{property:`left-margin`,member:`leftMargin`,shows:0},{property:`right-margin`,member:`rightMargin`,shows:0},{property:`top-margin`,member:`topMargin`,shows:0},{property:`bottom-margin`,member:`bottomMargin`,shows:0}],pick=(e,t)=>Object.fromEntries(t.map(t=>[t,e[t]])),t=[{rule:`Gtk.TextWindowType carries the typelib numbers`,instance:!1,observe:({Gtk:e})=>pick(e.TextWindowType,[`WIDGET`,`TEXT`,`LEFT`,`RIGHT`,`TOP`]),shows:{WIDGET:1,TEXT:2,LEFT:3,RIGHT:4,TOP:5}},{rule:`Gtk.PolicyType carries the typelib numbers`,instance:!1,observe:({Gtk:e})=>pick(e.PolicyType,[`ALWAYS`,`AUTOMATIC`,`NEVER`,`EXTERNAL`]),shows:{ALWAYS:0,AUTOMATIC:1,NEVER:2,EXTERNAL:3}},{rule:`Gtk.TextDirection carries the typelib numbers`,instance:!1,observe:({Gtk:e})=>pick(e.TextDirection,[`NONE`,`LTR`,`RTL`]),shows:{NONE:0,LTR:1,RTL:2}},{rule:`cursor_visible is true by default and the property and accessors agree`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View,n=[t.cursor_visible,t.get_cursor_visible()];t.cursor_visible=!1;let r=[t.cursor_visible,t.get_cursor_visible()];return t.set_cursor_visible(!0),[n,r,[t.cursor_visible,t.get_cursor_visible()]]},shows:[[!0,!0],[!1,!1],[!0,!0]]},{rule:`set_editable and the editable property agree`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View;t.set_editable(!1);let n=[t.editable,t.get_editable()];return t.editable=!0,[n,[t.editable,t.get_editable()]]},shows:[[!1,!1],[!0,!0]]},{rule:`highlight_current_line and show_line_numbers are plain boolean properties`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View,n=[t.highlight_current_line,t.show_line_numbers];return t.highlight_current_line=!0,t.show_line_numbers=!0,[n,[t.highlight_current_line,t.show_line_numbers]]},shows:[[!1,!1],[!0,!0]]},{rule:`vadjustment and hadjustment are two stable, distinct adjustments`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View;return[t.vadjustment===t.get_vadjustment(),t.vadjustment===t.hadjustment,t.vadjustment.get_value()]},shows:[!0,!1,0]},{rule:`direction is LTR by default and set_direction is read back`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,r=n.get_direction();return n.set_direction(e.TextDirection.RTL),[r,n.get_direction()]},shows:[1,2]},{rule:`a fresh view has no sibling and no parent`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View;return[t.get_next_sibling(),t.get_parent()]},shows:[null,null]},{rule:`a scrolled window starts AUTOMATIC on both axes and set_policy is read back`,instance:!1,observe:({Gtk:e})=>{let t=new e.ScrolledWindow,n=t.get_policy();return t.set_policy(e.PolicyType.NEVER,e.PolicyType.ALWAYS),[n,t.get_policy()]},shows:[[1,1],[2,0]]},{rule:`set_policy refuses a value that is not a Gtk.PolicyType`,instance:!1,observe:({Gtk:e})=>{let t=new e.ScrolledWindow;try{return t.set_policy(7,1),`accepted`}catch{return`threw`}},shows:`threw`},{rule:`a scrolled window adopts the view adjustment it is given`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,r=new e.ScrolledWindow;return r.set_vadjustment(n.vadjustment),[r.get_vadjustment()===n.vadjustment,r.vadjustment===n.vadjustment]},shows:[!0,!0]},{rule:`get_gutter answers one gutter per side, LEFT and RIGHT apart`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,{LEFT:r,RIGHT:i}=e.TextWindowType;return[n.get_gutter(r)!==null,n.get_gutter(r)===n.get_gutter(r),n.get_gutter(i)===n.get_gutter(i),n.get_gutter(r)!==n.get_gutter(i)]},shows:[!0,!0,!0,!0]},{rule:`a gutter knows its view and its side`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,r=n.get_gutter(e.TextWindowType.LEFT),i=n.get_gutter(e.TextWindowType.RIGHT);return[r.get_view()===n,r.view===n,r.window_type,i.window_type]},shows:[!0,!0,3,4]},{rule:`get_gutter answers null for a side that has no gutter`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,{TEXT:r,WIDGET:i,TOP:a}=e.TextWindowType;return[n.get_gutter(r),n.get_gutter(i),n.get_gutter(a)]},shows:[null,null,null]},{rule:`a text renderer starts empty with the widget defaults`,instance:!0,observe:({GtkSource:e})=>{let t=new e.GutterRendererText;return[t.text,t.markup,t.margin_start,t.margin_end,t.width_request,t.focusable,t.focus_on_click,t.get_view()]},shows:[null,null,0,0,-1,!1,!0,null]},{rule:`a text renderer takes widget properties at construction, snake_case or camelCase`,instance:!0,observe:({GtkSource:e})=>{let t=new e.GutterRendererText({margin_start:12,margin_end:8,width_request:36,focusable:!0,focus_on_click:!1,text:`q`}),n=new e.GutterRendererText({marginStart:3});return n.marginStart=5,[t.margin_start,t.margin_end,t.width_request,t.focusable,t.focus_on_click,t.text,n.margin_start]},shows:[12,8,36,!0,!1,`q`,5]},{rule:`a renderer refuses a property it does not have`,instance:!0,observe:({GtkSource:e})=>{try{return new e.GutterRendererText({bogus:1}),`accepted`}catch{return`threw`}},shows:`threw`},{rule:`GutterRenderer is abstract`,instance:!0,observe:({GtkSource:e})=>{try{return new e.GutterRenderer,`accepted`}catch{return`threw`}},shows:`threw`},{rule:`text and markup replace each other, and a length cuts the string in bytes`,instance:!0,observe:({GtkSource:e})=>{let t=new e.GutterRendererText;t.set_text(`abcdef`,3);let n=[t.text,t.markup];t.set_markup(`<b>x</b>`,-1);let r=[t.text,t.markup];return t.text=`zz`,[n,r,[t.text,t.markup]]},shows:[[`abc`,null],[null,`<b>x</b>`],[`zz`,null]]},{rule:`insert claims a renderer for the view, a second insert is refused, remove gives it back`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,r=n.get_gutter(e.TextWindowType.LEFT),i=n.get_gutter(e.TextWindowType.RIGHT),a=new t.GutterRendererText,o=r.insert(a,0),s=a.get_view()===n,c=[r.insert(a,1),i.insert(a,1)];return r.remove(a),[o,s,c,a.get_view(),i.insert(a,0)]},shows:[!0,!0,[!1,!1],null,!0]},{rule:`reorder and queue_draw answer nothing`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View().get_gutter(e.TextWindowType.LEFT),r=new t.GutterRendererText;return n.insert(r,0),[n.reorder(r,3),n.queue_draw(),r.queue_draw()]},shows:[void 0,void 0,void 0]}];export{e as GTKSOURCE_VIEW_DEFAULT_VECTORS,t as GTKSOURCE_VIEW_SURFACE_VECTORS};
|
|
1
|
+
import"./_virtual/_rolldown/runtime.js";const e=[{property:`auto-indent`,member:`autoIndent`,shows:!1},{property:`indent-width`,member:`indentWidth`,shows:-1},{property:`show-line-numbers`,member:`showLineNumbers`,shows:!1},{property:`highlight-current-line`,member:`highlightCurrentLine`,shows:!1},{property:`monospace`,member:`monospace`,shows:!1},{property:`editable`,member:`editable`,shows:!0},{property:`cursor-visible`,member:`cursorVisible`,shows:!0},{property:`left-margin`,member:`leftMargin`,shows:0},{property:`right-margin`,member:`rightMargin`,shows:0},{property:`top-margin`,member:`topMargin`,shows:0},{property:`bottom-margin`,member:`bottomMargin`,shows:0}],pick=(e,t)=>Object.fromEntries(t.map(t=>[t,e[t]])),t=[{rule:`Gtk.TextWindowType carries the typelib numbers`,instance:!1,observe:({Gtk:e})=>pick(e.TextWindowType,[`WIDGET`,`TEXT`,`LEFT`,`RIGHT`,`TOP`]),shows:{WIDGET:1,TEXT:2,LEFT:3,RIGHT:4,TOP:5}},{rule:`Gtk.PolicyType carries the typelib numbers`,instance:!1,observe:({Gtk:e})=>pick(e.PolicyType,[`ALWAYS`,`AUTOMATIC`,`NEVER`,`EXTERNAL`]),shows:{ALWAYS:0,AUTOMATIC:1,NEVER:2,EXTERNAL:3}},{rule:`Gtk.TextExtendSelection carries the typelib numbers`,instance:!1,observe:({Gtk:e})=>pick(e.TextExtendSelection,[`WORD`,`LINE`]),shows:{WORD:0,LINE:1}},{rule:`Gtk.TextDirection carries the typelib numbers`,instance:!1,observe:({Gtk:e})=>pick(e.TextDirection,[`NONE`,`LTR`,`RTL`]),shows:{NONE:0,LTR:1,RTL:2}},{rule:`cursor_visible is true by default and the property and accessors agree`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View,n=[t.cursor_visible,t.get_cursor_visible()];t.cursor_visible=!1;let r=[t.cursor_visible,t.get_cursor_visible()];return t.set_cursor_visible(!0),[n,r,[t.cursor_visible,t.get_cursor_visible()]]},shows:[[!0,!0],[!1,!1],[!0,!0]]},{rule:`set_editable and the editable property agree`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View;t.set_editable(!1);let n=[t.editable,t.get_editable()];return t.editable=!0,[n,[t.editable,t.get_editable()]]},shows:[[!1,!1],[!0,!0]]},{rule:`highlight_current_line and show_line_numbers are plain boolean properties`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View,n=[t.highlight_current_line,t.show_line_numbers];return t.highlight_current_line=!0,t.show_line_numbers=!0,[n,[t.highlight_current_line,t.show_line_numbers]]},shows:[[!1,!1],[!0,!0]]},{rule:`vadjustment and hadjustment are two stable, distinct adjustments`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View;return[t.vadjustment===t.get_vadjustment(),t.vadjustment===t.hadjustment,t.vadjustment.get_value()]},shows:[!0,!1,0]},{rule:`direction is LTR by default and set_direction is read back`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,r=n.get_direction();return n.set_direction(e.TextDirection.RTL),[r,n.get_direction()]},shows:[1,2]},{rule:`a fresh view has no sibling and no parent`,instance:!0,observe:({GtkSource:e})=>{let t=new e.View;return[t.get_next_sibling(),t.get_parent()]},shows:[null,null]},{rule:`a scrolled window starts AUTOMATIC on both axes and set_policy is read back`,instance:!1,observe:({Gtk:e})=>{let t=new e.ScrolledWindow,n=t.get_policy();return t.set_policy(e.PolicyType.NEVER,e.PolicyType.ALWAYS),[n,t.get_policy()]},shows:[[1,1],[2,0]]},{rule:`set_policy refuses a value that is not a Gtk.PolicyType`,instance:!1,observe:({Gtk:e})=>{let t=new e.ScrolledWindow;try{return t.set_policy(7,1),`accepted`}catch{return`threw`}},shows:`threw`},{rule:`a scrolled window adopts the view adjustment it is given`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,r=new e.ScrolledWindow;return r.set_vadjustment(n.vadjustment),[r.get_vadjustment()===n.vadjustment,r.vadjustment===n.vadjustment]},shows:[!0,!0]},{rule:`get_gutter answers one gutter per side, LEFT and RIGHT apart`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,{LEFT:r,RIGHT:i}=e.TextWindowType;return[n.get_gutter(r)!==null,n.get_gutter(r)===n.get_gutter(r),n.get_gutter(i)===n.get_gutter(i),n.get_gutter(r)!==n.get_gutter(i)]},shows:[!0,!0,!0,!0]},{rule:`a gutter knows its view and its side`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,r=n.get_gutter(e.TextWindowType.LEFT),i=n.get_gutter(e.TextWindowType.RIGHT);return[r.get_view()===n,r.view===n,r.window_type,i.window_type]},shows:[!0,!0,3,4]},{rule:`get_gutter answers null for a side that has no gutter`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,{TEXT:r,WIDGET:i,TOP:a,BOTTOM:o}=e.TextWindowType;return[n.get_gutter(r),n.get_gutter(i),n.get_gutter(a),n.get_gutter(o)]},shows:[null,null,null,null]},{rule:`a text renderer starts empty with the widget defaults`,instance:!0,observe:({GtkSource:e})=>{let t=new e.GutterRendererText;return[t.text,t.markup,t.margin_start,t.margin_end,t.width_request,t.focusable,t.focus_on_click,t.get_view()]},shows:[null,null,0,0,-1,!1,!0,null]},{rule:`a text renderer takes widget properties at construction, snake_case or camelCase`,instance:!0,observe:({GtkSource:e})=>{let t=new e.GutterRendererText({margin_start:12,margin_end:8,width_request:36,focusable:!0,focus_on_click:!1,text:`q`}),n=new e.GutterRendererText({marginStart:3});return n.marginStart=5,[t.margin_start,t.margin_end,t.width_request,t.focusable,t.focus_on_click,t.text,n.margin_start]},shows:[12,8,36,!0,!1,`q`,5]},{rule:`a renderer refuses a property it does not have`,instance:!0,observe:({GtkSource:e})=>{try{return new e.GutterRendererText({bogus:1}),`accepted`}catch{return`threw`}},shows:`threw`},{rule:`GutterRenderer is abstract`,instance:!0,observe:({GtkSource:e})=>{try{return new e.GutterRenderer,`accepted`}catch{return`threw`}},shows:`threw`},{rule:`text and markup replace each other, and a length cuts the string in bytes`,instance:!0,observe:({GtkSource:e})=>{let t=new e.GutterRendererText;t.set_text(`abcdef`,3);let n=[t.text,t.markup];t.set_markup(`<b>x</b>`,-1);let r=[t.text,t.markup];return t.text=`zz`,[n,r,[t.text,t.markup]]},shows:[[`abc`,null],[null,`<b>x</b>`],[`zz`,null]]},{rule:`insert claims a renderer for the view, a second insert is refused, remove gives it back`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View,r=n.get_gutter(e.TextWindowType.LEFT),i=n.get_gutter(e.TextWindowType.RIGHT),a=new t.GutterRendererText,o=r.insert(a,0),s=a.get_view()===n,c=[r.insert(a,1),i.insert(a,1)];return r.remove(a),[o,s,c,a.get_view(),i.insert(a,0)]},shows:[!0,!0,[!1,!1],null,!0]},{rule:`reorder and queue_draw answer nothing`,instance:!0,observe:({Gtk:e,GtkSource:t})=>{let n=new t.View().get_gutter(e.TextWindowType.LEFT),r=new t.GutterRendererText;return n.insert(r,0),[n.reorder(r,3),n.queue_draw(),r.queue_draw()]},shows:[void 0,void 0,void 0]}];export{e as GTKSOURCE_VIEW_DEFAULT_VECTORS,t as GTKSOURCE_VIEW_SURFACE_VECTORS};
|
package/lib/types/buffer.d.ts
CHANGED
|
@@ -93,6 +93,7 @@ export declare class GtkSourceBuffer extends SignalEmitter {
|
|
|
93
93
|
private record;
|
|
94
94
|
private push;
|
|
95
95
|
private syncUndoState;
|
|
96
|
+
protected classHandler(name: string, args: readonly unknown[]): unknown;
|
|
96
97
|
protected checkSignal(name: string): void;
|
|
97
98
|
private ownIter;
|
|
98
99
|
/** `GtkSource.Buffer:language` — what to highlight with; `null` highlights nothing. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MarkupRun } from './gutter-renderer.js';
|
|
2
2
|
import type { EditorPalette } from './style-scheme.js';
|
|
3
3
|
import type { StyledRun } from './token-styler.js';
|
|
4
|
-
/** The size a
|
|
4
|
+
/** The size a gutter renderer asks for, in device-independent pixels. */
|
|
5
5
|
export interface GutterMetrics {
|
|
6
6
|
/** The insert position: below 0 the column sits left of the line numbers, otherwise right of them. */
|
|
7
7
|
readonly position: number;
|
|
@@ -23,13 +23,22 @@ export interface EditorHost {
|
|
|
23
23
|
/** The user replaced `removedLength` characters at `start` with `inserted`. */
|
|
24
24
|
onNativeEdit(start: number, removedLength: number, inserted: string): void;
|
|
25
25
|
onNativeSelection(start: number, end: number): void;
|
|
26
|
-
/** The left gutter's renderers, in paint order and without cells. */
|
|
27
|
-
gutterColumns(): readonly GutterMetrics[];
|
|
28
26
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* A double or triple click at `location` (UTF-16): `granularity` is `Gtk.TextExtendSelection`. It answers
|
|
28
|
+
* the range to select, or null when the platform may apply its own word or line selection. A handler of
|
|
29
|
+
* `extend-selection` that stops the emission makes it the collapsed range at `location`, as in GTK.
|
|
31
30
|
*/
|
|
32
|
-
|
|
31
|
+
onNativeExtendSelection(granularity: number, location: number): readonly [number, number] | null;
|
|
32
|
+
/** The user asked to copy the selection; false when a handler of `copy-clipboard` stopped it, so the platform must not. */
|
|
33
|
+
onNativeCopy(): boolean;
|
|
34
|
+
/** The renderers of the gutter on `side` (`Gtk.TextWindowType` LEFT or RIGHT), left to right, without cells. */
|
|
35
|
+
gutterColumns(side?: number): readonly GutterMetrics[];
|
|
36
|
+
/**
|
|
37
|
+
* Asks every renderer of the gutter on `side` (LEFT unless given) to fill its cell for each line of
|
|
38
|
+
* `first..last` (inclusive) with `vfunc_query_data`, the lines the driver is about to paint. Call it
|
|
39
|
+
* once per paint pass and side.
|
|
40
|
+
*/
|
|
41
|
+
queryGutter(first: number, last: number, side?: number): readonly GutterColumn[];
|
|
33
42
|
}
|
|
34
43
|
export interface EditorLayout {
|
|
35
44
|
readonly showLineNumbers: boolean;
|
|
@@ -54,6 +63,11 @@ export interface HighlightSink {
|
|
|
54
63
|
setPalette(palette: EditorPalette): void;
|
|
55
64
|
}
|
|
56
65
|
export interface EditorDriver extends HighlightSink {
|
|
66
|
+
/**
|
|
67
|
+
* The `Gtk.TextWindowType` sides this driver paints; LEFT when absent. A renderer inserted into a gutter
|
|
68
|
+
* on any other side is refused by name (ADR 0103), never drawn wrongly.
|
|
69
|
+
*/
|
|
70
|
+
readonly gutterSides?: readonly number[];
|
|
57
71
|
bind(host: EditorHost): void;
|
|
58
72
|
/** Replaces the whole text and forgets every span: the buffer was swapped. */
|
|
59
73
|
setText(text: string): void;
|
|
@@ -63,8 +77,15 @@ export interface EditorDriver extends HighlightSink {
|
|
|
63
77
|
setLineCount(count: number): void;
|
|
64
78
|
setLayout(layout: EditorLayout): void;
|
|
65
79
|
/**
|
|
66
|
-
* A
|
|
80
|
+
* A gutter renderer was added, moved, resized or asked to repaint. Idempotent and cheap: a
|
|
67
81
|
* burst of calls costs one repaint per task, as `queue_draw` does in GTK.
|
|
68
82
|
*/
|
|
69
83
|
invalidateGutter(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Copies the selection the platform's own way. Only a driver whose platform copies BEFORE the
|
|
86
|
+
* handlers of `copy-clipboard` run needs it: the class handler of the emission calls it, so a
|
|
87
|
+
* `connect_after` handler that puts its own text on the clipboard replaces the default, as in GTK.
|
|
88
|
+
* The web has none: its default runs after the `copy` event and is cancelled instead.
|
|
89
|
+
*/
|
|
90
|
+
copySelection?(): void;
|
|
70
91
|
}
|
|
@@ -16,6 +16,7 @@ export declare class EditorSession extends SignalEmitter implements EditorHost {
|
|
|
16
16
|
private fromNative;
|
|
17
17
|
private variant;
|
|
18
18
|
private gutters;
|
|
19
|
+
private defaultRan;
|
|
19
20
|
private props;
|
|
20
21
|
constructor(driver: EditorDriver, schemes?: StyleSchemeManager, variant?: ColorSchemeVariant);
|
|
21
22
|
get buffer(): Buffer;
|
|
@@ -23,14 +24,17 @@ export declare class EditorSession extends SignalEmitter implements EditorHost {
|
|
|
23
24
|
private attach;
|
|
24
25
|
private onBufferChanged;
|
|
25
26
|
private onBufferCursor;
|
|
26
|
-
/** Paints the
|
|
27
|
+
/** Paints the gutters of `gutters`: their changes reach the driver, and `queryGutter` answers from them. */
|
|
27
28
|
bindGutters(gutters: GutterSet): void;
|
|
28
|
-
private
|
|
29
|
+
private renderersOf;
|
|
29
30
|
private metricsOf;
|
|
30
|
-
gutterColumns(): readonly GutterMetrics[];
|
|
31
|
-
queryGutter(first: number, last: number): readonly GutterColumn[];
|
|
31
|
+
gutterColumns(side?: number): readonly GutterMetrics[];
|
|
32
|
+
queryGutter(first: number, last: number, side?: number): readonly GutterColumn[];
|
|
32
33
|
onNativeEdit(start: number, removedLength: number, inserted: string): void;
|
|
33
34
|
onNativeSelection(start: number, end: number): void;
|
|
35
|
+
onNativeExtendSelection(granularity: number, location: number): readonly [number, number] | null;
|
|
36
|
+
onNativeCopy(): boolean;
|
|
37
|
+
protected classHandler(name: string): unknown;
|
|
34
38
|
private setProp;
|
|
35
39
|
private pushLayout;
|
|
36
40
|
get autoIndent(): boolean;
|
|
@@ -2,6 +2,7 @@ import { GIR_TYPE, GObjectObject } from '@gjsify/adwaita-core';
|
|
|
2
2
|
import type { Buffer } from './buffer.js';
|
|
3
3
|
/** `Gtk.TextWindowType`: the two sides that carry a gutter. */
|
|
4
4
|
export declare const WINDOW_LEFT = 3;
|
|
5
|
+
export declare const WINDOW_RIGHT = 4;
|
|
5
6
|
declare const WIDGET_PROPERTIES: readonly [readonly ["margin_start", "marginStart", 0], readonly ["margin_end", "marginEnd", 0], readonly ["width_request", "widthRequest", -1], readonly ["focusable", "focusable", false], readonly ["focus_on_click", "focusOnClick", true]];
|
|
6
7
|
type WidgetPropertyName = (typeof WIDGET_PROPERTIES)[number][0];
|
|
7
8
|
export interface GutterRendererProperties {
|
|
@@ -69,12 +70,15 @@ export declare class GutterLines {
|
|
|
69
70
|
}
|
|
70
71
|
/** Heard by the editor session: a column was added, moved, resized or asked to repaint. */
|
|
71
72
|
export type GutterListener = (gutter: Gutter) => void;
|
|
73
|
+
/** Asked before a renderer joins a gutter; throws when no driver paints that side. */
|
|
74
|
+
export type GutterGuard = (gutter: Gutter) => void;
|
|
72
75
|
export declare class Gutter {
|
|
73
76
|
private readonly owner;
|
|
74
77
|
readonly window_type: number;
|
|
75
78
|
private readonly listener;
|
|
79
|
+
private readonly guard;
|
|
76
80
|
private readonly placed;
|
|
77
|
-
constructor(owner: object, window_type: number, listener?: GutterListener);
|
|
81
|
+
constructor(owner: object, window_type: number, listener?: GutterListener, guard?: GutterGuard);
|
|
78
82
|
get_view(): object;
|
|
79
83
|
get view(): object;
|
|
80
84
|
/** Claims `renderer` at `position` (lower is nearer the left); `false` when another gutter holds it. */
|
|
@@ -93,9 +97,10 @@ export declare class GutterSet {
|
|
|
93
97
|
readonly view: object;
|
|
94
98
|
private readonly gutters;
|
|
95
99
|
private listener;
|
|
100
|
+
private guard;
|
|
96
101
|
constructor(view: object);
|
|
97
102
|
/** @internal The editor session hears of every change to a gutter of this view. */
|
|
98
|
-
watch(listener: GutterListener): void;
|
|
103
|
+
watch(listener: GutterListener, guard?: GutterGuard): void;
|
|
99
104
|
/** `gtk_source_view_get_gutter`: `null` for a side that has no gutter. */
|
|
100
105
|
get(windowType: number): Gutter | null;
|
|
101
106
|
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface IterLike {
|
|
2
|
+
copy(): IterLike;
|
|
3
|
+
get_offset(): number;
|
|
4
|
+
set_offset(offset: number): void;
|
|
5
|
+
}
|
|
6
|
+
interface MarkLike {
|
|
7
|
+
readonly name: string | null;
|
|
8
|
+
}
|
|
9
|
+
interface StoppableBufferLike {
|
|
10
|
+
text: string;
|
|
11
|
+
get_start_iter(): IterLike;
|
|
12
|
+
get_insert(): MarkLike;
|
|
13
|
+
get_selection_bound(): MarkLike;
|
|
14
|
+
move_mark(mark: MarkLike, where: IterLike): void;
|
|
15
|
+
connect(name: string, callback: (...args: never[]) => unknown): number;
|
|
16
|
+
connect_after(name: string, callback: (...args: never[]) => unknown): number;
|
|
17
|
+
disconnect(id: number): void;
|
|
18
|
+
}
|
|
19
|
+
export interface StoppableViewLike {
|
|
20
|
+
buffer: StoppableBufferLike;
|
|
21
|
+
connect(name: string, callback: (...args: never[]) => unknown): number;
|
|
22
|
+
connect_after(name: string, callback: (...args: never[]) => unknown): number;
|
|
23
|
+
}
|
|
24
|
+
/** The part of `GtkSource` and `GObject` the vectors read. */
|
|
25
|
+
export interface GtkSourceStopSurface {
|
|
26
|
+
GtkSource: {
|
|
27
|
+
Buffer: new () => StoppableBufferLike;
|
|
28
|
+
View: new () => StoppableViewLike;
|
|
29
|
+
};
|
|
30
|
+
GObject: {
|
|
31
|
+
signal_stop_emission_by_name(instance: object, detailedSignal: string): void;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* What a port does for a user gesture its view cannot be asked to perform by name. On GJS it emits the
|
|
36
|
+
* signal; on the web it dispatches the DOM event the driver turns into it.
|
|
37
|
+
*/
|
|
38
|
+
export interface GtkSourceStopGestures {
|
|
39
|
+
/**
|
|
40
|
+
* A double click (`Gtk.TextExtendSelection.WORD`) with the caret at `offset`. Answers what it left
|
|
41
|
+
* selected: `'native'` when the platform may apply its own word selection, else the range.
|
|
42
|
+
*/
|
|
43
|
+
extendSelection(view: StoppableViewLike, offset: number): 'native' | [number, number];
|
|
44
|
+
copyClipboard(view: StoppableViewLike): void;
|
|
45
|
+
}
|
|
46
|
+
export interface GtkSourceStopVector {
|
|
47
|
+
readonly rule: string;
|
|
48
|
+
/** Whether a `GtkSource.View` is built, which needs a display on GJS. */
|
|
49
|
+
readonly view: boolean;
|
|
50
|
+
readonly observe: (surface: GtkSourceStopSurface, gestures: GtkSourceStopGestures) => unknown;
|
|
51
|
+
readonly shows: unknown;
|
|
52
|
+
}
|
|
53
|
+
export declare const GTKSOURCE_STOP_VECTORS: readonly GtkSourceStopVector[];
|
|
54
|
+
export {};
|
package/lib/types/signals.d.ts
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
import { STOP_EMISSION, type StoppableEmitter } from '@gjsify/adwaita-core';
|
|
2
|
+
export declare class SignalEmitter implements StoppableEmitter {
|
|
2
3
|
private readonly handlers;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/** The emissions in progress, innermost last. */
|
|
5
|
+
private readonly emissions;
|
|
6
|
+
connect(name: string, callback: (self: this, ...args: never[]) => unknown): number;
|
|
7
|
+
/** `g_signal_connect_after`: runs once every plain handler and the class handler of the emission have run. */
|
|
8
|
+
connect_after(name: string, callback: (self: this, ...args: never[]) => unknown): number;
|
|
6
9
|
/** An emitter that knows its signals overrides this and throws for a name it does not have. */
|
|
7
10
|
protected checkSignal(_name: string): void;
|
|
8
11
|
private add;
|
|
9
12
|
/** Removes exactly the handler `connect` returned this id for; an id nothing holds throws. */
|
|
10
13
|
disconnect(id: number): void;
|
|
14
|
+
/**
|
|
15
|
+
* The class handler of a RUN_LAST signal: what the emission does by default, after the plain handlers
|
|
16
|
+
* and before the `connect_after` ones. A stopped emission never gets here. A signal with a
|
|
17
|
+
* `true_handled` accumulator (`emitHandled`) answers whether it handled the emission.
|
|
18
|
+
*/
|
|
19
|
+
protected classHandler(_name: string, _args: readonly unknown[]): unknown;
|
|
11
20
|
protected emit(name: string, ...args: unknown[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* A signal whose return value is accumulated with `g_signal_accumulator_true_handled`: the first
|
|
23
|
+
* handler, class handler included, to answer true ends the emission and decides the result.
|
|
24
|
+
*/
|
|
25
|
+
protected emitHandled(name: string, ...args: unknown[]): boolean;
|
|
26
|
+
private run;
|
|
27
|
+
/**
|
|
28
|
+
* `g_signal_stop_emission`: stops the innermost emission in progress of `detailedSignal`, so the
|
|
29
|
+
* handlers after the current one and the class handler do not run. With none in progress GLib warns
|
|
30
|
+
* and does nothing; so does this.
|
|
31
|
+
*/
|
|
32
|
+
[STOP_EMISSION](detailedSignal: string): void;
|
|
12
33
|
}
|
|
@@ -66,6 +66,7 @@ export interface GtkSourceViewSurfaceLike {
|
|
|
66
66
|
TextWindowType: Record<string, number>;
|
|
67
67
|
PolicyType: Record<string, number>;
|
|
68
68
|
TextDirection: Record<string, number>;
|
|
69
|
+
TextExtendSelection: Record<string, number>;
|
|
69
70
|
ScrolledWindow: new (properties?: any) => ScrolledWindowLike;
|
|
70
71
|
};
|
|
71
72
|
GtkSource: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/gtksource-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.1",
|
|
4
4
|
"description": "Headless GtkSourceView language/style parsing (renderer-free) — parse .lang and style scheme XML into typed data with JS regex translation, strict unsupported reporting",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"headless"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@gjsify/adwaita-core": "^0.
|
|
49
|
+
"@gjsify/adwaita-core": "^0.59.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@gjsify/cli": "^0.
|
|
53
|
-
"@gjsify/unit": "^0.
|
|
52
|
+
"@gjsify/cli": "^0.59.1",
|
|
53
|
+
"@gjsify/unit": "^0.59.1",
|
|
54
54
|
"@types/node": "^25.9.2",
|
|
55
55
|
"typescript": "^6.0.3"
|
|
56
56
|
},
|