diff --git a/frontend/bindings/time/index.ts b/frontend/bindings/time/index.ts new file mode 100644 index 0000000..c9d993a --- /dev/null +++ b/frontend/bindings/time/index.ts @@ -0,0 +1,4 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/frontend/bindings/time/models.ts b/frontend/bindings/time/models.ts new file mode 100644 index 0000000..6646738 --- /dev/null +++ b/frontend/bindings/time/models.ts @@ -0,0 +1,51 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "@wailsio/runtime"; + +/** + * A Time represents an instant in time with nanosecond precision. + * + * Programs using times should typically store and pass them as values, + * not pointers. That is, time variables and struct fields should be of + * type [time.Time], not *time.Time. + * + * A Time value can be used by multiple goroutines simultaneously except + * that the methods [Time.GobDecode], [Time.UnmarshalBinary], [Time.UnmarshalJSON] and + * [Time.UnmarshalText] are not concurrency-safe. + * + * Time instants can be compared using the [Time.Before], [Time.After], and [Time.Equal] methods. + * The [Time.Sub] method subtracts two instants, producing a [Duration]. + * The [Time.Add] method adds a Time and a Duration, producing a Time. + * + * The zero value of type Time is January 1, year 1, 00:00:00.000000000 UTC. + * As this time is unlikely to come up in practice, the [Time.IsZero] method gives + * a simple way of detecting a time that has not been initialized explicitly. + * + * Each time has an associated [Location]. The methods [Time.Local], [Time.UTC], and Time.In return a + * Time with a specific Location. Changing the Location of a Time value with + * these methods does not change the actual instant it represents, only the time + * zone in which to interpret it. + * + * Representations of a Time value saved by the [Time.GobEncode], [Time.MarshalBinary], [Time.AppendBinary], + * [Time.MarshalJSON], [Time.MarshalText] and [Time.AppendText] methods store the [Time.Location]'s offset, + * but not the location name. They therefore lose information about Daylight Saving Time. + * + * In addition to the required “wall clock” reading, a Time may contain an optional + * reading of the current process's monotonic clock, to provide additional precision + * for comparison or subtraction. + * See the “Monotonic Clocks” section in the package documentation for details. + * + * Note that the Go == operator compares not just the time instant but also the + * Location and the monotonic clock reading. Therefore, Time values should not + * be used as map or database keys without first guaranteeing that the + * identical Location has been set for all values, which can be achieved + * through use of the UTC or Local method, and that the monotonic clock reading + * has been stripped by setting t = t.Round(0). In general, prefer t.Equal(u) + * to t == u, since t.Equal uses the most accurate comparison available and + * correctly handles the case when only one of its arguments has a monotonic + * clock reading. + */ +export type Time = any; diff --git a/frontend/bindings/voidraft/internal/models/index.ts b/frontend/bindings/voidraft/internal/models/index.ts new file mode 100644 index 0000000..c9d993a --- /dev/null +++ b/frontend/bindings/voidraft/internal/models/index.ts @@ -0,0 +1,4 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +export * from "./models.js"; diff --git a/frontend/bindings/voidraft/internal/models/models.ts b/frontend/bindings/voidraft/internal/models/models.ts new file mode 100644 index 0000000..db6a899 --- /dev/null +++ b/frontend/bindings/voidraft/internal/models/models.ts @@ -0,0 +1,219 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as time$0 from "../../../time/models.js"; + +/** + * AppConfig 应用配置 + */ +export class AppConfig { + /** + * 编辑器配置 + */ + "editor": EditorConfig; + + /** + * 路径配置 + */ + "paths": PathConfig; + + /** + * 配置元数据 + */ + "metadata": ConfigMetadata; + + /** Creates a new AppConfig instance. */ + constructor($$source: Partial = {}) { + if (!("editor" in $$source)) { + this["editor"] = (new EditorConfig()); + } + if (!("paths" in $$source)) { + this["paths"] = (new PathConfig()); + } + if (!("metadata" in $$source)) { + this["metadata"] = (new ConfigMetadata()); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new AppConfig instance from a string or object. + */ + static createFrom($$source: any = {}): AppConfig { + const $$createField0_0 = $$createType0; + const $$createField1_0 = $$createType1; + const $$createField2_0 = $$createType2; + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + if ("editor" in $$parsedSource) { + $$parsedSource["editor"] = $$createField0_0($$parsedSource["editor"]); + } + if ("paths" in $$parsedSource) { + $$parsedSource["paths"] = $$createField1_0($$parsedSource["paths"]); + } + if ("metadata" in $$parsedSource) { + $$parsedSource["metadata"] = $$createField2_0($$parsedSource["metadata"]); + } + return new AppConfig($$parsedSource as Partial); + } +} + +/** + * ConfigMetadata 配置元数据 + */ +export class ConfigMetadata { + /** + * 配置版本 + */ + "version": string; + + /** + * 最后更新时间 + */ + "lastUpdated": time$0.Time; + + /** Creates a new ConfigMetadata instance. */ + constructor($$source: Partial = {}) { + if (!("version" in $$source)) { + this["version"] = ""; + } + if (!("lastUpdated" in $$source)) { + this["lastUpdated"] = null; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new ConfigMetadata instance from a string or object. + */ + static createFrom($$source: any = {}): ConfigMetadata { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new ConfigMetadata($$parsedSource as Partial); + } +} + +/** + * EditorConfig 定义编辑器配置 + */ +export class EditorConfig { + /** + * 字体大小 + */ + "fontSize": number; + + /** + * 文件保存的编码 + */ + "encoding": string; + + /** + * 是否启用Tab缩进 + */ + "enableTabIndent": boolean; + + /** + * Tab大小 + */ + "tabSize": number; + + /** + * Tab类型(空格或Tab) + */ + "tabType": TabType; + + /** Creates a new EditorConfig instance. */ + constructor($$source: Partial = {}) { + if (!("fontSize" in $$source)) { + this["fontSize"] = 0; + } + if (!("encoding" in $$source)) { + this["encoding"] = ""; + } + if (!("enableTabIndent" in $$source)) { + this["enableTabIndent"] = false; + } + if (!("tabSize" in $$source)) { + this["tabSize"] = 0; + } + if (!("tabType" in $$source)) { + this["tabType"] = ("" as TabType); + } + + Object.assign(this, $$source); + } + + /** + * Creates a new EditorConfig instance from a string or object. + */ + static createFrom($$source: any = {}): EditorConfig { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new EditorConfig($$parsedSource as Partial); + } +} + +/** + * PathConfig 定义配置文件路径相关配置 + */ +export class PathConfig { + /** + * 根目录 + */ + "rootDir": string; + + /** + * 配置文件路径 + */ + "configPath": string; + + /** Creates a new PathConfig instance. */ + constructor($$source: Partial = {}) { + if (!("rootDir" in $$source)) { + this["rootDir"] = ""; + } + if (!("configPath" in $$source)) { + this["configPath"] = ""; + } + + Object.assign(this, $$source); + } + + /** + * Creates a new PathConfig instance from a string or object. + */ + static createFrom($$source: any = {}): PathConfig { + let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source; + return new PathConfig($$parsedSource as Partial); + } +} + +/** + * TabType 定义了制表符类型 + */ +export enum TabType { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + /** + * TabTypeSpaces 使用空格作为制表符 + */ + TabTypeSpaces = "spaces", + + /** + * TabTypeTab 使用Tab作为制表符 + */ + TabTypeTab = "tab", +}; + +// Private type creation functions +const $$createType0 = EditorConfig.createFrom; +const $$createType1 = PathConfig.createFrom; +const $$createType2 = ConfigMetadata.createFrom; diff --git a/frontend/bindings/voidraft/internal/services/configservice.ts b/frontend/bindings/voidraft/internal/services/configservice.ts new file mode 100644 index 0000000..b5ed217 --- /dev/null +++ b/frontend/bindings/voidraft/internal/services/configservice.ts @@ -0,0 +1,76 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * ConfigService 提供配置管理功能 + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "@wailsio/runtime"; + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import * as models$0 from "../models/models.js"; + +/** + * GetAppConfig 获取应用配置 + */ +export function GetAppConfig(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3361428829) as any; + let $typingPromise = $resultPromise.then(($result: any) => { + return $$createType1($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * GetEditorConfig 获取编辑器配置 + */ +export function GetEditorConfig(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3648153351) as any; + let $typingPromise = $resultPromise.then(($result: any) => { + return $$createType2($result); + }) as any; + $typingPromise.cancel = $resultPromise.cancel.bind($resultPromise); + return $typingPromise; +} + +/** + * GetFullConfigPath 获取完整的配置文件路径 + */ +export function GetFullConfigPath(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(38527092) as any; + return $resultPromise; +} + +/** + * ResetToDefault 重置为默认配置 + */ +export function ResetToDefault(): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4057687351) as any; + return $resultPromise; +} + +/** + * SaveAppConfig 保存应用配置 + */ +export function SaveAppConfig(config: models$0.AppConfig | null): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2077587650, config) as any; + return $resultPromise; +} + +/** + * UpdateEditorConfig 更新编辑器配置 + */ +export function UpdateEditorConfig(editorConfig: models$0.EditorConfig): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1237949666, editorConfig) as any; + return $resultPromise; +} + +// Private type creation functions +const $$createType0 = models$0.AppConfig.createFrom; +const $$createType1 = $Create.Nullable($$createType0); +const $$createType2 = models$0.EditorConfig.createFrom; diff --git a/frontend/bindings/voidraft/internal/services/fileservice.ts b/frontend/bindings/voidraft/internal/services/fileservice.ts new file mode 100644 index 0000000..5b129a6 --- /dev/null +++ b/frontend/bindings/voidraft/internal/services/fileservice.ts @@ -0,0 +1,51 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +/** + * FileService 提供原子化文件操作 + * @module + */ + +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore: Unused imports +import {Call as $Call, Create as $Create} from "@wailsio/runtime"; + +/** + * DeleteFile 删除文件 + */ +export function DeleteFile(filePath: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1771867857, filePath) as any; + return $resultPromise; +} + +/** + * EnsureDir 确保目录存在,如不存在则创建 + */ +export function EnsureDir(dirPath: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(2291976369, dirPath) as any; + return $resultPromise; +} + +/** + * FileExists 检查文件是否存在 + */ +export function FileExists(filePath: string): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(4264173930, filePath) as any; + return $resultPromise; +} + +/** + * LoadJSON 从文件加载JSON数据 + */ +export function LoadJSON(filePath: string, target: any): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(1385779418, filePath, target) as any; + return $resultPromise; +} + +/** + * SaveJSON 原子化保存JSON数据到文件 + */ +export function SaveJSON(filePath: string, data: any): Promise & { cancel(): void } { + let $resultPromise = $Call.ByID(3646933935, filePath, data) as any; + return $resultPromise; +} diff --git a/frontend/bindings/voidraft/internal/services/index.ts b/frontend/bindings/voidraft/internal/services/index.ts new file mode 100644 index 0000000..85e1b09 --- /dev/null +++ b/frontend/bindings/voidraft/internal/services/index.ts @@ -0,0 +1,9 @@ +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL +// This file is automatically generated. DO NOT EDIT + +import * as ConfigService from "./configservice.js"; +import * as FileService from "./fileservice.js"; +export { + ConfigService, + FileService +}; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 658393f..9aaed30 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -40,6 +40,7 @@ "@lezer/highlight": "^1.2.1", "@primeuix/themes": "^1.0.3", "@types/uuid": "^10.0.0", + "@vueuse/core": "^13.1.0", "codemirror": "^6.0.1", "pinia": "^3.0.2", "pinia-plugin-persistedstate": "^4.2.0", @@ -2156,6 +2157,12 @@ "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", "license": "MIT" }, + "node_modules/@types/web-bluetooth": { + "version": "0.0.21", + "resolved": "https://registry.npmmirror.com/@types/web-bluetooth/-/web-bluetooth-0.0.21.tgz", + "integrity": "sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==", + "license": "MIT" + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "8.31.0", "resolved": "https://registry.npmmirror.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.31.0.tgz", @@ -2600,6 +2607,44 @@ "integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==", "license": "MIT" }, + "node_modules/@vueuse/core": { + "version": "13.1.0", + "resolved": "https://registry.npmmirror.com/@vueuse/core/-/core-13.1.0.tgz", + "integrity": "sha512-PAauvdRXZvTWXtGLg8cPUFjiZEddTqmogdwYpnn60t08AA5a8Q4hZokBnpTOnVNqySlFlTcRYIC8OqreV4hv3Q==", + "license": "MIT", + "dependencies": { + "@types/web-bluetooth": "^0.0.21", + "@vueuse/metadata": "13.1.0", + "@vueuse/shared": "13.1.0" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "vue": "^3.5.0" + } + }, + "node_modules/@vueuse/metadata": { + "version": "13.1.0", + "resolved": "https://registry.npmmirror.com/@vueuse/metadata/-/metadata-13.1.0.tgz", + "integrity": "sha512-+TDd7/a78jale5YbHX9KHW3cEDav1lz1JptwDvep2zSG8XjCsVE+9mHIzjTOaPbHUAk5XiE4jXLz51/tS+aKQw==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/shared": { + "version": "13.1.0", + "resolved": "https://registry.npmmirror.com/@vueuse/shared/-/shared-13.1.0.tgz", + "integrity": "sha512-IVS/qRRjhPTZ6C2/AM3jieqXACGwFZwWTdw5sNTSKk2m/ZpkuuN+ri+WCVUP8TqaKwJYt/KuMwmXspMAw8E6ew==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "vue": "^3.5.0" + } + }, "node_modules/@wailsio/runtime": { "version": "3.0.0-alpha.66", "resolved": "https://registry.npmmirror.com/@wailsio/runtime/-/runtime-3.0.0-alpha.66.tgz", diff --git a/frontend/package.json b/frontend/package.json index 52a010a..a039e01 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -44,6 +44,7 @@ "@lezer/highlight": "^1.2.1", "@primeuix/themes": "^1.0.3", "@types/uuid": "^10.0.0", + "@vueuse/core": "^13.1.0", "codemirror": "^6.0.1", "pinia": "^3.0.2", "pinia-plugin-persistedstate": "^4.2.0", diff --git a/frontend/src/App.vue b/frontend/src/App.vue index b689af8..c560b67 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,14 +1,21 @@ @@ -20,7 +27,7 @@ import Toolbar from '@/components/toolbar/Toolbar.vue'; padding: 0; display: flex; flex-direction: column; - + .editor-wrapper { flex: 1; overflow: hidden; diff --git a/frontend/src/components/toolbar/Toolbar.vue b/frontend/src/components/toolbar/Toolbar.vue index 4b45d09..1cb65b2 100644 --- a/frontend/src/components/toolbar/Toolbar.vue +++ b/frontend/src/components/toolbar/Toolbar.vue @@ -38,7 +38,7 @@ const configStore = useConfigStore(); {{ configStore.config.encoding }} -