This module contains a simple chat component that you can easily add to your Elm user interface.
Extra attributes for the UI components.
This is the initial value of Settings.attributes.
You'll usually create one by changing defaultExtraAttributes.
A function to turn a Settings record and a Cmd into a msg.
A function to turn an input string and a Settings record into a msg.
Represents a single line in a chat.
A wrapper around Updater to prevent type recursion.
Customizable Settings.
Make one of these with makeSettings, optionally customize the customRenderers field, and store it in your model.
Make a settings record to add to your Model.
Args are id initialFontSize showSizeControls updater.
id is the Html id for the div showing the chat.
initialFontSize is the initial font size of the div in pt.
showSizeControls is True to show the font size controls to the left of the text area.
updater will be called to generate messages to update the settings in your Model.
Create a chat component.
Add a string to the chat box.
Create a text input control.
Args are textSize buttonText sender settings.
textSize is the width in characters of the input control.
buttonText is the text for the button that sends the input.
sender is a function to turn an input string and settings into amsg`.
settings is your Settings record.
Same as inputBox, but takes two additional lists of attributes.
The first list is for the input box. The second is for the button.
Add a line to the chat box.
Make a LineSpec including a message and an optional user and time.
Turn chat Settings into a JSON string.
Does not encode the attributes or updater properties.
The JSON encoder for encodeSettings.
Turn a JSON string back into a CustomSettings record.
Updater is as to makeSettings.
Restores with default attributes, so you'll need to change those
after decoding, if you customize them.
The JSON Decoder for decodeSettings.
Restore the scroll position after restoring from a JSON string.
Convert a Time to a string in the format "HH:MM"
Convert a Time to a string in the format "HH:MM:SS"
Parse the first URL out of a string.
The result is Just (prefix, url, suffix), if there is a URL, or Nothing otherwise.
"foo.com" is interpreted as a URL, but is returned as just "foo.com". You have to prepend the http:// yourself, if that's what you need.
Used to customize rendering.
Set the customRenderers field of your settings record to one of these, if you want to override the default rendering, or render your own CustomLineSpec.
The overrider can provide an alternate to the default renderers for StringLineSpec, UserLineSpec, and TimeLineSpec.
The renderer will be called on CustomLineSpecs.
User function to override rendering of standard LineSpec options.
User function to render CustomLineSpec state.
Turn CustomSettings into a JSON string.
Use the (state -> Value) function to encode CustomLineSpecs.
Does not encode the attributes or updater properties.
The JSON encoder for encodeSettings.
Turn a JSON string that may contain CustomLineSpecs back into a CustomSettings record.
Updater is as to makeSettings.
The state decoder turns a Value into your state.
Restores with default attributes, so you'll need to change those
after decoding, if you customize them.
The JSON Decoder for decodeCustomSettings.
The default value of the Settings.attributes property.
Old, uncustomizable Settings for the chat component.
Make one of these with
makeSettings, and store it in your model.