mirror of
https://github.com/vrc-get/vrc-get.git
synced 2026-06-21 09:58:08 +00:00
feat: add staged GPUI migration scaffold and shared runtime bridge
This commit is contained in:
parent
d2b91647d2
commit
04da12d85a
5 changed files with 4250 additions and 218 deletions
4209
Cargo.lock
generated
4209
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,8 +1,8 @@
|
|||
use gpui::prelude::*;
|
||||
use gpui::{
|
||||
App, Application, Context, IntoElement, ParentElement, Render, Styled, Window, WindowOptions,
|
||||
div,
|
||||
};
|
||||
use gpui::prelude::*;
|
||||
use gpui_component::{
|
||||
Root, WindowExt,
|
||||
button::{Button, ButtonVariants as _},
|
||||
|
|
@ -103,7 +103,7 @@ impl PackageManagementPoc {
|
|||
}
|
||||
|
||||
impl Render for PackageManagementPoc {
|
||||
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
|
||||
v_flex()
|
||||
.size_full()
|
||||
.p_4()
|
||||
|
|
@ -112,7 +112,7 @@ impl Render for PackageManagementPoc {
|
|||
h_flex()
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.child(Input::new(&self.search_input).cleanable())
|
||||
.child(Input::new(&self.search_input).cleanable(true))
|
||||
.child(
|
||||
h_flex()
|
||||
.gap_2()
|
||||
|
|
@ -140,9 +140,9 @@ impl Render for PackageManagementPoc {
|
|||
)
|
||||
.child(Table::new(&self.table_state).stripe(true))
|
||||
.child(
|
||||
div().opacity(0.7).child(
|
||||
"POC target: package table + dialog + text input before full migration",
|
||||
),
|
||||
div()
|
||||
.opacity(0.7)
|
||||
.child("POC target: package table + dialog + text input before full migration"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,4 +11,4 @@ repository.workspace = true
|
|||
tokio = { version = "1", features = ["rt-multi-thread", "sync"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1", features = ["time"] }
|
||||
tokio = { version = "1", features = ["macros", "rt", "time"] }
|
||||
|
|
|
|||
|
|
@ -89,7 +89,9 @@ impl TokioBridge {
|
|||
}
|
||||
|
||||
pub fn shutdown(&self) -> Result<(), BridgeClosed> {
|
||||
self.sender.send(Message::Shutdown).map_err(|_| BridgeClosed)
|
||||
self.sender
|
||||
.send(Message::Shutdown)
|
||||
.map_err(|_| BridgeClosed)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -120,7 +122,13 @@ mod tests {
|
|||
})
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(timeout(Duration::from_secs(1), receiver).await.unwrap().unwrap(), "done");
|
||||
assert_eq!(
|
||||
timeout(Duration::from_secs(1), receiver)
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap(),
|
||||
"done"
|
||||
);
|
||||
|
||||
bridge.shutdown().unwrap();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,26 +4,6 @@ import { readFile, writeFile } from "node:fs/promises";
|
|||
import path from "node:path";
|
||||
import JSON5 from "json5";
|
||||
|
||||
function setNested(root, dottedKey, value) {
|
||||
const parts = dottedKey.split(":");
|
||||
let current = root;
|
||||
|
||||
for (let i = 0; i < parts.length - 1; i++) {
|
||||
const key = parts[i];
|
||||
if (!(key in current)) current[key] = {};
|
||||
if (
|
||||
typeof current[key] !== "object" ||
|
||||
current[key] === null ||
|
||||
Array.isArray(current[key])
|
||||
) {
|
||||
throw new Error(`Key collision at '${parts.slice(0, i + 1).join(":")}'`);
|
||||
}
|
||||
current = current[key];
|
||||
}
|
||||
|
||||
current[parts.at(-1)] = value;
|
||||
}
|
||||
|
||||
function toYaml(value, indent = 0) {
|
||||
const pad = " ".repeat(indent);
|
||||
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
||||
|
|
@ -58,12 +38,7 @@ async function main() {
|
|||
throw new Error("Expected object at root or translation");
|
||||
}
|
||||
|
||||
const rustI18n = {};
|
||||
for (const [key, value] of Object.entries(translationRoot)) {
|
||||
setNested(rustI18n, key, value);
|
||||
}
|
||||
|
||||
const yaml = `${toYaml(rustI18n)}\n`;
|
||||
const yaml = `${toYaml(translationRoot)}\n`;
|
||||
await writeFile(outputPath, yaml, "utf8");
|
||||
console.log(`Converted ${inputPath} -> ${outputPath}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue