mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Improve Documentation Site (#41)
* update css and snippets * Add banner * improve home page * Update Banner * cleanup * Update font to JetBrains Mono * Add a quick look to Home * Simplify Home Page * Removed banner, removed copyright notice, reduced home page
This commit is contained in:
parent
f7dac3f63a
commit
f8e84f9f8d
29 changed files with 255 additions and 184 deletions
|
|
@ -6,7 +6,7 @@ Returns a new source with a value always moving torwards the input source value.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function spring<T>(
|
||||
source: () -> T & Animatable,
|
||||
period: number = 1,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ target instance.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function mount<T>(component: () -> T, target: Instance?): () -> ()
|
||||
```
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ target instance.
|
|||
|
||||
- **Example**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local function App()
|
||||
return create "ScreenGui" {
|
||||
create "TextLabel" { Text = "Vide" }
|
||||
|
|
@ -41,7 +41,7 @@ Creates a new UI element, applying any given properties.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function create(class: string): (Properties) -> Instance
|
||||
function create(instance: Instance): (Properties) -> Instance
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ Creates a new UI element, applying any given properties.
|
|||
|
||||
Basic element creation.
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local frame = create "Frame" {
|
||||
Name = "NewFrame",
|
||||
Position = UDim2.fromScale(1, 0)
|
||||
|
|
@ -85,7 +85,7 @@ Creates a new UI element, applying any given properties.
|
|||
|
||||
A component using property nesting.
|
||||
|
||||
```lua
|
||||
```luau
|
||||
type Layout = {
|
||||
Layout = {
|
||||
Position: UDim2?,
|
||||
|
|
@ -116,7 +116,7 @@ instances.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function action((Instance) -> (), priority: number = 1): Action
|
||||
```
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ instances.
|
|||
|
||||
An action to listen to changed properties:
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local function changed(property: string, callback: (new) -> ())
|
||||
return action(function(instance)
|
||||
local con - instance:GetPropertyChangedSignal(property):Connect(function()
|
||||
|
|
@ -161,7 +161,7 @@ A wrapper for `action()` to listen for property changes.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function changed(property: string, callback: (...unknown) -> ()): Action
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Creates and runs a function in a new stable scope.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function root<T...>(fn: (() -> ()) -> T...): (() -> (), T...)
|
||||
```
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ Creates a new source with the given value.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function source<T>(value: T): Source<T>
|
||||
|
||||
type Source<T> =
|
||||
|
|
@ -45,7 +45,7 @@ Creates a new source with the given value.
|
|||
|
||||
- **Example**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local count = source(0)
|
||||
|
||||
count() -- 0
|
||||
|
|
@ -59,7 +59,7 @@ Runs a side-effect in a new reactive scope on source update.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function effect(callback: () -> ())
|
||||
```
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ Runs a side-effect in a new reactive scope on source update.
|
|||
|
||||
- **Example**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local num = source(1)
|
||||
|
||||
effect(function()
|
||||
|
|
@ -92,7 +92,7 @@ Derives a new source in a new reactive scope from existing sources.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function derive<T>(source: () -> T): () -> T
|
||||
```
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ Derives a new source in a new reactive scope from existing sources.
|
|||
|
||||
- **Example**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local count = source(0)
|
||||
local text = derive(function() return `count: {count()}` end)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ Shows one of two components depending on an input source.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function show<T>(source: () -> unknown, component: () -> T): () -> T?
|
||||
function show<T, U>(source: () -> unknown, component: () -> T, fallback: () -> U): () -> T | U
|
||||
```
|
||||
|
|
@ -32,7 +32,7 @@ Shows one of a set of components depending on an input source and a mapping tabl
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function switch<K, V>(source: () -> K): (map: Map<K, () -> V>) -> V?
|
||||
```
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ Shows one of a set of components depending on an input source and a mapping tabl
|
|||
|
||||
- **Example**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local logged = source(false)
|
||||
|
||||
local button = switch(logged) {
|
||||
|
|
@ -69,7 +69,7 @@ Maps each index in a table source to an object.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function indexes<KI, VI, VO>(
|
||||
source: () -> Map<KI, VI>,
|
||||
transform: (value: () -> VI, index: KI) -> VO
|
||||
|
|
@ -102,7 +102,7 @@ Maps each index in a table source to an object.
|
|||
The intended purpose of this function is to map each index in a table to
|
||||
a UI element.
|
||||
|
||||
```lua
|
||||
```luau
|
||||
type Item = {
|
||||
name: string,
|
||||
icon: number
|
||||
|
|
@ -129,7 +129,7 @@ Maps each value in a table source to an object.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function values<KI, VI, VO>(
|
||||
source: () -> Map<KI, VI>,
|
||||
transform: (value: VI, index: () -> KI) -> VO
|
||||
|
|
@ -169,7 +169,7 @@ Maps each value in a table source to an object.
|
|||
The intended purpose of this function is to map each value in a table to
|
||||
a UI element.
|
||||
|
||||
```lua
|
||||
```luau
|
||||
type Item = {
|
||||
name: string,
|
||||
icon: number
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Runs a callback anytime a scope is reran or destroyed.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function cleanup(callback: () -> ())
|
||||
function cleanup(obj: Destroyable)
|
||||
function cleanup(obj: Disconnectable)
|
||||
|
|
@ -17,7 +17,7 @@ Runs a callback anytime a scope is reran or destroyed.
|
|||
|
||||
- **Example**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local data = source(1)
|
||||
|
||||
effect(function()
|
||||
|
|
@ -35,7 +35,7 @@ Runs a given function in a new stable scope.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function untrack<T>(source: () -> T): T
|
||||
```
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ Runs a given function in a new stable scope.
|
|||
|
||||
- **Example**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local a = source(0)
|
||||
local b = source(0)
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ read can still be tracked inside a reactive scope.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function read<T>(value: T | () -> T): T
|
||||
```
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ trigger effects until after the function finishes running.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function batch(fn: () -> ())
|
||||
```
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ Creates a new context.
|
|||
|
||||
- **Type**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
function context<T>(default: T): Context<T>
|
||||
|
||||
type Context<T> =
|
||||
|
|
@ -113,7 +113,7 @@ Creates a new context.
|
|||
|
||||
- **Example**
|
||||
|
||||
```lua
|
||||
```luau
|
||||
local theme = context()
|
||||
|
||||
local function Button()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Strict mode is library-wide and can get set by doing:
|
||||
|
||||
```lua
|
||||
```luau
|
||||
vide.strict = true
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue