From 2a3e60581fe7476b2c1107e717e65134301151bf Mon Sep 17 00:00:00 2001 From: Jahames <75079031+AnUnderratedPerson@users.noreply.github.com> Date: Mon, 7 Aug 2023 22:25:46 -0500 Subject: [PATCH] Modification of type definitions and index for doc --- docs/api/animation.md | 4 ++-- docs/api/creation.md | 7 ++++--- docs/api/index.md | 3 ++- docs/api/reactivity-core.md | 12 ++++++------ docs/api/type-docs.md | 19 +++++++++++++++++++ 5 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 docs/api/type-docs.md diff --git a/docs/api/animation.md b/docs/api/animation.md index fc64c68..970e3e6 100644 --- a/docs/api/animation.md +++ b/docs/api/animation.md @@ -7,13 +7,13 @@ Returns a new state with a dynamically animated value of the source. - ### Type ```lua + type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3 + function spring( source: () -> T & Animatable, period: number = 1, damping_ratio: number = 1 ): () -> T - - type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3 ``` - ### Details diff --git a/docs/api/creation.md b/docs/api/creation.md index cfd7816..f066d19 100644 --- a/docs/api/creation.md +++ b/docs/api/creation.md @@ -9,10 +9,11 @@ Creates a new UI element, applying any given properties. - ### Type ```lua - function create(class: string): (Properties) -> Instance - function create(instance: Instace): (Properties) -> Instance + type Properties = Map + + function create(class: string): (Properties) -> Instance + function create(instance: Instance): (Properties) -> Instance - type Properties = Map ``` - ### Details diff --git a/docs/api/index.md b/docs/api/index.md index 6846cef..4592852 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -4,7 +4,8 @@ - [source()](../api/reactivity-core.md#source) - [derive()](../api/reactivity-core.md#derive) -- [map()](../api/reactivity-core.md#map) +- [indexes()](../api/reactivity-core.md#indexes) +- [values()](../api/reactivity-core.md#values) - [watch()](../api/reactivity-core.md#watch) ### [Reactivity: Utility](../api/reactivity-utility.md) diff --git a/docs/api/reactivity-core.md b/docs/api/reactivity-core.md index a46ece7..c5cff6b 100644 --- a/docs/api/reactivity-core.md +++ b/docs/api/reactivity-core.md @@ -39,9 +39,9 @@ Runs a callback on state change. - ### Type ```lua - function watch(callback: () -> ()): Unwatch - type Unwatch = () -> () + + function watch(callback: () -> ()): Unwatch ``` - ### Details @@ -58,15 +58,15 @@ Runs a callback on state change. - ### Example ```lua - local state = wrap(1) + local state = source(1) watch(function() - print(state.Value) + print(state()) end) -- prints 1 - state.Value += 1 + state(state() + 1) -- prints 2 ``` @@ -99,7 +99,7 @@ Derives a new state from existing states. - ### Example ```lua - local count = wrap(0) + local count = source(0) local text = derive(function() return `count: {count()}` end) text() -- "count: 0" diff --git a/docs/api/type-docs.md b/docs/api/type-docs.md new file mode 100644 index 0000000..1f1b904 --- /dev/null +++ b/docs/api/type-docs.md @@ -0,0 +1,19 @@ +# Type Documentation + +
+ +## Map + +### Type Definition + +```lua +type Map = { [K]: V } +``` + +## Array + +### Type Definition + +```lua +type Array = { T } +``` \ No newline at end of file