|
1 | 1 | ## Module Ace.Halogen.Component
|
2 | 2 |
|
| 3 | +#### `Autocomplete` |
| 4 | + |
| 5 | +``` purescript |
| 6 | +data Autocomplete |
| 7 | + = Live |
| 8 | + | Basic |
| 9 | +``` |
| 10 | + |
| 11 | +#### `AceEffects` |
| 12 | + |
| 13 | +``` purescript |
| 14 | +type AceEffects e = (random :: RANDOM, now :: Now, ref :: REF, ace :: ACE, avar :: AVAR, dom :: DOM | e) |
| 15 | +``` |
| 16 | + |
| 17 | +#### `AceQuery` |
| 18 | + |
| 19 | +``` purescript |
| 20 | +data AceQuery a |
| 21 | + = Init HTMLElement a |
| 22 | + | GetText (String -> a) |
| 23 | + | SetText String a |
| 24 | + | SetAutocomplete (Maybe Autocomplete) a |
| 25 | + | SetCompleteFn (forall e. CompleteFn e) a |
| 26 | + | GetEditor (Maybe Editor -> a) |
| 27 | + | Quit a |
| 28 | +``` |
| 29 | + |
| 30 | +Ace query algebra |
| 31 | +`Init` used internally to handle initialization of component |
| 32 | +`GetText` gets the current text value |
| 33 | +`SetText` alters the current text value |
| 34 | +`SetAutocomplete` sets autocomplete resume: |
| 35 | + `Nothing` turns it off |
| 36 | + `Just Basic` enables basic autocompletions (triggered by `Alt+Space` or `Ctrl + Space`) |
| 37 | + `Just Live` enables live autocomplete |
| 38 | +`SetCompleteFn` sets function providing autocomplete variants. |
| 39 | +`GetEditor` returns ace editor instance handled by this component. |
| 40 | +`Quit` used internally to handle finalizing of component |
| 41 | + |
| 42 | +#### `CompleteFn` |
| 43 | + |
| 44 | +``` purescript |
| 45 | +type CompleteFn e = Editor -> EditSession -> Position -> String -> Aff (AceEffects e) (Array Completion) |
| 46 | +``` |
| 47 | + |
| 48 | +Autocomplete function. Takes editor, session, text position and prefix |
| 49 | +returns array of possible completions in `Aff` monad. |
| 50 | + |
| 51 | +#### `AceState` |
| 52 | + |
| 53 | +``` purescript |
| 54 | +type AceState = { key :: Maybe String, editor :: Maybe Editor } |
| 55 | +``` |
| 56 | + |
| 57 | +Ace component state |
| 58 | +`key` -- unique key of this instance |
| 59 | +`editor` -- ace editor instance wrapped by this component |
| 60 | + |
3 | 61 | #### `aceComponent`
|
4 | 62 |
|
5 | 63 | ``` purescript
|
6 |
| -aceComponent :: forall g eff. (MonadEff (ace :: ACE | eff) g) => Maybe String -> Component AceState AceQuery g |
| 64 | +aceComponent :: forall g eff. (MonadEff (AceEffects eff) g) => (Editor -> g Unit) -> Maybe Autocomplete -> Component AceState AceQuery g |
7 | 65 | ```
|
8 | 66 |
|
9 | 67 | The Ace component.
|
10 | 68 |
|
11 | 69 | #### `aceConstructor`
|
12 | 70 |
|
13 | 71 | ``` purescript
|
14 |
| -aceConstructor :: forall g p eff. (MonadEff (ace :: ACE | eff) g) => p -> Maybe String -> SlotConstructor AceState AceQuery g p |
| 72 | +aceConstructor :: forall g p eff. (MonadEff (AceEffects eff) g) => p -> (Editor -> g Unit) -> Maybe Autocomplete -> SlotConstructor AceState AceQuery g p |
15 | 73 | ```
|
16 | 74 |
|
17 | 75 | A convenience function for creating a `SlotConstructor` for an Ace
|
|
0 commit comments