Compare commits
No commits in common. "d64779f660dc0edb1ed14420c7bd446e9f83fb33" and "ba7b8a539518f3245c54e53e5d2ab59a2e029d63" have entirely different histories.
d64779f660
...
ba7b8a5395
22
app.go
22
app.go
|
|
@ -62,28 +62,6 @@ func (a *App) ListProcessors() (resp []ListProcessorsResponse) {
|
|||
return resp
|
||||
}
|
||||
|
||||
func (a *App) TriggerTextProcess(action string) {
|
||||
runtime.EventsEmit(a.ctx, "request-text-process", RequestTextProcess{
|
||||
Action: action,
|
||||
})
|
||||
}
|
||||
|
||||
func (a *App) PromptUser(label string, resp func(string)) {
|
||||
runtime.EventsOnce(a.ctx, "prompt-response", func(data ...interface{}) {
|
||||
if len(data) == 0 {
|
||||
return
|
||||
}
|
||||
ans, ok := data[0].(string)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
resp(ans)
|
||||
})
|
||||
runtime.EventsEmit(a.ctx, "prompt-request", PromptRequest{
|
||||
Label: label,
|
||||
})
|
||||
}
|
||||
|
||||
func (a *App) ProcessText(req ProcessTextRequest) {
|
||||
filter, ok := TextFilters[req.Action]
|
||||
if !ok {
|
||||
|
|
|
|||
|
|
@ -10,15 +10,6 @@
|
|||
<div class="editor-mountpoint"></div>
|
||||
<div class="status-bar deemphasized" data-controller="status">Cmd+P: open command palette. Shift+Cmd+P: rerun last command.</div>
|
||||
</div>
|
||||
<dialog id="prompt-dialog" data-controller="prompt">
|
||||
<div class="dialog-body">
|
||||
<label class="prompt-label" data-prompt-target="label"></label>
|
||||
<div class="prompt-input">
|
||||
<input data-prompt-target="input" type="text"
|
||||
data-action="keyup.enter->prompt#submit keydown.esc->prompt#dismiss">
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
<dialog id="command-dialog" data-controller="commands"
|
||||
data-action="dq-showcommands@window->commands#showCommands dq-rerunlastcommand@window->commands#rerunLastCommand">
|
||||
<div class="dialog-body">
|
||||
|
|
|
|||
|
|
@ -27,52 +27,6 @@
|
|||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
dialog#prompt-dialog {
|
||||
width: 450px;
|
||||
max-width: 50%;
|
||||
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
padding: 0;
|
||||
|
||||
/* Frosted glass effect */
|
||||
background: rgba(225, 225, 225, 0.38);
|
||||
backdrop-filter: blur(15px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
|
||||
/* Subtle grey border and rounded corners */
|
||||
border: 1px solid rgba(169, 169, 169, 0.3);
|
||||
border-radius: 12px;
|
||||
|
||||
/* Add subtle shadow for depth */
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
dialog#prompt-dialog .dialog-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
dialog#prompt-dialog .prompt-label {
|
||||
font-size: 0.9em;
|
||||
color: rgba(0, 0, 0, 0.6);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
dialog#prompt-dialog input {
|
||||
width: 100%;
|
||||
border: none;
|
||||
text-decoration: none;
|
||||
outline: none;
|
||||
font-size: 1.3em;
|
||||
background-color: transparent;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
dialog#command-dialog {
|
||||
width: 450px;
|
||||
height: 400px;
|
||||
|
|
|
|||
|
|
@ -43,28 +43,6 @@ export const commandPalette = keymap.of([{
|
|||
let event = new CustomEvent('dq-rerunlastcommand');
|
||||
window.dispatchEvent(event);
|
||||
|
||||
return true;
|
||||
}
|
||||
}, {
|
||||
key: "Cmd-k",
|
||||
run: (view) => {
|
||||
const {state} = view;
|
||||
const changes = [];
|
||||
|
||||
for (let range of state.selection.ranges) {
|
||||
const line = state.doc.lineAt(range.head);
|
||||
changes.push({
|
||||
from: line.from,
|
||||
to: line.to < state.doc.length ? line.to + 1 : line.to,
|
||||
insert: ""
|
||||
});
|
||||
}
|
||||
|
||||
view.dispatch({
|
||||
changes: changes,
|
||||
sequential: true
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}]);
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export class PromptController extends Controller {
|
||||
static targets = [
|
||||
"label",
|
||||
"input",
|
||||
];
|
||||
|
||||
connect() {
|
||||
this._callback = null;
|
||||
|
||||
window.runtime.EventsOn("prompt-request", (data) => {
|
||||
this.prompt(data.label, (res) => {
|
||||
window.runtime.EventsEmit("prompt-response", res);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
prompt(label, callback) {
|
||||
this._callback = callback;
|
||||
this.labelTarget.textContent = label;
|
||||
this.inputTarget.value = "";
|
||||
this.element.showModal();
|
||||
this.inputTarget.focus();
|
||||
}
|
||||
|
||||
submit(ev) {
|
||||
ev.preventDefault();
|
||||
let value = this.inputTarget.value;
|
||||
this.element.close();
|
||||
if (this._callback) {
|
||||
this._callback(value);
|
||||
this._callback = null;
|
||||
}
|
||||
}
|
||||
|
||||
dismiss(ev) {
|
||||
ev.preventDefault();
|
||||
this._callback = null;
|
||||
this.element.close();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,17 +1,15 @@
|
|||
import './style.css';
|
||||
import './app.css';
|
||||
|
||||
import {basicSetup} from "codemirror";
|
||||
import {EditorView, keymap} from "@codemirror/view";
|
||||
import {EditorView, basicSetup} from "codemirror";
|
||||
import {Application} from "@hotwired/stimulus";
|
||||
|
||||
import {textProcessor} from "./services.js";
|
||||
import {multiCursorKeymap, commandPalette} from "./cmplugins.js";
|
||||
import {indentWithTab} from "@codemirror/commands";
|
||||
|
||||
import {StatusController} from "./controllers/status_controller.js";
|
||||
import {CommandsController} from "./controllers/commands_controller.js";
|
||||
import {PromptController} from "./controllers/prompt_controller.js";
|
||||
import {LogPrint, EventsOn} from "../wailsjs/runtime/runtime";
|
||||
|
||||
|
||||
|
||||
|
|
@ -20,7 +18,6 @@ const view = new EditorView({
|
|||
doc: "",
|
||||
extensions: [
|
||||
basicSetup,
|
||||
keymap.of([indentWithTab]),
|
||||
EditorView.lineWrapping,
|
||||
multiCursorKeymap,
|
||||
commandPalette,
|
||||
|
|
@ -29,7 +26,6 @@ const view = new EditorView({
|
|||
|
||||
window.Stimulus = Application.start()
|
||||
Stimulus.register("commands", CommandsController);
|
||||
Stimulus.register("prompt", PromptController);
|
||||
Stimulus.register("status", StatusController);
|
||||
|
||||
textProcessor.setCodeMirrorEditor(view);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,6 @@ class TextProcessor {
|
|||
});
|
||||
this._editor.dispatch({ changes: changes });
|
||||
});
|
||||
window.runtime.EventsOn("request-text-process", (data) => {
|
||||
this.runTextCommand(data.action);
|
||||
});
|
||||
}
|
||||
|
||||
async runTextCommand(command) {
|
||||
|
|
|
|||
4
frontend/wailsjs/go/main/App.d.ts
vendored
4
frontend/wailsjs/go/main/App.d.ts
vendored
|
|
@ -8,8 +8,4 @@ export function LoadCurrentBuffer():Promise<string>;
|
|||
|
||||
export function ProcessText(arg1:main.ProcessTextRequest):Promise<void>;
|
||||
|
||||
export function PromptUser(arg1:string,arg2:any):Promise<void>;
|
||||
|
||||
export function SaveCurrentBuffer(arg1:string):Promise<void>;
|
||||
|
||||
export function TriggerTextProcess(arg1:string):Promise<void>;
|
||||
|
|
|
|||
|
|
@ -14,14 +14,6 @@ export function ProcessText(arg1) {
|
|||
return window['go']['main']['App']['ProcessText'](arg1);
|
||||
}
|
||||
|
||||
export function PromptUser(arg1, arg2) {
|
||||
return window['go']['main']['App']['PromptUser'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function SaveCurrentBuffer(arg1) {
|
||||
return window['go']['main']['App']['SaveCurrentBuffer'](arg1);
|
||||
}
|
||||
|
||||
export function TriggerTextProcess(arg1) {
|
||||
return window['go']['main']['App']['TriggerTextProcess'](arg1);
|
||||
}
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -704,6 +704,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
lmika.dev/pkg/modash v0.1.0 h1:fltroSvP0nKj9K0E6G+S9LULvB9Qhj47+SZ2b9v/v/c=
|
||||
lmika.dev/pkg/modash v0.1.0/go.mod h1:8NDl/yR1eCCEhip9FJlVuMNXIeaztQ0Ks/tizExFcTI=
|
||||
lmika.dev/pkg/progdoc v0.0.0-20260201060415-64e19d8700ce h1:DuqMtt7E0miQfhljoJYKtw5cWLBr80APMbmXA1h2vLM=
|
||||
lmika.dev/pkg/progdoc v0.0.0-20260201060415-64e19d8700ce/go.mod h1:EYu63RkiUsx2pkJhZDlKtF+6XcOt3qGyVlS4H4SKDFc=
|
||||
lmika.dev/pkg/progdoc v0.0.0-20260202102543-b3ada3124549 h1:1/RklFVF7Dm9Wr6Nwba75g311lX050/Eso+2djPda5M=
|
||||
lmika.dev/pkg/progdoc v0.0.0-20260202102543-b3ada3124549/go.mod h1:EYu63RkiUsx2pkJhZDlKtF+6XcOt3qGyVlS4H4SKDFc=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
|
|
|
|||
Loading…
Reference in a new issue