Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Revamp (Cleanup of 26/05) #3

Merged
merged 8 commits into from
May 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 73 additions & 49 deletions raptorfx/raptorfx.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,73 @@
# RaptorFX
![RaptorFX Logo - by ArathainFarqou and LePichu](https://cdn.discordapp.com/attachments/890845937243684886/921414193423466536/rfx_text_logo.png)
## Aim
RaptorFX aims to centralise app development into one codebase while targetting multiple platforms at once, we will make use of web technologies to make it easier for anyone to dive in and start developing. People may even contribute to the main codebase of RaptorFX if they wish to improve it in any way, shape, or form.

## Core
### Standard Library
RaptorFX while shipping a Deno instance, will also ship its own set of functions like Electron, Tauri or Neutralino to make it easier to work across platforms with ease. In addition to the standard library, we will provide platform exclusive feature plugins that only work either on mobile or desktop, if the said functionality work on both, we will ship it in standard library instead. The following is a list of functions with their description on what they do:

#### Global API
- `loadURL`: Loads the webpage from the provided URL onto current WebView.
- `manageWindowMetadata`: Manages metadata of the current WebView window like Min/Max Sizes of Height/Width, is the Window Fullscreen, is it frameless, what is the window icon etc.
- `injectCustomCSS`: Injects a CSS File onto current WebView.
- `getSystemTheme`: Returns the System's current theme as either `LIGHT` or `DARK` depending on theme type respectively.
- `getOS`: Returns the current operating system of the machine being used, possible return values are `WINDOWS`, `MACOS`, `LINUX`, `ANDROID` and `IOS`.
- `getSystemLanguage`: Returns the language code (ex: `fr-FR`, `en_US`etc) of the current default system language set for use.
- `setWindowTitle`: Sets the title of the current window the JS is being executed from.
- `setWindowIcon`: Sets the icon of the current window the JS is being executed from.
- `setWindowBarColor`: Set the color of the window accent color (on Windows 10+) and the status bar (on Android and iOS).
- `minimizeWindow`: Minimizes the current WebView Window.
- `exitWindow`: Destroys the current WebView in the window and proceeds to close the window.
- `nativeDialogueBuilder`: A Class to make customizable native dialogue boxes across platforms, these dialogues can include Icons, Texts, Buttons, Scrollbars, and Input fields.
- `nativeNotificationBuilder`: A Class to deploy native notifications which can hold text-based descriptions and titles and images as notification icons.

#### Desktop-Exclusive
- `createNewWebView`: Creates a new WebView Window for use, similar to `createWindow()` from Electron.

#### Mobile Exclusive
- `showHudToast`: Shows a toast with provided text.
- `setWindowOrientation`: Sets the orientation of the current window to either `PORTRAIT` or `LANDSCAPE`.
- `nativeSnackbarBuilder`: A Class to make Android Snackbars.

### CLI
The RaptorFX CLI is a tool to helps scaffhold and handle RaptorFX projects quickly and efficiently, it has several (sub)commands and flags listed below as part of the CLI:
#### Subcommands:
- `init`: Initializes an empty RaptorFX project with a git repository in it, and recreates every file and folder seen in `RaptorFX/Example-App` repository.
- `build`: Builds the final app for the platforms listed in the local manifest file.
- `debug`: Launches the debug client with the current app if there is any in the workspace folder.
- `version`: Prints out the version of RaptorFX CLI you are using alongside if there are any future versions available.
- `upgrade`: Upgrades the CLI and restores project templates if they are missing.

#### Flags
- `-h, --help`: Provides syntax for a sub-command or a flag.
- `-m, --mode`: Release mode of how to build the app, possible values are `debug` and `release.`
- `-f, --force`: Executes a command even if warnings were issue prior.
- `--rfx_ver`: Sets the version of RaptorFX to use while generating project, format: `<version_number>-<release_channel>`; example: `0.1.0-alpha`.

### Debug Client (RaptorFX Toolbox)
Debug Clients are on-the-fly compilers for RaptorFX Projects to scaffhold or test packages anywhere at anytime. They will can compile apps on the fly while running them in a testing WebView which does share all the capabilities a normal RaptorFX App would, exceptions being a few functions will function differently, like `RaptorFX.exitWindow()` will now exit the current running app, instead of closing the entire toolbox app.
# RaptorFX
![RaptorFX Logo - by ArathainFarqou and LePichu](https://cdn.discordapp.com/attachments/890845937243684886/921414193423466536/rfx_text_logo.png)
![Our Motive!](https://cdn.discordapp.com/attachments/890845937243684886/979286337016430632/sub_text.png)

## Aim
RaptorFX aims to centralise app development into one codebase by targetting multiple platforms at once. It will make use of web technologies to make it easier for anyone to dive in and start developing. People may even contribute to the main codebase of RaptorFX if they wish to add features or fix bugs.

## Core

### API
RaptorFX, while shipping a Deno instance, will also ship its own set of functions (like Electron, Tauri, or Neutralino) to make it easier to work across multiple platforms with ease. We also aim to blend in with existing Web APIs and Standards. The following is a list of classes, functions, enums, and related, all of which come under the namespace of `RaptorFX`, each with a description of what they do:

#### Classes
- `Clipboard`: Relates to the user's clipboard (store of keyboard copy items).
- `Notifications`: Manages notifications; push, group, pop.
- `Window`: Window-related activities like Maximise, Minimize, and Position.
- `System`: System-related class which returns Architecture, OS, etc.

#### Interfaces
- `NotificationData`:
* `title (string)`: Main title of the notification.
* `description (string)`: Description/secondary title of the notification.
* `icon (url)`: URL of the icon to show in the notification.

- `PositionData`:
* `x (number)`: Starting coordinate in the X-Axis of the Window.
* `y (number)`: Starting coordinate in the Y-Axis of the Window.
* `height (number)`: Height of the Window.
* `width (number)`: Width of the Window.

#### Functions
- `Clipboard`:
* `copy (content: string) [void]`: Pushes copy content to user's clipboard.
* `cut (content: string) [void]`: Pushes cut content to user's clipboard.
* `read () [string]`: Reads and returns content from the user's clipboard.

- `Notifications`:
* `build (object: NotificationData) [void]`: Takes in `NotificationData`, to create a pushable/referencable notification block.
* `push (data: NotificationData, mode: NotificationMode) [Promise]`: Pushes the notification built from data, with the given configuration and channel to send to.
* `createToast (data: String, length: ToastLength) [void]`: Creates a Toast with data provided. [*¹]

- `Window`:
* `maximize () [void]`: Maximizes the context window.
* `minimize () [void]`: Minimizes the context window.
* `exit (code: number) [void]`: Completely exits the context window with an exit code.
* `position (newPosition: PositionData) [PositionData]`: If given arguments, changes the position of the window, without any arguments, the current cordinates of window are returned as `PositionData`.
* `statusBarColor (hex: string) [void]`: Sets the color of the status bar/window accent color from the provided hex color as paramater.

- `System`:
* `arch () [string]`: Returns the architecture (`x86`, `arm64` etc.) of the system as a string.
* `os () [string]`: Returns the operating system (`windows_11`, `android_12` etc.) of the system as a string.
* `locale () [string]`: Returns the system's locale, for example: `en_US`, `fr_FR`, `hi_IN` etc.

#### Variables
- `LocalStorage`: Points to the path of the internal app storage, which could be a folder under `$USER\LocalAppData\YourApp\` (on Windows), or `data/data/YourApp` (on Android).
- `ExternalStorage`: Points to the root of the file system, usually `/mounted/0/` (on Android), or any absolute/relative path on other operating systems like Windows or Linux.

#### Enums
- `ToastLength`: Accepts `SHORT` and `LONG`, self-describing length of Toast displayed on the screen. [*¹]
- `NotificationMode`: Accepts `SINGLE` and `GROUP`, where `SINGLE` creates a new notification for each push, while `GROUP` collects it into a single grouped notification.

_Classes and Interfaces are available as `RaptorFX.<Name>`, functions as `RaptorFX.<ClassName>.<FunctionName>`, while variables as `RaptorFX.Variables.<VariableName>`, and enums as `RaptorFX.Enums.<EnumName>`._

[*¹] refers to being exclusive to the mobile platform, or either one of them (i.e either on Android or iOS).

### CLI
The RaptorFX CLI is a tool to help scaffold and handle RaptorFX projects quickly and efficiently, it has several commands and flags listed below as part of the CLI:

[CLI Documentation/Specification scrapped/on-hold; new design coming with next RFC.]

## Toolbox
Toolbox is a cross-platform on-the-fly compiler for RaptorFX Projects to scaffold or test projects anywhere. It will compile apps on the fly while running them in a testing WebView which shares all the capabilities a normal RaptorFX App would, except for a few functions operating differently - such as `RaptorFX.Window.exit()`, which will exit the currently running app (instead of closing the entire toolbox app).