-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10e58ba
commit c0bd7e3
Showing
46 changed files
with
879 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { injectable } from 'inversify'; | ||
|
||
@injectable() | ||
export class FileExportService { | ||
exportText(contents: string, filename: string) { | ||
const uri = "data:text/plain;charset=utf-8," + encodeURIComponent(contents); | ||
this.export(uri, filename); | ||
} | ||
|
||
exportJson(obj: object, filename: string) { | ||
const uri = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(obj)); | ||
this.export(uri, filename); | ||
} | ||
|
||
export(uri: string, filename: string): void { | ||
var link = document.createElement("a"); | ||
link.download = filename; | ||
link.href = uri; | ||
link.click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 13 additions & 11 deletions
24
packages/interfaces/src/Services/IConfigurationService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
import { IProfile } from '../Profile'; | ||
|
||
export const IConfigurationServiceSymbol = Symbol.for('IConfigurationService'); | ||
|
||
/** | ||
* Service to manage app configuration. | ||
*/ | ||
export interface IConfigurationService { | ||
/** | ||
* Gets a list of all profile names. | ||
* Gets a list of all {@link IProfile} names. | ||
*/ | ||
getProfiles(): string[]; | ||
|
||
/** | ||
* Returns the specified Profile. | ||
* @param name name of the profile | ||
* Returns the specified {@link IProfile}. | ||
* @param id id of the {@link IProfile}. | ||
*/ | ||
getProfile(name: string): IProfile; | ||
getProfile(id: string): IProfile; | ||
|
||
/** | ||
* Updates the specified Profile. | ||
* @param name name of the profile | ||
* @param profile updated profile | ||
* Updates the specified {@link IProfile}. | ||
* @param id id of the {@link IProfile}. | ||
* @param profile updated {@link IProfile}. | ||
*/ | ||
setProfile(name: string, profile: IProfile): void; | ||
setProfile(id: string, profile: IProfile): void; | ||
|
||
/** | ||
* Deletes the specified Profile. | ||
* @param name name of the profile | ||
* Deletes the specified {@link IProfile}. | ||
* @param id id of the {@link IProfile}. | ||
*/ | ||
removeProfile(name: string): void; | ||
removeProfile(id: string): void; | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/interfaces/src/Services/IDialogService/IDialogOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { ReadonlySignal } from '@preact/signals-core'; | ||
|
||
export interface IDialogOptions { | ||
title?: ReadonlySignal<string>; | ||
okButtonText?: ReadonlySignal<string>; | ||
cancelButtonText?: ReadonlySignal<string>; | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/interfaces/src/Services/IDialogService/IDialogService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { IDialogOptions } from './IDialogOptions'; | ||
import { IFileDialogOptions } from './IFileDialogOptions'; | ||
|
||
export const IDialogServiceSymbol = Symbol.for('IDialogService'); | ||
|
||
/** | ||
* Service thats shows simple dialogs. | ||
*/ | ||
export interface IDialogService { | ||
/** | ||
* Shows a simple dialog that returns a boolean. | ||
*/ | ||
boolDialog(options: IDialogOptions): Promise<boolean>; | ||
|
||
/** | ||
* Shows a simple dialog that returns a string. | ||
*/ | ||
stringDialog(options: IDialogOptions): Promise<string>; | ||
|
||
/** | ||
* Shows a simple dialog that returns a file. | ||
*/ | ||
fileDialog(options: IFileDialogOptions): Promise<any>; | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/interfaces/src/Services/IDialogService/IFileDialogOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { IDialogOptions } from './IDialogOptions'; | ||
|
||
export interface IFileDialogOptions extends IDialogOptions { | ||
accept?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { type IDialogOptions } from './IDialogOptions'; | ||
export { IDialogServiceSymbol, type IDialogService } from './IDialogService'; | ||
export { type IFileDialogOptions } from './IFileDialogOptions'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export const IFileExportServiceSymbol = Symbol.for('IFileExportService'); | ||
|
||
export interface IFileExportService { | ||
/** | ||
* Exports a text file. | ||
* @param contents text content of the file. | ||
* @param filename name of the file. | ||
*/ | ||
exportText(contents: string, filename: string): void; | ||
|
||
/** | ||
* Exports a json file. | ||
* @param contents content of the json file. | ||
* @param filename name of the file. | ||
*/ | ||
exportJson(contents: object, filename: string): void; | ||
|
||
/** | ||
* Exports a file from a uri. | ||
* @param uri uri of the file to export. | ||
* @param filename name of the file. | ||
*/ | ||
export(uri: string, filename: string): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/interfaces/src/Services/IPopupService/IPopupOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Options for a popup. | ||
*/ | ||
export interface IPopupOptions { | ||
/** | ||
* Whether or not to close on outside click (default: true). | ||
*/ | ||
closeOnOutsideClick?: boolean; | ||
|
||
/** | ||
* Content of the popup. | ||
* @param close Function to close the popup. | ||
* @returns The component to display. | ||
*/ | ||
content: (close: () => void) => any; | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/interfaces/src/Services/IPopupService/IPopupService.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { IPopupOptions } from './IPopupOptions'; | ||
|
||
export const IPopupServiceSymbol = Symbol.for('IPopupService'); | ||
|
||
export interface IPopupService { | ||
/** | ||
* Shows a dialog. | ||
* @param options options of the popup. | ||
*/ | ||
show(options: IPopupOptions): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { type IPopupOptions } from './IPopupOptions'; | ||
export { IPopupServiceSymbol, type IPopupService } from './IPopupService'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.