From 1ca2d07540c47c95b82e2917e93edef02728ae9a Mon Sep 17 00:00:00 2001 From: NoryiE Date: Wed, 26 Feb 2025 23:42:14 +0000 Subject: [PATCH 01/17] deploy: 6f0b98ab89b04b1aad24c1c44998678142f7cc6b --- .github/workflows/deploy.yml | 55 ------------------------------- docs/references/elements/Input.md | 9 ++++- 2 files changed, 8 insertions(+), 56 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index f800bad..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Automatic Deploy VitePress site to Pages - -on: - push: - branches: [gh-pages] - paths: - - 'docs/**' - - workflow_dispatch: - -permissions: - contents: read - pages: write - id-token: write - -concurrency: - group: pages - cancel-in-progress: false - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout gh-pages - uses: actions/checkout@v4 - with: - ref: gh-pages - fetch-depth: 0 - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: npm - - name: Setup Pages - uses: actions/configure-pages@v4 - - name: Install dependencies - run: npm ci - - name: Build with VitePress - run: npm run docs:build - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: docs/.vitepress/dist - - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - needs: build - runs-on: ubuntu-latest - name: Deploy - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/docs/references/elements/Input.md b/docs/references/elements/Input.md index 8c149d7..bdffedf 100644 --- a/docs/references/elements/Input.md +++ b/docs/references/elements/Input.md @@ -12,7 +12,8 @@ cursor movement, text manipulation, placeholder text, and input validation. |maxLength|number?|nil|Maximum length of input text (optional) |placeholder|string|...|Text to display when input is empty |placeholderColor|color|gray|Color of the placeholder text -|focusedColor|color|blue|Background color when input is focused +|focusedBackground|color|blue|Background color when input is focused +|focusedForeground|color|white|Foreground color when input is focused |pattern|string?|nil|Regular expression pattern for input validation |cursorColor|number|nil|Color of the cursor @@ -20,6 +21,8 @@ cursor movement, text manipulation, placeholder text, and input validation. |Method|Returns|Description| |---|---|---| +|[Input:blur](#Input:blur)|-| +|[Input:focus](#Input:focus)|-| |[Input:setCursor](#Input:setCursor)|-| |[Input:updateViewport](#Input:updateViewport)|Input|Updates the input's viewport @@ -34,6 +37,10 @@ cursor movement, text manipulation, placeholder text, and input validation. |[Input:mouse_click](#Input:mouse_click)|boolean|Handles mouse click events |[Input:render](#Input:render)|-|Renders the input element +## Input:blur() + +## Input:focus() + ## Input:setCursor() ## Input:updateViewport() From 2b52c8608a009a247af5e1312021c22d8ad96517 Mon Sep 17 00:00:00 2001 From: NoryiE Date: Fri, 28 Feb 2025 09:18:45 +0000 Subject: [PATCH 02/17] deploy: 85988be89203ae3be198305d5ecfac24ae2a79a1 --- docs/references/elements/Container.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/references/elements/Container.md b/docs/references/elements/Container.md index 1a6aaf6..2cba919 100644 --- a/docs/references/elements/Container.md +++ b/docs/references/elements/Container.md @@ -17,6 +17,12 @@ like Frames, BaseFrames, and more. |offsetX|number|0|Horizontal content offset |offsetY|number|0|Vertical content offset +## Combined Properties + +|Name|Properties|Description| +|---|---|---| +|offset|`offsetX offsetY`|Combined property for offsetX and offsetY| + ## Functions |Method|Returns|Description| From 0d5942eeef3d0cd2f7108ee70b5e73814e7f6e49 Mon Sep 17 00:00:00 2001 From: NoryiE Date: Sun, 2 Mar 2025 21:04:20 +0000 Subject: [PATCH 03/17] deploy: 0af0a6252883ac4586af054da9b867e1ad740f02 --- docs/references/elements/Image.md | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/docs/references/elements/Image.md b/docs/references/elements/Image.md index 4d6160e..2fa3965 100644 --- a/docs/references/elements/Image.md +++ b/docs/references/elements/Image.md @@ -9,7 +9,6 @@ See: https://github.com/SkyTheCodeMaster/bimg |---|---|---|---| |bimg|table|{}|The bimg image data |currentFrame|number|1|Current animation frame -|metadata|table|{}|Image metadata (version, palette, etc) |autoResize|boolean|false|Whether to automatically resize the image when content exceeds bounds |offsetX|number|0|Horizontal offset for viewing larger images |offsetY|number|0|Vertical offset for viewing larger images @@ -25,15 +24,21 @@ See: https://github.com/SkyTheCodeMaster/bimg |Method|Returns|Description| |---|---|---| |[Image:addFrame](#Image:addFrame)|Image|Adds a new frame to the image +|[Image:getBg](#Image:getBg)|-| +|[Image:getFg](#Image:getFg)|-| +|[Image:getFrame](#Image:getFrame)|-| |[Image:getImageSize](#Image:getImageSize)|number|Gets the size of the image +|[Image:getMetadata](#Image:getMetadata)|-| |[Image:getPixelData](#Image:getPixelData)|number?|Gets pixel information at position -|[Image:loadBimg](#Image:loadBimg)|Image|Loads a bimg format image +|[Image:getText](#Image:getText)|-| |[Image:nextFrame](#Image:nextFrame)|Image|Advances to the next frame in the animation |[Image:resizeImage](#Image:resizeImage)|Image|Resizes the image to the specified width and height |[Image:setBg](#Image:setBg)|Image|Sets the background color at the specified position |[Image:setFg](#Image:setFg)|Image|Sets the foreground color at the specified position +|[Image:setMetadata](#Image:setMetadata)|-| |[Image:setPixel](#Image:setPixel)|Image|Sets the pixel at the specified position |[Image:setText](#Image:setText)|Image|Sets the text at the specified position +|[Image:updateFrame](#Image:updateFrame)|-| ## Protected Functions @@ -49,6 +54,12 @@ Adds a new frame to the image ### Returns * `Image` `self` The Image instance +## Image:getBg() + +## Image:getFg() + +## Image:getFrame() + ## Image:getImageSize() Gets the size of the image @@ -56,6 +67,8 @@ Gets the size of the image * `number` `width` The width of the image * `number` `height` The height of the image +## Image:getMetadata() + ## Image:getPixelData(x, y) Gets pixel information at position @@ -68,14 +81,7 @@ Gets pixel information at position * `number?` `bg` Background color * `string?` `char` Character at position -## Image:loadBimg(bimgData) -Loads a bimg format image - -### Parameters -* `bimgData` `table` The bimg image data - -### Returns -* `Image` `self` The Image instance +## Image:getText() ## Image:nextFrame() Advances to the next frame in the animation @@ -115,6 +121,8 @@ Sets the foreground color at the specified position ### Returns * `Image` `self` The Image instance +## Image:setMetadata() + ## Image:setPixel(x, y, char, fg, bg) Sets the pixel at the specified position @@ -139,4 +147,6 @@ Sets the text at the specified position ### Returns * `Image` `self` The Image instance +## Image:updateFrame() + From 31ea7f9d050a180b7428e3e94a8f9a3ad45a943f Mon Sep 17 00:00:00 2001 From: NoryiE Date: Mon, 3 Mar 2025 16:39:00 +0000 Subject: [PATCH 04/17] deploy: 373bd7b485fd1c453c43d6bb029990241c421a31 --- docs/references/elements/Graph.md | 24 ++++++++++++++++++++++++ docs/references/elements/List.md | 7 +++++++ docs/references/main.md | 10 ++++++++++ 3 files changed, 41 insertions(+) create mode 100644 docs/references/elements/Graph.md diff --git a/docs/references/elements/Graph.md b/docs/references/elements/Graph.md new file mode 100644 index 0000000..59cd7a2 --- /dev/null +++ b/docs/references/elements/Graph.md @@ -0,0 +1,24 @@ +# Graph : VisualElement + +## Functions + +|Method|Returns|Description| +|---|---|---| +|[Graph.new](#Graph.new)|-| +|[Graph:addPoint](#Graph:addPoint)|-| +|[Graph:init](#Graph:init)|-| +|[Graph:render](#Graph:render)|-| +|[Graph:setPoint](#Graph:setPoint)|-| + + +## Graph.new() + +## Graph:addPoint() + +## Graph:init() + +## Graph:render() + +## Graph:setPoint() + + diff --git a/docs/references/elements/List.md b/docs/references/elements/List.md index 82e18e5..2b9dc0c 100644 --- a/docs/references/elements/List.md +++ b/docs/references/elements/List.md @@ -25,6 +25,7 @@ custom item rendering, separators, and selection handling. |---|---|---| |[List:addItem](#List:addItem)|List|Adds an item to the list |[List:clear](#List:clear)|List|Clears all items from the list +|[List:getSelectedItem](#List:getSelectedItem)|table?|Gets first selected item |[List:getSelectedItems](#List:getSelectedItems)|table|Gets the currently selected items |[List:onSelect](#List:onSelect)|List|Registers a callback for the select event |[List:removeItem](#List:removeItem)|List|Removes an item from the list @@ -67,6 +68,12 @@ Clears all items from the list list:clear() ``` +## List:getSelectedItem() +Gets first selected item + +### Returns +* `table?` `selected` The first item + ## List:getSelectedItems() Gets the currently selected items diff --git a/docs/references/main.md b/docs/references/main.md index 159baa0..6522706 100644 --- a/docs/references/main.md +++ b/docs/references/main.md @@ -28,6 +28,7 @@ What this code does is it loads basalt into the project, and you can access it b |[basalt.create](#basalt.create)|table|Creates a new UI element |[basalt.createFrame](#basalt.createFrame)|table|Creates a new BaseFrame |[basalt.getAPI](#basalt.getAPI)|table|Returns a Plugin API +|[basalt.getElementClass](#basalt.getElementClass)|table|Returns an element class |[basalt.getElementManager](#basalt.getElementManager)|table|Returns the element manager |[basalt.getMainFrame](#basalt.getMainFrame)|BaseFrame|Gets or creates the main frame |[basalt.removeSchedule](#basalt.removeSchedule)|boolean|Removes a scheduled update @@ -73,6 +74,15 @@ Returns a Plugin API ### Returns * `table` `Plugin` The plugin API +## basalt.getElementClass(name) +Returns an element class + +### Parameters +* `name` `string` The name of the element + +### Returns +* `table` `Element` The element class + ## basalt.getElementManager() Returns the element manager instance From 83251175957f2b163b517cca2641d92da5c90245 Mon Sep 17 00:00:00 2001 From: NoryiE Date: Mon, 3 Mar 2025 22:37:15 +0000 Subject: [PATCH 05/17] deploy: 635720ac11e63eedd733ddbaf8be546ba9ebdc1b --- docs/references/plugins/xml.md | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/docs/references/plugins/xml.md b/docs/references/plugins/xml.md index a61b550..b63d542 100644 --- a/docs/references/plugins/xml.md +++ b/docs/references/plugins/xml.md @@ -1,27 +1,3 @@ -# BaseElement -The XML plugin provides XML parsing and UI creation from XML markup - -## Functions - -|Method|Returns|Description| -|---|---|---| -|[BaseElement:fromXML](#BaseElement:fromXML)|BaseElement|Creates element from XML node - - -## BaseElement:fromXML(self, node) -Creates an element from an XML node - -### Parameters -* `self` `BaseElement` The element instance -* `node` `table` The XML node to create from - -### Returns -* `BaseElement` `self` The element instance - - ---- -
- # Container ## Functions From 03e625f2905af1ca409bce5ca015a33e0d9dfbfa Mon Sep 17 00:00:00 2001 From: NoryiE Date: Tue, 4 Mar 2025 00:54:19 +0000 Subject: [PATCH 06/17] deploy: c0b404d0cd06d9bcabbfcc1efa92152681f4501c --- docs/references/elements/BarChart.md | 17 ++++++ docs/references/elements/Graph.md | 88 ++++++++++++++++++++++++--- docs/references/elements/LineChart.md | 17 ++++++ 3 files changed, 112 insertions(+), 10 deletions(-) create mode 100644 docs/references/elements/BarChart.md create mode 100644 docs/references/elements/LineChart.md diff --git a/docs/references/elements/BarChart.md b/docs/references/elements/BarChart.md new file mode 100644 index 0000000..275e0a8 --- /dev/null +++ b/docs/references/elements/BarChart.md @@ -0,0 +1,17 @@ +# BarChart : Graph +This is the bar chart class. It is based on the graph element. It draws bar based points. + +## Functions + +|Method|Returns|Description| +|---|---|---| + + +## Protected Functions + +|Method|Returns|Description| +|---|---|---| +|[BarChart:init](#BarChart:init)|BarChart|Initializes the BarChart instance +|[BarChart:render](#BarChart:render)|-|Renders the BarChart + + diff --git a/docs/references/elements/Graph.md b/docs/references/elements/Graph.md index 59cd7a2..a2dbd70 100644 --- a/docs/references/elements/Graph.md +++ b/docs/references/elements/Graph.md @@ -1,24 +1,92 @@ # Graph : VisualElement +This is the base class for all graph elements. It is a point based graph. + +## Properties + +|Property|Type|Default|Description| +|---|---|---|---| +|minValue|number|0|The minimum value of the graph +|maxValue|number|100|The maximum value of the graph +|series|table|{}|The series of the graph ## Functions |Method|Returns|Description| |---|---|---| -|[Graph.new](#Graph.new)|-| -|[Graph:addPoint](#Graph:addPoint)|-| -|[Graph:init](#Graph:init)|-| -|[Graph:render](#Graph:render)|-| -|[Graph:setPoint](#Graph:setPoint)|-| +|[Graph:addPoint](#Graph:addPoint)|Graph|Adds a point to a series +|[Graph:addSeries](#Graph:addSeries)|-|Adds a series to the graph +|[Graph:changeSeriesVisibility](#Graph:changeSeriesVisibility)|Graph|Changes the visibility of a series +|[Graph:focusSeries](#Graph:focusSeries)|Graph|Focuses a series +|[Graph:getSeries](#Graph:getSeries)|table?|Gets a series from the graph +|[Graph:removeSeries](#Graph:removeSeries)|Graph|Removes a series from the graph +|[Graph:setSeriesPointCount](#Graph:setSeriesPointCount)|Graph|Sets the point count of a series -## Graph.new() +## Protected Functions -## Graph:addPoint() +|Method|Returns|Description| +|---|---|---| +|[Graph:init](#Graph:init)|Graph|Initializes the Graph instance +|[Graph:render](#Graph:render)|-|Renders the graph -## Graph:init() +## Graph:addPoint(name, value) -## Graph:render() +### Parameters +* `name` `string` The name of the series +* `value` `number` The value of the point -## Graph:setPoint() +### Returns +* `Graph` `self` The graph instance + +## Graph:addSeries(name, symbol, bgCol, fgCol, pointCount) + +### Parameters +* `name` `string` The name of the series +* `symbol` `string` The symbol of the series +* `bgCol` `number` The background color of the series +* `fgCol` `number` The foreground color of the series +* `pointCount` `number` The number of points in the series + +## Graph:changeSeriesVisibility(name, visible) + +### Parameters +* `name` `string` The name of the series +* `visible` `boolean` Whether the series should be visible + +### Returns +* `Graph` `self` The graph instance + +## Graph:focusSeries(name) + +### Parameters +* `name` `string` The name of the series + +### Returns +* `Graph` `self` The graph instance + +## Graph:getSeries(name) + +### Parameters +* `name` `string` The name of the series + +### Returns +* `table?` `series` The series + +## Graph:removeSeries(name) + +### Parameters +* `name` `string` The name of the series + +### Returns +* `Graph` `self` The graph instance + +## Graph:setSeriesPointCount(name, count) + +### Parameters +* `name` `string` The name of the series +* `count` `number` The number of points in the series + +### Returns +* `Graph` `self` The graph instance diff --git a/docs/references/elements/LineChart.md b/docs/references/elements/LineChart.md new file mode 100644 index 0000000..86e5bfe --- /dev/null +++ b/docs/references/elements/LineChart.md @@ -0,0 +1,17 @@ +# LineChart : Graph +This is the line chart class. It is based on the graph element. It draws lines between points. + +## Functions + +|Method|Returns|Description| +|---|---|---| + + +## Protected Functions + +|Method|Returns|Description| +|---|---|---| +|[LineChart:init](#LineChart:init)|LineChart|Initializes the LineChart instance +|[LineChart:render](#LineChart:render)|-|Renders the LineChart + + From 3f6957601d6c2e1426166f81283cf14a0dbb24e2 Mon Sep 17 00:00:00 2001 From: NoryiE Date: Tue, 4 Mar 2025 09:38:18 +0000 Subject: [PATCH 07/17] deploy: 514c5c3452cbd5faa66ddf04b3625a2d717fe2c2 --- docs/references/elements/List.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/references/elements/List.md b/docs/references/elements/List.md index 2b9dc0c..30d615a 100644 --- a/docs/references/elements/List.md +++ b/docs/references/elements/List.md @@ -17,7 +17,7 @@ custom item rendering, separators, and selection handling. |Event|Parameters|Description| |---|---|---| -|onSelect|`index number, item any`|Fired when an item is selected| +|onSelect|`index number, item table`|Fired when an item is selected| ## Functions From ccd68ac0c236ca4ee24fc1e040f8f7e270411037 Mon Sep 17 00:00:00 2001 From: NoryiE Date: Tue, 4 Mar 2025 13:27:07 +0000 Subject: [PATCH 08/17] deploy: d9e34c8118a5451ce68f9e4c1e8a5d58e86d0be6 --- docs/references/main.md | 2 +- docs/references/render.md | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/references/main.md b/docs/references/main.md index 6522706..13b9e6e 100644 --- a/docs/references/main.md +++ b/docs/references/main.md @@ -75,7 +75,7 @@ Returns a Plugin API * `table` `Plugin` The plugin API ## basalt.getElementClass(name) -Returns an element class +Returns an element's class without creating a instance ### Parameters * `name` `string` The name of the element diff --git a/docs/references/render.md b/docs/references/render.md index 6876da9..58293f0 100644 --- a/docs/references/render.md +++ b/docs/references/render.md @@ -31,7 +31,7 @@ functionality. It also has a buffer system to reduce the number of calls |[Render:rectOverlaps](#Render:rectOverlaps)|boolean| |[Render:render](#Render:render)|Render| |[Render:setCursor](#Render:setCursor)|Render| -|[Render:setSize](#Render:setSize)|-| +|[Render:setSize](#Render:setSize)|Render| |[Render:text](#Render:text)|Render| |[Render:textBg](#Render:textBg)|Render| |[Render:textFg](#Render:textFg)|Render| @@ -173,7 +173,15 @@ Sets the cursor position ### Returns * `nil` `nil` nil -## Render:setSize() +## Render:setSize(width, height) +Sets the size of the render + +### Parameters +* `width` `number` The width of the render +* `height` `number` The height of the render + +### Returns +* `nil` `nil` nil ## Render:text(x, y, text) Blits text to the screen From eed28a414969210eb3305048461f966bd9ecb289 Mon Sep 17 00:00:00 2001 From: NoryiE Date: Tue, 4 Mar 2025 13:34:01 +0000 Subject: [PATCH 09/17] deploy: 4434989731fbf7fe0572d1c1d53cc8dc3aec76b5 --- docs/references/elements/VisualElement.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/references/elements/VisualElement.md b/docs/references/elements/VisualElement.md index cb3989a..9db2f3f 100644 --- a/docs/references/elements/VisualElement.md +++ b/docs/references/elements/VisualElement.md @@ -24,9 +24,9 @@ and provides core functionality for positioning, sizing, colors, and rendering. |Name|Properties|Description| |---|---|---| -|position|`x y`|Combined x, y position| -|size|`width height`|Combined width, height| -|color|`foreground background`|Combined foreground, background colors| +|position|`x number, y number`|Combined x, y position| +|size|`width number, height number`|Combined width, height| +|color|`foreground number, background number`|Combined foreground, background colors| ## Events From 0c010c6b59d320e1d15b913102ff01d36cb9a037 Mon Sep 17 00:00:00 2001 From: NoryiE Date: Tue, 4 Mar 2025 13:44:33 +0000 Subject: [PATCH 10/17] deploy: a33448c733ce95b2c47767b94a077da0bc1aa5a6 --- docs/references/main.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/references/main.md b/docs/references/main.md index 13b9e6e..412994c 100644 --- a/docs/references/main.md +++ b/docs/references/main.md @@ -165,7 +165,7 @@ basalt.stop() ``` ## basalt.update(...) -Runs basalt once +Runs basalt once, can be used to update the UI manually, but you have to feed it the events ### Parameters * `...` *(vararg)* `any` The event to run with From 0dbb1cef3e423963957e1b042d5f2a62181bcd61 Mon Sep 17 00:00:00 2001 From: NoryiE Date: Mon, 10 Mar 2025 02:21:03 +0000 Subject: [PATCH 11/17] deploy: 3be4c1bc5d3a591da74cd4202499ac67885645b0 --- docs/references/elements/Container.md | 2 +- docs/references/main.md | 23 +++++++--- .../benchmark_Container : VisualElement.md | 44 +++++++++++++++++++ 3 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 docs/references/plugins/benchmark_Container : VisualElement.md diff --git a/docs/references/elements/Container.md b/docs/references/elements/Container.md index 2cba919..5215367 100644 --- a/docs/references/elements/Container.md +++ b/docs/references/elements/Container.md @@ -21,7 +21,7 @@ like Frames, BaseFrames, and more. |Name|Properties|Description| |---|---|---| -|offset|`offsetX offsetY`|Combined property for offsetX and offsetY| +|offset|`offsetX number, offsetY number`|Combined property for offsetX and offsetY| ## Functions diff --git a/docs/references/main.md b/docs/references/main.md index 412994c..c98f181 100644 --- a/docs/references/main.md +++ b/docs/references/main.md @@ -1,4 +1,4 @@ -# Basalt +# basalt This is the UI Manager and the starting point for your project. The following functions allow you to influence the default behavior of Basalt. Before you can access Basalt, you need to add the following code on top of your file: @@ -18,6 +18,7 @@ What this code does is it loads basalt into the project, and you can access it b |_events|`table`|A table of events and their callbacks| |_schedule|`function[]`|A table of scheduled functions| |_plugins|`table`|A table of plugins| +|isRunning|`boolean`|Whether the Basalt runtime is active| |LOGGER|`Log`|The logger instance| |path|`string`|The path to the Basalt library| @@ -26,8 +27,9 @@ What this code does is it loads basalt into the project, and you can access it b |Method|Returns|Description| |---|---|---| |[basalt.create](#basalt.create)|table|Creates a new UI element -|[basalt.createFrame](#basalt.createFrame)|table|Creates a new BaseFrame +|[basalt.createFrame](#basalt.createFrame)|BaseFrame|Creates a new BaseFrame |[basalt.getAPI](#basalt.getAPI)|table|Returns a Plugin API +|[basalt.getActiveFrame](#basalt.getActiveFrame)|BaseFrame?|Returns the active frame |[basalt.getElementClass](#basalt.getElementClass)|table|Returns an element class |[basalt.getElementManager](#basalt.getElementManager)|table|Returns the element manager |[basalt.getMainFrame](#basalt.getMainFrame)|BaseFrame|Gets or creates the main frame @@ -58,7 +60,7 @@ local button = basalt.create("Button") Creates and returns a new BaseFrame ### Returns -* `table` `BaseFrame` The created frame instance +* `BaseFrame` `BaseFrame` The created frame instance ### Usage ```lua @@ -74,6 +76,17 @@ Returns a Plugin API ### Returns * `table` `Plugin` The plugin API +## basalt.getActiveFrame() +Returns the active frame + +### Returns +* `BaseFrame?` `BaseFrame` The frame to set as active + +### Usage + ```lua +local frame = basalt.getActiveFrame() +``` + ## basalt.getElementClass(name) Returns an element's class without creating a instance @@ -98,7 +111,7 @@ local manager = basalt.getElementManager() Gets or creates the main frame ### Returns -* `BaseFrame` `table` The main frame instance +* `BaseFrame` `BaseFrame` The main frame instance ### Usage ```lua @@ -149,7 +162,7 @@ local id = basalt.scheduleUpdate(myFunction) Sets the active frame ### Parameters -* `frame` `table` The frame to set as active +* `frame` `BaseFrame` The frame to set as active ### Usage ```lua diff --git a/docs/references/plugins/benchmark_Container : VisualElement.md b/docs/references/plugins/benchmark_Container : VisualElement.md new file mode 100644 index 0000000..28f226a --- /dev/null +++ b/docs/references/plugins/benchmark_Container : VisualElement.md @@ -0,0 +1,44 @@ +# Container : VisualElement + +## Functions + +|Method|Returns|Description| +|---|---|---| +|[Container:benchmarkContainer](#Container:benchmarkContainer)|Container|Recursively enables benchmarking +|[Container:logContainerBenchmarks](#Container:logContainerBenchmarks)|Container|Recursively logs benchmark statistics +|[Container:stopContainerBenchmark](#Container:stopContainerBenchmark)|Container|Recursively stops benchmarking + + +## Container:benchmarkContainer(methodName) +Enables benchmarking for a container and all its children + +### Parameters +* `methodName` `string` The method to benchmark + +### Returns +* `Container` `self` The container instance + +### Usage + ```lua +container:benchmarkContainer("render") +``` + +## Container:logContainerBenchmarks(methodName) +Logs benchmark statistics for a container and all its children + +### Parameters +* `methodName` `string` The method to log + +### Returns +* `Container` `self` The container instance + +## Container:stopContainerBenchmark(methodName) +Stops benchmarking for a container and all its children + +### Parameters +* `methodName` `string` The method to stop benchmarking + +### Returns +* `Container` `self` The container instance + + From 65e93f9985a3765106efa03cce2df10acfd74a4d Mon Sep 17 00:00:00 2001 From: NoryiE Date: Thu, 13 Mar 2025 19:46:53 +0000 Subject: [PATCH 12/17] deploy: 414703d18a03c4af04aed5ae0e63d4d67a44a47b --- docs/references/elements/Display.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/references/elements/Display.md diff --git a/docs/references/elements/Display.md b/docs/references/elements/Display.md new file mode 100644 index 0000000..34a12d2 --- /dev/null +++ b/docs/references/elements/Display.md @@ -0,0 +1,20 @@ +# Display : VisualElement +The Display is a special element where you can use the window (term) API to draw on a element, useful when you need to use external APIs. + +## Functions + +|Method|Returns|Description| +|---|---|---| +|[Display:getWindow](#Display:getWindow)|-| + + +## Protected Functions + +|Method|Returns|Description| +|---|---|---| +|[Display:init](#Display:init)|-|Initializes the Display instance +|[Display:render](#Display:render)|-|Renders the Display + +## Display:getWindow() + + From 0ccae0ca188fd771447e9a5c66642ddef6b302ec Mon Sep 17 00:00:00 2001 From: NoryiE Date: Fri, 14 Mar 2025 02:52:23 +0000 Subject: [PATCH 13/17] deploy: d6d53fdef02d3fe46c2d6c1fa082ff1ca4d92fa0 --- docs/references/elements/Display.md | 6 +++++- docs/references/elements/Image.md | 23 +++++++++++++++++++---- docs/references/elements/VisualElement.md | 3 +-- docs/references/plugins/theme.md | 12 ++++++------ docs/references/propertySystem.md | 3 +-- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/docs/references/elements/Display.md b/docs/references/elements/Display.md index 34a12d2..3a06066 100644 --- a/docs/references/elements/Display.md +++ b/docs/references/elements/Display.md @@ -5,7 +5,7 @@ The Display is a special element where you can use the window (term) API to draw |Method|Returns|Description| |---|---|---| -|[Display:getWindow](#Display:getWindow)|-| +|[Display:getWindow](#Display:getWindow)|table|Returns the current window object ## Protected Functions @@ -16,5 +16,9 @@ The Display is a special element where you can use the window (term) API to draw |[Display:render](#Display:render)|-|Renders the Display ## Display:getWindow() +Returns the current window object + +### Returns +* `table` `window` The current window object diff --git a/docs/references/elements/Image.md b/docs/references/elements/Image.md index 2fa3965..ca03b01 100644 --- a/docs/references/elements/Image.md +++ b/docs/references/elements/Image.md @@ -26,7 +26,7 @@ See: https://github.com/SkyTheCodeMaster/bimg |[Image:addFrame](#Image:addFrame)|Image|Adds a new frame to the image |[Image:getBg](#Image:getBg)|-| |[Image:getFg](#Image:getFg)|-| -|[Image:getFrame](#Image:getFrame)|-| +|[Image:getFrame](#Image:getFrame)|table|Gets the specified frame |[Image:getImageSize](#Image:getImageSize)|number|Gets the size of the image |[Image:getMetadata](#Image:getMetadata)|-| |[Image:getPixelData](#Image:getPixelData)|number?|Gets pixel information at position @@ -38,7 +38,7 @@ See: https://github.com/SkyTheCodeMaster/bimg |[Image:setMetadata](#Image:setMetadata)|-| |[Image:setPixel](#Image:setPixel)|Image|Sets the pixel at the specified position |[Image:setText](#Image:setText)|Image|Sets the text at the specified position -|[Image:updateFrame](#Image:updateFrame)|-| +|[Image:updateFrame](#Image:updateFrame)|Image|Updates the specified frame with the provided data ## Protected Functions @@ -58,7 +58,14 @@ Adds a new frame to the image ## Image:getFg() -## Image:getFrame() +## Image:getFrame(frameIndex) +Gets the specified frame + +### Parameters +* `frameIndex` `number` The index of the frame to get + +### Returns +* `table` `frame` The frame data ## Image:getImageSize() Gets the size of the image @@ -147,6 +154,14 @@ Sets the text at the specified position ### Returns * `Image` `self` The Image instance -## Image:updateFrame() +## Image:updateFrame(frameIndex, frame) +Updates the specified frame with the provided data + +### Parameters +* `frameIndex` `number` The index of the frame to update +* `frame` `table` The new frame data + +### Returns +* `Image` `self` The Image instance diff --git a/docs/references/elements/VisualElement.md b/docs/references/elements/VisualElement.md index 9db2f3f..ef3c275 100644 --- a/docs/references/elements/VisualElement.md +++ b/docs/references/elements/VisualElement.md @@ -119,8 +119,7 @@ Checks if the specified coordinates are within the bounds of the element * `boolean` `isInBounds` Whether the coordinates are within the bounds of the element ## VisualElement:prioritize() -This function is used to prioritize the element by moving it to the top of its parent's children. -It removes the element from its parent and adds it back, effectively changing its order. +This function is used to prioritize the element by moving it to the top of its parent's children. It removes the element from its parent and adds it back, effectively changing its order. ### Returns * `VisualElement` `self` The VisualElement instance diff --git a/docs/references/plugins/theme.md b/docs/references/plugins/theme.md index 79d8357..c6bdb16 100644 --- a/docs/references/plugins/theme.md +++ b/docs/references/plugins/theme.md @@ -39,24 +39,24 @@ The Theme API provides methods for managing themes globally |Method|Returns|Description| |---|---|---| -|[themeAPI.getTheme](#themeAPI.getTheme)|table|Gets the current theme -|[themeAPI.loadTheme](#themeAPI.loadTheme)|-|Loads theme from JSON file -|[themeAPI.setTheme](#themeAPI.setTheme)|-|Sets a new theme +|[ThemeAPI.getTheme](#ThemeAPI.getTheme)|table|Gets the current theme +|[ThemeAPI.loadTheme](#ThemeAPI.loadTheme)|-|Loads theme from JSON file +|[ThemeAPI.setTheme](#ThemeAPI.setTheme)|-|Sets a new theme -## themeAPI.getTheme() +## ThemeAPI.getTheme() Gets the current theme configuration ### Returns * `table` `theme` The current theme configuration -## themeAPI.loadTheme(path) +## ThemeAPI.loadTheme(path) Loads a theme from a JSON file ### Parameters * `path` `string` Path to the theme JSON file -## themeAPI.setTheme(newTheme) +## ThemeAPI.setTheme(newTheme) Sets the current theme ### Parameters diff --git a/docs/references/propertySystem.md b/docs/references/propertySystem.md index 03364e3..b147c17 100644 --- a/docs/references/propertySystem.md +++ b/docs/references/propertySystem.md @@ -27,7 +27,7 @@ It also allows for properties to have custom getters and setters. This is the ba |[PropertySystem:instanceProperty](#PropertySystem:instanceProperty)|table|Adds a property to the PropertySystem on instance level |[PropertySystem:observe](#PropertySystem:observe)|table|Observers a property |[PropertySystem:removeAllObservers](#PropertySystem:removeAllObservers)|table|Removes all observers from a property -|[PropertySystem:removeObserver](#PropertySystem:removeObserver)|table| +|[PropertySystem:removeObserver](#PropertySystem:removeObserver)|table|Removes an observer from a property |[PropertySystem:removeProperty](#PropertySystem:removeProperty)|table|Removes a property from the PropertySystem @@ -128,7 +128,6 @@ Removes all observers from a property ## PropertySystem:removeObserver(name, callback) Removes an observer from a property -@NshortDescription Removes an observer from a property ### Parameters * `name` `string` The name of the property From d3c4a7782a81aaa76d79acd490f4129ef3309f4a Mon Sep 17 00:00:00 2001 From: NoryiE Date: Fri, 14 Mar 2025 02:59:08 +0000 Subject: [PATCH 14/17] deploy: 4e26fec0b17e698ee1410c6c5eb7393c8291b05d --- docs/references/elements/Image.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/docs/references/elements/Image.md b/docs/references/elements/Image.md index ca03b01..0bd67c1 100644 --- a/docs/references/elements/Image.md +++ b/docs/references/elements/Image.md @@ -38,7 +38,7 @@ See: https://github.com/SkyTheCodeMaster/bimg |[Image:setMetadata](#Image:setMetadata)|-| |[Image:setPixel](#Image:setPixel)|Image|Sets the pixel at the specified position |[Image:setText](#Image:setText)|Image|Sets the text at the specified position -|[Image:updateFrame](#Image:updateFrame)|Image|Updates the specified frame with the provided data +|[Image:updateFrame](#Image:updateFrame)|-| ## Protected Functions @@ -154,14 +154,6 @@ Sets the text at the specified position ### Returns * `Image` `self` The Image instance -## Image:updateFrame(frameIndex, frame) -Updates the specified frame with the provided data - -### Parameters -* `frameIndex` `number` The index of the frame to update -* `frame` `table` The new frame data - -### Returns -* `Image` `self` The Image instance +## Image:updateFrame() From 61a3a90441cd6c9751913963a2bd0c3008745407 Mon Sep 17 00:00:00 2001 From: NoryiE Date: Fri, 14 Mar 2025 16:00:38 +0000 Subject: [PATCH 15/17] deploy: ae45eeac0fad66213265c736b6da689b6a2eccd3 --- docs/references/elements/BaseElement.md | 8 +++ docs/references/elements/Image.md | 73 +++++++++++++++++++---- docs/references/elements/VisualElement.md | 2 +- 3 files changed, 69 insertions(+), 14 deletions(-) diff --git a/docs/references/elements/BaseElement.md b/docs/references/elements/BaseElement.md index 6d0cd1a..068a618 100644 --- a/docs/references/elements/BaseElement.md +++ b/docs/references/elements/BaseElement.md @@ -14,6 +14,8 @@ The base class for all UI elements in Basalt. This class provides basic properti |Method|Returns|Description| |---|---|---| +|[BaseElement.defineEvent](#BaseElement.defineEvent)|-| +|[BaseElement.registerEventCallback](#BaseElement.registerEventCallback)|-| |[BaseElement:destroy](#BaseElement:destroy)|-|Destroys the element and cleans up all references |[BaseElement:fireEvent](#BaseElement:fireEvent)|table|Triggers an event and calls all registered callbacks |[BaseElement:getBaseFrame](#BaseElement:getBaseFrame)|table|Returns the base frame of the element @@ -33,6 +35,12 @@ The base class for all UI elements in Basalt. This class provides basic properti |[BaseElement:init](#BaseElement:init)|table|Initializes the BaseElement instance |[BaseElement:postInit](#BaseElement:postInit)|table|Post initialization +## BaseElement.defineEvent() +Registers a new event listener for the element (on class level) + +## BaseElement.registerEventCallback() +Registers a new event callback for the element (on class level) + ## BaseElement:destroy() Destroys the element and cleans up all references diff --git a/docs/references/elements/Image.md b/docs/references/elements/Image.md index 0bd67c1..ae7b431 100644 --- a/docs/references/elements/Image.md +++ b/docs/references/elements/Image.md @@ -1,6 +1,6 @@ # Image : VisualElement -This is the Image element class which can be used to display bimg format images. -The bimg format is a universal ComputerCraft image format. +This is the Image element class which can be used to display bimg formatted images. +Bimg is a universal ComputerCraft image format. See: https://github.com/SkyTheCodeMaster/bimg ## Properties @@ -24,21 +24,21 @@ See: https://github.com/SkyTheCodeMaster/bimg |Method|Returns|Description| |---|---|---| |[Image:addFrame](#Image:addFrame)|Image|Adds a new frame to the image -|[Image:getBg](#Image:getBg)|-| -|[Image:getFg](#Image:getFg)|-| +|[Image:getBg](#Image:getBg)|string|Gets the background color at the specified position +|[Image:getFg](#Image:getFg)|string|Gets the foreground color at the specified position |[Image:getFrame](#Image:getFrame)|table|Gets the specified frame |[Image:getImageSize](#Image:getImageSize)|number|Gets the size of the image -|[Image:getMetadata](#Image:getMetadata)|-| +|[Image:getMetadata](#Image:getMetadata)|table|Gets the metadata of the image |[Image:getPixelData](#Image:getPixelData)|number?|Gets pixel information at position -|[Image:getText](#Image:getText)|-| +|[Image:getText](#Image:getText)|string|Gets the text at the specified position |[Image:nextFrame](#Image:nextFrame)|Image|Advances to the next frame in the animation |[Image:resizeImage](#Image:resizeImage)|Image|Resizes the image to the specified width and height |[Image:setBg](#Image:setBg)|Image|Sets the background color at the specified position |[Image:setFg](#Image:setFg)|Image|Sets the foreground color at the specified position -|[Image:setMetadata](#Image:setMetadata)|-| +|[Image:setMetadata](#Image:setMetadata)|Image|Sets the metadata of the image |[Image:setPixel](#Image:setPixel)|Image|Sets the pixel at the specified position |[Image:setText](#Image:setText)|Image|Sets the text at the specified position -|[Image:updateFrame](#Image:updateFrame)|-| +|[Image:updateFrame](#Image:updateFrame)|Image|Updates the specified frame with the provided data ## Protected Functions @@ -54,9 +54,27 @@ Adds a new frame to the image ### Returns * `Image` `self` The Image instance -## Image:getBg() +## Image:getBg(x, y, length) +Gets the background color at the specified position -## Image:getFg() +### Parameters +* `x` `number` The x position +* `y` `number` The y position +* `length` `number` The length of the background color pattern to get + +### Returns +* `string` `bg` The background color pattern + +## Image:getFg(x, y, length) +Gets the foreground color at the specified position + +### Parameters +* `x` `number` The x position +* `y` `number` The y position +* `length` `number` The length of the foreground color pattern to get + +### Returns +* `string` `fg` The foreground color pattern ## Image:getFrame(frameIndex) Gets the specified frame @@ -75,6 +93,10 @@ Gets the size of the image * `number` `height` The height of the image ## Image:getMetadata() +Gets the metadata of the image + +### Returns +* `table` `metadata` The metadata of the image ## Image:getPixelData(x, y) Gets pixel information at position @@ -88,7 +110,16 @@ Gets pixel information at position * `number?` `bg` Background color * `string?` `char` Character at position -## Image:getText() +## Image:getText(x, y, length) +Gets the text at the specified position + +### Parameters +* `x` `number` The x position +* `y` `number` The y position +* `length` `number` The length of the text to get + +### Returns +* `string` `text` The text at the specified position ## Image:nextFrame() Advances to the next frame in the animation @@ -128,7 +159,15 @@ Sets the foreground color at the specified position ### Returns * `Image` `self` The Image instance -## Image:setMetadata() +## Image:setMetadata(key, value) +Sets the metadata of the image + +### Parameters +* `key` `string` The key of the metadata to set +* `value` `string` The value of the metadata to set + +### Returns +* `Image` `self` The Image instance ## Image:setPixel(x, y, char, fg, bg) Sets the pixel at the specified position @@ -154,6 +193,14 @@ Sets the text at the specified position ### Returns * `Image` `self` The Image instance -## Image:updateFrame() +## Image:updateFrame(frameIndex, frame) +Updates the specified frame with the provided data + +### Parameters +* `frameIndex` `number` The index of the frame to update +* `frame` `table` The new frame data + +### Returns +* `Image` `self` The Image instance diff --git a/docs/references/elements/VisualElement.md b/docs/references/elements/VisualElement.md index ef3c275..d29ae90 100644 --- a/docs/references/elements/VisualElement.md +++ b/docs/references/elements/VisualElement.md @@ -32,7 +32,7 @@ and provides core functionality for positioning, sizing, colors, and rendering. |Event|Parameters|Description| |---|---|---| -|onClick|`button, x, y`|Fired on mouse click| +|onClick|`button string, x number, y number`|Fired on mouse click| |onMouseUp|`button, x, y`|Fired on mouse button release| |onRelease|`button, x, y`|Fired when mouse leaves while clicked| |onDrag|`button, x, y`|Fired when mouse moves while clicked| From 57b46f62b9ed4fdccd7a8662439b533210124cbf Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Fri, 14 Mar 2025 17:08:30 +0100 Subject: [PATCH 16/17] Update config.mts --- docs/.vitepress/config.mts | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index e1d4608..81c8f74 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -6,7 +6,6 @@ export default defineConfig({ description: "A UI Framework made for CC:Tweaked", lang: 'en-US', lastUpdated: true, - base: "/Basalt2/", head: [ //[ From b36243de871eb2971394d41e00bf1318b6a9a62a Mon Sep 17 00:00:00 2001 From: Robert Jelic <36573031+NoryiE@users.noreply.github.com> Date: Fri, 14 Mar 2025 17:09:19 +0100 Subject: [PATCH 17/17] Delete docs/references/plugins/benchmark_Container : VisualElement.md Delete --- .../benchmark_Container : VisualElement.md | 44 ------------------- 1 file changed, 44 deletions(-) delete mode 100644 docs/references/plugins/benchmark_Container : VisualElement.md diff --git a/docs/references/plugins/benchmark_Container : VisualElement.md b/docs/references/plugins/benchmark_Container : VisualElement.md deleted file mode 100644 index 28f226a..0000000 --- a/docs/references/plugins/benchmark_Container : VisualElement.md +++ /dev/null @@ -1,44 +0,0 @@ -# Container : VisualElement - -## Functions - -|Method|Returns|Description| -|---|---|---| -|[Container:benchmarkContainer](#Container:benchmarkContainer)|Container|Recursively enables benchmarking -|[Container:logContainerBenchmarks](#Container:logContainerBenchmarks)|Container|Recursively logs benchmark statistics -|[Container:stopContainerBenchmark](#Container:stopContainerBenchmark)|Container|Recursively stops benchmarking - - -## Container:benchmarkContainer(methodName) -Enables benchmarking for a container and all its children - -### Parameters -* `methodName` `string` The method to benchmark - -### Returns -* `Container` `self` The container instance - -### Usage - ```lua -container:benchmarkContainer("render") -``` - -## Container:logContainerBenchmarks(methodName) -Logs benchmark statistics for a container and all its children - -### Parameters -* `methodName` `string` The method to log - -### Returns -* `Container` `self` The container instance - -## Container:stopContainerBenchmark(methodName) -Stops benchmarking for a container and all its children - -### Parameters -* `methodName` `string` The method to stop benchmarking - -### Returns -* `Container` `self` The container instance - -