From b4ccd8f5abeb78d1ce2e73ef41518f0e667f8dfb Mon Sep 17 00:00:00 2001 From: NegativeName Date: Mon, 22 Apr 2024 15:40:33 +0200 Subject: [PATCH 1/4] Add Static Properties support --- docs/scripting-reference/structs/color.mdx | 19 +------------ src/components/ClassBuilder.jsx | 33 ++++++++++++++++++++++ src/theme/MDXComponents.js | 3 +- 3 files changed, 36 insertions(+), 19 deletions(-) diff --git a/docs/scripting-reference/structs/color.mdx b/docs/scripting-reference/structs/color.mdx index f665417d298..25b47d5de36 100644 --- a/docs/scripting-reference/structs/color.mdx +++ b/docs/scripting-reference/structs/color.mdx @@ -37,24 +37,7 @@ This structure supports `+`, `-`, `*`, `/`, `==`, and `tostring` operations. ## 🗼 Static Properties -| **Value** | **Name** | -| :--- | :--- | -| `Color(1, 1, 1)` | **`Color.WHITE`** | -| `Color(0, 0, 0)` | **`Color.BLACK`** | -| `Color(0, 0, 0, 0)` | **`Color.TRANSPARENT`** | -| `Color(1, 0, 0)` | **`Color.RED`** | -| `Color(0, 1, 0)` | **`Color.GREEN`** | -| `Color(0, 0, 1)` | **`Color.BLUE`** | -| `Color(1, 1, 0)` | **`Color.YELLOW`** | -| `Color(0, 1, 1)` | **`Color.CYAN`** | -| `Color(1, 0, 1)` | **`Color.MAGENTA`** | -| `Color(1, 0.5, 0)` | **`Color.ORANGE`** | -| `Color(0.5, 1, 1)` | **`Color.CHARTREUSE`** | -| `Color(0, 1, 0.5)` | **`Color.AQUAMARINE`** | -| `Color(0, 0.5, 1)` | **`Color.AZURE`** | -| `Color(0.5, 0, 1)` | **`Color.VIOLET`** | -| `Color(1, 0, 0.5)` | **`Color.ROSE`** | - + ## 🗿 Static Functions diff --git a/src/components/ClassBuilder.jsx b/src/components/ClassBuilder.jsx index 777c7908365..dcd016a5a6b 100644 --- a/src/components/ClassBuilder.jsx +++ b/src/components/ClassBuilder.jsx @@ -706,4 +706,37 @@ export const PropertiesDeclaration = ({ type, name }) => { } ); +}; + +// Block of Static Properties +export const StaticPropertiesDeclaration = ({ type, name }) => { + const class_data = GetClassData(type, name); + + return (<> + { + class_data.static_properties == null || class_data.static_properties.length === 0 ? This class doesn't have static properties. : +
+ + + + + + + + + {class_data.static_properties.map((property, index) => ( + + + + + ))} + +
ValueName
{property.value} + + Color.{property.name} + +
+
+ } + ); }; \ No newline at end of file diff --git a/src/theme/MDXComponents.js b/src/theme/MDXComponents.js index 089fda9e764..06191c77cfc 100644 --- a/src/theme/MDXComponents.js +++ b/src/theme/MDXComponents.js @@ -2,7 +2,7 @@ import MDXComponents from '@theme-original/MDXComponents'; // Import custom elements -import { HeaderDeclaration, ConstructorDeclaration, FunctionsDeclaration, StaticFunctionsDeclaration, ExamplesDeclaration, EventsDeclaration, PropertiesDeclaration, APISourceURL } from '@site/src/components/ClassBuilder'; +import { HeaderDeclaration, ConstructorDeclaration, FunctionsDeclaration, StaticFunctionsDeclaration, ExamplesDeclaration, EventsDeclaration, PropertiesDeclaration, StaticPropertiesDeclaration, APISourceURL } from '@site/src/components/ClassBuilder'; import { Classes, Structs, BasicType, AuthorityType, UtilityClasses, ReferenceLink, Enums, CardLink, AssetPath, VideoExternal } from '@site/src/components/_nanos'; export default { @@ -15,6 +15,7 @@ export default { FunctionsDeclaration, StaticFunctionsDeclaration, PropertiesDeclaration, + StaticPropertiesDeclaration, EventsDeclaration, ExamplesDeclaration, APISourceURL, From b90a38c5ccba11c18e71129f1847e735ce0048c7 Mon Sep 17 00:00:00 2001 From: NegativeName Date: Mon, 22 Apr 2024 15:47:26 +0200 Subject: [PATCH 2/4] Update ClassBuilder.jsx --- src/components/ClassBuilder.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ClassBuilder.jsx b/src/components/ClassBuilder.jsx index dcd016a5a6b..1a47e1b2816 100644 --- a/src/components/ClassBuilder.jsx +++ b/src/components/ClassBuilder.jsx @@ -729,7 +729,7 @@ export const StaticPropertiesDeclaration = ({ type, name }) => { {property.value} - Color.{property.name} + {property.name} @@ -739,4 +739,4 @@ export const StaticPropertiesDeclaration = ({ type, name }) => { } ); -}; \ No newline at end of file +}; From fa231876d51a9b7481ab35b53cc209bb26d54f8b Mon Sep 17 00:00:00 2001 From: NegativeName Date: Mon, 22 Apr 2024 15:53:33 +0200 Subject: [PATCH 3/4] Update ClassBuilder.jsx --- src/components/ClassBuilder.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ClassBuilder.jsx b/src/components/ClassBuilder.jsx index 1a47e1b2816..43fc6b9638f 100644 --- a/src/components/ClassBuilder.jsx +++ b/src/components/ClassBuilder.jsx @@ -729,7 +729,7 @@ export const StaticPropertiesDeclaration = ({ type, name }) => { {property.value} - {property.name} + {name + "." + property.name} From c8c40dedec08b40f48872bfd6a8a4effa8df1333 Mon Sep 17 00:00:00 2001 From: NegativeName Date: Mon, 22 Apr 2024 15:57:25 +0200 Subject: [PATCH 4/4] Update math.mdx --- docs/scripting-reference/standard-libraries/math.mdx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/scripting-reference/standard-libraries/math.mdx b/docs/scripting-reference/standard-libraries/math.mdx index 6006a7f4663..0e6aac2a794 100644 --- a/docs/scripting-reference/standard-libraries/math.mdx +++ b/docs/scripting-reference/standard-libraries/math.mdx @@ -17,11 +17,7 @@ TODO Examples ## 🗼 Static Properties -| **Value** | **Name** | -| :--- | :--- | -| `3.141592653589793` | **`math.pi`** | -| `2^1024` | **`math.huge`** | - + ## 🗿 Static Functions